VirtualBox

Changeset 6291 in vbox for trunk/include/VBox/VBoxHDD-new.h


Ignore:
Timestamp:
Jan 9, 2008 10:57:05 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27155
Message:

Big virtual disk changeset containing several modifications

  • remove the always buggy translation setting and replace it with two sets of geometries, physical and logical
  • complete vmdk creation (fixed/dynamic variants, both split in 2G chunks and single file)
  • implemented VBoxHDD-new generic snapshot support, i.e. diff image creation and image merging (completely untested, I'm pretty sure there are bugs)
  • assorted changes which generalize the VBoxHDD-new interfaces (both externally and internally)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxHDD-new.h

    r5999 r6291  
    55
    66/*
    7  * Copyright (C) 2006-2007 innotek GmbH
     7 * Copyright (C) 2006-2008 innotek GmbH
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5656/** Get VDI minor version from combined version. */
    5757#define VDI_GET_VERSION_MINOR(uVer)    ((uVer) & 0xffff)
     58
     59/** Placeholder for specifying the last opened image. */
     60#define VD_LAST_IMAGE               0xffffffffU
    5861
    5962/** @name VBox HDD container image types
     
    97100/** Mask of valid image flags for VDI. */
    98101#define VD_VDI_IMAGE_FLAGS_MASK             (VD_IMAGE_FLAGS_NONE | VD_VDI_IMAGE_FLAGS_ZERO_EXPAND)
     102
     103/** Mask of all valid image flags for all formats. */
     104#define VD_IMAGE_FLAGS_MASK                 (VD_VMDK_IMAGE_FLAGS_MASK | VD_VDI_IMAGE_FLAGS_MASK)
    99105
    100106/** Default image flags. */
     
    132138typedef struct VBOXHDDRAW
    133139{
     140    /** Signature for structure. Must be 'R', 'A', 'W', '\0'. Actually a trick
     141     * to make logging of the comment string produce sensible results. */
     142    char            szSignature[4];
    134143    /** Flag whether access to full disk should be given (ignoring the
    135144     * partition information below). */
     
    189198
    190199/**
    191  * Allocates and initializes an empty VBox HDD container.
     200 * Allocates and initializes an empty HDD container.
    192201 * No image files are opened.
    193202 *
     
    196205 * @param   pfnError        Callback for setting extended error information.
    197206 * @param   pvErrorUser     Opaque parameter for pfnError.
    198  * @param   ppDisk          Where to store the reference to the VBox HDD container.
    199  */
    200 VBOXDDU_DECL(int) VDCreate(const char *pszBackend, PFNVDERROR pfnError, void *pvErrorUser, PVBOXHDD *ppDisk);
    201 
    202 /**
    203  * Destroys the VBox HDD container.
     207 * @param   ppDisk          Where to store the reference to HDD container.
     208 */
     209VBOXDDU_DECL(int) VDCreate(const char *pszBackend, PFNVDERROR pfnError,
     210                           void *pvErrorUser, PVBOXHDD *ppDisk);
     211
     212/**
     213 * Destroys HDD container.
    204214 * If container has opened image files they will be closed.
    205215 *
    206  * @param   pDisk           Pointer to VBox HDD container.
     216 * @param   pDisk           Pointer to HDD container.
    207217 */
    208218VBOXDDU_DECL(void) VDDestroy(PVBOXHDD pDisk);
    209219
    210220/**
    211  * Try to get the backend name which can use this image. 
     221 * Try to get the backend name which can use this image.
    212222 *
    213223 * @returns VBox status code.
     
    221231 * Opens an image file.
    222232 *
    223  * The first opened image file in a HDD container must have a base image type,
     233 * The first opened image file in HDD container must have a base image type,
    224234 * others (next opened images) must be differencing or undo images.
    225235 * Linkage is checked for differencing image to be consistent with the previously opened image.
     
    232242 *
    233243 * @returns VBox status code.
    234  * @param   pDisk           Pointer to VBox HDD container.
     244 * @param   pDisk           Pointer to HDD container.
    235245 * @param   pszFilename     Name of the image file to open.
    236246 * @param   uOpenFlags      Image file open mode, see VD_OPEN_FLAGS_* constants.
    237247 */
    238 VBOXDDU_DECL(int) VDOpen(PVBOXHDD pDisk, const char *pszFilename, unsigned uOpenFlags);
     248VBOXDDU_DECL(int) VDOpen(PVBOXHDD pDisk, const char *pszFilename,
     249                         unsigned uOpenFlags);
    239250
    240251/**
     
    242253 *
    243254 * @returns VBox status code.
    244  * @param   pDisk           Pointer to VBox HDD container.
     255 * @param   pDisk           Pointer to HDD container.
    245256 * @param   pszFilename     Name of the image file to create.
    246257 * @param   enmType         Image type, only base image types are acceptable.
     
    248259 * @param   uImageFlags     Flags specifying special image features.
    249260 * @param   pszComment      Pointer to image comment. NULL is ok.
    250  * @param   cCylinders      Number of cylinders (must be <= 16383).
    251  * @param   cHeads          Number of heads (must be <= 16).
    252  * @param   cSectors        Number of sectors (must be <= 63);
     261 * @param   pPCHSGeometry   Pointer to physical disk geometry <= (16383,16,63). Not NULL.
     262 * @param   pLCHSGeometry   Pointer to logical disk geometry <= (1024,255,63). Not NULL.
    253263 * @param   uOpenFlags      Image file open mode, see VD_OPEN_FLAGS_* constants.
    254264 * @param   pfnProgress     Progress callback. Optional. NULL if not to be used.
     
    258268                               VDIMAGETYPE enmType, uint64_t cbSize,
    259269                               unsigned uImageFlags, const char *pszComment,
    260                                unsigned cCylinders, unsigned cHeads,
    261                                unsigned cSectors, unsigned uOpenFlags,
    262                                PFNVMPROGRESS pfnProgress, void *pvUser);
     270                               PCPDMMEDIAGEOMETRY pPCHSGeometry,
     271                               PCPDMMEDIAGEOMETRY pLCHSGeometry,
     272                               unsigned uOpenFlags, PFNVMPROGRESS pfnProgress,
     273                               void *pvUser);
    263274
    264275/**
     
    267278 *
    268279 * @returns VBox status code.
    269  * @param   pDisk           Pointer to VBox HDD container.
     280 * @param   pDisk           Pointer to HDD container.
    270281 * @param   pszFilename     Name of the differencing image file to create.
    271282 * @param   uImageFlags     Flags specifying special image features.
     
    277288VBOXDDU_DECL(int) VDCreateDiff(PVBOXHDD pDisk, const char *pszFilename,
    278289                               unsigned uImageFlags, const char *pszComment,
    279                                unsigned uOpenFlags,
    280                                PFNVMPROGRESS pfnProgress, void *pvUser);
    281 
    282 /**
    283  * Merges two images having a parent/child relationship (both directions).
    284  * As a side effect the source image is deleted from both the disk and
    285  * the images in the VBox HDD container.
    286  *
    287  * @returns VBox status code.
    288  * @param   pDisk           Pointer to VBox HDD container.
     290                               unsigned uOpenFlags, PFNVMPROGRESS pfnProgress,
     291                               void *pvUser);
     292
     293/**
     294 * Merges two images (not necessarily with direct parent/child relationship).
     295 * As a side effect the source image and potentially the other images which
     296 * are also merged to the destination are deleted from both the disk and the
     297 * images in the HDD container.
     298 *
     299 * @returns VBox status code.
     300 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     301 * @param   pDisk           Pointer to HDD container.
    289302 * @param   nImageFrom      Name of the image file to merge from.
    290303 * @param   nImageTo        Name of the image file to merge to.
     
    292305 * @param   pvUser          User argument for the progress callback.
    293306 */
    294 VBOXDDU_DECL(int) VDMerge(PVBOXHDD pDisk, unsigned nImageFrom, unsigned nImageTo,
    295                           PFNVMPROGRESS pfnProgress, void *pvUser);
    296 
    297 /**
    298  * Copies an image from one VBox HDD container to another.
    299  * The copy is opened in the target VBox HDD container.
     307VBOXDDU_DECL(int) VDMerge(PVBOXHDD pDisk, unsigned nImageFrom,
     308                          unsigned nImageTo, PFNVMPROGRESS pfnProgress,
     309                          void *pvUser);
     310
     311/**
     312 * Copies an image from one HDD container to another.
     313 * The copy is opened in the target HDD container.
    300314 * It is possible to convert between different image formats, because the
    301  * backend for the destination VBox HDD container may be different from the
     315 * backend for the destination HDD container may be different from the
    302316 * source container.
    303  * If both the source and destination reference the same VBox HDD container,
    304  * then the image is moved (by copying/deleting) to the new location.
     317 * If both the source and destination reference the same HDD container,
     318 * then the image is moved (by copying/deleting or renaming) to the new location.
    305319 * The source container is unchanged if the move operation fails, otherwise
    306320 * the image at the new location is opened in the same way as the old one was.
    307321 *
    308322 * @returns VBox status code.
    309  * @param   pDiskFrom       Pointer to source VBox HDD container.
    310  * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    311  * @param   pDiskTo         Pointer to destination VBox HDD container.
     323 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     324 * @param   pDiskFrom       Pointer to source HDD container.
     325 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     326 * @param   pDiskTo         Pointer to destination HDD container.
     327 * @param   pszFilename     New name of the image (may be NULL if pDiskFrom == pDiskTo).
     328 * @param   fMoveByRename   If true, attempt to perform a move by renaming (if successful the new size is ignored).
     329 * @param   cbSize          New image size (0 means leave unchanged).
    312330 * @param   pfnProgress     Progress callback. Optional. NULL if not to be used.
    313331 * @param   pvUser          User argument for the progress callback.
    314332 */
    315333VBOXDDU_DECL(int) VDCopy(PVBOXHDD pDiskFrom, unsigned nImage, PVBOXHDD pDiskTo,
    316                          PFNVMPROGRESS pfnProgress, void *pvUser);
    317 
    318 /**
    319  * Compacts a growing image file by removing zeroed data blocks.
    320  * Optionally defragments data in the image so that ascending sector numbers
    321  * are stored in ascending location in the image file.
    322  *
    323  * @todo maybe include this function in VDCopy.
    324  *
    325  * @returns VBox status code.
    326  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
    327  * @param   pDisk           Pointer to VBox HDD container.
    328  * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    329  * @param   fDefragment     If true, reorder file data so that sectors are stored in ascending order.
    330  * @param   pfnProgress     Progress callback. Optional. NULL if not to be used.
    331  * @param   pvUser          User argument for the progress callback.
    332  */
    333 VBOXDDU_DECL(int) VDCompact(PVBOXHDD pDisk, unsigned nImage,
    334                             bool fDefragment,
    335                             PFNVMPROGRESS pfnProgress, void *pvUser);
    336 
    337 /**
    338  * Resizes an image. Allows setting the disk size to both larger and smaller
    339  * values than the current disk size.
    340  *
    341  * @returns VBox status code.
    342  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
    343  * @param   pDisk           Pointer to VBox HDD container.
    344  * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    345  * @param   cbSize          New image size in bytes.
    346  * @param   pfnProgress     Progress callback. Optional. NULL if not to be used.
    347  * @param   pvUser          User argument for the progress callback.
    348  */
    349 VBOXDDU_DECL(int) VDResize(PVBOXHDD pDisk, unsigned nImage, uint64_t cbSize,
    350                            PFNVMPROGRESS pfnProgress, void *pvUser);
    351 
    352 /**
    353  * Closes the last opened image file in the HDD container. Leaves all changes inside it.
     334                         const char *pszFilename, bool fMoveByRename,
     335                         uint64_t cbSize, PFNVMPROGRESS pfnProgress,
     336                         void *pvUser);
     337
     338/**
     339 * Closes the last opened image file in HDD container.
    354340 * If previous image file was opened in read-only mode (that is normal) and closing image
    355341 * was opened in read-write mode (the whole disk was in read-write mode) - the previous image
    356342 * will be reopened in read/write mode.
    357343 *
    358  * @param   pDisk           Pointer to VBox HDD container.
     344 * @returns VBox status code.
     345 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     346 * @param   pDisk           Pointer to HDD container.
    359347 * @param   fDelete         If true, delete the image from the host disk.
    360348 */
     
    364352 * Closes all opened image files in HDD container.
    365353 *
    366  * @param   pDisk           Pointer to VBox HDD container.
     354 * @returns VBox status code.
     355 * @param   pDisk           Pointer to HDD container.
    367356 */
    368357VBOXDDU_DECL(int) VDCloseAll(PVBOXHDD pDisk);
     
    373362 * @returns VBox status code.
    374363 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
    375  * @param   pDisk           Pointer to VBox HDD container.
     364 * @param   pDisk           Pointer to HDD container.
    376365 * @param   uOffset         Offset of first reading byte from start of disk.
    377366 * @param   pvBuf           Pointer to buffer for reading data.
     
    385374 * @returns VBox status code.
    386375 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
    387  * @param   pDisk           Pointer to VBox HDD container.
     376 * @param   pDisk           Pointer to HDD container.
    388377 * @param   uOffset         Offset of first writing byte from start of disk.
    389378 * @param   pvBuf           Pointer to buffer for writing data.
     
    397386 * @returns VBox status code.
    398387 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
    399  * @param   pDisk           Pointer to VBox HDD container.
     388 * @param   pDisk           Pointer to HDD container.
    400389 */
    401390VBOXDDU_DECL(int) VDFlush(PVBOXHDD pDisk);
     
    405394 *
    406395 * @returns Number of opened images for HDD container. 0 if no images have been opened.
    407  * @param   pDisk           Pointer to VBox HDD container.
     396 * @param   pDisk           Pointer to HDD container.
    408397 */
    409398VBOXDDU_DECL(unsigned) VDGetCount(PVBOXHDD pDisk);
    410399
    411400/**
    412  * Get read/write mode of the VBox HDD container.
     401 * Get read/write mode of HDD container.
    413402 *
    414403 * @returns Virtual disk ReadOnly status.
    415404 * @returns true if no image is opened in HDD container.
    416  * @param   pDisk           Pointer to VBox HDD container.
     405 * @param   pDisk           Pointer to HDD container.
    417406 */
    418407VBOXDDU_DECL(bool) VDIsReadOnly(PVBOXHDD pDisk);
    419408
    420409/**
    421  * Get total disk size of the VBox HDD container.
     410 * Get total capacity of an image in HDD container.
    422411 *
    423412 * @returns Virtual disk size in bytes.
    424  * @returns 0 if no image is opened in HDD container.
    425  * @param   pDisk           Pointer to VBox HDD container.
    426  */
    427 VBOXDDU_DECL(uint64_t) VDGetSize(PVBOXHDD pDisk);
    428 
    429 /**
    430  * Get virtual disk geometry stored in HDD container.
    431  *
    432  * @returns VBox status code.
    433  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     413 * @returns 0 if image with specified number was not opened.
     414 * @param   pDisk           Pointer to HDD container.
     415 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     416 */
     417VBOXDDU_DECL(uint64_t) VDGetSize(PVBOXHDD pDisk, unsigned nImage);
     418
     419/**
     420 * Get total file size of an image in HDD container.
     421 *
     422 * @returns Virtual disk size in bytes.
     423 * @returns 0 if image with specified number was not opened.
     424 * @param   pDisk           Pointer to HDD container.
     425 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     426 */
     427VBOXDDU_DECL(uint64_t) VDGetFileSize(PVBOXHDD pDisk, unsigned nImage);
     428
     429/**
     430 * Get virtual disk PCHS geometry of an image in HDD container.
     431 *
     432 * @returns VBox status code.
     433 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    434434 * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
    435  * @param   pDisk           Pointer to VBox HDD container.
    436  * @param   pcCylinders     Where to store the number of cylinders. NULL is ok.
    437  * @param   pcHeads         Where to store the number of heads. NULL is ok.
    438  * @param   pcSectors       Where to store the number of sectors. NULL is ok.
    439  */
    440 VBOXDDU_DECL(int) VDGetGeometry(PVBOXHDD pDisk,
    441                                 unsigned *pcCylinders, unsigned *pcHeads, unsigned *pcSectors);
    442 
    443 /**
    444  * Store virtual disk geometry in HDD container.
    445  *
    446  * Note that in case of unrecoverable error all images in HDD container will be closed.
    447  *
    448  * @returns VBox status code.
    449  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
    450  * @param   pDisk           Pointer to VBox HDD container.
    451  * @param   cCylinders      Number of cylinders.
    452  * @param   cHeads          Number of heads.
    453  * @param   cSectors        Number of sectors.
    454  */
    455 VBOXDDU_DECL(int) VDSetGeometry(PVBOXHDD pDisk,
    456                                 unsigned cCylinders, unsigned cHeads, unsigned cSectors);
    457 
    458 /**
    459  * Get virtual disk translation mode stored in HDD container.
    460  *
    461  * @returns VBox status code.
    462  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     435 * @param   pDisk           Pointer to HDD container.
     436 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     437 * @param   pPCHSGeometry   Where to store PCHS geometry. Not NULL.
     438 */
     439VBOXDDU_DECL(int) VDGetPCHSGeometry(PVBOXHDD pDisk, unsigned nImage,
     440                                    PPDMMEDIAGEOMETRY pPCHSGeometry);
     441
     442/**
     443 * Store virtual disk PCHS geometry of an image in HDD container.
     444 *
     445 * @returns VBox status code.
     446 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     447 * @param   pDisk           Pointer to HDD container.
     448 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     449 * @param   pPCHSGeometry   Where to load PCHS geometry from. Not NULL.
     450 */
     451VBOXDDU_DECL(int) VDSetPCHSGeometry(PVBOXHDD pDisk, unsigned nImage,
     452                                    PCPDMMEDIAGEOMETRY pPCHSGeometry);
     453
     454/**
     455 * Get virtual disk LCHS geometry of an image in HDD container.
     456 *
     457 * @returns VBox status code.
     458 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    463459 * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
    464  * @param   pDisk           Pointer to VBox HDD container.
    465  * @param   penmTranslation Where to store the translation mode (see pdm.h).
    466  */
    467 VBOXDDU_DECL(int) VDGetTranslation(PVBOXHDD pDisk, PPDMBIOSTRANSLATION penmTranslation);
    468 
    469 /**
    470  * Store virtual disk translation mode in HDD container.
    471  *
    472  * Note that in case of unrecoverable error all images in HDD container will be closed.
    473  *
    474  * @returns VBox status code.
    475  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
    476  * @param   pDisk           Pointer to VBox HDD container.
    477  * @param   enmTranslation  Translation mode (see pdm.h).
    478  */
    479 VBOXDDU_DECL(int) VDSetTranslation(PVBOXHDD pDisk, PDMBIOSTRANSLATION enmTranslation);
     460 * @param   pDisk           Pointer to HDD container.
     461 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     462 * @param   pLCHSGeometry   Where to store LCHS geometry. Not NULL.
     463 */
     464VBOXDDU_DECL(int) VDGetLCHSGeometry(PVBOXHDD pDisk, unsigned nImage,
     465                                    PPDMMEDIAGEOMETRY pLCHSGeometry);
     466
     467/**
     468 * Store virtual disk LCHS geometry of an image in HDD container.
     469 *
     470 * @returns VBox status code.
     471 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     472 * @param   pDisk           Pointer to HDD container.
     473 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     474 * @param   pLCHSGeometry   Where to load LCHS geometry from. Not NULL.
     475 */
     476VBOXDDU_DECL(int) VDSetLCHSGeometry(PVBOXHDD pDisk, unsigned nImage,
     477                                    PCPDMMEDIAGEOMETRY pLCHSGeometry);
    480478
    481479/**
     
    484482 * @returns VBox status code.
    485483 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    486  * @param   pDisk           Pointer to VBox HDD container.
     484 * @param   pDisk           Pointer to HDD container.
    487485 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    488486 * @param   puVersion       Where to store the image version.
    489487 */
    490 VBOXDDU_DECL(int) VDGetVersion(PVBOXHDD pDisk, unsigned nImage, unsigned *puVersion);
     488VBOXDDU_DECL(int) VDGetVersion(PVBOXHDD pDisk, unsigned nImage,
     489                               unsigned *puVersion);
    491490
    492491/**
     
    495494 * @returns VBox status code.
    496495 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    497  * @param   pDisk           Pointer to VBox HDD container.
     496 * @param   pDisk           Pointer to HDD container.
    498497 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    499498 * @param   penmType        Where to store the image type.
    500499 */
    501 VBOXDDU_DECL(int) VDGetImageType(PVBOXHDD pDisk, unsigned nImage, PVDIMAGETYPE penmType);
     500VBOXDDU_DECL(int) VDGetImageType(PVBOXHDD pDisk, unsigned nImage,
     501                                 PVDIMAGETYPE penmType);
    502502
    503503/**
     
    506506 * @returns VBox status code.
    507507 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    508  * @param   pDisk           Pointer to VBox HDD container.
     508 * @param   pDisk           Pointer to HDD container.
    509509 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    510510 * @param   puImageFlags    Where to store the image flags.
     
    513513
    514514/**
    515  * Get open flags of last opened image in HDD container.
    516  *
    517  * @returns VBox status code.
    518  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
    519  * @param   pDisk           Pointer to VBox HDD container.
     515 * Get open flags of image in HDD container.
     516 *
     517 * @returns VBox status code.
     518 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     519 * @param   pDisk           Pointer to HDD container.
     520 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    520521 * @param   puOpenFlags     Where to store the image open flags.
    521522 */
    522 VBOXDDU_DECL(int) VDGetOpenFlags(PVBOXHDD pDisk, unsigned *puOpenFlags);
    523 
    524 /**
    525  * Set open flags of last opened image in HDD container.
     523VBOXDDU_DECL(int) VDGetOpenFlags(PVBOXHDD pDisk, unsigned nImage,
     524                                 unsigned *puOpenFlags);
     525
     526/**
     527 * Set open flags of image in HDD container.
    526528 * This operation may cause file locking changes and/or files being reopened.
    527529 * Note that in case of unrecoverable error all images in HDD container will be closed.
     
    529531 * @returns VBox status code.
    530532 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    531  * @param   pDisk           Pointer to VBox HDD container.
     533 * @param   pDisk           Pointer to HDD container.
     534 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    532535 * @param   uOpenFlags      Image file open mode, see VD_OPEN_FLAGS_* constants.
    533536 */
    534 VBOXDDU_DECL(int) VDSetOpenFlags(PVBOXHDD pDisk, unsigned uOpenFlags);
     537VBOXDDU_DECL(int) VDSetOpenFlags(PVBOXHDD pDisk, unsigned nImage,
     538                                 unsigned uOpenFlags);
    535539
    536540/**
    537541 * Get base filename of image in HDD container. Some image formats use
    538  * other filenames as well, so don't use this for anything but for informational
     542 * other filenames as well, so don't use this for anything but informational
    539543 * purposes.
    540544 *
     
    542546 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    543547 * @returns VERR_BUFFER_OVERFLOW if pszFilename buffer too small to hold filename.
    544  * @param   pDisk           Pointer to VBox HDD container.
     548 * @param   pDisk           Pointer to HDD container.
    545549 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    546550 * @param   pszFilename     Where to store the image file name.
    547551 * @param   cbFilename      Size of buffer pszFilename points to.
    548552 */
    549 VBOXDDU_DECL(int) VDGetFilename(PVBOXHDD pDisk, unsigned nImage, char *pszFilename, unsigned cbFilename);
     553VBOXDDU_DECL(int) VDGetFilename(PVBOXHDD pDisk, unsigned nImage,
     554                                char *pszFilename, unsigned cbFilename);
    550555
    551556/**
     
    555560 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    556561 * @returns VERR_BUFFER_OVERFLOW if pszComment buffer too small to hold comment text.
    557  * @param   pDisk           Pointer to VBox HDD container.
     562 * @param   pDisk           Pointer to HDD container.
    558563 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    559564 * @param   pszComment      Where to store the comment string of image. NULL is ok.
    560565 * @param   cbComment       The size of pszComment buffer. 0 is ok.
    561566 */
    562 VBOXDDU_DECL(int) VDGetComment(PVBOXHDD pDisk, unsigned nImage, char *pszComment, unsigned cbComment);
     567VBOXDDU_DECL(int) VDGetComment(PVBOXHDD pDisk, unsigned nImage,
     568                               char *pszComment, unsigned cbComment);
    563569
    564570/**
     
    567573 * @returns VBox status code.
    568574 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    569  * @param   pDisk           Pointer to VBox HDD container.
     575 * @param   pDisk           Pointer to HDD container.
    570576 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    571577 * @param   pszComment      New comment string (UTF-8). NULL is allowed to reset the comment.
    572578 */
    573 VBOXDDU_DECL(int) VDSetComment(PVBOXHDD pDisk, unsigned nImage, const char *pszComment);
     579VBOXDDU_DECL(int) VDSetComment(PVBOXHDD pDisk, unsigned nImage,
     580                               const char *pszComment);
    574581
    575582/**
     
    578585 * @returns VBox status code.
    579586 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    580  * @param   pDisk           Pointer to VBox HDD container.
     587 * @param   pDisk           Pointer to HDD container.
    581588 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    582589 * @param   pUuid           Where to store the image UUID.
     
    589596 * @returns VBox status code.
    590597 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    591  * @param   pDisk           Pointer to VBox HDD container.
    592  * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    593  * @param   pUuid           Optional parameter, new UUID of the image.
     598 * @param   pDisk           Pointer to HDD container.
     599 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     600 * @param   pUuid           New UUID of the image. If NULL, a new UUID is created.
    594601 */
    595602VBOXDDU_DECL(int) VDSetUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
     
    600607 * @returns VBox status code.
    601608 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    602  * @param   pDisk           Pointer to VBox HDD container.
     609 * @param   pDisk           Pointer to HDD container.
    603610 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    604611 * @param   pUuid           Where to store the image modification UUID.
    605612 */
    606 VBOXDDU_DECL(int) VDGetModificationUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
     613VBOXDDU_DECL(int) VDGetModificationUuid(PVBOXHDD pDisk, unsigned nImage,
     614                                        PRTUUID pUuid);
    607615
    608616/**
     
    611619 * @returns VBox status code.
    612620 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    613  * @param   pDisk           Pointer to VBox HDD container.
    614  * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    615  * @param   pUuid           Optional parameter, new last modification UUID of the image.
    616  */
    617 VBOXDDU_DECL(int) VDSetModificationUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
     621 * @param   pDisk           Pointer to HDD container.
     622 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     623 * @param   pUuid           New modification UUID of the image. If NULL, a new UUID is created.
     624 */
     625VBOXDDU_DECL(int) VDSetModificationUuid(PVBOXHDD pDisk, unsigned nImage,
     626                                        PCRTUUID pUuid);
    618627
    619628/**
     
    622631 * @returns VBox status code.
    623632 * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    624  * @param   pDisk           Pointer to VBox HDD container.
     633 * @param   pDisk           Pointer to HDD container.
    625634 * @param   nImage          Image number, counts from 0. 0 is always base image of the container.
    626635 * @param   pUuid           Where to store the parent image UUID.
    627636 */
    628 VBOXDDU_DECL(int) VDGetParentUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
     637VBOXDDU_DECL(int) VDGetParentUuid(PVBOXHDD pDisk, unsigned nImage,
     638                                  PRTUUID pUuid);
    629639
    630640/**
     
    632642 *
    633643 * @returns VBox status code.
    634  * @param   pDisk           Pointer to VBox HDD container.
    635  * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    636  * @param   pUuid           Optional parameter, new parent UUID of the image.
    637  */
    638 VBOXDDU_DECL(int) VDSetParentUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
     644 * @param   pDisk           Pointer to HDD container.
     645 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     646 * @param   pUuid           New parent UUID of the image. If NULL, a new UUID is created.
     647 */
     648VBOXDDU_DECL(int) VDSetParentUuid(PVBOXHDD pDisk, unsigned nImage,
     649                                  PCRTUUID pUuid);
    639650
    640651
     
    642653 * Debug helper - dumps all opened images in HDD container into the log file.
    643654 *
    644  * @param   pDisk           Pointer to VBox HDD container.
     655 * @param   pDisk           Pointer to HDD container.
    645656 */
    646657VBOXDDU_DECL(void) VDDumpImages(PVBOXHDD pDisk);
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