- Timestamp:
- Oct 11, 2020 6:40:21 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VD.cpp
r86044 r86526 5022 5022 } 5023 5023 5024 /** 5025 * Initializes HDD backends. 5026 * 5027 * @returns VBox status code. 5028 */ 5024 5029 5025 VBOXDDU_DECL(int) VDInit(void) 5030 5026 { … … 5034 5030 } 5035 5031 5036 /** 5037 * Destroys loaded HDD backends. 5038 * 5039 * @returns VBox status code. 5040 */ 5032 5041 5033 VBOXDDU_DECL(int) VDShutdown(void) 5042 5034 { … … 5044 5036 } 5045 5037 5046 /** 5047 * Loads a single plugin given by filename. 5048 * 5049 * @returns VBox status code. 5050 * @param pszFilename The plugin filename to load. 5051 */ 5038 5052 5039 VBOXDDU_DECL(int) VDPluginLoadFromFilename(const char *pszFilename) 5053 5040 { … … 5080 5067 } 5081 5068 5082 /** 5083 * Unloads a single plugin given by filename. 5084 * 5085 * @returns VBox status code. 5086 * @param pszFilename The plugin filename to unload. 5087 */ 5069 5088 5070 VBOXDDU_DECL(int) VDPluginUnloadFromFilename(const char *pszFilename) 5089 5071 { … … 5098 5080 } 5099 5081 5100 /** 5101 * Unload all plugins from a given path. 5102 * 5103 * @returns VBox statuse code. 5104 * @param pszPath The path to unload plugins from. 5105 */ 5082 5106 5083 VBOXDDU_DECL(int) VDPluginUnloadFromPath(const char *pszPath) 5107 5084 { … … 5116 5093 } 5117 5094 5118 /** 5119 * Lists all HDD backends and their capabilities in a caller-provided buffer. 5120 * 5121 * @returns VBox status code. 5122 * VERR_BUFFER_OVERFLOW if not enough space is passed. 5123 * @param cEntriesAlloc Number of list entries available. 5124 * @param pEntries Pointer to array for the entries. 5125 * @param pcEntriesUsed Number of entries returned. 5126 */ 5095 5127 5096 VBOXDDU_DECL(int) VDBackendInfo(unsigned cEntriesAlloc, PVDBACKENDINFO pEntries, 5128 5097 unsigned *pcEntriesUsed) … … 5170 5139 } 5171 5140 5172 /** 5173 * Lists the capabilities of a backend identified by its name. 5174 * 5175 * @returns VBox status code. 5176 * @param pszBackend The backend name. 5177 * @param pEntry Pointer to an entry. 5178 */ 5141 5179 5142 VBOXDDU_DECL(int) VDBackendInfoOne(const char *pszBackend, PVDBACKENDINFO pEntry) 5180 5143 { … … 5203 5166 } 5204 5167 5205 /** 5206 * Lists all filters and their capabilities in a caller-provided buffer. 5207 * 5208 * @return VBox status code. 5209 * VERR_BUFFER_OVERFLOW if not enough space is passed. 5210 * @param cEntriesAlloc Number of list entries available. 5211 * @param pEntries Pointer to array for the entries. 5212 * @param pcEntriesUsed Number of entries returned. 5213 */ 5168 5214 5169 VBOXDDU_DECL(int) VDFilterInfo(unsigned cEntriesAlloc, PVDFILTERINFO pEntries, 5215 5170 unsigned *pcEntriesUsed) … … 5251 5206 } 5252 5207 5253 /** 5254 * Lists the capabilities of a filter identified by its name. 5255 * 5256 * @return VBox status code. 5257 * @param pszFilter The filter name (case insensitive). 5258 * @param pEntry Pointer to an entry. 5259 */ 5208 5260 5209 VBOXDDU_DECL(int) VDFilterInfoOne(const char *pszFilter, PVDFILTERINFO pEntry) 5261 5210 { … … 5282 5231 } 5283 5232 5284 /** 5285 * Allocates and initializes an empty HDD container. 5286 * No image files are opened. 5287 * 5288 * @returns VBox status code. 5289 * @param pVDIfsDisk Pointer to the per-disk VD interface list. 5290 * @param enmType Type of the image container. 5291 * @param ppDisk Where to store the reference to HDD container. 5292 */ 5233 5293 5234 VBOXDDU_DECL(int) VDCreate(PVDINTERFACE pVDIfsDisk, VDTYPE enmType, PVDISK *ppDisk) 5294 5235 { … … 5367 5308 } 5368 5309 5369 /** 5370 * Destroys HDD container. 5371 * If container has opened image files they will be closed. 5372 * 5373 * @returns VBox status code. 5374 * @param pDisk Pointer to HDD container. 5375 */ 5310 5376 5311 VBOXDDU_DECL(int) VDDestroy(PVDISK pDisk) 5377 5312 { … … 5398 5333 } 5399 5334 5400 /** 5401 * Try to get the backend name which can use this image. 5402 * 5403 * @returns VBox status code. 5404 * VINF_SUCCESS if a plugin was found. 5405 * ppszFormat contains the string which can be used as backend name. 5406 * VERR_NOT_SUPPORTED if no backend was found. 5407 * @param pVDIfsDisk Pointer to the per-disk VD interface list. 5408 * @param pVDIfsImage Pointer to the per-image VD interface list. 5409 * @param pszFilename Name of the image file for which the backend is queried. 5410 * @param enmDesiredType The desired image type, VDTYPE_INVALID if anything goes. 5411 * @param ppszFormat Receives pointer of the UTF-8 string which contains the format name. 5412 * The returned pointer must be freed using RTStrFree(). 5413 * @param penmType Where to store the type of the image. 5414 */ 5335 5415 5336 VBOXDDU_DECL(int) VDGetFormat(PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage, 5416 5337 const char *pszFilename, VDTYPE enmDesiredType, … … 5567 5488 } 5568 5489 5569 /** 5570 * Opens an image file. 5571 * 5572 * The first opened image file in HDD container must have a base image type, 5573 * others (next opened images) must be a differencing or undo images. 5574 * Linkage is checked for differencing image to be in consistence with the previously opened image. 5575 * When another differencing image is opened and the last image was opened in read/write access 5576 * mode, then the last image is reopened in read-only with deny write sharing mode. This allows 5577 * other processes to use images in read-only mode too. 5578 * 5579 * Note that the image is opened in read-only mode if a read/write open is not possible. 5580 * Use VDIsReadOnly to check open mode. 5581 * 5582 * @returns VBox status code. 5583 * @param pDisk Pointer to HDD container. 5584 * @param pszBackend Name of the image file backend to use. 5585 * @param pszFilename Name of the image file to open. 5586 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 5587 * @param pVDIfsImage Pointer to the per-image VD interface list. 5588 */ 5490 5589 5491 VBOXDDU_DECL(int) VDOpen(PVDISK pDisk, const char *pszBackend, 5590 5492 const char *pszFilename, unsigned uOpenFlags, … … 5905 5807 } 5906 5808 5907 /** 5908 * Opens a cache image. 5909 * 5910 * @return VBox status code. 5911 * @param pDisk Pointer to the HDD container which should use the cache image. 5912 * @param pszBackend Name of the cache file backend to use (case insensitive). 5913 * @param pszFilename Name of the cache image to open. 5914 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 5915 * @param pVDIfsCache Pointer to the per-cache VD interface list. 5916 */ 5809 5917 5810 VBOXDDU_DECL(int) VDCacheOpen(PVDISK pDisk, const char *pszBackend, 5918 5811 const char *pszFilename, unsigned uOpenFlags, … … 6087 5980 } 6088 5981 5982 6089 5983 VBOXDDU_DECL(int) VDFilterAdd(PVDISK pDisk, const char *pszFilter, uint32_t fFlags, 6090 5984 PVDINTERFACE pVDIfsFilter) … … 6181 6075 } 6182 6076 6183 /** 6184 * Creates and opens a new base image file. 6185 * 6186 * @returns VBox status code. 6187 * @param pDisk Pointer to HDD container. 6188 * @param pszBackend Name of the image file backend to use. 6189 * @param pszFilename Name of the image file to create. 6190 * @param cbSize Image size in bytes. 6191 * @param uImageFlags Flags specifying special image features. 6192 * @param pszComment Pointer to image comment. NULL is ok. 6193 * @param pPCHSGeometry Pointer to physical disk geometry <= (16383,16,63). Not NULL. 6194 * @param pLCHSGeometry Pointer to logical disk geometry <= (x,255,63). Not NULL. 6195 * @param pUuid New UUID of the image. If NULL, a new UUID is created. 6196 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 6197 * @param pVDIfsImage Pointer to the per-image VD interface list. 6198 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 6199 */ 6077 6200 6078 VBOXDDU_DECL(int) VDCreateBase(PVDISK pDisk, const char *pszBackend, 6201 6079 const char *pszFilename, uint64_t cbSize, … … 6487 6365 } 6488 6366 6489 /** 6490 * Creates and opens a new differencing image file in HDD container. 6491 * See comments for VDOpen function about differencing images. 6492 * 6493 * @returns VBox status code. 6494 * @param pDisk Pointer to HDD container. 6495 * @param pszBackend Name of the image file backend to use. 6496 * @param pszFilename Name of the differencing image file to create. 6497 * @param uImageFlags Flags specifying special image features. 6498 * @param pszComment Pointer to image comment. NULL is ok. 6499 * @param pUuid New UUID of the image. If NULL, a new UUID is created. 6500 * @param pParentUuid New parent UUID of the image. If NULL, the UUID is queried automatically. 6501 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 6502 * @param pVDIfsImage Pointer to the per-image VD interface list. 6503 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 6504 */ 6367 6505 6368 VBOXDDU_DECL(int) VDCreateDiff(PVDISK pDisk, const char *pszBackend, 6506 6369 const char *pszFilename, unsigned uImageFlags, … … 6765 6628 6766 6629 6767 /**6768 * Creates and opens new cache image file in HDD container.6769 *6770 * @return VBox status code.6771 * @param pDisk Name of the cache file backend to use (case insensitive).6772 * @param pszFilename Name of the differencing cache file to create.6773 * @param cbSize Maximum size of the cache.6774 * @param uImageFlags Flags specifying special cache features.6775 * @param pszComment Pointer to image comment. NULL is ok.6776 * @param pUuid New UUID of the image. If NULL, a new UUID is created.6777 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.6778 * @param pVDIfsCache Pointer to the per-cache VD interface list.6779 * @param pVDIfsOperation Pointer to the per-operation VD interface list.6780 */6781 6630 VBOXDDU_DECL(int) VDCreateCache(PVDISK pDisk, const char *pszBackend, 6782 6631 const char *pszFilename, uint64_t cbSize, … … 6981 6830 } 6982 6831 6983 /** 6984 * Merges two images (not necessarily with direct parent/child relationship). 6985 * As a side effect the source image and potentially the other images which 6986 * are also merged to the destination are deleted from both the disk and the 6987 * images in the HDD container. 6988 * 6989 * @returns VBox status code. 6990 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 6991 * @param pDisk Pointer to HDD container. 6992 * @param nImageFrom Name of the image file to merge from. 6993 * @param nImageTo Name of the image file to merge to. 6994 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 6995 */ 6832 6996 6833 VBOXDDU_DECL(int) VDMerge(PVDISK pDisk, unsigned nImageFrom, 6997 6834 unsigned nImageTo, PVDINTERFACE pVDIfsOperation) … … 7433 7270 } 7434 7271 7435 /** 7436 * Copies an image from one HDD container to another - extended version. 7437 * The copy is opened in the target HDD container. 7438 * It is possible to convert between different image formats, because the 7439 * backend for the destination may be different from the source. 7440 * If both the source and destination reference the same HDD container, 7441 * then the image is moved (by copying/deleting or renaming) to the new location. 7442 * The source container is unchanged if the move operation fails, otherwise 7443 * the image at the new location is opened in the same way as the old one was. 7444 * 7445 * @note The read/write accesses across disks are not synchronized, just the 7446 * accesses to each disk. Once there is a use case which requires a defined 7447 * read/write behavior in this situation this needs to be extended. 7448 * 7449 * @returns VBox status code. 7450 * @retval VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 7451 * @param pDiskFrom Pointer to source HDD container. 7452 * @param nImage Image number, counts from 0. 0 is always base image of container. 7453 * @param pDiskTo Pointer to destination HDD container. 7454 * @param pszBackend Name of the image file backend to use (may be NULL to use the same as the source, case insensitive). 7455 * @param pszFilename New name of the image (may be NULL to specify that the 7456 * copy destination is the destination container, or 7457 * if pDiskFrom == pDiskTo, i.e. when moving). 7458 * @param fMoveByRename If true, attempt to perform a move by renaming (if successful the new size is ignored). 7459 * @param cbSize New image size (0 means leave unchanged). 7460 * @param nImageFromSame todo 7461 * @param nImageToSame todo 7462 * @param uImageFlags Flags specifying special destination image features. 7463 * @param pDstUuid New UUID of the destination image. If NULL, a new UUID is created. 7464 * This parameter is used if and only if a true copy is created. 7465 * In all rename/move cases or copy to existing image cases the modification UUIDs are copied over. 7466 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 7467 * Only used if the destination image is created. 7468 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 7469 * @param pDstVDIfsImage Pointer to the per-image VD interface list, for the 7470 * destination image. 7471 * @param pDstVDIfsOperation Pointer to the per-operation VD interface list, 7472 * for the destination operation. 7473 */ 7272 7474 7273 VBOXDDU_DECL(int) VDCopyEx(PVDISK pDiskFrom, unsigned nImage, PVDISK pDiskTo, 7475 7274 const char *pszBackend, const char *pszFilename, … … 7772 7571 } 7773 7572 7774 /** 7775 * Copies an image from one HDD container to another. 7776 * The copy is opened in the target HDD container. 7777 * It is possible to convert between different image formats, because the 7778 * backend for the destination may be different from the source. 7779 * If both the source and destination reference the same HDD container, 7780 * then the image is moved (by copying/deleting or renaming) to the new location. 7781 * The source container is unchanged if the move operation fails, otherwise 7782 * the image at the new location is opened in the same way as the old one was. 7783 * 7784 * @returns VBox status code. 7785 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 7786 * @param pDiskFrom Pointer to source HDD container. 7787 * @param nImage Image number, counts from 0. 0 is always base image of container. 7788 * @param pDiskTo Pointer to destination HDD container. 7789 * @param pszBackend Name of the image file backend to use. 7790 * @param pszFilename New name of the image (may be NULL if pDiskFrom == pDiskTo). 7791 * @param fMoveByRename If true, attempt to perform a move by renaming (if successful the new size is ignored). 7792 * @param cbSize New image size (0 means leave unchanged). 7793 * @param uImageFlags Flags specifying special destination image features. 7794 * @param pDstUuid New UUID of the destination image. If NULL, a new UUID is created. 7795 * This parameter is used if and only if a true copy is created. 7796 * In all rename/move cases the UUIDs are copied over. 7797 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 7798 * Only used if the destination image is created. 7799 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 7800 * @param pDstVDIfsImage Pointer to the per-image VD interface list, for the 7801 * destination image. 7802 * @param pDstVDIfsOperation Pointer to the per-image VD interface list, 7803 * for the destination image. 7804 */ 7573 7805 7574 VBOXDDU_DECL(int) VDCopy(PVDISK pDiskFrom, unsigned nImage, PVDISK pDiskTo, 7806 7575 const char *pszBackend, const char *pszFilename, … … 7817 7586 } 7818 7587 7819 /** 7820 * Optimizes the storage consumption of an image. Typically the unused blocks 7821 * have to be wiped with zeroes to achieve a substantial reduced storage use. 7822 * Another optimization done is reordering the image blocks, which can provide 7823 * a significant performance boost, as reads and writes tend to use less random 7824 * file offsets. 7825 * 7826 * @return VBox status code. 7827 * @return VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 7828 * @return VERR_VD_IMAGE_READ_ONLY if image is not writable. 7829 * @return VERR_NOT_SUPPORTED if this kind of image can be compacted, but 7830 * the code for this isn't implemented yet. 7831 * @param pDisk Pointer to HDD container. 7832 * @param nImage Image number, counts from 0. 0 is always base image of container. 7833 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 7834 */ 7588 7835 7589 VBOXDDU_DECL(int) VDCompact(PVDISK pDisk, unsigned nImage, 7836 7590 PVDINTERFACE pVDIfsOperation) … … 7928 7682 } 7929 7683 7930 /** 7931 * Resizes the given disk image to the given size. 7932 * 7933 * @return VBox status 7934 * @return VERR_VD_IMAGE_READ_ONLY if image is not writable. 7935 * @return VERR_NOT_SUPPORTED if this kind of image can be compacted, but 7936 * 7937 * @param pDisk Pointer to the HDD container. 7938 * @param cbSize New size of the image. 7939 * @param pPCHSGeometry Pointer to the new physical disk geometry <= (16383,16,63). Not NULL. 7940 * @param pLCHSGeometry Pointer to the new logical disk geometry <= (x,255,63). Not NULL. 7941 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 7942 */ 7684 7943 7685 VBOXDDU_DECL(int) VDResize(PVDISK pDisk, uint64_t cbSize, 7944 7686 PCVDGEOMETRY pPCHSGeometry, … … 8254 7996 } 8255 7997 8256 /** 8257 * Closes the last opened image file in HDD container. 8258 * If previous image file was opened in read-only mode (the normal case) and 8259 * the last opened image is in read-write mode then the previous image will be 8260 * reopened in read/write mode. 8261 * 8262 * @returns VBox status code. 8263 * @returns VERR_VD_NOT_OPENED if no image is opened in HDD container. 8264 * @param pDisk Pointer to HDD container. 8265 * @param fDelete If true, delete the image from the host disk. 8266 */ 7998 8267 7999 VBOXDDU_DECL(int) VDClose(PVDISK pDisk, bool fDelete) 8268 8000 { … … 8367 8099 } 8368 8100 8369 /** 8370 * Closes the currently opened cache image file in HDD container. 8371 * 8372 * @return VBox status code. 8373 * @return VERR_VD_NOT_OPENED if no cache is opened in HDD container. 8374 * @param pDisk Pointer to HDD container. 8375 * @param fDelete If true, delete the image from the host disk. 8376 */ 8101 8377 8102 VBOXDDU_DECL(int) VDCacheClose(PVDISK pDisk, bool fDelete) 8378 8103 { … … 8467 8192 } 8468 8193 8469 /** 8470 * Closes all opened image files in HDD container. 8471 * 8472 * @returns VBox status code. 8473 * @param pDisk Pointer to HDD container. 8474 */ 8194 8475 8195 VBOXDDU_DECL(int) VDCloseAll(PVDISK pDisk) 8476 8196 { … … 8531 8251 } 8532 8252 8533 /** 8534 * Removes all filters of the given HDD container. 8535 * 8536 * @return VBox status code. 8537 * @param pDisk Pointer to HDD container. 8538 */ 8253 8539 8254 VBOXDDU_DECL(int) VDFilterRemoveAll(PVDISK pDisk) 8540 8255 { … … 8581 8296 } 8582 8297 8583 /** 8584 * Read data from virtual HDD. 8585 * 8586 * @returns VBox status code. 8587 * @retval VERR_VD_NOT_OPENED if no image is opened in HDD container. 8588 * @param pDisk Pointer to HDD container. 8589 * @param uOffset Offset of first reading byte from start of disk. 8590 * @param pvBuf Pointer to buffer for reading data. 8591 * @param cbRead Number of bytes to read. 8592 */ 8298 8593 8299 VBOXDDU_DECL(int) VDRead(PVDISK pDisk, uint64_t uOffset, void *pvBuf, 8594 8300 size_t cbRead) … … 8649 8355 } 8650 8356 8651 /** 8652 * Write data to virtual HDD. 8653 * 8654 * @returns VBox status code. 8655 * @retval VERR_VD_NOT_OPENED if no image is opened in HDD container. 8656 * @param pDisk Pointer to HDD container. 8657 * @param uOffset Offset of the first byte being 8658 * written from start of disk. 8659 * @param pvBuf Pointer to buffer for writing data. 8660 * @param cbWrite Number of bytes to write. 8661 */ 8357 8662 8358 VBOXDDU_DECL(int) VDWrite(PVDISK pDisk, uint64_t uOffset, const void *pvBuf, 8663 8359 size_t cbWrite) … … 8724 8420 } 8725 8421 8726 /** 8727 * Make sure the on disk representation of a virtual HDD is up to date. 8728 * 8729 * @returns VBox status code. 8730 * @retval VERR_VD_NOT_OPENED if no image is opened in HDD container. 8731 * @param pDisk Pointer to HDD container. 8732 */ 8422 8733 8423 VBOXDDU_DECL(int) VDFlush(PVDISK pDisk) 8734 8424 { … … 8779 8469 } 8780 8470 8781 /** 8782 * Get number of opened images in HDD container. 8783 * 8784 * @returns Number of opened images for HDD container. 0 if no images have been opened. 8785 * @param pDisk Pointer to HDD container. 8786 */ 8471 8787 8472 VBOXDDU_DECL(unsigned) VDGetCount(PVDISK pDisk) 8788 8473 { … … 8815 8500 } 8816 8501 8817 /** 8818 * Get read/write mode of HDD container. 8819 * 8820 * @returns Virtual disk ReadOnly status. 8821 * @returns true if no image is opened in HDD container. 8822 * @param pDisk Pointer to HDD container. 8823 */ 8502 8824 8503 VBOXDDU_DECL(bool) VDIsReadOnly(PVDISK pDisk) 8825 8504 { … … 8857 8536 } 8858 8537 8859 /** 8860 * Get sector size of an image in HDD container. 8861 * 8862 * @return Virtual disk sector size in bytes. 8863 * @return 0 if image with specified number was not opened. 8864 * @param pDisk Pointer to HDD container. 8865 * @param nImage Image number, counts from 0. 0 is always base image of container. 8866 */ 8538 8867 8539 VBOXDDU_DECL(uint32_t) VDGetSectorSize(PVDISK pDisk, unsigned nImage) 8868 8540 { … … 8909 8581 } 8910 8582 8911 /** 8912 * Get total capacity of an image in HDD container. 8913 * 8914 * @returns Virtual disk size in bytes. 8915 * @returns 0 if no image with specified number was not opened. 8916 * @param pDisk Pointer to HDD container. 8917 * @param nImage Image number, counts from 0. 0 is always base image of container. 8918 */ 8583 8919 8584 VBOXDDU_DECL(uint64_t) VDGetSize(PVDISK pDisk, unsigned nImage) 8920 8585 { … … 8950 8615 } 8951 8616 8952 /** 8953 * Get total file size of an image in HDD container. 8954 * 8955 * @returns Virtual disk size in bytes. 8956 * @returns 0 if no image is opened in HDD container. 8957 * @param pDisk Pointer to HDD container. 8958 * @param nImage Image number, counts from 0. 0 is always base image of container. 8959 */ 8617 8960 8618 VBOXDDU_DECL(uint64_t) VDGetFileSize(PVDISK pDisk, unsigned nImage) 8961 8619 { … … 8990 8648 } 8991 8649 8992 /** 8993 * Get virtual disk PCHS geometry stored in HDD container. 8994 * 8995 * @returns VBox status code. 8996 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 8997 * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container. 8998 * @param pDisk Pointer to HDD container. 8999 * @param nImage Image number, counts from 0. 0 is always base image of container. 9000 * @param pPCHSGeometry Where to store PCHS geometry. Not NULL. 9001 */ 8650 9002 8651 VBOXDDU_DECL(int) VDGetPCHSGeometry(PVDISK pDisk, unsigned nImage, 9003 8652 PVDGEOMETRY pPCHSGeometry) … … 9052 8701 } 9053 8702 9054 /** 9055 * Store virtual disk PCHS geometry in HDD container. 9056 * 9057 * Note that in case of unrecoverable error all images in HDD container will be closed. 9058 * 9059 * @returns VBox status code. 9060 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9061 * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container. 9062 * @param pDisk Pointer to HDD container. 9063 * @param nImage Image number, counts from 0. 0 is always base image of container. 9064 * @param pPCHSGeometry Where to load PCHS geometry from. Not NULL. 9065 */ 8703 9066 8704 VBOXDDU_DECL(int) VDSetPCHSGeometry(PVDISK pDisk, unsigned nImage, 9067 8705 PCVDGEOMETRY pPCHSGeometry) … … 9158 8796 } 9159 8797 9160 /** 9161 * Get virtual disk LCHS geometry stored in HDD container. 9162 * 9163 * @returns VBox status code. 9164 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9165 * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container. 9166 * @param pDisk Pointer to HDD container. 9167 * @param nImage Image number, counts from 0. 0 is always base image of container. 9168 * @param pLCHSGeometry Where to store LCHS geometry. Not NULL. 9169 */ 8798 9170 8799 VBOXDDU_DECL(int) VDGetLCHSGeometry(PVDISK pDisk, unsigned nImage, 9171 8800 PVDGEOMETRY pLCHSGeometry) … … 9220 8849 } 9221 8850 9222 /** 9223 * Store virtual disk LCHS geometry in HDD container. 9224 * 9225 * Note that in case of unrecoverable error all images in HDD container will be closed. 9226 * 9227 * @returns VBox status code. 9228 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9229 * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container. 9230 * @param pDisk Pointer to HDD container. 9231 * @param nImage Image number, counts from 0. 0 is always base image of container. 9232 * @param pLCHSGeometry Where to load LCHS geometry from. Not NULL. 9233 */ 8851 9234 8852 VBOXDDU_DECL(int) VDSetLCHSGeometry(PVDISK pDisk, unsigned nImage, 9235 8853 PCVDGEOMETRY pLCHSGeometry) … … 9326 8944 } 9327 8945 9328 /** 9329 * Queries the available regions of an image in the given VD container. 9330 * 9331 * @return VBox status code. 9332 * @retval VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9333 * @retval VERR_NOT_SUPPORTED if the image backend doesn't support region lists. 9334 * @param pDisk Pointer to HDD container. 9335 * @param nImage Image number, counts from 0. 0 is always base image of container. 9336 * @param fFlags Combination of VD_REGION_LIST_F_* flags. 9337 * @param ppRegionList Where to store the pointer to the region list on success, must be freed 9338 * with VDRegionListFree(). 9339 */ 8946 9340 8947 VBOXDDU_DECL(int) VDQueryRegions(PVDISK pDisk, unsigned nImage, uint32_t fFlags, 9341 8948 PPVDREGIONLIST ppRegionList) … … 9386 8993 } 9387 8994 9388 /** 9389 * Frees a region list previously queried with VDQueryRegions(). 9390 * 9391 * @return nothing. 9392 * @param pRegionList The region list to free. 9393 */ 8995 9394 8996 VBOXDDU_DECL(void) VDRegionListFree(PVDREGIONLIST pRegionList) 9395 8997 { … … 9397 8999 } 9398 9000 9399 /** 9400 * Get version of image in HDD container. 9401 * 9402 * @returns VBox status code. 9403 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9404 * @param pDisk Pointer to HDD container. 9405 * @param nImage Image number, counts from 0. 0 is always base image of container. 9406 * @param puVersion Where to store the image version. 9407 */ 9001 9408 9002 VBOXDDU_DECL(int) VDGetVersion(PVDISK pDisk, unsigned nImage, 9409 9003 unsigned *puVersion) … … 9446 9040 } 9447 9041 9448 /** 9449 * List the capabilities of image backend in HDD container. 9450 * 9451 * @returns VBox status code. 9452 * @retval VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9453 * @param pDisk Pointer to the HDD container. 9454 * @param nImage Image number, counts from 0. 0 is always base image of container. 9455 * @param pBackendInfo Where to store the backend information. 9456 */ 9042 9457 9043 VBOXDDU_DECL(int) VDBackendInfoSingle(PVDISK pDisk, unsigned nImage, 9458 9044 PVDBACKENDINFO pBackendInfo) … … 9498 9084 } 9499 9085 9500 /** 9501 * Get flags of image in HDD container. 9502 * 9503 * @returns VBox status code. 9504 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9505 * @param pDisk Pointer to HDD container. 9506 * @param nImage Image number, counts from 0. 0 is always base image of container. 9507 * @param puImageFlags Where to store the image flags. 9508 */ 9086 9509 9087 VBOXDDU_DECL(int) VDGetImageFlags(PVDISK pDisk, unsigned nImage, 9510 9088 unsigned *puImageFlags) … … 9547 9125 } 9548 9126 9549 /** 9550 * Get open flags of image in HDD container. 9551 * 9552 * @returns VBox status code. 9553 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9554 * @param pDisk Pointer to HDD container. 9555 * @param nImage Image number, counts from 0. 0 is always base image of container. 9556 * @param puOpenFlags Where to store the image open flags. 9557 */ 9127 9558 9128 VBOXDDU_DECL(int) VDGetOpenFlags(PVDISK pDisk, unsigned nImage, 9559 9129 unsigned *puOpenFlags) … … 9596 9166 } 9597 9167 9598 /** 9599 * Set open flags of image in HDD container. 9600 * This operation may cause file locking changes and/or files being reopened. 9601 * Note that in case of unrecoverable error all images in HDD container will be closed. 9602 * 9603 * @returns VBox status code. 9604 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9605 * @param pDisk Pointer to HDD container. 9606 * @param nImage Image number, counts from 0. 0 is always base image of container. 9607 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 9608 */ 9168 9609 9169 VBOXDDU_DECL(int) VDSetOpenFlags(PVDISK pDisk, unsigned nImage, 9610 9170 unsigned uOpenFlags) … … 9654 9214 } 9655 9215 9656 /** 9657 * Get base filename of image in HDD container. Some image formats use 9658 * other filenames as well, so don't use this for anything but informational 9659 * purposes. 9660 * 9661 * @returns VBox status code. 9662 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9663 * @returns VERR_BUFFER_OVERFLOW if pszFilename buffer too small to hold filename. 9664 * @param pDisk Pointer to HDD container. 9665 * @param nImage Image number, counts from 0. 0 is always base image of container. 9666 * @param pszFilename Where to store the image file name. 9667 * @param cbFilename Size of buffer pszFilename points to. 9668 */ 9216 9669 9217 VBOXDDU_DECL(int) VDGetFilename(PVDISK pDisk, unsigned nImage, 9670 9218 char *pszFilename, unsigned cbFilename) … … 9721 9269 } 9722 9270 9723 /** 9724 * Get the comment line of image in HDD container. 9725 * 9726 * @returns VBox status code. 9727 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9728 * @returns VERR_BUFFER_OVERFLOW if pszComment buffer too small to hold comment text. 9729 * @param pDisk Pointer to HDD container. 9730 * @param nImage Image number, counts from 0. 0 is always base image of container. 9731 * @param pszComment Where to store the comment string of image. NULL is ok. 9732 * @param cbComment The size of pszComment buffer. 0 is ok. 9733 */ 9271 9734 9272 VBOXDDU_DECL(int) VDGetComment(PVDISK pDisk, unsigned nImage, 9735 9273 char *pszComment, unsigned cbComment) … … 9776 9314 } 9777 9315 9778 /** 9779 * Changes the comment line of image in HDD container. 9780 * 9781 * @returns VBox status code. 9782 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9783 * @param pDisk Pointer to HDD container. 9784 * @param nImage Image number, counts from 0. 0 is always base image of container. 9785 * @param pszComment New comment string (UTF-8). NULL is allowed to reset the comment. 9786 */ 9316 9787 9317 VBOXDDU_DECL(int) VDSetComment(PVDISK pDisk, unsigned nImage, 9788 9318 const char *pszComment) … … 9826 9356 9827 9357 9828 /**9829 * Get UUID of image in HDD container.9830 *9831 * @returns VBox status code.9832 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.9833 * @param pDisk Pointer to HDD container.9834 * @param nImage Image number, counts from 0. 0 is always base image of container.9835 * @param pUuid Where to store the image creation UUID.9836 */9837 9358 VBOXDDU_DECL(int) VDGetUuid(PVDISK pDisk, unsigned nImage, PRTUUID pUuid) 9838 9359 { … … 9873 9394 } 9874 9395 9875 /** 9876 * Set the image's UUID. Should not be used by normal applications. 9877 * 9878 * @returns VBox status code. 9879 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9880 * @param pDisk Pointer to HDD container. 9881 * @param nImage Image number, counts from 0. 0 is always base image of container. 9882 * @param pUuid New UUID of the image. If NULL, a new UUID is created. 9883 */ 9396 9884 9397 VBOXDDU_DECL(int) VDSetUuid(PVDISK pDisk, unsigned nImage, PCRTUUID pUuid) 9885 9398 { … … 9926 9439 } 9927 9440 9928 /** 9929 * Get last modification UUID of image in HDD container. 9930 * 9931 * @returns VBox status code. 9932 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9933 * @param pDisk Pointer to HDD container. 9934 * @param nImage Image number, counts from 0. 0 is always base image of container. 9935 * @param pUuid Where to store the image modification UUID. 9936 */ 9441 9937 9442 VBOXDDU_DECL(int) VDGetModificationUuid(PVDISK pDisk, unsigned nImage, PRTUUID pUuid) 9938 9443 { … … 9974 9479 } 9975 9480 9976 /** 9977 * Set the image's last modification UUID. Should not be used by normal applications. 9978 * 9979 * @returns VBox status code. 9980 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 9981 * @param pDisk Pointer to HDD container. 9982 * @param nImage Image number, counts from 0. 0 is always base image of container. 9983 * @param pUuid New modification UUID of the image. If NULL, a new UUID is created. 9984 */ 9481 9985 9482 VBOXDDU_DECL(int) VDSetModificationUuid(PVDISK pDisk, unsigned nImage, PCRTUUID pUuid) 9986 9483 { … … 10029 9526 } 10030 9527 10031 /** 10032 * Get parent UUID of image in HDD container. 10033 * 10034 * @returns VBox status code. 10035 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened. 10036 * @param pDisk Pointer to HDD container. 10037 * @param nImage Image number, counts from 0. 0 is always base image of container. 10038 * @param pUuid Where to store the parent image UUID. 10039 */ 9528 10040 9529 VBOXDDU_DECL(int) VDGetParentUuid(PVDISK pDisk, unsigned nImage, 10041 9530 PRTUUID pUuid) … … 10077 9566 } 10078 9567 10079 /** 10080 * Set the image's parent UUID. Should not be used by normal applications. 10081 * 10082 * @returns VBox status code. 10083 * @param pDisk Pointer to HDD container. 10084 * @param nImage Image number, counts from 0. 0 is always base image of container. 10085 * @param pUuid New parent UUID of the image. If NULL, a new UUID is created. 10086 */ 9568 10087 9569 VBOXDDU_DECL(int) VDSetParentUuid(PVDISK pDisk, unsigned nImage, 10088 9570 PCRTUUID pUuid) … … 10132 9614 10133 9615 10134 /**10135 * Debug helper - dumps all opened images in HDD container into the log file.10136 *10137 * @param pDisk Pointer to HDD container.10138 */10139 9616 VBOXDDU_DECL(void) VDDumpImages(PVDISK pDisk) 10140 9617 {
Note:
See TracChangeset
for help on using the changeset viewer.