VirtualBox

Changeset 40027 in vbox for trunk/include


Ignore:
Timestamp:
Feb 7, 2012 11:09:31 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76150
Message:

Runtime/Dvm: Add callbacks to query the allocation status of blocks (for filesystem aware image compaction)

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/dvm.h

    r37024 r40027  
    7777} RTDVMVOLTYPE;
    7878
     79/** @defgroup grp_dvm_flags     Flags used by RTDvmCreate.
     80 * @{ */
     81/** DVM flags - Blocks are always marked as unused if the volume has
     82 *              no block status callback set.
     83 *              The default is to mark them as used. */
     84#define DVM_FLAGS_NO_STATUS_CALLBACK_MARK_AS_UNUSED    RT_BIT_32(0)
     85/** DVM flags - Space which is unused in the map will be marked as used
     86 *              when calling RTDvmMapQueryBlockStatus(). */
     87#define DVM_FLAGS_UNUSED_SPACE_MARK_AS_USED            RT_BIT_32(1)
     88/** Mask of all valid flags. */
     89#define DVM_FLAGS_MASK (DVM_FLAGS_NO_STATUS_CALLBACK_MARK_AS_UNUSED | DVM_FLAGS_UNUSED_SPACE_MARK_AS_USED)
     90/** @}  */
     91
    7992
    8093/** @defgroup grp_dvm_vol_flags     Volume flags used by DVMVolumeGetFlags.
     
    125138/** Pointer to a read callback. */
    126139typedef FNDVMWRITE *PFNDVMWRITE;
     140
     141/**
     142 * Callback for querying the block allocation status of a volume.
     143 *
     144 * @returns IPRT status code.
     145 * @param   pvUser         Opaque user data passed when setting the callback.
     146 * @param   off            Offset relative to the start of the volume.
     147 * @param   cb             Range to check in bytes.
     148 * @param   pfAllocated    Where to store the allocation status on success.
     149 */
     150typedef DECLCALLBACK(int) FNDVMVOLUMEQUERYBLOCKSTATUS(void *pvUser, uint64_t off,
     151                                                      uint64_t cb, bool *pfAllocated);
     152/** Pointer to a query block allocation status callback. */
     153typedef FNDVMVOLUMEQUERYBLOCKSTATUS *PFNDVMVOLUMEQUERYBLOCKSTATUS;
    127154
    128155/**
     
    138165 * @param   cbDisk      Size of the underlying disk in bytes.
    139166 * @param   cbSector    Size of one sector in bytes.
     167 * @param   fFlags      Combination of RTDVM_FLAGS_*
    140168 * @param   pvUser      Opaque user data passed to the callbacks.
    141169 */
    142170RTDECL(int) RTDvmCreate(PRTDVM phVolMgr, PFNDVMREAD pfnRead,
    143171                        PFNDVMWRITE pfnWrite, uint64_t cbDisk,
    144                         uint64_t cbSector, void *pvUser);
     172                        uint64_t cbSector, uint32_t fFlags,
     173                        void *pvUser);
    145174
    146175/**
     
    225254
    226255/**
     256 * Returns whether the given block on the disk is in use.
     257 *
     258 * @returns IPRT status code.
     259 * @param   hVolMgr         The volume manager handler.
     260 * @param   off             The start offset to check for.
     261 * @param   cb              The range in bytes to check.
     262 * @param   pfAllocated     Where to store the status on success.
     263 *
     264 * @remark This method will return true even if a part of the range is not in use.
     265 */
     266RTDECL(int) RTDvmMapQueryBlockStatus(RTDVM hVolMgr, uint64_t off, uint64_t cb,
     267                                     bool *pfAllocated);
     268
     269/**
    227270 * Retains a valid volume handle.
    228271 *
     
    239282 */
    240283RTDECL(uint32_t) RTDvmVolumeRelease(RTDVMVOLUME hVol);
     284
     285/**
     286 * Sets the callback to query the block allocation status for a volume.
     287 * This overwrites any other callback set previously.
     288 *
     289 * @returns nothing.
     290 * @param   hVol                   The volume handle.
     291 * @param   pfnQueryBlockStatus    The callback to set. Can be NULL to disable
     292 *                                 a previous callback.
     293 * @param   pvUser                 Opaque user data passed in the callback.
     294 */
     295RTDECL(void) RTDvmVolumeSetQueryBlockStatusCallback(RTDVMVOLUME hVol,
     296                                                    PFNDVMVOLUMEQUERYBLOCKSTATUS pfnQueryBlockStatus,
     297                                                    void *pvUser);
    241298
    242299/**
  • trunk/include/iprt/mangling.h

    r39910 r40027  
    410410# define RTDvmMapGetValidVolumes                        RT_MANGLER(RTDvmMapGetValidVolumes)
    411411# define RTDvmMapGetMaxVolumes                          RT_MANGLER(RTDvmMapGetMaxVolumes)
     412# define RTDvmMapQueryBlockStatus                       RT_MANGLER(RTDvmMapQueryBlockStatus)
    412413# define RTDvmMapQueryFirstVolume                       RT_MANGLER(RTDvmMapQueryFirstVolume)
    413414# define RTDvmMapQueryNextVolume                        RT_MANGLER(RTDvmMapQueryNextVolume)
     
    420421# define RTDvmVolumeRead                                RT_MANGLER(RTDvmVolumeRead)
    421422# define RTDvmVolumeWrite                               RT_MANGLER(RTDvmVolumeWrite)
     423# define RTDvmVolumeSetQueryBlockStatusCallback         RT_MANGLER(RTDvmVolumeSetQueryBlockStatusCallback)
    422424# define RTDvmVolumeTypeGetDescr                        RT_MANGLER(RTDvmVolumeTypeGetDescr)
    423425# define RTEnvClone                                     RT_MANGLER(RTEnvClone)
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