Changeset 38621 in vbox for trunk/include/VBox
- Timestamp:
- Sep 4, 2011 4:56:56 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 73828
- Location:
- trunk/include/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/err.h
r37794 r38621 1334 1334 /** The cache is not up to date with the image. */ 1335 1335 #define VERR_VD_CACHE_NOT_UP_TO_DATE (-3276) 1336 /** The given range does not meet the required alignment. */ 1337 #define VERR_VD_DISCARD_ALIGNMENT_NOT_MET (-3277) 1338 /** The discard operation is not supported for this image. */ 1339 #define VERR_VD_DISCARD_NOT_SUPPORTED (-3278) 1336 1340 /** @} */ 1337 1341 -
trunk/include/VBox/vd-plugin.h
r38469 r38621 4 4 5 5 /* 6 * Copyright (C) 2006-201 0Oracle Corporation6 * Copyright (C) 2006-2011 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 40 40 /** @}*/ 41 41 42 /** @name VBox HDD backend discard flags 43 * @{ 44 */ 45 /** Don't discard block but mark the given range as unused 46 * (usually by writing 0's to it). 47 * This doesn't require the range to be aligned on a block boundary but 48 * the image size might not be decreased. */ 49 #define VD_DISCARD_MARK_UNUSED RT_BIT(0) 50 /** @}*/ 51 42 52 43 53 /** … … 540 550 * 541 551 * @returns VBox status code. 542 * @returns VERR_NOT_SUPPORTED if this image cannot be compacted yet.552 * @returns VERR_NOT_SUPPORTED if this image cannot be resized yet. 543 553 * @param pBackendData Opaque state data for this image. 544 554 * @param cbSize New size of the image. … … 559 569 PVDINTERFACE pVDIfsImage, 560 570 PVDINTERFACE pVDIfsOperation)); 571 572 /** 573 * Discards the given amount of bytes decreasing the size of the image if possible. 574 * 575 * @returns VBox status code. 576 * @retval VERR_VD_DISCARD_ALIGNMENT_NOT_MET if the range doesn't meet the required alignment 577 * for the discard. 578 * @param pBackendData Opaque state data for this image. 579 * @param uOffset The offset of the first byte to discard. 580 * @param cbDiscard How many bytes to discard. 581 * @param pcbPreAllocated Pointer to the returned amount of bytes that must 582 * be discarded before the range to perform a full 583 * block discard. 584 * @param pcbPostAllocated Pointer to the returned amount of bytes that must 585 * be discarded after the range to perform a full 586 * block discard. 587 * @param pcbActuallyDiscarded Pointer to the returned amount of bytes which 588 * could be actually discarded. 589 * @param ppbmAllocationBitmap Where to store the pointer to the allocation bitmap 590 * if VERR_VD_DISCARD_ALIGNMENT_NOT_MET is returned or NULL 591 * if the allocation bitmap should be returned. 592 * @param fDiscard Flags which affect discard behavior. Combination 593 * of the VD_DISCARD_* flags. 594 */ 595 DECLR3CALLBACKMEMBER(int, pfnDiscard, (void *pBackendData, 596 uint64_t uOffset, size_t cbDiscard, 597 size_t *pcbPreAllocated, 598 size_t *pcbPostAllocated, 599 size_t *pcbActuallyDiscarded, 600 void **ppbmAllocationBitmap, 601 unsigned fDiscard)); 561 602 562 603 } VBOXHDDBACKEND; -
trunk/include/VBox/vd.h
r38469 r38621 4 4 5 5 /* 6 * Copyright (C) 2006-201 0Oracle Corporation6 * Copyright (C) 2006-2011 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 180 180 * will not fail if it cannot do this, the flag will be simply ignored. */ 181 181 #define VD_OPEN_FLAGS_SEQUENTIAL RT_BIT(6) 182 /** Allow the discard operation if supported. Only available if VD_CAP_DISCARD 183 * is set. VDOpen fails with VERR_VD_DISCARD_NOT_SUPPORTED if discarding is not 184 * supported. */ 185 #define VD_OPEN_FLAGS_DISCARD RT_BIT(7) 182 186 /** Mask of valid flags. */ 183 #define VD_OPEN_FLAGS_MASK (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES | VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_ASYNC_IO | VD_OPEN_FLAGS_SHAREABLE | VD_OPEN_FLAGS_SEQUENTIAL )187 #define VD_OPEN_FLAGS_MASK (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES | VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_ASYNC_IO | VD_OPEN_FLAGS_SHAREABLE | VD_OPEN_FLAGS_SEQUENTIAL | VD_OPEN_FLAGS_DISCARD) 184 188 /** @}*/ 185 189 … … 249 253 * VDINTERFACEIO exclusively for all file operations. */ 250 254 #define VD_CAP_VFS RT_BIT(9) 255 /** The backend supports the discard operation. */ 256 #define VD_CAP_DISCARD RT_BIT(10) 251 257 /** @}*/ 252 258 … … 392 398 393 399 /** 400 * VD range descriptor. 401 */ 402 typedef struct VDRANGE 403 { 404 /** Start offset in bytes, multiple of 512. */ 405 uint64_t offStart; 406 /** Amount of bytes described by this range, multiple of 512. */ 407 size_t cbRange; 408 } VDRANGE; 409 410 /** Pointer to a range descriptor. */ 411 typedef VDRANGE *PVDRANGE; 412 /** Pointer to a constant range descriptor. */ 413 typedef const VDRANGE *PCVDRANGE; 414 415 /** 394 416 * VBox HDD Container main structure. 395 417 */ … … 1090 1112 1091 1113 /** 1114 * Discards unused ranges given as a list. 1115 * 1116 * @return VBox status code. 1117 * @param pDisk Pointer to HDD container. 1118 * @param paRanges The array of ranges to discard. 1119 * @param cRanges Number of entries in the array. 1120 * 1121 * @note In contrast to VDCompact() the ranges are always discarded even if they 1122 * appear to contain data. This method is mainly used to implement TRIM support. 1123 */ 1124 VBOXDDU_DECL(int) VDDiscardRanges(PVBOXHDD pDisk, PCVDRANGE paRanges, unsigned cRanges); 1125 1126 1127 /** 1092 1128 * Start an asynchronous read request. 1093 1129 *
Note:
See TracChangeset
for help on using the changeset viewer.