VirtualBox

Changeset 63905 in vbox for trunk/include


Ignore:
Timestamp:
Sep 20, 2016 8:31:05 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
110782
Message:

Storage/VD: Add proper versioning of the backend structures instead of just relying on the structure size to make changing callback signatures possible in the future and still being able to reject incompatible plugins

Location:
trunk/include/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vd-cache-backend.h

    r62476 r63905  
    2828
    2929#include <VBox/vd.h>
     30#include <VBox/vd-common.h>
    3031#include <VBox/vd-ifs-internal.h>
    3132
     
    3536typedef struct VDCACHEBACKEND
    3637{
    37     /**
    38      * The name of the backend (constant string).
    39      */
    40     const char *pszBackendName;
    41 
    42     /**
    43      * The size of the structure.
    44      */
    45     uint32_t cbSize;
    46 
    47     /**
    48      * The capabilities of the backend.
    49      */
    50     uint64_t uBackendCaps;
     38    /** Structure version. VD_CACHEBACKEND_VERSION defines the current version. */
     39    uint32_t            u32Version;
     40    /** The name of the backend (constant string). */
     41    const char          *pszBackendName;
     42    /** The capabilities of the backend. */
     43    uint64_t            uBackendCaps;
    5144
    5245    /**
     
    6356     * Mandatory if the backend sets VD_CAP_CONFIG.
    6457     */
    65     PCVDCONFIGINFO paConfigInfo;
     58    PCVDCONFIGINFO      paConfigInfo;
    6659
    6760    /**
     
    312305    DECLR3CALLBACKMEMBER(int, pfnComposeName, (PVDINTERFACE pConfig, char **pszName));
    313306
     307    /** Initialization safty marker. */
     308    uint32_t            u32VersionEnd;
     309
    314310} VDCACHEBACKEND;
    315311/** Pointer to VD cache backend. */
     
    318314typedef const VDCACHEBACKEND *PCVDCACHEBACKEND;
    319315
     316/** The current version of the VDCACHEBACKEND structure. */
     317#define VD_CACHEBACKEND_VERSION                 VD_VERSION_MAKE(0xff03, 1, 0)
     318
    320319#endif
  • trunk/include/VBox/vd-filter-backend.h

    r62476 r63905  
    2828
    2929#include <VBox/vd.h>
     30#include <VBox/vd-common.h>
    3031#include <VBox/vd-ifs-internal.h>
    3132
     
    3536typedef struct VDFILTERBACKEND
    3637{
    37     /**
    38      * The name of the backend (constant string).
    39      */
    40     const char *pszBackendName;
    41 
    42     /**
    43      * The size of the structure.
    44      */
    45     uint32_t cbSize;
     38    /** Structure version. VD_FLTBACKEND_VERSION defines the current version. */
     39    uint32_t            u32Version;
     40    /** The name of the backend (constant string). */
     41    const char          *pszBackendName;
    4642
    4743    /**
     
    5147     * Mandatory if the backend sets VD_CAP_CONFIG.
    5248     */
    53     PCVDCONFIGINFO paConfigInfo;
     49    PCVDCONFIGINFO      paConfigInfo;
    5450
    5551    /**
     
    10096                                               PVDIOCTX pIoCtx));
    10197
     98    /** Initialization safty marker. */
     99    uint32_t            u32VersionEnd;
    102100} VDFILTERBACKEND;
    103101/** Pointer to VD filter backend. */
     
    106104typedef const VDFILTERBACKEND *PCVDFILTERBACKEND;
    107105
     106/** The current version of the VDFILTERBACKEND structure. */
     107#define VD_FLTBACKEND_VERSION                   VD_VERSION_MAKE(0xff02, 1, 0)
     108
    108109#endif
  • trunk/include/VBox/vd-image-backend.h

    r63802 r63905  
    2828
    2929#include <VBox/vd.h>
     30#include <VBox/vd-common.h>
    3031#include <VBox/vd-ifs-internal.h>
    3132
     
    6364typedef struct VDIMAGEBACKEND
    6465{
    65     /**
    66      * The name of the backend (constant string).
    67      */
    68     const char *pszBackendName;
    69 
    70     /**
    71      * The size of the structure.
    72      */
    73     uint32_t cbSize;
    74 
    75     /**
    76      * The capabilities of the backend.
    77      */
    78     uint64_t uBackendCaps;
     66    /** Structure version. VD_IMGBACKEND_VERSION defines the current version. */
     67    uint32_t            u32Version;
     68    /** The name of the backend (constant string). */
     69    const char          *pszBackendName;
     70    /** The capabilities of the backend. */
     71    uint64_t            uBackendCaps;
    7972
    8073    /**
     
    8376     * pointer may just contain NULL.
    8477     */
    85     PCVDFILEEXTENSION paFileExtensions;
     78    PCVDFILEEXTENSION   paFileExtensions;
    8679
    8780    /**
     
    9184     * Mandatory if the backend sets VD_CAP_CONFIG.
    9285     */
    93     PCVDCONFIGINFO paConfigInfo;
     86    PCVDCONFIGINFO      paConfigInfo;
    9487
    9588    /**
     
    585578                                                    PVDINTERFACE pVDIfsOperation));
    586579
     580    /** Initialization safty marker. */
     581    uint32_t            u32VersionEnd;
     582
    587583} VDIMAGEBACKEND;
    588584
     
    592588typedef const VDIMAGEBACKEND *PCVDIMAGEBACKEND;
    593589
     590/** The current version of the VDIMAGEBACKEND structure. */
     591#define VD_IMGBACKEND_VERSION                   VD_VERSION_MAKE(0xff01, 1, 0)
     592
    594593/** @copydoc VDIMAGEBACKEND::pfnComposeLocation */
    595594DECLCALLBACK(int) genericFileComposeLocation(PVDINTERFACE pConfig, char **pszLocation);
  • trunk/include/VBox/vd-plugin.h

    r63781 r63905  
    2828
    2929#include <VBox/vd.h>
     30#include <VBox/vd-common.h>
    3031#include <VBox/vd-image-backend.h>
    3132#include <VBox/vd-cache-backend.h>
     
    3738typedef struct VDBACKENDREGISTER
    3839{
     40    /** Interface version.
     41     * This is set to VD_BACKENDREG_CB_VERSION. */
     42    uint32_t                    u32Version;
     43
    3944    /**
    4045     * Registers a new image backend.
     
    6671typedef VDBACKENDREGISTER *PVDBACKENDREGISTER;
    6772
     73/** Current version of the VDBACKENDREGISTER structure.  */
     74#define VD_BACKENDREG_CB_VERSION                VD_VERSION_MAKE(0xff00, 1, 0)
     75
    6876/**
    6977 * Initialization entry point called by the generic VD layer when
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette