VirtualBox

Changeset 15366 in vbox


Ignore:
Timestamp:
Dec 12, 2008 1:50:32 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
40805
Message:

Storage: Eradicated the last bits using the old VDI only backend, keeping only the testcases for now (no longer built).

Completely removed old iSCSI driver.

Added intnet option to addiscsidisk and adjusted documentation.

Made backend name comparisons case-insensitive.

Detect VMDK files not according to VMDK 1.0 and reject with clear error message.

Changed format probing logic to not fall through to the "unsupported" case if it's a known format, i.e. has valid header.

VBoxManage converthd generic format converter made official.

Added format flag to VBoxManage createhd, allows creating VMDK files.

VBoxManage convertdd reimplemented based on new framework, supporting any image format.

VBoxManage internalcommands sethduuid reimplemented based on new framework, supporting any image format.

Cleaned up error codes.

Location:
trunk
Files:
3 deleted
18 edited

Legend:

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

    r14967 r15366  
    10491049typedef struct VDBACKENDINFO
    10501050{
    1051     /** Name of the backend. */
     1051    /** Name of the backend. Must be unique even with case insensitive comparison. */
    10521052    const char *pszBackend;
    10531053    /** Capabilities of the backend (a combination of the VD_CAP_* flags). */
     
    11161116 *
    11171117 * @return  VBox status code.
    1118  * @param   pszBackend      The backend name.
     1118 * @param   pszBackend      The backend name (case insensitive).
    11191119 * @param   pEntries        Pointer to an entry.
    11201120 */
     
    11641164 * @return  VBox status code.
    11651165 * @param   pDisk           Pointer to HDD container.
    1166  * @param   pszBackend      Name of the image file backend to use.
     1166 * @param   pszBackend      Name of the image file backend to use (case insensitive).
    11671167 * @param   pszFilename     Name of the image file to open.
    11681168 * @param   uOpenFlags      Image file open mode, see VD_OPEN_FLAGS_* constants.
     
    11781178 * @return  VBox status code.
    11791179 * @param   pDisk           Pointer to HDD container.
    1180  * @param   pszBackend      Name of the image file backend to use.
     1180 * @param   pszBackend      Name of the image file backend to use (case insensitive).
    11811181 * @param   pszFilename     Name of the image file to create.
    11821182 * @param   enmType         Image type, only base image types are acceptable.
     
    12071207 * @return  VBox status code.
    12081208 * @param   pDisk           Pointer to HDD container.
    1209  * @param   pszBackend      Name of the image file backend to use.
     1209 * @param   pszBackend      Name of the image file backend to use (case insensitive).
    12101210 * @param   pszFilename     Name of the differencing image file to create.
    12111211 * @param   uImageFlags     Flags specifying special image features.
     
    12291229 *
    12301230 * @return  VBox status code.
    1231  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1231 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    12321232 * @param   pDisk           Pointer to HDD container.
    12331233 * @param   nImageFrom      Name of the image file to merge from.
     
    12491249 *
    12501250 * @return  VBox status code.
    1251  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1251 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    12521252 * @param   pDiskFrom       Pointer to source HDD container.
    12531253 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
    12541254 * @param   pDiskTo         Pointer to destination HDD container.
    1255  * @param   pszBackend      Name of the image file backend to use (may be NULL to use the same as the source).
     1255 * @param   pszBackend      Name of the image file backend to use (may be NULL to use the same as the source, case insensitive).
    12561256 * @param   pszFilename     New name of the image (may be NULL if pDiskFrom == pDiskTo).
    12571257 * @param   fMoveByRename   If true, attempt to perform a move by renaming (if successful the new size is ignored).
     
    12771277 *
    12781278 * @return  VBox status code.
    1279  * @return  VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     1279 * @return  VERR_VD_NOT_OPENED if no image is opened in HDD container.
    12801280 * @param   pDisk           Pointer to HDD container.
    12811281 * @param   fDelete         If true, delete the image from the host disk.
     
    12951295 *
    12961296 * @return  VBox status code.
    1297  * @return  VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     1297 * @return  VERR_VD_NOT_OPENED if no image is opened in HDD container.
    12981298 * @param   pDisk           Pointer to HDD container.
    12991299 * @param   uOffset         Offset of first reading byte from start of disk.
     
    13091309 *
    13101310 * @return  VBox status code.
    1311  * @return  VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     1311 * @return  VERR_VD_NOT_OPENED if no image is opened in HDD container.
    13121312 * @param   pDisk           Pointer to HDD container.
    13131313 * @param   uOffset         Offset of first writing byte from start of disk.
     
    13231323 *
    13241324 * @return  VBox status code.
    1325  * @return  VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     1325 * @return  VERR_VD_NOT_OPENED if no image is opened in HDD container.
    13261326 * @param   pDisk           Pointer to HDD container.
    13271327 */
     
    13691369 *
    13701370 * @return  VBox status code.
    1371  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    1372  * @return  VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
     1371 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
     1372 * @return  VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container.
    13731373 * @param   pDisk           Pointer to HDD container.
    13741374 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    13821382 *
    13831383 * @return  VBox status code.
    1384  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1384 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    13851385 * @param   pDisk           Pointer to HDD container.
    13861386 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    13941394 *
    13951395 * @return  VBox status code.
    1396  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    1397  * @return  VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
     1396 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
     1397 * @return  VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container.
    13981398 * @param   pDisk           Pointer to HDD container.
    13991399 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    14071407 *
    14081408 * @return  VBox status code.
    1409  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1409 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    14101410 * @param   pDisk           Pointer to HDD container.
    14111411 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    14191419 *
    14201420 * @return  VBox status code.
    1421  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1421 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    14221422 * @param   pDisk           Pointer to HDD container.
    14231423 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    14311431 *
    14321432 * @return  VBox status code.
    1433  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1433 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    14341434 * @param   pDisk           Pointer to HDD container.
    14351435 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    14431443 *
    14441444 * @return  VBox status code.
    1445  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1445 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    14461446 * @param   pDisk           Pointer to the HDD container.
    14471447 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    14551455 *
    14561456 * @return  VBox status code.
    1457  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1457 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    14581458 * @param   pDisk           Pointer to HDD container.
    14591459 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    14661466 *
    14671467 * @return  VBox status code.
    1468  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1468 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    14691469 * @param   pDisk           Pointer to HDD container.
    14701470 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    14801480 *
    14811481 * @return  VBox status code.
    1482  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1482 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    14831483 * @param   pDisk           Pointer to HDD container.
    14841484 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    14941494 *
    14951495 * @return  VBox status code.
    1496  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1496 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    14971497 * @return  VERR_BUFFER_OVERFLOW if pszFilename buffer too small to hold filename.
    14981498 * @param   pDisk           Pointer to HDD container.
     
    15081508 *
    15091509 * @return  VBox status code.
    1510  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1510 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    15111511 * @return  VERR_BUFFER_OVERFLOW if pszComment buffer too small to hold comment text.
    15121512 * @param   pDisk           Pointer to HDD container.
     
    15221522 *
    15231523 * @return  VBox status code.
    1524  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1524 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    15251525 * @param   pDisk           Pointer to HDD container.
    15261526 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    15341534 *
    15351535 * @return  VBox status code.
    1536  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1536 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    15371537 * @param   pDisk           Pointer to HDD container.
    15381538 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    15451545 *
    15461546 * @return  VBox status code.
    1547  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1547 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    15481548 * @param   pDisk           Pointer to HDD container.
    15491549 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    15561556 *
    15571557 * @return  VBox status code.
    1558  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1558 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    15591559 * @param   pDisk           Pointer to HDD container.
    15601560 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    15681568 *
    15691569 * @return  VBox status code.
    1570  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1570 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    15711571 * @param   pDisk           Pointer to HDD container.
    15721572 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    15801580 *
    15811581 * @return  VBox status code.
    1582  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1582 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    15831583 * @param   pDisk           Pointer to HDD container.
    15841584 * @param   nImage          Image number, counts from 0. 0 is always base image of the container.
     
    16121612 *
    16131613 * @return  VBox status code.
    1614  * @return  VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1614 * @return  VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    16151615 * @param   pDisk           Pointer to the HDD container.
    16161616 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
  • trunk/include/VBox/err.h

    r15284 r15366  
    10301030
    10311031
    1032 /** @name VBox HDD Container (VDI) Status Codes
    1033  * @{
    1034  */
    1035 /** Invalid image file header. */
    1036 #define VERR_VDI_INVALID_HEADER                     (-3200)
    1037 /** Invalid image file header: invalid signature. */
    1038 #define VERR_VDI_INVALID_SIGNATURE                  (-3201)
    1039 /** Invalid image file header: invalid version. */
    1040 #define VERR_VDI_UNSUPPORTED_VERSION                (-3202)
     1032/** @name VBox HDD Container (VD) Status Codes
     1033 * @{
     1034 */
    10411035/** Invalid image type. */
    1042 #define VERR_VDI_INVALID_TYPE                       (-3203)
    1043 /** Invalid image flags. */
    1044 #define VERR_VDI_INVALID_FLAGS                      (-3204)
     1036#define VERR_VD_INVALID_TYPE                        (-3200)
    10451037/** Operation can't be done in current HDD container state. */
    1046 #define VERR_VDI_INVALID_STATE                      (-3205)
    1047 /** Differencing image can't be used with current base image. */
    1048 #define VERR_VDI_WRONG_DIFF_IMAGE                   (-3206)
    1049 /** Two or more images of one HDD has different versions. */
    1050 #define VERR_VDI_IMAGES_VERSION_MISMATCH            (-3207)
     1038#define VERR_VD_INVALID_STATE                       (-3201)
     1039/** Configuration value not found. */
     1040#define VERR_VD_VALUE_NOT_FOUND                     (-3202)
     1041/** Virtual HDD is not opened. */
     1042#define VERR_VD_NOT_OPENED                          (-3203)
     1043/** Requested image is not opened. */
     1044#define VERR_VD_IMAGE_NOT_FOUND                     (-3204)
     1045/** Image is read-only. */
     1046#define VERR_VD_IMAGE_READ_ONLY                     (-3205)
     1047/** Geometry hasn't been set. */
     1048#define VERR_VD_GEOMETRY_NOT_SET                    (-3206)
     1049/** No data for this block in image. */
     1050#define VERR_VD_BLOCK_FREE                          (-3207)
    10511051/** Differencing and parent images can't be used together due to UUID. */
    1052 #define VERR_VDI_IMAGES_UUID_MISMATCH               (-3208)
    1053 /** No differencing images to commit. */
    1054 #define VERR_VDI_NO_DIFF_IMAGES                     (-3209)
    1055 /** Virtual HDD is not opened. */
    1056 #define VERR_VDI_NOT_OPENED                         (-3210)
    1057 /** Requested image is not opened. */
    1058 #define VERR_VDI_IMAGE_NOT_FOUND                    (-3211)
    1059 /** Image is read-only. */
    1060 #define VERR_VDI_IMAGE_READ_ONLY                    (-3212)
     1052#define VERR_VD_UUID_MISMATCH                       (-3208)
     1053/** Asynchronous I/O request finished. */
     1054#define VINF_VD_ASYNC_IO_FINISHED                   3209
     1055/** Asynchronous I/O is not finished yet. */
     1056#define VERR_VD_ASYNC_IO_IN_PROGRESS                (-3210)
     1057/** Generic: Invalid image file header. Use this for plugins. */
     1058#define VERR_VD_GEN_INVALID_HEADER                  (-3220)
     1059/** VDI: Invalid image file header. */
     1060#define VERR_VD_VDI_INVALID_HEADER                  (-3230)
     1061/** VDI: Invalid image file header: invalid signature. */
     1062#define VERR_VD_VDI_INVALID_SIGNATURE               (-3231)
     1063/** VDI: Invalid image file header: invalid version. */
     1064#define VERR_VD_VDI_UNSUPPORTED_VERSION             (-3232)
    10611065/** Comment string is too long. */
    1062 #define VERR_VDI_COMMENT_TOO_LONG                   (-3213)
    1063 /** Geometry hasn't been set. */
    1064 #define VERR_VDI_GEOMETRY_NOT_SET                   (-3214)
    1065 /** No data for this block in image. */
    1066 #define VERR_VDI_BLOCK_FREE                         (-3215)
    1067 /** Configuration value not found. */
    1068 #define VERR_VDI_VALUE_NOT_FOUND                    (-3216)
    1069 /** Configuration value is unknown. This indicates misconfiguration. */
    1070 #define VERR_VDI_UNKNOWN_CFG_VALUES                 (-3217)
    1071 /** Asynchronous I/O request finished. */
    1072 #define VINF_VDI_ASYNC_IO_FINISHED                  3218
    1073 /** Asynchronous I/O is not finished yet. */
    1074 #define VERR_VDI_ASYNC_IO_IN_PROGRESS               (-3219)
     1066#define VERR_VD_VDI_COMMENT_TOO_LONG                (-3233)
     1067/** VMDK: Invalid image file header. */
     1068#define VERR_VD_VMDK_INVALID_HEADER                 (-3240)
     1069/** VMDK: Invalid image file header: invalid version. */
     1070#define VERR_VD_VMDK_UNSUPPORTED_VERSION            (-3241)
     1071/** VMDK: Image property not found. */
     1072#define VERR_VD_VMDK_VALUE_NOT_FOUND                (-3242)
     1073/** VMDK: Operation can't be done in current image state. */
     1074#define VERR_VD_VMDK_INVALID_STATE                  (-3243)
     1075/** iSCSI: Invalid header, i.e. dummy for validity check. */
     1076#define VERR_VD_ISCSI_INVALID_HEADER                (-3250)
     1077/** iSCSI: Configuration value is unknown. This indicates misconfiguration. */
     1078#define VERR_VD_ISCSI_UNKNOWN_CFG_VALUES            (-3251)
     1079/** iSCSI: Interface is unknown. This indicates misconfiguration. */
     1080#define VERR_VD_ISCSI_UNKNOWN_INTERFACE             (-3252)
     1081/** iSCSI: Operation can't be done in current image state. */
     1082#define VERR_VD_ISCSI_INVALID_STATE                 (-3253)
     1083/** iSCSI: Invalid device type (not a disk). */
     1084#define VERR_VD_ISCSI_INVALID_TYPE                  (-3254)
     1085/** VHD: Invalid image file header. */
     1086#define VERR_VD_VHD_INVALID_HEADER                  (-3260)
     1087/** Raw: Invalid image file header. */
     1088#define VERR_VD_RAW_INVALID_HEADER                  (-3270)
     1089/** Raw: Invalid image file type. */
     1090#define VERR_VD_RAW_INVALID_TYPE                    (-3271)
    10751091/** @} */
    10761092
  • trunk/src/VBox/Devices/Builtins.cpp

    r14965 r15366  
    181181    if (RT_FAILURE(rc))
    182182        return rc;
    183     rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVBoxHDD);
    184     if (RT_FAILURE(rc))
    185         return rc;
    186183    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD);
    187184    if (RT_FAILURE(rc))
     
    203200    if (RT_FAILURE(rc))
    204201        return rc;
    205 #ifdef VBOX_WITH_ISCSI
    206     rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSI);
    207     if (RT_FAILURE(rc))
    208         return rc;
    209     rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSITransportTcp);
    210     if (RT_FAILURE(rc))
    211         return rc;
    212 #endif
    213202#ifndef RT_OS_L4
    214203    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT);
  • trunk/src/VBox/Devices/Makefile.kmk

    r15287 r15366  
    8282VBoxDDU_SOURCES          = \
    8383        Storage/VBoxHDD-new.cpp \
    84         Storage/VDICore.cpp \
    8584        Storage/VDIHDDCore.cpp \
    8685        Storage/VHDHDDCore.cpp \
     
    579578        Storage/DrvRawImage.cpp \
    580579        Storage/DrvVD.cpp \
    581         Storage/VBoxHDD.cpp \
    582580        Network/DrvNetSniffer.cpp \
    583581        Network/Pcap.cpp
     
    644642        Input/DrvMouseQueue.cpp \
    645643        Input/DrvKeyboardQueue.cpp \
    646         Storage/VBoxHDD.cpp \
    647644        Storage/DrvBlock.cpp \
    648645        Storage/DrvMediaISO.cpp \
     
    712709
    713710ifdef VBOX_WITH_ISCSI
    714  Drivers_SOURCES      += \
    715         Storage/DrvISCSI.cpp \
    716         Storage/DrvISCSITransportTCP.cpp
    717  Drivers_DEFS         += VBOX_WITH_ISCSI
    718  Storage/DrvISCSITransportTCP.cpp_INCS = \
    719         Network/lwip/src/include \
    720         Network/lwip/src/include/ipv4 \
    721         Network/lwip/vbox/include
    722711 VBoxDDU_SOURCES      += \
    723712    Storage/ISCSIHDDCore.cpp
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r15192 r15366  
    458458        }
    459459        rc = pHardDisk->pfnSetLCHSGeometry(pHardDisk, &LCHSGeometry);
    460         if (rc == VERR_VDI_IMAGE_READ_ONLY)
     460        if (rc == VERR_VD_IMAGE_READ_ONLY)
    461461        {
    462462            LogRel(("DevPcBios: ATA failed to update LCHS geometry, read only\n"));
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r15156 r15366  
    552552    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
    553553    int rc = VDSetPCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pPCHSGeometry);
    554     if (rc == VERR_VDI_GEOMETRY_NOT_SET)
     554    if (rc == VERR_VD_GEOMETRY_NOT_SET)
    555555        rc = VERR_PDM_GEOMETRY_NOT_SET;
    556556    LogFlow(("%s: returns %Rrc\n", __FUNCTION__, rc));
     
    583583    PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface);
    584584    int rc = VDSetLCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pLCHSGeometry);
    585     if (rc == VERR_VDI_GEOMETRY_NOT_SET)
     585    if (rc == VERR_VD_GEOMETRY_NOT_SET)
    586586        rc = VERR_PDM_GEOMETRY_NOT_SET;
    587587    LogFlow(("%s: returns %Rrc\n", __FUNCTION__, rc));
     
    635635    PVBOXDISK pThis = PDMITRANSPORTASYNCPORT_2_VBOXDISK(pInterface);
    636636    PDRVVDASYNCTASK pDrvVDAsyncTask = (PDRVVDASYNCTASK)pvUser;
    637     int rc = VINF_VDI_ASYNC_IO_FINISHED;
     637    int rc = VINF_VD_ASYNC_IO_FINISHED;
    638638
    639639    /* Having a completion callback for a task is not mandatory. */
     
    642642
    643643    /* Check if the request is finished. */
    644     if (rc == VINF_VDI_ASYNC_IO_FINISHED)
     644    if (rc == VINF_VD_ASYNC_IO_FINISHED)
    645645    {
    646646        rc = pThis->pDrvMediaAsyncPort->pfnTransferCompleteNotify(pThis->pDrvMediaAsyncPort, pDrvVDAsyncTask->pvUserCaller);
    647647    }
    648     else if (rc == VERR_VDI_ASYNC_IO_IN_PROGRESS)
     648    else if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    649649        rc = VINF_SUCCESS;
    650650
  • trunk/src/VBox/Devices/Storage/RawHDDCore.cpp

    r14967 r15366  
    143143    if (pImage->cbSize % 512)
    144144    {
    145         rc = VERR_VDI_INVALID_HEADER;
     145        rc = VERR_VD_RAW_INVALID_HEADER;
    146146        goto out;
    147147    }
     
    174174    if (enmType != VD_IMAGE_TYPE_FIXED)
    175175    {
    176         rc = rawError(pImage, VERR_VDI_INVALID_TYPE, RT_SRC_POS, N_("Raw: cannot create diff image '%s'"), pImage->pszFilename);
     176        rc = rawError(pImage, VERR_VD_RAW_INVALID_TYPE, RT_SRC_POS, N_("Raw: cannot create diff image '%s'"), pImage->pszFilename);
    177177        goto out;
    178178    }
     
    322322
    323323    /* Always return failure, to avoid opening everything as a raw image. */
    324     rc = VERR_VDI_INVALID_HEADER;
     324    rc = VERR_VD_RAW_INVALID_HEADER;
    325325
    326326out:
     
    519519    if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    520520    {
    521         rc = VERR_VDI_IMAGE_READ_ONLY;
     521        rc = VERR_VD_IMAGE_READ_ONLY;
    522522        goto out;
    523523    }
     
    578578        *penmImageType = pImage->enmImageType;
    579579    else
    580         rc = VERR_VDI_NOT_OPENED;
     580        rc = VERR_VD_NOT_OPENED;
    581581
    582582    LogFlowFunc(("returns %Rrc enmImageType=%u\n", rc, *penmImageType));
     
    640640        }
    641641        else
    642             rc = VERR_VDI_GEOMETRY_NOT_SET;
    643     }
    644     else
    645         rc = VERR_VDI_NOT_OPENED;
     642            rc = VERR_VD_GEOMETRY_NOT_SET;
     643    }
     644    else
     645        rc = VERR_VD_NOT_OPENED;
    646646
    647647    LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
     
    663663        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    664664        {
    665             rc = VERR_VDI_IMAGE_READ_ONLY;
     665            rc = VERR_VD_IMAGE_READ_ONLY;
    666666            goto out;
    667667        }
     
    671671    }
    672672    else
    673         rc = VERR_VDI_NOT_OPENED;
     673        rc = VERR_VD_NOT_OPENED;
    674674
    675675out:
     
    696696        }
    697697        else
    698             rc = VERR_VDI_GEOMETRY_NOT_SET;
    699     }
    700     else
    701         rc = VERR_VDI_NOT_OPENED;
     698            rc = VERR_VD_GEOMETRY_NOT_SET;
     699    }
     700    else
     701        rc = VERR_VD_NOT_OPENED;
    702702
    703703    LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
     
    719719        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    720720        {
    721             rc = VERR_VDI_IMAGE_READ_ONLY;
     721            rc = VERR_VD_IMAGE_READ_ONLY;
    722722            goto out;
    723723        }
     
    727727    }
    728728    else
    729         rc = VERR_VDI_NOT_OPENED;
     729        rc = VERR_VD_NOT_OPENED;
    730730
    731731out:
     
    811811    }
    812812    else
    813         rc = VERR_VDI_NOT_OPENED;
     813        rc = VERR_VD_NOT_OPENED;
    814814
    815815    LogFlowFunc(("returns %Rrc comment='%s'\n", rc, pszComment));
     
    828828    if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    829829    {
    830         rc = VERR_VDI_IMAGE_READ_ONLY;
     830        rc = VERR_VD_IMAGE_READ_ONLY;
    831831        goto out;
    832832    }
     
    835835        rc = VERR_NOT_SUPPORTED;
    836836    else
    837         rc = VERR_VDI_NOT_OPENED;
     837        rc = VERR_VD_NOT_OPENED;
    838838
    839839out:
     
    854854        rc = VERR_NOT_SUPPORTED;
    855855    else
    856         rc = VERR_VDI_NOT_OPENED;
     856        rc = VERR_VD_NOT_OPENED;
    857857
    858858    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    875875            rc = VERR_NOT_SUPPORTED;
    876876        else
    877             rc = VERR_VDI_IMAGE_READ_ONLY;
    878     }
    879     else
    880         rc = VERR_VDI_NOT_OPENED;
     877            rc = VERR_VD_IMAGE_READ_ONLY;
     878    }
     879    else
     880        rc = VERR_VD_NOT_OPENED;
    881881
    882882    LogFlowFunc(("returns %Rrc\n", rc));
     
    896896        rc = VERR_NOT_SUPPORTED;
    897897    else
    898         rc = VERR_VDI_NOT_OPENED;
     898        rc = VERR_VD_NOT_OPENED;
    899899
    900900    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    916916            rc = VERR_NOT_SUPPORTED;
    917917        else
    918             rc = VERR_VDI_IMAGE_READ_ONLY;
    919     }
    920     else
    921         rc = VERR_VDI_NOT_OPENED;
     918            rc = VERR_VD_IMAGE_READ_ONLY;
     919    }
     920    else
     921        rc = VERR_VD_NOT_OPENED;
    922922
    923923    LogFlowFunc(("returns %Rrc\n", rc));
     
    937937        rc = VERR_NOT_SUPPORTED;
    938938    else
    939         rc = VERR_VDI_NOT_OPENED;
     939        rc = VERR_VD_NOT_OPENED;
    940940
    941941    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    957957            rc = VERR_NOT_SUPPORTED;
    958958        else
    959             rc = VERR_VDI_IMAGE_READ_ONLY;
    960     }
    961     else
    962         rc = VERR_VDI_NOT_OPENED;
     959            rc = VERR_VD_IMAGE_READ_ONLY;
     960    }
     961    else
     962        rc = VERR_VD_NOT_OPENED;
    963963
    964964    LogFlowFunc(("returns %Rrc\n", rc));
     
    978978        rc = VERR_NOT_SUPPORTED;
    979979    else
    980         rc = VERR_VDI_NOT_OPENED;
     980        rc = VERR_VD_NOT_OPENED;
    981981
    982982    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    998998            rc = VERR_NOT_SUPPORTED;
    999999        else
    1000             rc = VERR_VDI_IMAGE_READ_ONLY;
    1001     }
    1002     else
    1003         rc = VERR_VDI_NOT_OPENED;
     1000            rc = VERR_VD_IMAGE_READ_ONLY;
     1001    }
     1002    else
     1003        rc = VERR_VD_NOT_OPENED;
    10041004
    10051005    LogFlowFunc(("returns %Rrc\n", rc));
  • trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp

    r14967 r15366  
    190190    for (unsigned i = 0; i < g_cBackends; i++)
    191191    {
    192         if (!strcmp(pszBackend, g_apBackends[i]->pszBackendName))
     192        if (!RTStrICmp(pszBackend, g_apBackends[i]->pszBackendName))
    193193        {
    194194            pBackend = g_apBackends[i];
     
    281281         * stale data when different block sizes are used for the images. */
    282282        cbThisRead = cbRead;
    283         rc = VERR_VDI_BLOCK_FREE;
     283        rc = VERR_VD_BLOCK_FREE;
    284284        for (PVDIMAGE pCurrImage = pImage;
    285              pCurrImage != NULL && rc == VERR_VDI_BLOCK_FREE;
     285             pCurrImage != NULL && rc == VERR_VD_BLOCK_FREE;
    286286             pCurrImage = pCurrImage->pPrev)
    287287        {
     
    292292
    293293        /* No image in the chain contains the data for the block. */
    294         if (rc == VERR_VDI_BLOCK_FREE)
     294        if (rc == VERR_VD_BLOCK_FREE)
    295295        {
    296296            memset(pvBuf, '\0', cbThisRead);
     
    415415                                   cbPreRead + cbThisWrite + cbPostRead,
    416416                                   NULL, &cbPreRead, &cbPostRead, 0);
    417     Assert(rc != VERR_VDI_BLOCK_FREE);
     417    Assert(rc != VERR_VD_BLOCK_FREE);
    418418    Assert(cbPreRead == 0);
    419419    Assert(cbPostRead == 0);
     
    494494                                   cbPreRead + cbThisWrite + cbPostRead,
    495495                                   NULL, &cbPreRead, &cbPostRead, 0);
    496     Assert(rc != VERR_VDI_BLOCK_FREE);
     496    Assert(rc != VERR_VD_BLOCK_FREE);
    497497    Assert(cbPreRead == 0);
    498498    Assert(cbPostRead == 0);
     
    528528                                       cbThisWrite, &cbThisWrite, &cbPreRead,
    529529                                       &cbPostRead, fWrite);
    530         if (rc == VERR_VDI_BLOCK_FREE)
     530        if (rc == VERR_VD_BLOCK_FREE)
    531531        {
    532532            void *pvTmp = RTMemTmpAlloc(cbPreRead + cbThisWrite + cbPostRead);
     
    800800    for (unsigned i = 0; i < g_cBackends; i++)
    801801    {
    802         if (!strcmp(pszBackend, g_apBackends[i]->pszBackendName))
     802        if (!RTStrICmp(pszBackend, g_apBackends[i]->pszBackendName))
    803803        {
    804804            pEntry->pszBackend = g_apBackends[i]->pszBackendName;
     
    921921        {
    922922            rc = g_apBackends[i]->pfnCheckIfValid(pszFilename);
    923             if (RT_SUCCESS(rc))
     923            if (    RT_SUCCESS(rc)
     924                /* The correct backend has been found, but there is a small
     925                 * incompatibility so that the file cannot be used. Stop here
     926                 * and signal success - the actual open will of course fail,
     927                 * but that will create a really sensible error message. */
     928                ||  (   rc != VERR_VD_GEN_INVALID_HEADER
     929                     && rc != VERR_VD_VDI_INVALID_HEADER
     930                     && rc != VERR_VD_VMDK_INVALID_HEADER
     931                     && rc != VERR_VD_ISCSI_INVALID_HEADER
     932                     && rc != VERR_VD_VHD_INVALID_HEADER
     933                     && rc != VERR_VD_RAW_INVALID_HEADER))
    924934            {
    925935                /* Copy the name into the new string. */
     
    934944                break;
    935945            }
     946            rc = VERR_NOT_SUPPORTED;
    936947        }
    937948    }
     
    10581069                &&  enmImageType != VD_IMAGE_TYPE_NORMAL)
    10591070            {
    1060                 rc = VERR_VDI_INVALID_TYPE;
     1071                rc = VERR_VD_INVALID_TYPE;
    10611072                break;
    10621073            }
     
    10661077                    &&  enmImageType != VD_IMAGE_TYPE_DIFF)
    10671078                {
    1068                     rc = VERR_VDI_INVALID_TYPE;
     1079                    rc = VERR_VD_INVALID_TYPE;
    10691080                    break;
    10701081                }
     
    12601271        AssertMsgBreakStmt(pDisk->cImages == 0,
    12611272                           ("Create base image cannot be done with other images open\n"),
    1262                            rc = VERR_VDI_INVALID_STATE);
     1273                           rc = VERR_VD_INVALID_STATE);
    12631274
    12641275        /* Set up image descriptor. */
     
    14601471        AssertMsgBreakStmt(pDisk->cImages != 0,
    14611472                           ("Create diff image cannot be done without other images open\n"),
    1462                            rc = VERR_VDI_INVALID_STATE);
     1473                           rc = VERR_VD_INVALID_STATE);
    14631474
    14641475        /* Set up image descriptor. */
     
    15971608 *
    15981609 * @returns VBox status code.
    1599  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1610 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    16001611 * @param   pDisk           Pointer to HDD container.
    16011612 * @param   nImageFrom      Name of the image file to merge from.
     
    16281639        if (!pImageFrom || !pImageTo)
    16291640        {
    1630             rc = VERR_VDI_IMAGE_NOT_FOUND;
     1641            rc = VERR_VD_IMAGE_NOT_FOUND;
    16311642            break;
    16321643        }
     
    16741685                                                uOffset, pvBuf, cbThisRead,
    16751686                                                &cbThisRead);
    1676                 if (rc == VERR_VDI_BLOCK_FREE)
     1687                if (rc == VERR_VD_BLOCK_FREE)
    16771688                {
    16781689                    /* Search for image with allocated block. Do not attempt to
     
    16811692                     * block sizes are used for the images. */
    16821693                    for (PVDIMAGE pCurrImage = pImageTo->pPrev;
    1683                          pCurrImage != NULL && pCurrImage != pImageFrom->pPrev && rc == VERR_VDI_BLOCK_FREE;
     1694                         pCurrImage != NULL && pCurrImage != pImageFrom->pPrev && rc == VERR_VD_BLOCK_FREE;
    16841695                         pCurrImage = pCurrImage->pPrev)
    16851696                    {
     
    16901701                    }
    16911702
    1692                     if (rc != VERR_VDI_BLOCK_FREE)
     1703                    if (rc != VERR_VD_BLOCK_FREE)
    16931704                    {
    16941705                        if (RT_FAILURE(rc))
     
    17281739            {
    17291740                size_t cbThisRead = RT_MIN(VD_MERGE_BUFFER_SIZE, cbRemaining);
    1730                 rc = VERR_VDI_BLOCK_FREE;
     1741                rc = VERR_VD_BLOCK_FREE;
    17311742                /* Search for image with allocated block. Do not attempt to
    17321743                 * read more than the previous reads marked as valid. Otherwise
     
    17341745                 * used for the images. */
    17351746                for (PVDIMAGE pCurrImage = pImageFrom;
    1736                      pCurrImage != NULL && pCurrImage != pImageTo && rc == VERR_VDI_BLOCK_FREE;
     1747                     pCurrImage != NULL && pCurrImage != pImageTo && rc == VERR_VD_BLOCK_FREE;
    17371748                     pCurrImage = pCurrImage->pPrev)
    17381749                {
     
    17421753                }
    17431754
    1744                 if (rc != VERR_VDI_BLOCK_FREE)
     1755                if (rc != VERR_VD_BLOCK_FREE)
    17451756                {
    17461757                    if (RT_FAILURE(rc))
     
    18461857 *
    18471858 * @returns VBox status code.
    1848  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     1859 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    18491860 * @param   pDiskFrom       Pointer to source HDD container.
    18501861 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    18941905
    18951906        PVDIMAGE pImageFrom = vdGetImageByNumber(pDiskFrom, nImage);
    1896         AssertPtrBreakStmt(pImageFrom, rc = VERR_VDI_IMAGE_NOT_FOUND);
     1907        AssertPtrBreakStmt(pImageFrom, rc = VERR_VD_IMAGE_NOT_FOUND);
    18971908        AssertMsgBreakStmt(VALID_PTR(pDiskTo), ("pDiskTo=%#p\n", pDiskTo),
    18981909                           rc = VERR_INVALID_PARAMETER);
     
    19021913        /* If the containers are equal and the backend is the same, rename the image. */
    19031914        if (   (pDiskFrom == pDiskTo)
    1904             && (!strcmp(pszBackend, pImageFrom->Backend->pszBackendName)))
     1915            && (!RTStrICmp(pszBackend, pImageFrom->Backend->pszBackendName)))
    19051916        {
    19061917            /* Rename the image. */
     
    19111922        /* If the fMoveByRename flag is set and the backend is the same, rename the image. */
    19121923        if (   (fMoveByRename == true)
    1913             && (!strcmp(pszBackend, pImageFrom->Backend->pszBackendName)))
     1924            && (!RTStrICmp(pszBackend, pImageFrom->Backend->pszBackendName)))
    19141925        {
    19151926            /* Close the source image. */
     
    19621973        if (cbSizeFrom == 0)
    19631974        {
    1964             rc = VERR_VDI_VALUE_NOT_FOUND;
     1975            rc = VERR_VD_VALUE_NOT_FOUND;
    19651976            break;
    19661977        }
     
    19982009
    19992010        pImageTo = pDiskTo->pLast;
    2000         AssertPtrBreakStmt(pImageTo, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2011        AssertPtrBreakStmt(pImageTo, rc = VERR_VD_IMAGE_NOT_FOUND);
    20012012
    20022013        /* Allocate tmp buffer. */
     
    20492060        /* If fMoveByRename is set but the backend is different, close and delete pImageFrom. */
    20502061        if (   (fMoveByRename == true)
    2051             && (strcmp(pszBackend, pImageFrom->Backend->pszBackendName)))
     2062            && (RTStrICmp(pszBackend, pImageFrom->Backend->pszBackendName)))
    20522063        {
    20532064            vdRemoveImageFromList(pDiskFrom, pImageFrom);
     
    21072118 *
    21082119 * @returns VBox status code.
    2109  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     2120 * @returns VERR_VD_NOT_OPENED if no image is opened in HDD container.
    21102121 * @param   pDisk           Pointer to HDD container.
    21112122 * @param   fDelete         If true, delete the image from the host disk.
     
    21232134
    21242135        PVDIMAGE pImage = pDisk->pLast;
    2125         AssertPtrBreakStmt(pImage, rc = VERR_VDI_NOT_OPENED);
     2136        AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED);
    21262137        unsigned uOpenFlags = pImage->Backend->pfnGetOpenFlags(pImage->pvBackendData);
    21272138        /* Remove image from list of opened images. */
     
    22342245 *
    22352246 * @returns VBox status code.
    2236  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     2247 * @returns VERR_VD_NOT_OPENED if no image is opened in HDD container.
    22372248 * @param   pDisk           Pointer to HDD container.
    22382249 * @param   uOffset         Offset of first reading byte from start of disk.
     
    22662277
    22672278        PVDIMAGE pImage = pDisk->pLast;
    2268         AssertPtrBreakStmt(pImage, rc = VERR_VDI_NOT_OPENED);
     2279        AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED);
    22692280
    22702281        rc = vdReadHelper(pDisk, pImage, uOffset, pvBuf, cbRead);
     
    22792290 *
    22802291 * @returns VBox status code.
    2281  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     2292 * @returns VERR_VD_NOT_OPENED if no image is opened in HDD container.
    22822293 * @param   pDisk           Pointer to HDD container.
    22832294 * @param   uOffset         Offset of the first byte being
     
    23122323
    23132324        PVDIMAGE pImage = pDisk->pLast;
    2314         AssertPtrBreakStmt(pImage, rc = VERR_VDI_NOT_OPENED);
     2325        AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED);
    23152326
    23162327        vdSetModifiedFlag(pDisk);
     
    23262337 *
    23272338 * @returns VBox status code.
    2328  * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
     2339 * @returns VERR_VD_NOT_OPENED if no image is opened in HDD container.
    23292340 * @param   pDisk           Pointer to HDD container.
    23302341 */
     
    23412352
    23422353        PVDIMAGE pImage = pDisk->pLast;
    2343         AssertPtrBreakStmt(pImage, rc = VERR_VDI_NOT_OPENED);
     2354        AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED);
    23442355
    23452356        vdResetModifiedFlag(pDisk);
     
    24652476 *
    24662477 * @returns VBox status code.
    2467  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    2468  * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
     2478 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
     2479 * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container.
    24692480 * @param   pDisk           Pointer to HDD container.
    24702481 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    24902501
    24912502        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    2492         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2503        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    24932504
    24942505        if (pImage == pDisk->pLast)
     
    24982509                *pPCHSGeometry = pDisk->PCHSGeometry;
    24992510            else
    2500                 rc = VERR_VDI_GEOMETRY_NOT_SET;
     2511                rc = VERR_VD_GEOMETRY_NOT_SET;
    25012512        }
    25022513        else
     
    25172528 *
    25182529 * @returns VBox status code.
    2519  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    2520  * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
     2530 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
     2531 * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container.
    25212532 * @param   pDisk           Pointer to HDD container.
    25222533 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    25482559
    25492560        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    2550         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2561        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    25512562
    25522563        if (pImage == pDisk->pLast)
     
    26112622 *
    26122623 * @returns VBox status code.
    2613  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    2614  * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
     2624 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
     2625 * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container.
    26152626 * @param   pDisk           Pointer to HDD container.
    26162627 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    26362647
    26372648        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    2638         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2649        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    26392650
    26402651        if (pImage == pDisk->pLast)
     
    26442655                *pLCHSGeometry = pDisk->LCHSGeometry;
    26452656            else
    2646                 rc = VERR_VDI_GEOMETRY_NOT_SET;
     2657                rc = VERR_VD_GEOMETRY_NOT_SET;
    26472658        }
    26482659        else
     
    26632674 *
    26642675 * @returns VBox status code.
    2665  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
    2666  * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
     2676 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
     2677 * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container.
    26672678 * @param   pDisk           Pointer to HDD container.
    26682679 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    26942705
    26952706        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    2696         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2707        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    26972708
    26982709        if (pImage == pDisk->pLast)
     
    27572768 *
    27582769 * @returns VBox status code.
    2759  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     2770 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    27602771 * @param   pDisk           Pointer to HDD container.
    27612772 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    27812792
    27822793        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    2783         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2794        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    27842795
    27852796        *puVersion = pImage->Backend->pfnGetVersion(pImage->pvBackendData);
     
    27942805 *
    27952806 * @returns VBox status code.
    2796  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     2807 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    27972808 * @param   pDisk           Pointer to HDD container.
    27982809 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    28182829
    28192830        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    2820         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2831        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    28212832
    28222833        if (    pImage->enmImageType >= VD_IMAGE_TYPE_FIRST
     
    28272838        }
    28282839        else
    2829             rc = VERR_VDI_INVALID_TYPE;
     2840            rc = VERR_VD_INVALID_TYPE;
    28302841    } while (0);
    28312842
     
    28392850 *
    28402851 * @returns VBox status code.
    2841  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     2852 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    28422853 * @param   pDisk           Pointer to the HDD container.
    28432854 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    28632874
    28642875        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    2865         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2876        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    28662877
    28672878        if (    pImage->enmImageType >= VD_IMAGE_TYPE_FIRST
     
    28752886        }
    28762887        else
    2877             rc = VERR_VDI_INVALID_TYPE;
     2888            rc = VERR_VD_INVALID_TYPE;
    28782889    } while (0);
    28792890
     
    28862897 *
    28872898 * @returns VBox status code.
    2888  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     2899 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    28892900 * @param   pDisk           Pointer to HDD container.
    28902901 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    29102921
    29112922        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    2912         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2923        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    29132924
    29142925        *puImageFlags = pImage->Backend->pfnGetImageFlags(pImage->pvBackendData);
     
    29232934 *
    29242935 * @returns VBox status code.
    2925  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     2936 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    29262937 * @param   pDisk           Pointer to HDD container.
    29272938 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    29472958
    29482959        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    2949         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2960        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    29502961
    29512962        *puOpenFlags = pImage->Backend->pfnGetOpenFlags(pImage->pvBackendData);
     
    29622973 *
    29632974 * @returns VBox status code.
    2964  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     2975 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    29652976 * @param   pDisk           Pointer to HDD container.
    29662977 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    29852996
    29862997        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    2987         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     2998        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    29882999
    29893000        rc = pImage->Backend->pfnSetOpenFlags(pImage->pvBackendData,
     
    30013012 *
    30023013 * @returns VBox status code.
    3003  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     3014 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    30043015 * @returns VERR_BUFFER_OVERFLOW if pszFilename buffer too small to hold filename.
    30053016 * @param   pDisk           Pointer to HDD container.
     
    30303041
    30313042        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    3032         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     3043        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    30333044
    30343045        size_t cb = strlen(pImage->pszFilename);
     
    30543065 *
    30553066 * @returns VBox status code.
    3056  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     3067 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    30573068 * @returns VERR_BUFFER_OVERFLOW if pszComment buffer too small to hold comment text.
    30583069 * @param   pDisk           Pointer to HDD container.
     
    30833094
    30843095        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    3085         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     3096        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    30863097
    30873098        rc = pImage->Backend->pfnGetComment(pImage->pvBackendData, pszComment,
     
    30973108 *
    30983109 * @returns VBox status code.
    3099  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     3110 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    31003111 * @param   pDisk           Pointer to HDD container.
    31013112 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    31213132
    31223133        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    3123         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     3134        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    31243135
    31253136        rc = pImage->Backend->pfnSetComment(pImage->pvBackendData, pszComment);
     
    31353146 *
    31363147 * @returns VBox status code.
    3137  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     3148 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    31383149 * @param   pDisk           Pointer to HDD container.
    31393150 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    31573168
    31583169        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    3159         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     3170        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    31603171
    31613172        rc = pImage->Backend->pfnGetUuid(pImage->pvBackendData, pUuid);
     
    31703181 *
    31713182 * @returns VBox status code.
    3172  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     3183 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    31733184 * @param   pDisk           Pointer to HDD container.
    31743185 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    31923203
    31933204        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    3194         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     3205        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    31953206
    31963207        RTUUID Uuid;
     
    32113222 *
    32123223 * @returns VBox status code.
    3213  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     3224 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    32143225 * @param   pDisk           Pointer to HDD container.
    32153226 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    32333244
    32343245        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    3235         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     3246        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    32363247
    32373248        rc = pImage->Backend->pfnGetModificationUuid(pImage->pvBackendData,
     
    32473258 *
    32483259 * @returns VBox status code.
    3249  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     3260 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    32503261 * @param   pDisk           Pointer to HDD container.
    32513262 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    32703281
    32713282        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    3272         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     3283        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    32733284
    32743285        RTUUID Uuid;
     
    32903301 *
    32913302 * @returns VBox status code.
    3292  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     3303 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    32933304 * @param   pDisk           Pointer to HDD container.
    32943305 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    33133324
    33143325        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    3315         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     3326        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    33163327
    33173328        rc = pImage->Backend->pfnGetParentUuid(pImage->pvBackendData, pUuid);
     
    33493360
    33503361        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    3351         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     3362        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    33523363
    33533364        RTUUID Uuid;
     
    33923403 *
    33933404 * @returns VBox status code.
    3394  * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
     3405 * @returns VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.
    33953406 * @param   pDisk           Pointer to the HDD container.
    33963407 * @param   nImage          Image number, counts from 0. 0 is always base image of container.
     
    34143425
    34153426        PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage);
    3416         AssertPtrBreakStmt(pImage, rc = VERR_VDI_IMAGE_NOT_FOUND);
     3427        AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND);
    34173428
    34183429        if (pImage->Backend->uBackendCaps & VD_CAP_ASYNC)
     
    34413452                              void *pvUser)
    34423453{
    3443     int rc = VERR_VDI_BLOCK_FREE;
     3454    int rc = VERR_VD_BLOCK_FREE;
    34443455
    34453456    LogFlowFunc(("pDisk=%#p uOffset=%llu paSeg=%p cSeg=%u cbRead=%zu\n",
     
    34683479
    34693480        PVDIMAGE pImage = pDisk->pLast;
    3470         AssertPtrBreakStmt(pImage, rc = VERR_VDI_NOT_OPENED);
     3481        AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED);
    34713482
    34723483        /* @todo: This does not work for images which do not have all meta data in memory. */
    34733484        for (PVDIMAGE pCurrImage = pImage;
    3474              pCurrImage != NULL && rc == VERR_VDI_BLOCK_FREE;
     3485             pCurrImage != NULL && rc == VERR_VD_BLOCK_FREE;
    34753486             pCurrImage = pCurrImage->pPrev)
    34763487        {
     
    34813492
    34823493        /* No image in the chain contains the data for the block. */
    3483         if (rc == VERR_VDI_BLOCK_FREE)
     3494        if (rc == VERR_VD_BLOCK_FREE)
    34843495        {
    34853496            for (unsigned i = 0; i < cSeg && (cbRead > 0); i++)
     
    34893500            }
    34903501            /* Request finished without the need to enqueue a async I/O request. Tell caller. */
    3491             rc = VINF_VDI_ASYNC_IO_FINISHED;
     3502            rc = VINF_VD_ASYNC_IO_FINISHED;
    34923503        }
    34933504
     
    35413552
    35423553        PVDIMAGE pImage = pDisk->pLast;
    3543         AssertPtrBreakStmt(pImage, rc = VERR_VDI_NOT_OPENED);
     3554        AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED);
    35443555
    35453556        vdSetModifiedFlag(pDisk);
  • trunk/src/VBox/Devices/Storage/VBoxHDD-newInternal.h

    r14967 r15366  
    161161     *
    162162     * @returns VBox status code.
    163      * @returns VINF_VDI_BLOCK_FREE if this image contains no data for this block.
    164      * @returns VINF_VDI_BLOCK_ZERO if this image contains a zero data block.
     163     * @returns VINF_VD_BLOCK_FREE if this image contains no data for this block.
     164     * @returns VINF_VD_BLOCK_ZERO if this image contains a zero data block.
    165165     * @param   pvBackendData   Opaque state data for this image.
    166166     * @param   off             Offset to start reading from.
     
    177177     *
    178178     * @returns VBox status code.
    179      * @returns VINF_VDI_BLOCK_FREE if this image contains no data for this block and
     179     * @returns VINF_VD_BLOCK_FREE if this image contains no data for this block and
    180180     *          this is not a full-block write. The write must be repeated with
    181181     *          the correct amount of prefix/postfix data read from the images below
     
    189189     * @param   pcbWriteProcess Pointer to returned number of bytes that could
    190190     *                          be processed. In case the function returned
    191      *                          VINF_VDI_BLOCK_FREE this is the number of bytes
     191     *                          VINF_VD_BLOCK_FREE this is the number of bytes
    192192     *                          that could be written in a full block write,
    193193     *                          when prefixed/postfixed by the appropriate
     
    250250     *
    251251     * @returns VBox status code.
    252      * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the image.
     252     * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the image.
    253253     * @param   pvBackendData   Opaque state data for this image.
    254254     * @param   pPCHSGeometry   Where to store the geometry. Not NULL.
     
    270270     *
    271271     * @returns VBox status code.
    272      * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the image.
     272     * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the image.
    273273     * @param   pvBackendData   Opaque state data for this image.
    274274     * @param   pLCHSGeometry   Where to store the geometry. Not NULL.
  • trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp

    r14967 r15366  
    117117{
    118118    if (pPreHdr->u32Signature != VDI_IMAGE_SIGNATURE)
    119         return VERR_VDI_INVALID_SIGNATURE;
     119        return VERR_VD_VDI_INVALID_SIGNATURE;
    120120
    121121    if (    VDI_GET_VERSION_MAJOR(pPreHdr->u32Version) != VDI_IMAGE_VERSION_MAJOR
    122122        &&  pPreHdr->u32Version != 0x00000002)    /* old version. */
    123         return VERR_VDI_UNSUPPORTED_VERSION;
     123        return VERR_VD_VDI_UNSUPPORTED_VERSION;
    124124
    125125    return VINF_SUCCESS;
     
    246246                LogRel(("VDI: v1 header size wrong (%d < %d)\n",
    247247                       pHeader->u.v1.cbHeader, sizeof(VDIHEADER1)));
    248                 return VERR_VDI_INVALID_HEADER;
     248                return VERR_VD_VDI_INVALID_HEADER;
    249249            }
    250250
     
    253253                LogRel(("VDI: v1 blocks offset wrong (%d < %d)\n",
    254254                       getImageBlocksOffset(pHeader), sizeof(VDIPREHEADER) + sizeof(VDIHEADER1)));
    255                 return VERR_VDI_INVALID_HEADER;
     255                return VERR_VD_VDI_INVALID_HEADER;
    256256            }
    257257
     
    260260                LogRel(("VDI: v1 image data offset wrong (%d < %d)\n",
    261261                       getImageDataOffset(pHeader), getImageBlocksOffset(pHeader) + getImageBlocks(pHeader) * sizeof(VDIIMAGEBLOCKPOINTER)));
    262                 return VERR_VDI_INVALID_HEADER;
     262                return VERR_VD_VDI_INVALID_HEADER;
    263263            }
    264264
     
    267267        default:
    268268            /* Unsupported. */
    269             return VERR_VDI_UNSUPPORTED_VERSION;
     269            return VERR_VD_VDI_UNSUPPORTED_VERSION;
    270270    }
    271271
     
    342342    }
    343343
    344     return fFailed ? VERR_VDI_INVALID_HEADER : VINF_SUCCESS;
     344    return fFailed ? VERR_VD_VDI_INVALID_HEADER : VINF_SUCCESS;
    345345}
    346346
     
    381381        && strlen(pszComment) >= VDI_IMAGE_COMMENT_SIZE)
    382382    {
    383         rc = vdiError(pImage, VERR_VDI_COMMENT_TOO_LONG, RT_SRC_POS, N_("VDI: comment is too long for '%s'"), pImage->pszFilename);
     383        rc = vdiError(pImage, VERR_VD_VDI_COMMENT_TOO_LONG, RT_SRC_POS, N_("VDI: comment is too long for '%s'"), pImage->pszFilename);
    384384        goto out;
    385385    }
     
    656656            break;
    657657        default:
    658             rc = vdiError(pImage, VERR_VDI_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VDI: unsupported major version %u in '%s'"), GET_MAJOR_HEADER_VERSION(&pImage->Header), pImage->pszFilename);
     658            rc = vdiError(pImage, VERR_VD_VDI_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VDI: unsupported major version %u in '%s'"), GET_MAJOR_HEADER_VERSION(&pImage->Header), pImage->pszFilename);
    659659            goto out;
    660660    }
     
    663663    if (RT_FAILURE(rc))
    664664    {
    665         rc = vdiError(pImage, VERR_VDI_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VDI: invalid header in '%s'"), pImage->pszFilename);
     665        rc = vdiError(pImage, VERR_VD_VDI_INVALID_HEADER, RT_SRC_POS, N_("VDI: invalid header in '%s'"), pImage->pszFilename);
    666666        goto out;
    667667    }
     
    707707            break;
    708708        default:
    709             rc = VERR_VDI_UNSUPPORTED_VERSION;
     709            rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
    710710            break;
    711711    }
     
    10301030
    10311031    if (pImage->paBlocks[uBlock] == VDI_IMAGE_BLOCK_FREE)
    1032         rc = VERR_VDI_BLOCK_FREE;
     1032        rc = VERR_VD_BLOCK_FREE;
    10331033    else if (pImage->paBlocks[uBlock] == VDI_IMAGE_BLOCK_ZERO)
    10341034    {
     
    10691069    if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    10701070    {
    1071         rc = VERR_VDI_IMAGE_READ_ONLY;
     1071        rc = VERR_VD_IMAGE_READ_ONLY;
    10721072        goto out;
    10731073    }
     
    11381138            *pcbPreRead = offWrite % getImageBlockSize(&pImage->Header);
    11391139            *pcbPostRead = getImageBlockSize(&pImage->Header) - cbToWrite - *pcbPreRead;
    1140             rc = VERR_VDI_BLOCK_FREE;
     1140            rc = VERR_VD_BLOCK_FREE;
    11411141        }
    11421142    }
     
    12011201        *penmImageType = vdiTranslateTypeVDI2VD(getImageType(&pImage->Header));
    12021202    else
    1203         rc = VERR_VDI_NOT_OPENED;
     1203        rc = VERR_VD_NOT_OPENED;
    12041204
    12051205    LogFlowFunc(("returns %Rrc enmImageType=%u\n", rc, *penmImageType));
     
    12671267        }
    12681268        else
    1269             rc = VERR_VDI_GEOMETRY_NOT_SET;
    1270     }
    1271     else
    1272         rc = VERR_VDI_NOT_OPENED;
     1269            rc = VERR_VD_GEOMETRY_NOT_SET;
     1270    }
     1271    else
     1272        rc = VERR_VD_NOT_OPENED;
    12731273
    12741274    LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
     
    12901290        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    12911291        {
    1292             rc = VERR_VDI_IMAGE_READ_ONLY;
     1292            rc = VERR_VD_IMAGE_READ_ONLY;
    12931293            goto out;
    12941294        }
     
    12981298    }
    12991299    else
    1300         rc = VERR_VDI_NOT_OPENED;
     1300        rc = VERR_VD_NOT_OPENED;
    13011301
    13021302out:
     
    13321332        }
    13331333        else
    1334             rc = VERR_VDI_GEOMETRY_NOT_SET;
    1335     }
    1336     else
    1337         rc = VERR_VDI_NOT_OPENED;
     1334            rc = VERR_VD_GEOMETRY_NOT_SET;
     1335    }
     1336    else
     1337        rc = VERR_VD_NOT_OPENED;
    13381338
    13391339    LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
     
    13561356        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    13571357        {
    1358             rc = VERR_VDI_IMAGE_READ_ONLY;
     1358            rc = VERR_VD_IMAGE_READ_ONLY;
    13591359            goto out;
    13601360        }
     
    13741374    }
    13751375    else
    1376         rc = VERR_VDI_NOT_OPENED;
     1376        rc = VERR_VD_NOT_OPENED;
    13771377
    13781378out:
     
    14661466    }
    14671467    else
    1468         rc = VERR_VDI_NOT_OPENED;
     1468        rc = VERR_VD_NOT_OPENED;
    14691469
    14701470    LogFlowFunc(("returns %Rrc comment=\"%s\"\n", rc, pszComment));
     
    14831483    if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    14841484    {
    1485         rc = VERR_VDI_IMAGE_READ_ONLY;
     1485        rc = VERR_VD_IMAGE_READ_ONLY;
    14861486        goto out;
    14871487    }
     
    14931493        {
    14941494            LogFunc(("pszComment is too long, %d bytes!\n", cchComment));
    1495             rc = VERR_VDI_COMMENT_TOO_LONG;
     1495            rc = VERR_VD_VDI_COMMENT_TOO_LONG;
    14961496            goto out;
    14971497        }
     
    15101510        }
    15111511        else
    1512             rc = VERR_VDI_UNSUPPORTED_VERSION;
    1513     }
    1514     else
    1515         rc = VERR_VDI_NOT_OPENED;
     1512            rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
     1513    }
     1514    else
     1515        rc = VERR_VD_NOT_OPENED;
    15161516
    15171517out:
     
    15351535    }
    15361536    else
    1537         rc = VERR_VDI_NOT_OPENED;
     1537        rc = VERR_VD_NOT_OPENED;
    15381538
    15391539    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    15621562            {
    15631563                LogFunc(("Version is not supported!\n"));
    1564                 rc = VERR_VDI_UNSUPPORTED_VERSION;
     1564                rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
    15651565            }
    15661566        }
    15671567        else
    1568             rc = VERR_VDI_IMAGE_READ_ONLY;
    1569     }
    1570     else
    1571         rc = VERR_VDI_NOT_OPENED;
     1568            rc = VERR_VD_IMAGE_READ_ONLY;
     1569    }
     1570    else
     1571        rc = VERR_VD_NOT_OPENED;
    15721572
    15731573    LogFlowFunc(("returns %Rrc\n", rc));
     
    15901590    }
    15911591    else
    1592         rc = VERR_VDI_NOT_OPENED;
     1592        rc = VERR_VD_NOT_OPENED;
    15931593
    15941594    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    16171617            {
    16181618                LogFunc(("Version is not supported!\n"));
    1619                 rc = VERR_VDI_UNSUPPORTED_VERSION;
     1619                rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
    16201620            }
    16211621        }
    16221622        else
    1623             rc = VERR_VDI_IMAGE_READ_ONLY;
    1624     }
    1625     else
    1626         rc = VERR_VDI_NOT_OPENED;
     1623            rc = VERR_VD_IMAGE_READ_ONLY;
     1624    }
     1625    else
     1626        rc = VERR_VD_NOT_OPENED;
    16271627
    16281628    LogFlowFunc(("returns %Rrc\n", rc));
     
    16451645    }
    16461646    else
    1647         rc = VERR_VDI_NOT_OPENED;
     1647        rc = VERR_VD_NOT_OPENED;
    16481648
    16491649    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    16721672            {
    16731673                LogFunc(("Version is not supported!\n"));
    1674                 rc = VERR_VDI_UNSUPPORTED_VERSION;
     1674                rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
    16751675            }
    16761676        }
    16771677        else
    1678             rc = VERR_VDI_IMAGE_READ_ONLY;
    1679     }
    1680     else
    1681         rc = VERR_VDI_NOT_OPENED;
     1678            rc = VERR_VD_IMAGE_READ_ONLY;
     1679    }
     1680    else
     1681        rc = VERR_VD_NOT_OPENED;
    16821682
    16831683    LogFlowFunc(("returns %Rrc\n", rc));
     
    17001700    }
    17011701    else
    1702         rc = VERR_VDI_NOT_OPENED;
     1702        rc = VERR_VD_NOT_OPENED;
    17031703
    17041704    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    17241724            {
    17251725                LogFunc(("Version is not supported!\n"));
    1726                 rc = VERR_VDI_UNSUPPORTED_VERSION;
     1726                rc = VERR_VD_VDI_UNSUPPORTED_VERSION;
    17271727            }
    17281728        }
    17291729        else
    1730             rc = VERR_VDI_IMAGE_READ_ONLY;
    1731     }
    1732     else
    1733         rc = VERR_VDI_NOT_OPENED;
     1730            rc = VERR_VD_IMAGE_READ_ONLY;
     1731    }
     1732    else
     1733        rc = VERR_VD_NOT_OPENED;
    17341734
    17351735    LogFlowFunc(("returns %Rrc\n", rc));
  • trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp

    r14967 r15366  
    344344
    345345    if (!pImage)
    346         return VERR_VDI_NOT_OPENED;
     346        return VERR_VD_NOT_OPENED;
    347347
    348348    rc = RTFileReadAt(pImage->File, pImage->u64DataOffset, &ddh, sizeof(ddh), NULL);
     
    351351    if (memcmp(ddh.Cookie, VHD_DYNAMIC_DISK_HEADER_COOKIE, VHD_DYNAMIC_DISK_HEADER_COOKIE_SIZE) != 0)
    352352    {
    353         return VERR_VDI_INVALID_HEADER;
     353        return VERR_VD_VHD_INVALID_HEADER;
    354354    }
    355355    uint32_t u32Checksum = RT_BE2H_U32(ddh.Checksum);
     
    357357    if (u32Checksum != vhdChecksum(&ddh, sizeof(ddh)))
    358358    {
    359         return VERR_VDI_INVALID_HEADER;
     359        return VERR_VD_VHD_INVALID_HEADER;
    360360    }
    361361    /* Update parent's timestamp. */
     
    423423    rc = RTFileReadAt(File, pImage->uCurrentEndOfFile, &vhdFooter, sizeof(VHDFooter), NULL);
    424424    if (memcmp(vhdFooter.Cookie, VHD_FOOTER_COOKIE, VHD_FOOTER_COOKIE_SIZE) != 0) {
    425         return VERR_VDI_INVALID_HEADER;
     425        return VERR_VD_VHD_INVALID_HEADER;
    426426    }
    427427
     
    588588    rc = RTFileOpen(&File, pszFilename, RTFILE_O_READ | RTFILE_O_OPEN);
    589589    if (RT_FAILURE(rc))
    590         return VERR_VDI_INVALID_HEADER;
     590        return VERR_VD_VHD_INVALID_HEADER;
    591591
    592592    rc = RTFileGetSize(File, &cbFile);
     
    594594    {
    595595        RTFileClose(File);
    596         return VERR_VDI_INVALID_HEADER;
     596        return VERR_VD_VHD_INVALID_HEADER;
    597597    }
    598598
    599599    rc = RTFileReadAt(File, cbFile - sizeof(VHDFooter), &vhdFooter, sizeof(VHDFooter), NULL);
    600600    if (RT_FAILURE(rc) || (memcmp(vhdFooter.Cookie, VHD_FOOTER_COOKIE, VHD_FOOTER_COOKIE_SIZE) != 0))
    601         rc = VERR_VDI_INVALID_HEADER;
     601        rc = VERR_VD_VHD_INVALID_HEADER;
    602602    else
    603603        rc = VINF_SUCCESS;
     
    631631        *penmImageType = pImage->enmImageType;
    632632    else
    633         rc = VERR_VDI_NOT_OPENED;
     633        rc = VERR_VD_NOT_OPENED;
    634634
    635635    return rc;
     
    651651        }
    652652        else
    653             rc = VERR_VDI_GEOMETRY_NOT_SET;
    654     }
    655     else
    656         rc = VERR_VDI_NOT_OPENED;
     653            rc = VERR_VD_GEOMETRY_NOT_SET;
     654    }
     655    else
     656        rc = VERR_VD_NOT_OPENED;
    657657
    658658    LogFlowFunc(("returned %Rrc (CHS=%u/%u/%u)\n", rc, pImage->PCHSGeometry.cCylinders, pImage->PCHSGeometry.cHeads, pImage->PCHSGeometry.cSectors));
     
    671671        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    672672        {
    673             rc = VERR_VDI_IMAGE_READ_ONLY;
     673            rc = VERR_VD_IMAGE_READ_ONLY;
    674674            goto out;
    675675        }
     
    679679    }
    680680    else
    681         rc = VERR_VDI_NOT_OPENED;
     681        rc = VERR_VD_NOT_OPENED;
    682682
    683683out:
     
    701701        }
    702702        else
    703             rc = VERR_VDI_GEOMETRY_NOT_SET;
    704     }
    705     else
    706         rc = VERR_VDI_NOT_OPENED;
     703            rc = VERR_VD_GEOMETRY_NOT_SET;
     704    }
     705    else
     706        rc = VERR_VD_NOT_OPENED;
    707707
    708708    LogFlowFunc(("returned %Rrc (CHS=%u/%u/%u)\n", rc, pImage->LCHSGeometry.cCylinders, pImage->LCHSGeometry.cHeads, pImage->LCHSGeometry.cSectors));
     
    721721        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    722722        {
    723             rc = VERR_VDI_IMAGE_READ_ONLY;
     723            rc = VERR_VD_IMAGE_READ_ONLY;
    724724            goto out;
    725725        }
     
    729729    }
    730730    else
    731         rc = VERR_VDI_NOT_OPENED;
     731        rc = VERR_VD_NOT_OPENED;
    732732
    733733out:
     
    891891            /* Return block size as read. */
    892892            *pcbActuallyRead = RT_MIN(cbRead, pImage->cSectorsPerDataBlock * VHD_SECTOR_SIZE);
    893             return VERR_VDI_BLOCK_FREE;
     893            return VERR_VD_BLOCK_FREE;
    894894        }
    895895
     
    976976                cbRead = cSectors * VHD_SECTOR_SIZE;
    977977                Log(("%s: Sectors free: uVhdOffset=%llu cbRead=%u\n", uVhdOffset, cbRead));
    978                 rc = VERR_VDI_BLOCK_FREE;
     978                rc = VERR_VD_BLOCK_FREE;
    979979            }
    980980        }
     
    11871187    }
    11881188    else
    1189         rc = VERR_VDI_NOT_OPENED;
     1189        rc = VERR_VD_NOT_OPENED;
    11901190    LogFlowFunc(("returned %Rrc (%RTuuid)\n", rc, pUuid));
    11911191    return rc;
     
    12071207    }
    12081208    else
    1209         rc = VERR_VDI_NOT_OPENED;
     1209        rc = VERR_VD_NOT_OPENED;
    12101210    LogFlowFunc(("returned %Rrc\n", rc));
    12111211    return rc;
     
    12211221    if (pImage)
    12221222    {
    1223         rc = VERR_VDI_VALUE_NOT_FOUND;
    1224     }
    1225     else
    1226         rc = VERR_VDI_NOT_OPENED;
     1223        rc = VERR_NOT_SUPPORTED;
     1224    }
     1225    else
     1226        rc = VERR_VD_NOT_OPENED;
    12271227
    12281228    LogFlowFunc(("returned %Rrc comment='%s'\n", rc, pszComment));
     
    12441244    }
    12451245    else
    1246         rc = VERR_VDI_NOT_OPENED;
     1246        rc = VERR_VD_NOT_OPENED;
    12471247
    12481248    LogFlowFunc(("returned %Rrc\n", rc));
     
    12591259    if (pImage)
    12601260    {
    1261         rc = VERR_VDI_VALUE_NOT_FOUND;
    1262     }
    1263     else
    1264         rc = VERR_VDI_NOT_OPENED;
     1261        rc = VERR_NOT_SUPPORTED;
     1262    }
     1263    else
     1264        rc = VERR_VD_NOT_OPENED;
    12651265    LogFlowFunc(("returned %Rrc (%RTuuid)\n", rc, pUuid));
    12661266    return rc;
     
    12801280    }
    12811281    else
    1282         rc = VERR_VDI_NOT_OPENED;
     1282        rc = VERR_VD_NOT_OPENED;
    12831283    LogFlowFunc(("returned %Rrc\n", rc));
    12841284    return rc;
     
    12981298    }
    12991299    else
    1300         rc = VERR_VDI_NOT_OPENED;
     1300        rc = VERR_VD_NOT_OPENED;
    13011301    LogFlowFunc(("returned %Rrc (%RTuuid)\n", rc, pUuid));
    13021302    return rc;
     
    13221322    }
    13231323    else
    1324         rc = VERR_VDI_NOT_OPENED;
     1324        rc = VERR_VD_NOT_OPENED;
    13251325    LogFlowFunc(("returned %Rrc\n", rc));
    13261326    return rc;
     
    13361336    if (pImage)
    13371337    {
    1338         rc = VERR_VDI_VALUE_NOT_FOUND;
    1339     }
    1340     else
    1341         rc = VERR_VDI_NOT_OPENED;
     1338        rc = VERR_NOT_SUPPORTED;
     1339    }
     1340    else
     1341        rc = VERR_VD_NOT_OPENED;
    13421342    LogFlowFunc(("returned %Rrc (%RTuuid)\n", rc, pUuid));
    13431343    return rc;
     
    13571357    }
    13581358    else
    1359         rc = VERR_VDI_NOT_OPENED;
     1359        rc = VERR_VD_NOT_OPENED;
    13601360    LogFlowFunc(("returned %Rrc\n", rc));
    13611361    return rc;
     
    17591759    }
    17601760    else
    1761         rc = VERR_VDI_NOT_OPENED;
     1761        rc = VERR_VD_NOT_OPENED;
    17621762    LogFlowFunc(("returned %Rrc\n", rc));
    17631763    return rc;
     
    17731773        vhdTime2RtTime(pTimeStamp, pImage->u32ParentTimeStamp);
    17741774    else
    1775         rc = VERR_VDI_NOT_OPENED;
     1775        rc = VERR_VD_NOT_OPENED;
    17761776    LogFlowFunc(("returned %Rrc\n", rc));
    17771777    return rc;
     
    17871787    {
    17881788        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    1789             rc = VERR_VDI_IMAGE_READ_ONLY;
     1789            rc = VERR_VD_IMAGE_READ_ONLY;
    17901790        else
    17911791        {
     
    17951795    }
    17961796    else
    1797         rc = VERR_VDI_NOT_OPENED;
     1797        rc = VERR_VD_NOT_OPENED;
    17981798    LogFlowFunc(("returned %Rrc\n", rc));
    17991799    return rc;
     
    18091809        *ppszParentFilename = RTStrDup(pImage->pszParentFilename);
    18101810    else
    1811         rc = VERR_VDI_NOT_OPENED;
     1811        rc = VERR_VD_NOT_OPENED;
    18121812    LogFlowFunc(("returned %Rrc\n", rc));
    18131813    return rc;
     
    18231823    {
    18241824        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    1825             rc = VERR_VDI_IMAGE_READ_ONLY;
     1825            rc = VERR_VD_IMAGE_READ_ONLY;
    18261826        else
    18271827        {
     
    18361836    }
    18371837    else
    1838         rc = VERR_VDI_NOT_OPENED;
     1838        rc = VERR_VD_NOT_OPENED;
    18391839    LogFlowFunc(("returned %Rrc\n", rc));
    18401840    return rc;
  • trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp

    r14967 r15366  
    758758            else if (CpQ == '\0')
    759759            {
    760                 rc = VERR_VDI_INVALID_HEADER;
     760                rc = VERR_VD_VMDK_INVALID_HEADER;
    761761                break;
    762762            }
     
    859859                RTMemTmpFree(pTmpGT1);
    860860                RTMemTmpFree(pTmpGT2);
    861                 rc = vmdkError(pExtent->pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: inconsistent references to grain directory in '%s'"), pExtent->pszFullname);
     861                rc = vmdkError(pExtent->pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: inconsistent references to grain directory in '%s'"), pExtent->pszFullname);
    862862                goto out;
    863863            }
     
    884884                RTMemTmpFree(pTmpGT1);
    885885                RTMemTmpFree(pTmpGT2);
    886                 rc = vmdkError(pExtent->pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: inconsistency between grain table and backup grain table in '%s'"), pExtent->pszFullname);
     886                rc = vmdkError(pExtent->pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: inconsistency between grain table and backup grain table in '%s'"), pExtent->pszFullname);
    887887                goto out;
    888888            }
     
    10031003        pszStr++;
    10041004    if (*pszStr++ != '"')
    1005         return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrectly quoted value in descriptor in '%s'"), pImage->pszFilename);
     1005        return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrectly quoted value in descriptor in '%s'"), pImage->pszFilename);
    10061006
    10071007    pszQ = (char *)strchr(pszStr, '"');
    10081008    if (pszQ == NULL)
    1009         return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrectly quoted value in descriptor in '%s'"), pImage->pszFilename);
     1009        return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrectly quoted value in descriptor in '%s'"), pImage->pszFilename);
    10101010    pszUnquoted = (char *)RTMemTmpAlloc(pszQ - pszStr + 1);
    10111011    if (!pszUnquoted)
     
    11831183    if (!vmdkDescGetStr(pDescriptor, pDescriptor->uFirstDesc, pszKey,
    11841184                        &pszValue))
    1185         return VERR_VDI_VALUE_NOT_FOUND;
     1185        return VERR_VD_VMDK_VALUE_NOT_FOUND;
    11861186    return RTStrToUInt32Ex(pszValue, NULL, 10, puValue);
    11871187}
     
    11951195    if (!vmdkDescGetStr(pDescriptor, pDescriptor->uFirstDesc, pszKey,
    11961196                        &pszValue))
    1197         return VERR_VDI_VALUE_NOT_FOUND;
     1197        return VERR_VD_VMDK_VALUE_NOT_FOUND;
    11981198    int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL);
    11991199    if (RT_FAILURE(rc))
     
    13241324    if (!vmdkDescGetStr(pDescriptor, pDescriptor->uFirstDDB, pszKey,
    13251325                        &pszValue))
    1326         return VERR_VDI_VALUE_NOT_FOUND;
     1326        return VERR_VD_VMDK_VALUE_NOT_FOUND;
    13271327    int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL);
    13281328    if (RT_FAILURE(rc))
     
    13401340    if (!vmdkDescGetStr(pDescriptor, pDescriptor->uFirstDDB, pszKey,
    13411341                        &pszValue))
    1342         return VERR_VDI_VALUE_NOT_FOUND;
     1342        return VERR_VD_VMDK_VALUE_NOT_FOUND;
    13431343    int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL);
    13441344    if (RT_FAILURE(rc))
     
    13571357    if (!vmdkDescGetStr(pDescriptor, pDescriptor->uFirstDDB, pszKey,
    13581358                        &pszValue))
    1359         return VERR_VDI_VALUE_NOT_FOUND;
     1359        return VERR_VD_VMDK_VALUE_NOT_FOUND;
    13601360    int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL);
    13611361    if (RT_FAILURE(rc))
     
    14291429        if (cLine >= VMDK_DESCRIPTOR_LINES_MAX)
    14301430        {
    1431             rc = vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: descriptor too big in '%s'"), pImage->pszFilename);
     1431            rc = vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: descriptor too big in '%s'"), pImage->pszFilename);
    14321432            goto out;
    14331433        }
     
    14391439                if (*(pTmp + 1) != '\n')
    14401440                {
    1441                     rc = vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: unsupported end of line in descriptor in '%s'"), pImage->pszFilename);
     1441                    rc = vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: unsupported end of line in descriptor in '%s'"), pImage->pszFilename);
    14421442                    goto out;
    14431443                }
     
    14641464        &&  strcmp(pDescriptor->aLines[0], "# Disk Descriptor File"))
    14651465    {
    1466         rc = vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: descriptor does not start as expected in '%s'"), pImage->pszFilename);
     1466        rc = vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: descriptor does not start as expected in '%s'"), pImage->pszFilename);
    14671467        goto out;
    14681468    }
     
    14841484                {
    14851485                    /* Incorrect ordering of entries. */
    1486                     rc = vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrect ordering of entries in descriptor in '%s'"), pImage->pszFilename);
     1486                    rc = vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrect ordering of entries in descriptor in '%s'"), pImage->pszFilename);
    14871487                    goto out;
    14881488                }
     
    14991499                {
    15001500                    /* Incorrect ordering of entries. */
    1501                     rc = vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrect ordering of entries in descriptor in '%s'"), pImage->pszFilename);
     1501                    rc = vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrect ordering of entries in descriptor in '%s'"), pImage->pszFilename);
    15021502                    goto out;
    15031503                }
     
    15141514                {
    15151515                    /* Incorrect ordering of entries. */
    1516                     rc = vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrect ordering of entries in descriptor in '%s'"), pImage->pszFilename);
     1516                    rc = vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrect ordering of entries in descriptor in '%s'"), pImage->pszFilename);
    15171517                    goto out;
    15181518                }
     
    16591659        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error finding key 'version' in descriptor in '%s'"), pImage->pszFilename);
    16601660    if (uVersion != 1)
    1661         return vmdkError(pImage, VERR_VDI_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VMDK: unsupported format version in descriptor in '%s'"), pImage->pszFilename);
     1661        return vmdkError(pImage, VERR_VD_VMDK_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VMDK: unsupported format version in descriptor in '%s'"), pImage->pszFilename);
    16621662
    16631663    /* Get image creation type and determine image flags. */
     
    16861686    {
    16871687        /* Monolithic image, must have only one extent (already opened). */
    1688         return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: monolithic image may only have one extent in '%s'"), pImage->pszFilename);
     1688        return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: monolithic image may only have one extent in '%s'"), pImage->pszFilename);
    16891689    }
    16901690
     
    17191719        }
    17201720        else
    1721             return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
     1721            return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17221722        if (*pszLine++ != ' ')
    1723             return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
     1723            return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17241724
    17251725        /* Nominal size of the extent. */
     
    17271727                             &pImage->pExtents[i].cNominalSectors);
    17281728        if (RT_FAILURE(rc))
    1729             return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
     1729            return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17301730        if (*pszLine++ != ' ')
    1731             return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
     1731            return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17321732
    17331733        /* Type of the extent. */
     
    17531753        }
    17541754        else
    1755             return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
     1755            return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17561756        if (pImage->pExtents[i].enmType == VMDKETYPE_ZERO)
    17571757        {
     
    17601760                pszLine++;
    17611761            if (*pszLine != '\0')
    1762                 return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
     1762                return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17631763            pImage->pExtents[i].pszBasename = NULL;
    17641764        }
     
    17671767            /* All other extent types have basename and optional offset. */
    17681768            if (*pszLine++ != ' ')
    1769                 return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
     1769                return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17701770
    17711771            /* Basename of the image. Surrounded by quotes. */
     
    17841784                                         &pImage->pExtents[i].uSectorOffset);
    17851785                    if (RT_FAILURE(rc))
    1786                         return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
     1786                        return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17871787                }
    17881788            }
    17891789
    17901790            if (*pszLine != '\0')
    1791                 return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
     1791                return vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17921792        }
    17931793    }
     
    17971797                           VMDK_DDB_GEO_PCHS_CYLINDERS,
    17981798                           &pImage->PCHSGeometry.cCylinders);
    1799     if (rc == VERR_VDI_VALUE_NOT_FOUND)
     1799    if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    18001800        pImage->PCHSGeometry.cCylinders = 0;
    18011801    else if (RT_FAILURE(rc))
     
    18041804                           VMDK_DDB_GEO_PCHS_HEADS,
    18051805                           &pImage->PCHSGeometry.cHeads);
    1806     if (rc == VERR_VDI_VALUE_NOT_FOUND)
     1806    if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    18071807        pImage->PCHSGeometry.cHeads = 0;
    18081808    else if (RT_FAILURE(rc))
     
    18111811                           VMDK_DDB_GEO_PCHS_SECTORS,
    18121812                           &pImage->PCHSGeometry.cSectors);
    1813     if (rc == VERR_VDI_VALUE_NOT_FOUND)
     1813    if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    18141814        pImage->PCHSGeometry.cSectors = 0;
    18151815    else if (RT_FAILURE(rc))
     
    18321832                           VMDK_DDB_GEO_LCHS_CYLINDERS,
    18331833                           &pImage->LCHSGeometry.cCylinders);
    1834     if (rc == VERR_VDI_VALUE_NOT_FOUND)
     1834    if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    18351835        pImage->LCHSGeometry.cCylinders = 0;
    18361836    else if (RT_FAILURE(rc))
     
    18391839                           VMDK_DDB_GEO_LCHS_HEADS,
    18401840                           &pImage->LCHSGeometry.cHeads);
    1841     if (rc == VERR_VDI_VALUE_NOT_FOUND)
     1841    if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    18421842        pImage->LCHSGeometry.cHeads = 0;
    18431843    else if (RT_FAILURE(rc))
     
    18461846                           VMDK_DDB_GEO_LCHS_SECTORS,
    18471847                           &pImage->LCHSGeometry.cSectors);
    1848     if (rc == VERR_VDI_VALUE_NOT_FOUND)
     1848    if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    18491849        pImage->LCHSGeometry.cSectors = 0;
    18501850    else if (RT_FAILURE(rc))
     
    18621862    rc = vmdkDescDDBGetUuid(pImage, &pImage->Descriptor, VMDK_DDB_IMAGE_UUID,
    18631863                            &pImage->ImageUuid);
    1864     if (rc == VERR_VDI_VALUE_NOT_FOUND)
     1864    if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    18651865    {
    18661866        /* Image without UUID. Probably created by VMware and not yet used
     
    18871887                            VMDK_DDB_MODIFICATION_UUID,
    18881888                            &pImage->ModificationUuid);
    1889     if (rc == VERR_VDI_VALUE_NOT_FOUND)
     1889    if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    18901890    {
    18911891        /* Image without UUID. Probably created by VMware and not yet used
     
    19121912    rc = vmdkDescDDBGetUuid(pImage, &pImage->Descriptor, VMDK_DDB_PARENT_UUID,
    19131913                            &pImage->ParentUuid);
    1914     if (rc == VERR_VDI_VALUE_NOT_FOUND)
     1914    if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    19151915    {
    19161916        /* Image without UUID. Probably created by VMware and not yet used
     
    19371937                            VMDK_DDB_PARENT_MODIFICATION_UUID,
    19381938                            &pImage->ParentModificationUuid);
    1939     if (rc == VERR_VDI_VALUE_NOT_FOUND)
     1939    if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    19401940    {
    19411941        /* Image without UUID. Probably created by VMware and not yet used
     
    20402040        goto out;
    20412041    }
    2042     if (    RT_LE2H_U32(Header.magicNumber) != VMDK_SPARSE_MAGICNUMBER
    2043         ||  RT_LE2H_U32(Header.version) != 1)
    2044     {
    2045         rc = vmdkError(pExtent->pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrect magic/version in extent header in '%s'"), pExtent->pszFullname);
     2042    if (RT_LE2H_U32(Header.magicNumber) != VMDK_SPARSE_MAGICNUMBER)
     2043    {
     2044        rc = vmdkError(pExtent->pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrect magic in sparse extent header in '%s'"), pExtent->pszFullname);
     2045        goto out;
     2046    }
     2047    if (RT_LE2H_U32(Header.version) != 1)
     2048    {
     2049        rc = vmdkError(pExtent->pImage, VERR_VD_VMDK_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VMDK: incorrect version in sparse extent header in '%s', not a VMDK 1.0 conforming file"), pExtent->pszFullname);
    20462050        goto out;
    20472051    }
     
    20522056             || Header.doubleEndLineChar2 != '\n') )
    20532057    {
    2054         rc = vmdkError(pExtent->pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: corrupted by CR/LF translation in '%s'"), pExtent->pszFullname);
     2058        rc = vmdkError(pExtent->pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: corrupted by CR/LF translation in '%s'"), pExtent->pszFullname);
    20552059        goto out;
    20562060    }
     
    20622066    if (pExtent->uDescriptorSector && !pExtent->cDescriptorSectors)
    20632067    {
    2064         rc = vmdkError(pExtent->pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: inconsistent embedded descriptor config in '%s'"), pExtent->pszFullname);
     2068        rc = vmdkError(pExtent->pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: inconsistent embedded descriptor config in '%s'"), pExtent->pszFullname);
    20652069        goto out;
    20662070    }
     
    20832087    if (!cSectorsPerGDE || cSectorsPerGDE > UINT32_MAX)
    20842088    {
    2085         rc = vmdkError(pExtent->pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrect grain directory size in '%s'"), pExtent->pszFullname);
     2089        rc = vmdkError(pExtent->pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: incorrect grain directory size in '%s'"), pExtent->pszFullname);
    20862090        goto out;
    20872091    }
     
    21312135        &&  (pExtent->enmType != VMDKETYPE_FLAT || pExtent->cNominalSectors + pExtent->uSectorOffset > VMDK_BYTE2SECTOR(cbExtentSize)))
    21322136    {
    2133         rc = vmdkError(pExtent->pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: file size is not a multiple of 512 in '%s', file is truncated or otherwise garbled"), pExtent->pszFullname);
     2137        rc = vmdkError(pExtent->pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: file size is not a multiple of 512 in '%s', file is truncated or otherwise garbled"), pExtent->pszFullname);
    21342138        goto out;
    21352139    }
     
    21432147        ||  pExtent->cSectorsPerGrain < 8)
    21442148    {
    2145         rc = vmdkError(pExtent->pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: invalid extent grain size %u in '%s'"), pExtent->cSectorsPerGrain, pExtent->pszFullname);
     2149        rc = vmdkError(pExtent->pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: invalid extent grain size %u in '%s'"), pExtent->cSectorsPerGrain, pExtent->pszFullname);
    21462150        goto out;
    21472151    }
     
    21522156        ||  pExtent->cGTEntries < VMDK_GT_CACHELINE_SIZE)
    21532157    {
    2154         rc = vmdkError(pExtent->pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: grain table cache size problem in '%s'"), pExtent->pszFullname);
     2158        rc = vmdkError(pExtent->pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: grain table cache size problem in '%s'"), pExtent->pszFullname);
    21552159        goto out;
    21562160    }
     
    22262230        ||  RT_LE2H_U32(Header.flags) != 3)
    22272231    {
    2228         rc = VERR_VDI_INVALID_HEADER;
     2232        rc = VERR_VD_VMDK_INVALID_HEADER;
    22292233        goto out;
    22302234    }
     
    22382242        ||  pExtent->cSectorsPerGrain > 2048)
    22392243    {
    2240         rc = VERR_VDI_INVALID_HEADER;
     2244        rc = VERR_VD_VMDK_INVALID_HEADER;
    22412245        goto out;
    22422246    }
     
    22502254    if (!cSectorsPerGDE || cSectorsPerGDE > UINT32_MAX)
    22512255    {
    2252         rc = VERR_VDI_INVALID_HEADER;
     2256        rc = VERR_VD_VMDK_INVALID_HEADER;
    22532257        goto out;
    22542258    }
     
    22592263        /* Inconsistency detected. Computed number of GD entries doesn't match
    22602264         * stored value. Better be safe than sorry. */
    2261         rc = VERR_VDI_INVALID_HEADER;
     2265        rc = VERR_VD_VMDK_INVALID_HEADER;
    22622266        goto out;
    22632267    }
     
    24442448        if (!pExtent->uDescriptorSector || !pExtent->cDescriptorSectors)
    24452449        {
    2446             rc = vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: monolithic image without descriptor in '%s'"), pImage->pszFilename);
     2450            rc = vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: monolithic image without descriptor in '%s'"), pImage->pszFilename);
    24472451            goto out;
    24482452        }
     
    25032507            /* Likely the read is truncated. Better fail a bit too early
    25042508             * (normally the descriptor is much smaller than our buffer). */
    2505             rc = vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: cannot read descriptor in '%s'"), pImage->pszFilename);
     2509            rc = vmdkError(pImage, VERR_VD_VMDK_INVALID_HEADER, RT_SRC_POS, N_("VMDK: cannot read descriptor in '%s'"), pImage->pszFilename);
    25062510            goto out;
    25072511        }
     
    36123616         * ever happen on a valid extent. */
    36133617        if (uGTSector > UINT32_MAX)
    3614             return VERR_VDI_INVALID_HEADER;
     3618            return VERR_VD_VMDK_INVALID_HEADER;
    36153619        /* Write grain table by writing the required number of grain table
    36163620         * cache chunks. Avoids dynamic memory allocation, but is a bit
     
    36303634        if (pExtent->pRGD)
    36313635        {
    3632             AssertReturn(!uRGTSector, VERR_VDI_INVALID_HEADER);
     3636            AssertReturn(!uRGTSector, VERR_VD_VMDK_INVALID_HEADER);
    36333637            rc = vmdkFileGetSize(pExtent->pFile, &cbExtentSize);
    36343638            if (RT_FAILURE(rc))
     
    36403644             * this shouldn't ever happen on a valid extent. */
    36413645            if (uRGTSector > UINT32_MAX)
    3642                 return VERR_VDI_INVALID_HEADER;
     3646                return VERR_VD_VMDK_INVALID_HEADER;
    36433647            /* Write backup grain table by writing the required number of grain
    36443648             * table cache chunks. Avoids dynamic memory allocation, but is a
     
    42594263    if (pExtent->enmAccess == VMDKACCESS_NOACCESS)
    42604264    {
    4261         rc = VERR_VDI_INVALID_STATE;
     4265        rc = VERR_VD_VMDK_INVALID_STATE;
    42624266        goto out;
    42634267    }
     
    42814285            Assert(!(cbToRead % 512));
    42824286            if (uSectorExtentAbs == 0)
    4283                 rc = VERR_VDI_BLOCK_FREE;
     4287                rc = VERR_VD_BLOCK_FREE;
    42844288            else
    42854289                rc = vmdkFileReadAt(pExtent->pFile,
     
    43224326    if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    43234327    {
    4324         rc = VERR_VDI_IMAGE_READ_ONLY;
     4328        rc = VERR_VD_IMAGE_READ_ONLY;
    43254329        goto out;
    43264330    }
     
    43474351    if (pExtent->enmAccess != VMDKACCESS_READWRITE)
    43484352    {
    4349         rc = VERR_VDI_INVALID_STATE;
     4353        rc = VERR_VD_VMDK_INVALID_STATE;
    43504354        goto out;
    43514355    }
     
    43774381                    }
    43784382                    else
    4379                         rc = VERR_VDI_BLOCK_FREE;
     4383                        rc = VERR_VD_BLOCK_FREE;
    43804384                    *pcbPreRead = 0;
    43814385                    *pcbPostRead = 0;
     
    43874391                    *pcbPreRead = VMDK_SECTOR2BYTE(uSectorExtentRel % pExtent->cSectorsPerGrain);
    43884392                    *pcbPostRead = VMDK_SECTOR2BYTE(pExtent->cSectorsPerGrain) - cbToWrite - *pcbPreRead;
    4389                     rc = VERR_VDI_BLOCK_FREE;
     4393                    rc = VERR_VD_BLOCK_FREE;
    43904394                }
    43914395            }
     
    44564460        *penmImageType = pImage->enmImageType;
    44574461    else
    4458         rc = VERR_VDI_NOT_OPENED;
     4462        rc = VERR_VD_NOT_OPENED;
    44594463
    44604464    LogFlowFunc(("returns %Rrc enmImageType=%u\n", rc, *penmImageType));
     
    45274531        }
    45284532        else
    4529             rc = VERR_VDI_GEOMETRY_NOT_SET;
     4533            rc = VERR_VD_GEOMETRY_NOT_SET;
    45304534    }
    45314535    else
    4532         rc = VERR_VDI_NOT_OPENED;
     4536        rc = VERR_VD_NOT_OPENED;
    45334537
    45344538    LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
     
    45504554        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    45514555        {
    4552             rc = VERR_VDI_IMAGE_READ_ONLY;
     4556            rc = VERR_VD_IMAGE_READ_ONLY;
    45534557            goto out;
    45544558        }
     
    45614565    }
    45624566    else
    4563         rc = VERR_VDI_NOT_OPENED;
     4567        rc = VERR_VD_NOT_OPENED;
    45644568
    45654569out:
     
    45864590        }
    45874591        else
    4588             rc = VERR_VDI_GEOMETRY_NOT_SET;
     4592            rc = VERR_VD_GEOMETRY_NOT_SET;
    45894593    }
    45904594    else
    4591         rc = VERR_VDI_NOT_OPENED;
     4595        rc = VERR_VD_NOT_OPENED;
    45924596
    45934597    LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
     
    46094613        if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    46104614        {
    4611             rc = VERR_VDI_IMAGE_READ_ONLY;
     4615            rc = VERR_VD_IMAGE_READ_ONLY;
    46124616            goto out;
    46134617        }
     
    46204624    }
    46214625    else
    4622         rc = VERR_VDI_NOT_OPENED;
     4626        rc = VERR_VD_NOT_OPENED;
    46234627
    46244628out:
     
    47024706        rc = vmdkDescDDBGetStr(pImage, &pImage->Descriptor,
    47034707                              "ddb.comment", &pszCommentEncoded);
    4704         if (rc == VERR_VDI_VALUE_NOT_FOUND)
     4708        if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND)
    47054709            pszCommentEncoded = NULL;
    47064710        else if (RT_FAILURE(rc))
     
    47154719    }
    47164720    else
    4717         rc = VERR_VDI_NOT_OPENED;
     4721        rc = VERR_VD_NOT_OPENED;
    47184722
    47194723out:
     
    47334737    if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    47344738    {
    4735         rc = VERR_VDI_IMAGE_READ_ONLY;
     4739        rc = VERR_VD_IMAGE_READ_ONLY;
    47364740        goto out;
    47374741    }
     
    47404744        rc = vmdkSetImageComment(pImage, pszComment);
    47414745    else
    4742         rc = VERR_VDI_NOT_OPENED;
     4746        rc = VERR_VD_NOT_OPENED;
    47434747
    47444748out:
     
    47624766    }
    47634767    else
    4764         rc = VERR_VDI_NOT_OPENED;
     4768        rc = VERR_VD_NOT_OPENED;
    47654769
    47664770    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    47904794        }
    47914795        else
    4792             rc = VERR_VDI_IMAGE_READ_ONLY;
     4796            rc = VERR_VD_IMAGE_READ_ONLY;
    47934797    }
    47944798    else
    4795         rc = VERR_VDI_NOT_OPENED;
     4799        rc = VERR_VD_NOT_OPENED;
    47964800
    47974801    LogFlowFunc(("returns %Rrc\n", rc));
     
    48144818    }
    48154819    else
    4816         rc = VERR_VDI_NOT_OPENED;
     4820        rc = VERR_VD_NOT_OPENED;
    48174821
    48184822    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    48414845        }
    48424846        else
    4843             rc = VERR_VDI_IMAGE_READ_ONLY;
     4847            rc = VERR_VD_IMAGE_READ_ONLY;
    48444848    }
    48454849    else
    4846         rc = VERR_VDI_NOT_OPENED;
     4850        rc = VERR_VD_NOT_OPENED;
    48474851
    48484852    LogFlowFunc(("returns %Rrc\n", rc));
     
    48654869    }
    48664870    else
    4867         rc = VERR_VDI_NOT_OPENED;
     4871        rc = VERR_VD_NOT_OPENED;
    48684872
    48694873    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    48924896        }
    48934897        else
    4894             rc = VERR_VDI_IMAGE_READ_ONLY;
     4898            rc = VERR_VD_IMAGE_READ_ONLY;
    48954899    }
    48964900    else
    4897         rc = VERR_VDI_NOT_OPENED;
     4901        rc = VERR_VD_NOT_OPENED;
    48984902
    48994903    LogFlowFunc(("returns %Rrc\n", rc));
     
    49164920    }
    49174921    else
    4918         rc = VERR_VDI_NOT_OPENED;
     4922        rc = VERR_VD_NOT_OPENED;
    49194923
    49204924    LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid));
     
    49434947        }
    49444948        else
    4945             rc = VERR_VDI_IMAGE_READ_ONLY;
     4949            rc = VERR_VD_IMAGE_READ_ONLY;
    49464950    }
    49474951    else
    4948         rc = VERR_VDI_NOT_OPENED;
     4952        rc = VERR_VD_NOT_OPENED;
    49494953
    49504954    LogFlowFunc(("returns %Rrc\n", rc));
     
    50655069        if (pExtent->enmAccess == VMDKACCESS_NOACCESS)
    50665070        {
    5067             rc = VERR_VDI_INVALID_STATE;
     5071            rc = VERR_VD_VMDK_INVALID_STATE;
    50685072            goto out;
    50695073        }
     
    51495153    {
    51505154        /* The request was completely in a ZERO extent nothing to do. */
    5151         rc = VINF_VDI_ASYNC_IO_FINISHED;
     5155        rc = VINF_VD_ASYNC_IO_FINISHED;
    51525156    }
    51535157    else
     
    52015205        if (pExtent->enmAccess == VMDKACCESS_NOACCESS)
    52025206        {
    5203             rc = VERR_VDI_INVALID_STATE;
     5207            rc = VERR_VD_VMDK_INVALID_STATE;
    52045208            goto out;
    52055209        }
     
    52855289    {
    52865290        /* The request was completely in a ZERO extent nothing to do. */
    5287         rc = VINF_VDI_ASYNC_IO_FINISHED;
     5291        rc = VINF_VD_ASYNC_IO_FINISHED;
    52885292    }
    52895293    else
  • trunk/src/VBox/Devices/Storage/testcase/Makefile.kmk

    r14787 r15366  
    2727# probably will go away soon. Testcase only now.
    2828#
    29 ifdef VBOX_WITH_TESTCASES
    30  PROGRAMS += vditool
    31  ifeq ($(KBUILD_TARGET),l4)
    32   vditool_TEMPLATE = VBOXLNXHOSTR3EXE
    33   vditool_LIBS     = \
    34         $(PATH_LIB)/VBoxDDULnxHostR3.a \
    35         $(PATH_LIB)/RuntimeLnxHostR3.a
    36  else
    37   vditool_TEMPLATE = VBOXR3TSTEXE
    38   vditool_LIBS     = $(LIB_DDU) $(LIB_RUNTIME)
    39  endif
    40  vditool_SOURCES   = vditool.cpp
    41 endif
     29#ifdef VBOX_WITH_TESTCASES
     30# PROGRAMS += vditool
     31# ifeq ($(KBUILD_TARGET),l4)
     32#  vditool_TEMPLATE = VBOXLNXHOSTR3EXE
     33#  vditool_LIBS     = \
     34#       $(PATH_LIB)/VBoxDDULnxHostR3.a \
     35#       $(PATH_LIB)/RuntimeLnxHostR3.a
     36# else
     37#  vditool_TEMPLATE = VBOXR3TSTEXE
     38#  vditool_LIBS     = $(LIB_DDU) $(LIB_RUNTIME)
     39# endif
     40# vditool_SOURCES   = vditool.cpp
     41#endif
    4242
    4343
     
    4545# Basic testcase for the VDI code.
    4646#
    47 ifdef VBOX_WITH_TESTCASES
    48  PROGRAMS += tstVDI
    49  ifeq ($(KBUILD_TARGET),l4)
    50   tstVDI_TEMPLATE = VBOXLNXHOSTR3EXE
    51  else
    52   tstVDI_TEMPLATE = VBOXR3TSTEXE
    53  endif
    54  tstVDI_LIBS     = $(vditool_LIBS)
    55  tstVDI_SOURCES  = tstVDI.cpp
    56 endif
     47#ifdef VBOX_WITH_TESTCASES
     48# PROGRAMS += tstVDI
     49# ifeq ($(KBUILD_TARGET),l4)
     50#  tstVDI_TEMPLATE = VBOXLNXHOSTR3EXE
     51# else
     52#  tstVDI_TEMPLATE = VBOXR3TSTEXE
     53# endif
     54# tstVDI_LIBS     = $(vditool_LIBS)
     55# tstVDI_SOURCES  = tstVDI.cpp
     56#endif
    5757
    5858#
     
    6868  tstVD-2_TEMPLATE = VBOXR3TSTEXE
    6969 endif
    70  tstVD_LIBS     = $(vditool_LIBS)
    71  tstVD-2_LIBS     = $(vditool_LIBS)
     70 tstVD_LIBS     = $(LIB_DDU) $(LIB_RUNTIME)
     71 tstVD-2_LIBS   = $(LIB_DDU) $(LIB_RUNTIME)
    7272 tstVD_SOURCES  = tstVD.cpp
    7373 tstVD-2_SOURCES  = tstVD-2.cpp
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r14838 r15366  
    3636#include <VBox/com/VirtualBox.h>
    3737
    38 #include <VBox/VBoxHDD.h>
    3938#include <VBox/VBoxHDD-new.h>
    4039#include <VBox/sup.h>
     
    140139                "\n"
    141140                : "",
    142             (u64Cmd & USAGE_SETVDIUUID) ?
    143                 "  setvdiuuid <filepath>\n"
    144                 "       Assigns a new UUID to the given VDI file. This way, multiple copies\n"
    145                 "       of VDI containers can be registered.\n"
     141            (u64Cmd & USAGE_SETHDUUID) ?
     142                "  sethduuid <filepath>\n"
     143                "       Assigns a new UUID to the given image file. This way, multiple copies\n"
     144                "       of a container can be registered.\n"
    146145                "\n"
    147146                : "",
     
    187186                 "\n"
    188187                 : "",
    189              (u64Cmd & USAGE_CONVERTDISK) ?
    190                  "  convertdisk [-srcformat <fmt>] [-dstformat <fmt>] <inputfile> <outputfile>"
    191                  "\n"
    192                  "       Convert image to another image format.\n"
    193                  "\n"
    194                  : "",
    195188#ifdef RT_OS_WINDOWS
    196189            (u64Cmd & USAGE_MODINSTALL) ?
     
    469462}
    470463
    471 static int handleSetVDIUUID(int argc, char **argv, ComPtr<IVirtualBox> aVirtualBox, ComPtr<ISession> aSession)
    472 {
    473     /* we need exactly one parameter: the vdi file */
    474     if (argc != 1)
    475     {
    476         return errorSyntax(USAGE_SETVDIUUID, "Not enough parameters");
    477     }
    478 
    479     /* generate a new UUID */
    480     Guid uuid;
    481     uuid.create();
    482 
    483     /* just try it */
    484     int rc = VDISetImageUUIDs(argv[0], uuid.raw(), NULL, NULL, NULL);
    485     if (RT_FAILURE(rc))
    486     {
    487         RTPrintf("Error while setting a new UUID: %Rrc (%d)\n", rc, rc);
    488     }
    489     else
    490     {
    491         RTPrintf("UUID changed to: %s\n", uuid.toString().raw());
    492     }
    493 
    494     return 0;
    495 }
    496 
    497464
    498465static DECLCALLBACK(void) handleVDError(void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
     
    502469    RTPrintf("\n");
    503470    RTPrintf("Error code %Rrc at %s(%u) in function %s\n", rc, RT_SRC_POS_ARGS);
     471}
     472
     473static int handleSetHDUUID(int argc, char **argv, ComPtr<IVirtualBox> aVirtualBox, ComPtr<ISession> aSession)
     474{
     475    /* we need exactly one parameter: the image file */
     476    if (argc != 1)
     477    {
     478        return errorSyntax(USAGE_SETHDUUID, "Not enough parameters");
     479    }
     480
     481    /* generate a new UUID */
     482    Guid uuid;
     483    uuid.create();
     484
     485    /* just try it */
     486    char *pszFormat = NULL;
     487    int rc = VDGetFormat(argv[0], &pszFormat);
     488    if (RT_FAILURE(rc))
     489    {
     490        RTPrintf("Format autodetect failed: %Rrc\n", rc);
     491        return 1;
     492    }
     493
     494    PVBOXHDD pDisk = NULL;
     495
     496    PVDINTERFACE     pVDIfs = NULL;
     497    VDINTERFACE      vdInterfaceError;
     498    VDINTERFACEERROR vdInterfaceErrorCallbacks;
     499    vdInterfaceErrorCallbacks.cbSize       = sizeof(VDINTERFACEERROR);
     500    vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR;
     501    vdInterfaceErrorCallbacks.pfnError     = handleVDError;
     502
     503    rc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR,
     504                        &vdInterfaceErrorCallbacks, NULL, &pVDIfs);
     505    AssertRC(rc);
     506
     507    rc = VDCreate(pVDIfs, &pDisk);
     508    if (RT_FAILURE(rc))
     509    {
     510        RTPrintf("Error while creating the virtual disk container: %Rrc\n", rc);
     511        return 1;
     512    }
     513
     514    /* Open the image */
     515    rc = VDOpen(pDisk, pszFormat, argv[0], VD_OPEN_FLAGS_NORMAL, NULL);
     516    if (RT_FAILURE(rc))
     517    {
     518        RTPrintf("Error while opening the image: %Rrc\n", rc);
     519        return 1;
     520    }
     521
     522    rc = VDSetUuid(pDisk, VD_LAST_IMAGE, uuid.raw());
     523    if (RT_FAILURE(rc))
     524        RTPrintf("Error while setting a new UUID: %Rrc\n", rc);
     525    else
     526        RTPrintf("UUID changed to: %s\n", uuid.toString().raw());
     527
     528    VDCloseAll(pDisk);
     529
     530    return RT_FAILURE(rc);
    504531}
    505532
     
    11641191    AssertRC(vrc);
    11651192
    1166     vrc = VDCreate(&vdInterfaceError, &pDisk);
     1193    vrc = VDCreate(pVDIfs, &pDisk);
    11671194    if (RT_FAILURE(vrc))
    11681195    {
     
    12731300    AssertRC(vrc);
    12741301
    1275     vrc = VDCreate(&vdInterfaceError, &pDisk);
     1302    vrc = VDCreate(pVDIfs, &pDisk);
    12761303    if (RT_FAILURE(vrc))
    12771304    {
     
    13541381    AssertRC(vrc);
    13551382
    1356     vrc = VDCreate(&vdInterfaceError, &pDisk);
     1383    vrc = VDCreate(pVDIfs, &pDisk);
    13571384    if (RT_FAILURE(vrc))
    13581385    {
     
    14561483}
    14571484
    1458 static int CmdConvertDisk(int argc, char **argv, ComPtr<IVirtualBox> aVirtualBox, ComPtr<ISession> aSession)
    1459 {
    1460     Bstr srcformat;
    1461     Bstr dstformat;
    1462     Bstr src;
    1463     Bstr dst;
    1464     int vrc;
    1465     PVBOXHDD pSrcDisk = NULL;
    1466     PVBOXHDD pDstDisk = NULL;
    1467 
    1468     /* Parse the arguments. */
    1469     for (int i = 0; i < argc; i++)
    1470     {
    1471         if (strcmp(argv[i], "-srcformat") == 0)
    1472         {
    1473             if (argc <= i + 1)
    1474             {
    1475                 return errorArgument("Missing argument to '%s'", argv[i]);
    1476             }
    1477             i++;
    1478             srcformat = argv[i];
    1479         }
    1480         else if (strcmp(argv[i], "-dstformat") == 0)
    1481         {
    1482             if (argc <= i + 1)
    1483             {
    1484                 return errorArgument("Missing argument to '%s'", argv[i]);
    1485             }
    1486             i++;
    1487             dstformat = argv[i];
    1488         }
    1489         else if (src.isEmpty())
    1490         {
    1491             src = argv[i];
    1492         }
    1493         else if (dst.isEmpty())
    1494         {
    1495             dst = argv[i];
    1496         }
    1497         else
    1498         {
    1499             return errorSyntax(USAGE_CONVERTDISK, "Invalid parameter '%s'", Utf8Str(argv[i]).raw());
    1500         }
    1501     }
    1502 
    1503     if (src.isEmpty())
    1504         return errorSyntax(USAGE_CONVERTDISK, "Mandatory input image parameter missing");
    1505     if (dst.isEmpty())
    1506         return errorSyntax(USAGE_CONVERTDISK, "Mandatory output image parameter missing");
    1507 
    1508 
    1509     PVDINTERFACE     pVDIfs = NULL;
    1510     VDINTERFACE      vdInterfaceError;
    1511     VDINTERFACEERROR vdInterfaceErrorCallbacks;
    1512     vdInterfaceErrorCallbacks.cbSize       = sizeof(VDINTERFACEERROR);
    1513     vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR;
    1514     vdInterfaceErrorCallbacks.pfnError     = handleVDError;
    1515 
    1516     vrc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR,
    1517                              &vdInterfaceErrorCallbacks, NULL, &pVDIfs);
    1518     AssertRC(vrc);
    1519 
    1520     do
    1521     {
    1522         /* Try to determine input image format */
    1523         if (srcformat.isEmpty())
    1524         {
    1525             char *pszFormat = NULL;
    1526             vrc = VDGetFormat(Utf8Str(src).raw(), &pszFormat);
    1527             if (RT_FAILURE(vrc))
    1528             {
    1529                 RTPrintf("No file format specified and autodetect failed - please specify format: %Rrc\n", vrc);
    1530                 break;
    1531             }
    1532             srcformat = pszFormat;
    1533             RTStrFree(pszFormat);
    1534         }
    1535 
    1536         vrc = VDCreate(&vdInterfaceError, &pSrcDisk);
    1537         if (RT_FAILURE(vrc))
    1538         {
    1539             RTPrintf("Error while creating the source virtual disk container: %Rrc\n", vrc);
    1540             break;
    1541         }
    1542 
    1543         /* Open the input image */
    1544         vrc = VDOpen(pSrcDisk, Utf8Str(srcformat).raw(), Utf8Str(src).raw(), VD_OPEN_FLAGS_READONLY, NULL);
    1545         if (RT_FAILURE(vrc))
    1546         {
    1547             RTPrintf("Error while opening the source image: %Rrc\n", vrc);
    1548             break;
    1549         }
    1550 
    1551         /* Output format defaults to VDI */
    1552         if (dstformat.isEmpty())
    1553             dstformat = "VDI";
    1554 
    1555         vrc = VDCreate(&vdInterfaceError, &pDstDisk);
    1556         if (RT_FAILURE(vrc))
    1557         {
    1558             RTPrintf("Error while creating the destination virtual disk container: %Rrc\n", vrc);
    1559             break;
    1560         }
    1561 
    1562         uint64_t cbSize = VDGetSize(pSrcDisk, VD_LAST_IMAGE);
    1563         RTPrintf("Converting image \"%s\" with size %RU64 bytes (%RU64MB)...\n", Utf8Str(src).raw(), cbSize, (cbSize + _1M - 1) / _1M);
    1564 
    1565         /* Create the output image */
    1566         vrc = VDCopy(pSrcDisk, VD_LAST_IMAGE, pDstDisk, Utf8Str(dstformat).raw(),
    1567                      Utf8Str(dst).raw(), false, 0, NULL, NULL, NULL);
    1568         if (RT_FAILURE(vrc))
    1569         {
    1570             RTPrintf("Error while copying the image: %Rrc\n", vrc);
    1571             break;
    1572         }
    1573     }
    1574     while (0);
    1575 
    1576     if (pDstDisk)
    1577         VDCloseAll(pDstDisk);
    1578     if (pSrcDisk)
    1579         VDCloseAll(pSrcDisk);
    1580 
    1581     return RT_SUCCESS(vrc) ? 0 : 1;
    1582 }
    1583 
    15841485/**
    15851486 * Unloads the neccessary driver.
     
    16361537    //if (!strcmp(pszCmd, "unloadsyms"))
    16371538    //    return CmdUnloadSyms(argc - 1 , &argv[1]);
    1638     if (!strcmp(pszCmd, "setvdiuuid"))
    1639         return handleSetVDIUUID(argc - 1, &argv[1], aVirtualBox, aSession);
     1539    if (!strcmp(pszCmd, "sethduuid") || !strcmp(pszCmd, "setvdiuuid"))
     1540        return handleSetHDUUID(argc - 1, &argv[1], aVirtualBox, aSession);
    16401541    if (!strcmp(pszCmd, "listpartitions"))
    16411542        return CmdListPartitions(argc - 1, &argv[1], aVirtualBox, aSession);
     
    16461547    if (!strcmp(pszCmd, "converttoraw"))
    16471548        return CmdConvertToRaw(argc - 1, &argv[1], aVirtualBox, aSession);
    1648     if (!strcmp(pszCmd, "convertdisk"))
    1649         return CmdConvertDisk(argc - 1, &argv[1], aVirtualBox, aSession);
    16501549
    16511550    if (!strcmp(pszCmd, "modinstall"))
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r15267 r15366  
    5454#include <iprt/uuid.h>
    5555#include <VBox/version.h>
    56 #include <VBox/VBoxHDD.h>
     56#include <VBox/VBoxHDD-new.h>
    5757#include <VBox/log.h>
    5858
     
    512512        RTPrintf("VBoxManage createhd         -filename <filename>\n"
    513513                 "                            -size <megabytes>\n"
     514                 "                            [-format VDI|VMDK]\n"
    514515                 "                            [-static]\n"
    515516                 "                            [-comment <comment>]\n"
     
    533534    }
    534535
     536    if (u64Cmd & USAGE_CONVERTHD)
     537    {
     538        RTPrintf("VBoxManage converthd        [-srcformat VDI|VMDK|RAW]\n"
     539                 "                            [-dstformat VDI|VMDK|RAW]\n"
     540                 "                            <inputfile> <outputfile>\n"
     541                 "\n");
     542    }
     543
    535544    if (u64Cmd & USAGE_CONVERTDD)
    536545    {
    537         RTPrintf("VBoxManage convertdd        [-static] <filename> <outputfile>\n"
    538                  "VBoxManage convertdd        [-static] stdin <outputfile> <bytes>\n"
     546        RTPrintf("VBoxManage convertdd        [-static] [-format VDI|VMDK]"
     547                 "                            <filename> <outputfile>\n"
     548                 "VBoxManage convertdd        [-static] [-format VDI|VMDK]"
     549                 "                            stdin <outputfile> <bytes>\n"
    539550                 "\n");
    540551    }
     
    550561                 "                            [-password <password>]\n"
    551562                 "                            [-comment <comment>]\n"
     563                 "                            [-intnet]\n"
    552564                 "\n");
    553565    }
     
    816828}
    817829
     830
     831static DECLCALLBACK(void) handleVDError(void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va)
     832{
     833    RTPrintf("ERROR: ");
     834    RTPrintfV(pszFormat, va);
     835    RTPrintf("\n");
     836    RTPrintf("Error code %Rrc at %s(%u) in function %s\n", rc, RT_SRC_POS_ARGS);
     837}
     838
     839
    818840static int handleCreateHardDisk(int argc, char *argv[],
    819841                                ComPtr<IVirtualBox> virtualBox, ComPtr<ISession> session)
     
    822844    Bstr filename;
    823845    uint64_t sizeMB = 0;
     846    Bstr format = "VDI";
    824847    bool fStatic = false;
    825848    Bstr comment;
     
    844867            sizeMB = RTStrToUInt64(argv[i]);
    845868        }
     869        else if (strcmp(argv[i], "-format") == 0)
     870        {
     871            if (argc <= i + 1)
     872                return errorArgument("Missing argument to '%s'", argv[i]);
     873            i++;
     874            format = argv[i];
     875        }
    846876        else if (strcmp(argv[i], "-static") == 0)
    847877        {
     
    877907
    878908    ComPtr<IHardDisk2> hardDisk;
    879     CHECK_ERROR(virtualBox, CreateHardDisk2(Bstr("VDI"), filename, hardDisk.asOutParam()));
     909    CHECK_ERROR(virtualBox, CreateHardDisk2(format, filename, hardDisk.asOutParam()));
    880910    if (SUCCEEDED(rc) && hardDisk)
    881911    {
     
    939969}
    940970
     971#if 0 /* disabled until disk shrinking is implemented based on VBoxHDD-new */
    941972static DECLCALLBACK(int) hardDiskProgressCallback(PVM pVM, unsigned uPercent, void *pvUser)
    942973{
     
    954985    return VINF_SUCCESS;
    955986}
     987#endif
    956988
    957989
     
    10201052    else if (strcmp(argv[1], "compact") == 0)
    10211053    {
     1054#if 1
     1055        RTPrintf("Error: Shrink hard disk operation is temporarily unavailable!\n");
     1056        return 1;
     1057#else
    10221058        /* the hard disk image might not be registered */
    10231059        if (!hardDisk)
     
    10481084            rc = E_FAIL;
    10491085        }
     1086#endif
    10501087    }
    10511088    else
     
    11041141}
    11051142
     1143static int handleConvertHardDisk(int argc, char **argv)
     1144{
     1145    Bstr srcformat;
     1146    Bstr dstformat;
     1147    Bstr src;
     1148    Bstr dst;
     1149    int vrc;
     1150    PVBOXHDD pSrcDisk = NULL;
     1151    PVBOXHDD pDstDisk = NULL;
     1152
     1153    /* Parse the arguments. */
     1154    for (int i = 0; i < argc; i++)
     1155    {
     1156        if (strcmp(argv[i], "-srcformat") == 0)
     1157        {
     1158            if (argc <= i + 1)
     1159            {
     1160                return errorArgument("Missing argument to '%s'", argv[i]);
     1161            }
     1162            i++;
     1163            srcformat = argv[i];
     1164        }
     1165        else if (strcmp(argv[i], "-dstformat") == 0)
     1166        {
     1167            if (argc <= i + 1)
     1168            {
     1169                return errorArgument("Missing argument to '%s'", argv[i]);
     1170            }
     1171            i++;
     1172            dstformat = argv[i];
     1173        }
     1174        else if (src.isEmpty())
     1175        {
     1176            src = argv[i];
     1177        }
     1178        else if (dst.isEmpty())
     1179        {
     1180            dst = argv[i];
     1181        }
     1182        else
     1183        {
     1184            return errorSyntax(USAGE_CONVERTHD, "Invalid parameter '%s'", Utf8Str(argv[i]).raw());
     1185        }
     1186    }
     1187
     1188    if (src.isEmpty())
     1189        return errorSyntax(USAGE_CONVERTHD, "Mandatory input image parameter missing");
     1190    if (dst.isEmpty())
     1191        return errorSyntax(USAGE_CONVERTHD, "Mandatory output image parameter missing");
     1192
     1193
     1194    PVDINTERFACE     pVDIfs = NULL;
     1195    VDINTERFACE      vdInterfaceError;
     1196    VDINTERFACEERROR vdInterfaceErrorCallbacks;
     1197    vdInterfaceErrorCallbacks.cbSize       = sizeof(VDINTERFACEERROR);
     1198    vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR;
     1199    vdInterfaceErrorCallbacks.pfnError     = handleVDError;
     1200
     1201    vrc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR,
     1202                         &vdInterfaceErrorCallbacks, NULL, &pVDIfs);
     1203    AssertRC(vrc);
     1204
     1205    do
     1206    {
     1207        /* Try to determine input image format */
     1208        if (srcformat.isEmpty())
     1209        {
     1210            char *pszFormat = NULL;
     1211            vrc = VDGetFormat(Utf8Str(src).raw(), &pszFormat);
     1212            if (RT_FAILURE(vrc))
     1213            {
     1214                RTPrintf("No file format specified and autodetect failed - please specify format: %Rrc\n", vrc);
     1215                break;
     1216            }
     1217            srcformat = pszFormat;
     1218            RTStrFree(pszFormat);
     1219        }
     1220
     1221        vrc = VDCreate(pVDIfs, &pSrcDisk);
     1222        if (RT_FAILURE(vrc))
     1223        {
     1224            RTPrintf("Error while creating the source virtual disk container: %Rrc\n", vrc);
     1225            break;
     1226        }
     1227
     1228        /* Open the input image */
     1229        vrc = VDOpen(pSrcDisk, Utf8Str(srcformat).raw(), Utf8Str(src).raw(), VD_OPEN_FLAGS_READONLY, NULL);
     1230        if (RT_FAILURE(vrc))
     1231        {
     1232            RTPrintf("Error while opening the source image: %Rrc\n", vrc);
     1233            break;
     1234        }
     1235
     1236        /* Output format defaults to VDI */
     1237        if (dstformat.isEmpty())
     1238            dstformat = "VDI";
     1239
     1240        vrc = VDCreate(pVDIfs, &pDstDisk);
     1241        if (RT_FAILURE(vrc))
     1242        {
     1243            RTPrintf("Error while creating the destination virtual disk container: %Rrc\n", vrc);
     1244            break;
     1245        }
     1246
     1247        uint64_t cbSize = VDGetSize(pSrcDisk, VD_LAST_IMAGE);
     1248        RTPrintf("Converting image \"%s\" with size %RU64 bytes (%RU64MB)...\n", Utf8Str(src).raw(), cbSize, (cbSize + _1M - 1) / _1M);
     1249
     1250        /* Create the output image */
     1251        vrc = VDCopy(pSrcDisk, VD_LAST_IMAGE, pDstDisk, Utf8Str(dstformat).raw(),
     1252                     Utf8Str(dst).raw(), false, 0, NULL, NULL, NULL);
     1253        if (RT_FAILURE(vrc))
     1254        {
     1255            RTPrintf("Error while copying the image: %Rrc\n", vrc);
     1256            break;
     1257        }
     1258    }
     1259    while (0);
     1260    if (pDstDisk)
     1261        VDCloseAll(pDstDisk);
     1262    if (pSrcDisk)
     1263        VDCloseAll(pSrcDisk);
     1264
     1265    return RT_SUCCESS(vrc) ? 0 : 1;
     1266}
     1267
     1268
    11061269static int handleConvertDDImage(int argc, char *argv[])
    11071270{
    1108     int arg = 0;
    1109     VDIIMAGETYPE enmImgType = VDI_IMAGE_TYPE_NORMAL;
    1110     if (argc >= 1 && !strcmp(argv[arg], "-static"))
    1111     {
    1112         arg++;
    1113         enmImgType = VDI_IMAGE_TYPE_FIXED;
    1114     }
    1115 
     1271    VDIMAGETYPE enmImgType = VD_IMAGE_TYPE_NORMAL;
     1272    bool fReadFromStdIn = false;
     1273    const char *format = NULL;
     1274    const char *srcfilename = NULL;
     1275    const char *dstfilename = NULL;
     1276    const char *filesize = NULL;
     1277    unsigned uImageFlags = 0; /**< @todo allow creation of non-default image variants */
     1278
     1279    for (int i = 0; i < argc; i++)
     1280    {
     1281        if (!strcmp(argv[i], "-static"))
     1282        {
     1283            enmImgType = VD_IMAGE_TYPE_FIXED;
     1284        }
     1285        else if (strcmp(argv[i], "-format") == 0)
     1286        {
     1287            if (argc <= i + 1)
     1288            {
     1289                return errorArgument("Missing argument to '%s'", argv[i]);
     1290            }
     1291            i++;
     1292            format = argv[i];
     1293        }
     1294        else
     1295        {
     1296            if (srcfilename)
     1297            {
     1298                if (dstfilename)
     1299                {
     1300                    if (fReadFromStdIn && !filesize)
     1301                        filesize = argv[i];
     1302                    else
     1303                        return errorSyntax(USAGE_CONVERTDD, "Incorrect number of parameters");
     1304                }
     1305                else
     1306                    dstfilename = argv[i];
     1307            }
     1308            else
     1309            {
     1310                srcfilename = argv[i];
    11161311#if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS)
    1117     const bool fReadFromStdIn = (argc >= arg + 1) && !strcmp(argv[arg], "stdin");
    1118 #else
    1119     const bool fReadFromStdIn = false;
     1312                fReadFromStdIn = !strcmp(srcfilename, "stdin");
    11201313#endif
    1121 
    1122     if ((!fReadFromStdIn && argc != arg + 2) || (fReadFromStdIn && argc != arg + 3))
    1123         return errorSyntax(USAGE_CONVERTDD, "Incorrect number of parameters");
     1314            }
     1315        }
     1316    }
    11241317
    11251318    RTPrintf("Converting VDI: from DD image file=\"%s\" to file=\"%s\"...\n",
    1126              argv[arg], argv[arg + 1]);
     1319             srcfilename, dstfilename);
     1320
     1321    int rc = VINF_SUCCESS;
     1322    PVBOXHDD pDisk = NULL;
     1323
     1324    PVDINTERFACE     pVDIfs = NULL;
     1325    VDINTERFACE      vdInterfaceError;
     1326    VDINTERFACEERROR vdInterfaceErrorCallbacks;
     1327    vdInterfaceErrorCallbacks.cbSize       = sizeof(VDINTERFACEERROR);
     1328    vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR;
     1329    vdInterfaceErrorCallbacks.pfnError     = handleVDError;
     1330
     1331    rc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR,
     1332                        &vdInterfaceErrorCallbacks, NULL, &pVDIfs);
     1333    AssertRC(rc);
    11271334
    11281335    /* open raw image file. */
    11291336    RTFILE File;
    1130     int rc = VINF_SUCCESS;
    11311337    if (fReadFromStdIn)
    11321338        File = 0;
    11331339    else
    1134         rc = RTFileOpen(&File, argv[arg], RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
     1340        rc = RTFileOpen(&File, srcfilename, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
    11351341    if (RT_FAILURE(rc))
    11361342    {
    1137         RTPrintf("File=\"%s\" open error: %Rrf\n", argv[arg], rc);
    1138         return rc;
     1343        RTPrintf("File=\"%s\" open error: %Rrf\n", srcfilename, rc);
     1344        goto out;
    11391345    }
    11401346
     
    11421348    /* get image size. */
    11431349    if (fReadFromStdIn)
    1144         cbFile = RTStrToUInt64(argv[arg + 2]);
     1350        cbFile = RTStrToUInt64(filesize);
    11451351    else
    11461352        rc = RTFileGetSize(File, &cbFile);
    1147     if (RT_SUCCESS(rc))
    1148     {
    1149         RTPrintf("Creating %s image with size %RU64 bytes (%RU64MB)...\n", (enmImgType == VDI_IMAGE_TYPE_FIXED) ? "fixed" : "dynamic", cbFile, (cbFile + _1M - 1) / _1M);
    1150         char pszComment[256];
    1151         RTStrPrintf(pszComment, sizeof(pszComment), "Converted image from %s", argv[arg]);
    1152         rc = VDICreateBaseImage(argv[arg + 1],
    1153                                 enmImgType,
    1154                                 cbFile,
    1155                                 pszComment, NULL, NULL);
    1156         if (RT_SUCCESS(rc))
    1157         {
    1158             PVDIDISK pVdi = VDIDiskCreate();
    1159             rc = VDIDiskOpenImage(pVdi, argv[arg + 1], VDI_OPEN_FLAGS_NORMAL);
    1160             if (RT_SUCCESS(rc))
    1161             {
    1162                 /* alloc work buffer. */
    1163                 size_t cbBuffer = VDIDiskGetBufferSize(pVdi);
    1164                 void   *pvBuf = RTMemAlloc(cbBuffer);
    1165                 if (pvBuf)
    1166                 {
    1167                     uint64_t offFile = 0;
    1168                     while (offFile < cbFile)
    1169                     {
    1170                         size_t cbRead = 0;
    1171                         size_t cbToRead = cbFile - offFile >= (uint64_t) cbBuffer ?
     1353    if (RT_FAILURE(rc))
     1354    {
     1355        RTPrintf("Error getting image size for file \"%s\": %Rrc\n", srcfilename, rc);
     1356        goto out;
     1357    }
     1358
     1359    RTPrintf("Creating %s image with size %RU64 bytes (%RU64MB)...\n", (enmImgType == VD_IMAGE_TYPE_FIXED) ? "fixed" : "dynamic", cbFile, (cbFile + _1M - 1) / _1M);
     1360    char pszComment[256];
     1361    RTStrPrintf(pszComment, sizeof(pszComment), "Converted image from %s", srcfilename);
     1362    rc = VDCreate(pVDIfs, &pDisk);
     1363    if (RT_FAILURE(rc))
     1364    {
     1365        RTPrintf("Error while creating the virtual disk container: %Rrc\n", rc);
     1366        goto out;
     1367    }
     1368
     1369    Assert(RT_MIN(cbFile / 512 / 16 / 63, 16383) -
     1370           (unsigned int)RT_MIN(cbFile / 512 / 16 / 63, 16383) == 0);
     1371    PDMMEDIAGEOMETRY PCHS, LCHS;
     1372    PCHS.cCylinders = (unsigned int)RT_MIN(cbFile / 512 / 16 / 63, 16383);
     1373    PCHS.cHeads = 16;
     1374    PCHS.cSectors = 63;
     1375    LCHS.cCylinders = 0;
     1376    LCHS.cHeads = 0;
     1377    LCHS.cSectors = 0;
     1378    rc = VDCreateBase(pDisk, format, dstfilename, enmImgType, cbFile,
     1379                      uImageFlags, pszComment, &PCHS, &LCHS, NULL,
     1380                      VD_OPEN_FLAGS_NORMAL, NULL, NULL);
     1381    if (RT_FAILURE(rc))
     1382    {
     1383        RTPrintf("Error while creating the disk image \"%s\": %Rrc\n", dstfilename, rc);
     1384        goto out;
     1385    }
     1386
     1387    size_t cbBuffer;
     1388    cbBuffer = _1M;
     1389    void *pvBuf;
     1390    pvBuf = RTMemAlloc(cbBuffer);
     1391    if (!pvBuf)
     1392    {
     1393        rc = VERR_NO_MEMORY;
     1394        RTPrintf("Not enough memory allocating buffers for image \"%s\": %Rrc\n", dstfilename, rc);
     1395        goto out;
     1396    }
     1397
     1398    uint64_t offFile;
     1399    offFile = 0;
     1400    while (offFile < cbFile)
     1401    {
     1402        size_t cbRead;
     1403        size_t cbToRead;
     1404        cbRead = 0;
     1405        cbToRead = cbFile - offFile >= (uint64_t)cbBuffer ?
    11721406                            cbBuffer : (size_t) (cbFile - offFile);
    1173                         rc = RTFileRead(File, pvBuf, cbToRead, &cbRead);
    1174                         if (RT_FAILURE(rc) || !cbRead)
    1175                             break;
    1176                         rc = VDIDiskWrite(pVdi, offFile, pvBuf, cbRead);
    1177                         if (RT_FAILURE(rc))
    1178                             break;
    1179                         offFile += cbRead;
    1180                     }
    1181 
    1182                     RTMemFree(pvBuf);
    1183                 }
    1184                 else
    1185                     rc = VERR_NO_MEMORY;
    1186 
    1187                 VDIDiskCloseImage(pVdi);
    1188             }
    1189 
    1190             if (RT_FAILURE(rc))
    1191             {
    1192                 /* delete image on error */
    1193                 RTPrintf("Failed (%Rrc)!\n", rc);
    1194                 VDIDeleteImage(argv[arg + 1]);
    1195             }
    1196         }
    1197         else
    1198             RTPrintf("Failed to create output file (%Rrc)!\n", rc);
    1199     }
    1200     RTFileClose(File);
    1201 
    1202     return rc;
     1407        rc = RTFileRead(File, pvBuf, cbToRead, &cbRead);
     1408        if (RT_FAILURE(rc) || !cbRead)
     1409            break;
     1410        rc = VDWrite(pDisk, offFile, pvBuf, cbRead);
     1411        if (RT_FAILURE(rc))
     1412        {
     1413            RTPrintf("Failed to write to disk image \"%s\": %Rrc\n", dstfilename, rc);
     1414            goto out;
     1415        }
     1416        offFile += cbRead;
     1417    }
     1418
     1419out:
     1420    if (pvBuf)
     1421        RTMemFree(pvBuf);
     1422    if (pDisk)
     1423        VDClose(pDisk, RT_FAILURE(rc));
     1424    if (File != NIL_RTFILE)
     1425        RTFileClose(File);
     1426
     1427    return RT_FAILURE(rc);
    12031428}
    12041429
     
    12141439    Bstr password;
    12151440    Bstr comment;
     1441    bool fIntNet = false;
    12161442
    12171443    /* at least server and target */
     
    12991525            comment = argv[i];
    13001526        }
     1527        else if (strcmp(argv[i], "-intnet") == 0)
     1528        {
     1529            i++;
     1530            fIntNet = true;
     1531        }
    13011532        else
    13021533            return errorSyntax(USAGE_ADDISCSIDISK, "Invalid parameter '%s'", Utf8Str(argv[i]).raw());
     
    13511582
    13521583        /// @todo add -targetName and -targetPassword options
     1584
     1585        if (fIntNet)
     1586        {
     1587            Bstr ("HostIPStack").detachTo (names.appendedRaw());
     1588            Bstr ("0").detachTo (values.appendedRaw());
     1589        }
    13531590
    13541591        CHECK_ERROR_BREAK (hardDisk,
     
    55675804    ////////////////////////////////////////////////////////////////////////////
    55685805
    5569     /* convertdd: does not need a VirtualBox instantiation) */
     5806    /* converthd: does not need a VirtualBox instantiation. */
     5807    if (argc >= iCmdArg && (strcmp(argv[iCmd], "converthd") == 0))
     5808    {
     5809        rc = handleConvertHardDisk(argc - iCmdArg, argv + iCmdArg);
     5810        break;
     5811    }
     5812
     5813    /* convertdd: does not need a VirtualBox instantiation. */
    55705814    if (argc >= iCmdArg && (strcmp(argv[iCmd], "convertdd") == 0))
    55715815    {
     
    56235867        { "modifyhd",         handleModifyHardDisk },
    56245868        { "modifyvdi",        handleModifyHardDisk }, /* backward compatiblity */
     5869        { "clonehd",          handleCloneHardDisk },
     5870        { "clonevdi",         handleCloneHardDisk }, /* backward compatiblity */
    56255871        { "addiscsidisk",     handleAddiSCSIDisk },
    56265872        { "createvm",         handleCreateVM },
    56275873        { "modifyvm",         handleModifyVM },
    5628         { "clonehd",          handleCloneHardDisk },
    5629         { "clonevdi",         handleCloneHardDisk }, /* backward compatiblity */
    56305874        { "startvm",          handleStartVM },
    56315875        { "controlvm",        handleControlVM },
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r14732 r15366  
    7070#define USAGE_LOADSYMS              RT_BIT_64(29)
    7171#define USAGE_UNLOADSYMS            RT_BIT_64(30)
    72 #define USAGE_SETVDIUUID            RT_BIT_64(31)
     72#define USAGE_SETHDUUID             RT_BIT_64(31)
    7373#define USAGE_CONVERTDD             RT_BIT_64(32)
    7474#define USAGE_LISTPARTITIONS        RT_BIT_64(33)
     
    8484#define USAGE_CONVERTTORAW          RT_BIT_64(41)
    8585#define USAGE_METRICS               RT_BIT_64(42)
    86 #define USAGE_CONVERTDISK           RT_BIT_64(43)
     86#define USAGE_CONVERTHD             RT_BIT_64(43)
    8787#define USAGE_ALL                   (~(uint64_t)0)
    8888/** @} */
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r14814 r15366  
    3333#include <VBox/com/VirtualBox.h>
    3434
    35 #include <VBox/VBoxHDD.h>
    3635#include <VBox/log.h>
    3736#include <iprt/stream.h>
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r15318 r15366  
    5858#include <VBox/err.h>
    5959#include <VBox/param.h>
    60 #include <VBox/VBoxHDD.h>
    6160#include <VBox/VBoxHDD-new.h>
    6261#include <VBox/version.h>
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