VirtualBox

Changeset 44412 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Jan 28, 2013 10:39:34 AM (12 years ago)
Author:
vboxsync
Message:

Storage: Merge sync/async interface for the cache

File:
1 edited

Legend:

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

    r38469 r44412  
    132132
    133133    /**
    134      * Read data from a cache image. The area read never crosses a block
    135      * boundary.
    136      *
    137      * @returns VBox status code.
    138      * @returns VERR_VD_BLOCK_FREE if this image contains no data for this block.
    139      * @param   pBackendData    Opaque state data for this image.
    140      * @param   uOffset         Offset to start reading from.
    141      * @param   pvBuf           Where to store the read bits.
    142      * @param   cbRead          Number of bytes to read.
    143      * @param   pcbActuallyRead Pointer to returned number of bytes read.
    144      */
    145     DECLR3CALLBACKMEMBER(int, pfnRead, (void *pBackendData, uint64_t uOffset, void *pvBuf,
    146                                         size_t cbRead, size_t *pcbActuallyRead));
    147 
    148     /**
    149      * Write data to a cache image. The area written never crosses a block
    150      * boundary.
    151      *
    152      * @returns VBox status code.
    153      * @param   pBackendData    Opaque state data for this image.
    154      * @param   uOffset         Offset to start writing to.
    155      * @param   pvBuf           Where to retrieve the written bits.
    156      * @param   cbWrite         Number of bytes to write.
    157      * @param   pcbWriteProcess Pointer to returned number of bytes that could
    158      *                          be processed.
    159      */
    160     DECLR3CALLBACKMEMBER(int, pfnWrite, (void *pBackendData, uint64_t uOffset,
    161                                          const void *pvBuf, size_t cbWrite,
    162                                          size_t *pcbWriteProcess));
    163 
    164     /**
    165      * Flush data to disk.
    166      *
    167      * @returns VBox status code.
    168      * @param   pBackendData    Opaque state data for this image.
    169      */
    170     DECLR3CALLBACKMEMBER(int, pfnFlush, (void *pBackendData));
    171 
    172     /**
    173      * Get the version of a cache image.
    174      *
    175      * @returns version of cache image.
    176      * @param   pBackendData    Opaque state data for this image.
    177      */
    178     DECLR3CALLBACKMEMBER(unsigned, pfnGetVersion, (void *pBackendData));
    179 
    180     /**
    181      * Get the capacity of a cache image.
    182      *
    183      * @returns size of cache image in bytes.
    184      * @param   pBackendData    Opaque state data for this image.
    185      */
    186     DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize, (void *pBackendData));
    187 
    188     /**
    189      * Get the file size of a cache image.
    190      *
    191      * @returns size of cache image in bytes.
    192      * @param   pBackendData    Opaque state data for this image.
    193      */
    194     DECLR3CALLBACKMEMBER(uint64_t, pfnGetFileSize, (void *pBackendData));
    195 
    196     /**
    197      * Get the image flags of a cache image.
    198      *
    199      * @returns image flags of cache image.
    200      * @param   pBackendData    Opaque state data for this image.
    201      */
    202     DECLR3CALLBACKMEMBER(unsigned, pfnGetImageFlags, (void *pBackendData));
    203 
    204     /**
    205      * Get the open flags of a cache image.
    206      *
    207      * @returns open flags of cache image.
    208      * @param   pBackendData    Opaque state data for this image.
    209      */
    210     DECLR3CALLBACKMEMBER(unsigned, pfnGetOpenFlags, (void *pBackendData));
    211 
    212     /**
    213      * Set the open flags of a cache image. May cause the image to be locked
    214      * in a different mode or be reopened (which can fail).
    215      *
    216      * @returns VBox status code.
    217      * @param   pBackendData    Opaque state data for this image.
    218      * @param   uOpenFlags      New open flags for this image.
    219      */
    220     DECLR3CALLBACKMEMBER(int, pfnSetOpenFlags, (void *pBackendData, unsigned uOpenFlags));
    221 
    222     /**
    223      * Get comment of a cache image.
    224      *
    225      * @returns VBox status code.
    226      * @param   pBackendData    Opaque state data for this image.
    227      * @param   pszComment      Where to store the comment.
    228      * @param   cbComment       Size of the comment buffer.
    229      */
    230     DECLR3CALLBACKMEMBER(int, pfnGetComment, (void *pBackendData, char *pszComment, size_t cbComment));
    231 
    232     /**
    233      * Set comment of a cache image.
    234      *
    235      * @returns VBox status code.
    236      * @param   pBackendData    Opaque state data for this image.
    237      * @param   pszComment      Where to get the comment from. NULL resets comment.
    238      *                          The comment is silently truncated if the image format
    239      *                          limit is exceeded.
    240      */
    241     DECLR3CALLBACKMEMBER(int, pfnSetComment, (void *pBackendData, const char *pszComment));
    242 
    243     /**
    244      * Get UUID of a cache image.
    245      *
    246      * @returns VBox status code.
    247      * @param   pBackendData    Opaque state data for this image.
    248      * @param   pUuid           Where to store the image UUID.
    249      */
    250     DECLR3CALLBACKMEMBER(int, pfnGetUuid, (void *pBackendData, PRTUUID pUuid));
    251 
    252     /**
    253      * Set UUID of a cache image.
    254      *
    255      * @returns VBox status code.
    256      * @param   pBackendData    Opaque state data for this image.
    257      * @param   pUuid           Where to get the image UUID from.
    258      */
    259     DECLR3CALLBACKMEMBER(int, pfnSetUuid, (void *pBackendData, PCRTUUID pUuid));
    260 
    261     /**
    262      * Get last modification UUID of a cache image.
    263      *
    264      * @returns VBox status code.
    265      * @param   pBackendData    Opaque state data for this image.
    266      * @param   pUuid           Where to store the image modification UUID.
    267      */
    268     DECLR3CALLBACKMEMBER(int, pfnGetModificationUuid, (void *pBackendData, PRTUUID pUuid));
    269 
    270     /**
    271      * Set last modification UUID of a cache image.
    272      *
    273      * @returns VBox status code.
    274      * @param   pBackendData    Opaque state data for this image.
    275      * @param   pUuid           Where to get the image modification UUID from.
    276      */
    277     DECLR3CALLBACKMEMBER(int, pfnSetModificationUuid, (void *pBackendData, PCRTUUID pUuid));
    278 
    279     /**
    280      * Dump information about a cache image.
    281      *
    282      * @param   pBackendData    Opaque state data for this image.
    283      */
    284     DECLR3CALLBACKMEMBER(void, pfnDump, (void *pBackendData));
    285 
    286     /**
    287      * Start an asynchronous read request.
     134     * Start a read request.
    288135     *
    289136     * @returns VBox status code.
     
    294141     * @param   pcbActuallyRead Pointer to returned number of bytes read.
    295142     */
    296     DECLR3CALLBACKMEMBER(int, pfnAsyncRead, (void *pBackendData, uint64_t uOffset, size_t cbRead,
    297                                              PVDIOCTX pIoCtx, size_t *pcbActuallyRead));
    298 
    299     /**
    300      * Start an asynchronous write request.
     143    DECLR3CALLBACKMEMBER(int, pfnRead, (void *pBackendData, uint64_t uOffset, size_t cbRead,
     144                                        PVDIOCTX pIoCtx, size_t *pcbActuallyRead));
     145
     146    /**
     147     * Start a write request.
    301148     *
    302149     * @returns VBox status code.
     
    312159     *                          amount of (previously read) padding data.
    313160     */
    314     DECLR3CALLBACKMEMBER(int, pfnAsyncWrite, (void *pBackendData, uint64_t uOffset, size_t cbWrite,
    315                                               PVDIOCTX pIoCtx, size_t *pcbWriteProcess));
     161    DECLR3CALLBACKMEMBER(int, pfnWrite, (void *pBackendData, uint64_t uOffset, size_t cbWrite,
     162                                         PVDIOCTX pIoCtx, size_t *pcbWriteProcess));
    316163
    317164    /**
     
    322169     * @param   pIoCtx          I/O context associated with this request.
    323170     */
    324     DECLR3CALLBACKMEMBER(int, pfnAsyncFlush, (void *pBackendData, PVDIOCTX pIoCtx));
     171    DECLR3CALLBACKMEMBER(int, pfnFlush, (void *pBackendData, PVDIOCTX pIoCtx));
     172
     173    /**
     174     * Discards the given amount of bytes from the cache.
     175     *
     176     * @returns VBox status code.
     177     * @retval  VERR_VD_DISCARD_ALIGNMENT_NOT_MET if the range doesn't meet the required alignment
     178     *          for the discard.
     179     * @param   pBackendData         Opaque state data for this image.
     180     * @param   pIoCtx               I/O context associated with this request.
     181     * @param   uOffset              The offset of the first byte to discard.
     182     * @param   cbDiscard            How many bytes to discard.
     183     */
     184    DECLR3CALLBACKMEMBER(int, pfnDiscard, (void *pBackendData, PVDIOCTX pIoCtx,
     185                                           uint64_t uOffset, size_t cbDiscard,
     186                                           size_t *pcbPreAllocated,
     187                                           size_t *pcbPostAllocated,
     188                                           size_t *pcbActuallyDiscarded,
     189                                           void   **ppbmAllocationBitmap,
     190                                           unsigned fDiscard));
     191
     192    /**
     193     * Get the version of a cache image.
     194     *
     195     * @returns version of cache image.
     196     * @param   pBackendData    Opaque state data for this image.
     197     */
     198    DECLR3CALLBACKMEMBER(unsigned, pfnGetVersion, (void *pBackendData));
     199
     200    /**
     201     * Get the capacity of a cache image.
     202     *
     203     * @returns size of cache image in bytes.
     204     * @param   pBackendData    Opaque state data for this image.
     205     */
     206    DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize, (void *pBackendData));
     207
     208    /**
     209     * Get the file size of a cache image.
     210     *
     211     * @returns size of cache image in bytes.
     212     * @param   pBackendData    Opaque state data for this image.
     213     */
     214    DECLR3CALLBACKMEMBER(uint64_t, pfnGetFileSize, (void *pBackendData));
     215
     216    /**
     217     * Get the image flags of a cache image.
     218     *
     219     * @returns image flags of cache image.
     220     * @param   pBackendData    Opaque state data for this image.
     221     */
     222    DECLR3CALLBACKMEMBER(unsigned, pfnGetImageFlags, (void *pBackendData));
     223
     224    /**
     225     * Get the open flags of a cache image.
     226     *
     227     * @returns open flags of cache image.
     228     * @param   pBackendData    Opaque state data for this image.
     229     */
     230    DECLR3CALLBACKMEMBER(unsigned, pfnGetOpenFlags, (void *pBackendData));
     231
     232    /**
     233     * Set the open flags of a cache image. May cause the image to be locked
     234     * in a different mode or be reopened (which can fail).
     235     *
     236     * @returns VBox status code.
     237     * @param   pBackendData    Opaque state data for this image.
     238     * @param   uOpenFlags      New open flags for this image.
     239     */
     240    DECLR3CALLBACKMEMBER(int, pfnSetOpenFlags, (void *pBackendData, unsigned uOpenFlags));
     241
     242    /**
     243     * Get comment of a cache image.
     244     *
     245     * @returns VBox status code.
     246     * @param   pBackendData    Opaque state data for this image.
     247     * @param   pszComment      Where to store the comment.
     248     * @param   cbComment       Size of the comment buffer.
     249     */
     250    DECLR3CALLBACKMEMBER(int, pfnGetComment, (void *pBackendData, char *pszComment, size_t cbComment));
     251
     252    /**
     253     * Set comment of a cache image.
     254     *
     255     * @returns VBox status code.
     256     * @param   pBackendData    Opaque state data for this image.
     257     * @param   pszComment      Where to get the comment from. NULL resets comment.
     258     *                          The comment is silently truncated if the image format
     259     *                          limit is exceeded.
     260     */
     261    DECLR3CALLBACKMEMBER(int, pfnSetComment, (void *pBackendData, const char *pszComment));
     262
     263    /**
     264     * Get UUID of a cache image.
     265     *
     266     * @returns VBox status code.
     267     * @param   pBackendData    Opaque state data for this image.
     268     * @param   pUuid           Where to store the image UUID.
     269     */
     270    DECLR3CALLBACKMEMBER(int, pfnGetUuid, (void *pBackendData, PRTUUID pUuid));
     271
     272    /**
     273     * Set UUID of a cache image.
     274     *
     275     * @returns VBox status code.
     276     * @param   pBackendData    Opaque state data for this image.
     277     * @param   pUuid           Where to get the image UUID from.
     278     */
     279    DECLR3CALLBACKMEMBER(int, pfnSetUuid, (void *pBackendData, PCRTUUID pUuid));
     280
     281    /**
     282     * Get last modification UUID of a cache image.
     283     *
     284     * @returns VBox status code.
     285     * @param   pBackendData    Opaque state data for this image.
     286     * @param   pUuid           Where to store the image modification UUID.
     287     */
     288    DECLR3CALLBACKMEMBER(int, pfnGetModificationUuid, (void *pBackendData, PRTUUID pUuid));
     289
     290    /**
     291     * Set last modification UUID of a cache image.
     292     *
     293     * @returns VBox status code.
     294     * @param   pBackendData    Opaque state data for this image.
     295     * @param   pUuid           Where to get the image modification UUID from.
     296     */
     297    DECLR3CALLBACKMEMBER(int, pfnSetModificationUuid, (void *pBackendData, PCRTUUID pUuid));
     298
     299    /**
     300     * Dump information about a cache image.
     301     *
     302     * @param   pBackendData    Opaque state data for this image.
     303     */
     304    DECLR3CALLBACKMEMBER(void, pfnDump, (void *pBackendData));
    325305
    326306    /** Returns a human readable hard disk location string given a
Note: See TracChangeset for help on using the changeset viewer.

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