VirtualBox

Changeset 40030 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Feb 7, 2012 11:20:31 PM (13 years ago)
Author:
vboxsync
Message:

VD: New interface to query the use of blocks in the disk image

File:
1 edited

Legend:

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

    r38469 r40030  
    6666     * This interface is completely internal and must not be used elsewhere. */
    6767    VDINTERFACETYPE_IOINT,
     68    /** Interface to query the use of block ranges on the disk. Per-operation. */
     69    VDINTERFACETYPE_QUERYRANGEUSE,
    6870    /** invalid interface. */
    6971    VDINTERFACETYPE_INVALID
     
    12381240}
    12391241
     1242/**
     1243 * Interface to query usage of disk ranges.
     1244 *
     1245 * Per-operation interface. Optional.
     1246 */
     1247typedef struct VDINTERFACEQUERYRANGEUSE
     1248{
     1249    /**
     1250     * Common interface header.
     1251     */
     1252    VDINTERFACE    Core;
     1253
     1254    /**
     1255     * Query use of a disk range.
     1256     */
     1257    DECLR3CALLBACKMEMBER(int, pfnQueryRangeUse, (void *pvUser, uint64_t off, uint64_t cb,
     1258                                                 bool *pfUsed));
     1259
     1260} VDINTERFACEQUERYRANGEUSE, *PVDINTERFACEQUERYRANGEUSE;
     1261
     1262/**
     1263 * Get query range use interface from interface list.
     1264 *
     1265 * @return Pointer to the first thread synchronization interface in the list.
     1266 * @param  pVDIfs    Pointer to the interface list.
     1267 */
     1268DECLINLINE(PVDINTERFACEQUERYRANGEUSE) VDIfQueryRangeUseGet(PVDINTERFACE pVDIfs)
     1269{
     1270    PVDINTERFACE pIf = VDInterfaceGet(pVDIfs, VDINTERFACETYPE_QUERYRANGEUSE);
     1271
     1272    /* Check that the interface descriptor is a progress interface. */
     1273    AssertMsgReturn(   !pIf
     1274                    || (   (pIf->enmInterface == VDINTERFACETYPE_QUERYRANGEUSE)
     1275                        && (pIf->cbSize == sizeof(VDINTERFACEQUERYRANGEUSE))),
     1276                    ("Not a query range use interface"), NULL);
     1277
     1278    return (PVDINTERFACEQUERYRANGEUSE)pIf;
     1279}
     1280
     1281DECLINLINE(int) vdIfQueryRangeUse(PVDINTERFACEQUERYRANGEUSE pIfQueryRangeUse, uint64_t off, uint64_t cb,
     1282                                  bool *pfUsed)
     1283{
     1284    return pIfQueryRangeUse->pfnQueryRangeUse(pIfQueryRangeUse->Core.pvUser, off, cb, pfUsed);
     1285}
     1286
    12401287RT_C_DECLS_END
    12411288
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