Changeset 15366 in vbox
- Timestamp:
- Dec 12, 2008 1:50:32 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 40805
- Location:
- trunk
- Files:
-
- 3 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/VBoxHDD-new.h
r14967 r15366 1049 1049 typedef struct VDBACKENDINFO 1050 1050 { 1051 /** Name of the backend. */1051 /** Name of the backend. Must be unique even with case insensitive comparison. */ 1052 1052 const char *pszBackend; 1053 1053 /** Capabilities of the backend (a combination of the VD_CAP_* flags). */ … … 1116 1116 * 1117 1117 * @return VBox status code. 1118 * @param pszBackend The backend name .1118 * @param pszBackend The backend name (case insensitive). 1119 1119 * @param pEntries Pointer to an entry. 1120 1120 */ … … 1164 1164 * @return VBox status code. 1165 1165 * @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). 1167 1167 * @param pszFilename Name of the image file to open. 1168 1168 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. … … 1178 1178 * @return VBox status code. 1179 1179 * @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). 1181 1181 * @param pszFilename Name of the image file to create. 1182 1182 * @param enmType Image type, only base image types are acceptable. … … 1207 1207 * @return VBox status code. 1208 1208 * @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). 1210 1210 * @param pszFilename Name of the differencing image file to create. 1211 1211 * @param uImageFlags Flags specifying special image features. … … 1229 1229 * 1230 1230 * @return VBox status code. 1231 * @return VERR_VD I_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. 1232 1232 * @param pDisk Pointer to HDD container. 1233 1233 * @param nImageFrom Name of the image file to merge from. … … 1249 1249 * 1250 1250 * @return VBox status code. 1251 * @return VERR_VD I_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. 1252 1252 * @param pDiskFrom Pointer to source HDD container. 1253 1253 * @param nImage Image number, counts from 0. 0 is always base image of container. 1254 1254 * @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). 1256 1256 * @param pszFilename New name of the image (may be NULL if pDiskFrom == pDiskTo). 1257 1257 * @param fMoveByRename If true, attempt to perform a move by renaming (if successful the new size is ignored). … … 1277 1277 * 1278 1278 * @return VBox status code. 1279 * @return VERR_VD I_NOT_OPENED if no image is opened in HDD container.1279 * @return VERR_VD_NOT_OPENED if no image is opened in HDD container. 1280 1280 * @param pDisk Pointer to HDD container. 1281 1281 * @param fDelete If true, delete the image from the host disk. … … 1295 1295 * 1296 1296 * @return VBox status code. 1297 * @return VERR_VD I_NOT_OPENED if no image is opened in HDD container.1297 * @return VERR_VD_NOT_OPENED if no image is opened in HDD container. 1298 1298 * @param pDisk Pointer to HDD container. 1299 1299 * @param uOffset Offset of first reading byte from start of disk. … … 1309 1309 * 1310 1310 * @return VBox status code. 1311 * @return VERR_VD I_NOT_OPENED if no image is opened in HDD container.1311 * @return VERR_VD_NOT_OPENED if no image is opened in HDD container. 1312 1312 * @param pDisk Pointer to HDD container. 1313 1313 * @param uOffset Offset of first writing byte from start of disk. … … 1323 1323 * 1324 1324 * @return VBox status code. 1325 * @return VERR_VD I_NOT_OPENED if no image is opened in HDD container.1325 * @return VERR_VD_NOT_OPENED if no image is opened in HDD container. 1326 1326 * @param pDisk Pointer to HDD container. 1327 1327 */ … … 1369 1369 * 1370 1370 * @return VBox status code. 1371 * @return VERR_VD I_IMAGE_NOT_FOUND if image with specified number was not opened.1372 * @return VERR_VD I_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. 1373 1373 * @param pDisk Pointer to HDD container. 1374 1374 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1382 1382 * 1383 1383 * @return VBox status code. 1384 * @return VERR_VD I_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. 1385 1385 * @param pDisk Pointer to HDD container. 1386 1386 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1394 1394 * 1395 1395 * @return VBox status code. 1396 * @return VERR_VD I_IMAGE_NOT_FOUND if image with specified number was not opened.1397 * @return VERR_VD I_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. 1398 1398 * @param pDisk Pointer to HDD container. 1399 1399 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1407 1407 * 1408 1408 * @return VBox status code. 1409 * @return VERR_VD I_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. 1410 1410 * @param pDisk Pointer to HDD container. 1411 1411 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1419 1419 * 1420 1420 * @return VBox status code. 1421 * @return VERR_VD I_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. 1422 1422 * @param pDisk Pointer to HDD container. 1423 1423 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1431 1431 * 1432 1432 * @return VBox status code. 1433 * @return VERR_VD I_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. 1434 1434 * @param pDisk Pointer to HDD container. 1435 1435 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1443 1443 * 1444 1444 * @return VBox status code. 1445 * @return VERR_VD I_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. 1446 1446 * @param pDisk Pointer to the HDD container. 1447 1447 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1455 1455 * 1456 1456 * @return VBox status code. 1457 * @return VERR_VD I_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. 1458 1458 * @param pDisk Pointer to HDD container. 1459 1459 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1466 1466 * 1467 1467 * @return VBox status code. 1468 * @return VERR_VD I_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. 1469 1469 * @param pDisk Pointer to HDD container. 1470 1470 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1480 1480 * 1481 1481 * @return VBox status code. 1482 * @return VERR_VD I_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. 1483 1483 * @param pDisk Pointer to HDD container. 1484 1484 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1494 1494 * 1495 1495 * @return VBox status code. 1496 * @return VERR_VD I_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. 1497 1497 * @return VERR_BUFFER_OVERFLOW if pszFilename buffer too small to hold filename. 1498 1498 * @param pDisk Pointer to HDD container. … … 1508 1508 * 1509 1509 * @return VBox status code. 1510 * @return VERR_VD I_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. 1511 1511 * @return VERR_BUFFER_OVERFLOW if pszComment buffer too small to hold comment text. 1512 1512 * @param pDisk Pointer to HDD container. … … 1522 1522 * 1523 1523 * @return VBox status code. 1524 * @return VERR_VD I_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. 1525 1525 * @param pDisk Pointer to HDD container. 1526 1526 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1534 1534 * 1535 1535 * @return VBox status code. 1536 * @return VERR_VD I_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. 1537 1537 * @param pDisk Pointer to HDD container. 1538 1538 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1545 1545 * 1546 1546 * @return VBox status code. 1547 * @return VERR_VD I_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. 1548 1548 * @param pDisk Pointer to HDD container. 1549 1549 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1556 1556 * 1557 1557 * @return VBox status code. 1558 * @return VERR_VD I_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. 1559 1559 * @param pDisk Pointer to HDD container. 1560 1560 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1568 1568 * 1569 1569 * @return VBox status code. 1570 * @return VERR_VD I_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. 1571 1571 * @param pDisk Pointer to HDD container. 1572 1572 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1580 1580 * 1581 1581 * @return VBox status code. 1582 * @return VERR_VD I_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. 1583 1583 * @param pDisk Pointer to HDD container. 1584 1584 * @param nImage Image number, counts from 0. 0 is always base image of the container. … … 1612 1612 * 1613 1613 * @return VBox status code. 1614 * @return VERR_VD I_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. 1615 1615 * @param pDisk Pointer to the HDD container. 1616 1616 * @param nImage Image number, counts from 0. 0 is always base image of container. -
trunk/include/VBox/err.h
r15284 r15366 1030 1030 1031 1031 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 */ 1041 1035 /** 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) 1045 1037 /** 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) 1051 1051 /** 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) 1061 1065 /** 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) 1075 1091 /** @} */ 1076 1092 -
trunk/src/VBox/Devices/Builtins.cpp
r14965 r15366 181 181 if (RT_FAILURE(rc)) 182 182 return rc; 183 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVBoxHDD);184 if (RT_FAILURE(rc))185 return rc;186 183 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD); 187 184 if (RT_FAILURE(rc)) … … 203 200 if (RT_FAILURE(rc)) 204 201 return rc; 205 #ifdef VBOX_WITH_ISCSI206 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 #endif213 202 #ifndef RT_OS_L4 214 203 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT); -
trunk/src/VBox/Devices/Makefile.kmk
r15287 r15366 82 82 VBoxDDU_SOURCES = \ 83 83 Storage/VBoxHDD-new.cpp \ 84 Storage/VDICore.cpp \85 84 Storage/VDIHDDCore.cpp \ 86 85 Storage/VHDHDDCore.cpp \ … … 579 578 Storage/DrvRawImage.cpp \ 580 579 Storage/DrvVD.cpp \ 581 Storage/VBoxHDD.cpp \582 580 Network/DrvNetSniffer.cpp \ 583 581 Network/Pcap.cpp … … 644 642 Input/DrvMouseQueue.cpp \ 645 643 Input/DrvKeyboardQueue.cpp \ 646 Storage/VBoxHDD.cpp \647 644 Storage/DrvBlock.cpp \ 648 645 Storage/DrvMediaISO.cpp \ … … 712 709 713 710 ifdef VBOX_WITH_ISCSI 714 Drivers_SOURCES += \715 Storage/DrvISCSI.cpp \716 Storage/DrvISCSITransportTCP.cpp717 Drivers_DEFS += VBOX_WITH_ISCSI718 Storage/DrvISCSITransportTCP.cpp_INCS = \719 Network/lwip/src/include \720 Network/lwip/src/include/ipv4 \721 Network/lwip/vbox/include722 711 VBoxDDU_SOURCES += \ 723 712 Storage/ISCSIHDDCore.cpp -
trunk/src/VBox/Devices/PC/DevPcBios.cpp
r15192 r15366 458 458 } 459 459 rc = pHardDisk->pfnSetLCHSGeometry(pHardDisk, &LCHSGeometry); 460 if (rc == VERR_VD I_IMAGE_READ_ONLY)460 if (rc == VERR_VD_IMAGE_READ_ONLY) 461 461 { 462 462 LogRel(("DevPcBios: ATA failed to update LCHS geometry, read only\n")); -
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r15156 r15366 552 552 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 553 553 int rc = VDSetPCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pPCHSGeometry); 554 if (rc == VERR_VD I_GEOMETRY_NOT_SET)554 if (rc == VERR_VD_GEOMETRY_NOT_SET) 555 555 rc = VERR_PDM_GEOMETRY_NOT_SET; 556 556 LogFlow(("%s: returns %Rrc\n", __FUNCTION__, rc)); … … 583 583 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 584 584 int rc = VDSetLCHSGeometry(pThis->pDisk, VD_LAST_IMAGE, pLCHSGeometry); 585 if (rc == VERR_VD I_GEOMETRY_NOT_SET)585 if (rc == VERR_VD_GEOMETRY_NOT_SET) 586 586 rc = VERR_PDM_GEOMETRY_NOT_SET; 587 587 LogFlow(("%s: returns %Rrc\n", __FUNCTION__, rc)); … … 635 635 PVBOXDISK pThis = PDMITRANSPORTASYNCPORT_2_VBOXDISK(pInterface); 636 636 PDRVVDASYNCTASK pDrvVDAsyncTask = (PDRVVDASYNCTASK)pvUser; 637 int rc = VINF_VD I_ASYNC_IO_FINISHED;637 int rc = VINF_VD_ASYNC_IO_FINISHED; 638 638 639 639 /* Having a completion callback for a task is not mandatory. */ … … 642 642 643 643 /* Check if the request is finished. */ 644 if (rc == VINF_VD I_ASYNC_IO_FINISHED)644 if (rc == VINF_VD_ASYNC_IO_FINISHED) 645 645 { 646 646 rc = pThis->pDrvMediaAsyncPort->pfnTransferCompleteNotify(pThis->pDrvMediaAsyncPort, pDrvVDAsyncTask->pvUserCaller); 647 647 } 648 else if (rc == VERR_VD I_ASYNC_IO_IN_PROGRESS)648 else if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 649 649 rc = VINF_SUCCESS; 650 650 -
trunk/src/VBox/Devices/Storage/RawHDDCore.cpp
r14967 r15366 143 143 if (pImage->cbSize % 512) 144 144 { 145 rc = VERR_VD I_INVALID_HEADER;145 rc = VERR_VD_RAW_INVALID_HEADER; 146 146 goto out; 147 147 } … … 174 174 if (enmType != VD_IMAGE_TYPE_FIXED) 175 175 { 176 rc = rawError(pImage, VERR_VD I_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); 177 177 goto out; 178 178 } … … 322 322 323 323 /* Always return failure, to avoid opening everything as a raw image. */ 324 rc = VERR_VD I_INVALID_HEADER;324 rc = VERR_VD_RAW_INVALID_HEADER; 325 325 326 326 out: … … 519 519 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 520 520 { 521 rc = VERR_VD I_IMAGE_READ_ONLY;521 rc = VERR_VD_IMAGE_READ_ONLY; 522 522 goto out; 523 523 } … … 578 578 *penmImageType = pImage->enmImageType; 579 579 else 580 rc = VERR_VD I_NOT_OPENED;580 rc = VERR_VD_NOT_OPENED; 581 581 582 582 LogFlowFunc(("returns %Rrc enmImageType=%u\n", rc, *penmImageType)); … … 640 640 } 641 641 else 642 rc = VERR_VD I_GEOMETRY_NOT_SET;643 } 644 else 645 rc = VERR_VD I_NOT_OPENED;642 rc = VERR_VD_GEOMETRY_NOT_SET; 643 } 644 else 645 rc = VERR_VD_NOT_OPENED; 646 646 647 647 LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors)); … … 663 663 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 664 664 { 665 rc = VERR_VD I_IMAGE_READ_ONLY;665 rc = VERR_VD_IMAGE_READ_ONLY; 666 666 goto out; 667 667 } … … 671 671 } 672 672 else 673 rc = VERR_VD I_NOT_OPENED;673 rc = VERR_VD_NOT_OPENED; 674 674 675 675 out: … … 696 696 } 697 697 else 698 rc = VERR_VD I_GEOMETRY_NOT_SET;699 } 700 else 701 rc = VERR_VD I_NOT_OPENED;698 rc = VERR_VD_GEOMETRY_NOT_SET; 699 } 700 else 701 rc = VERR_VD_NOT_OPENED; 702 702 703 703 LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors)); … … 719 719 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 720 720 { 721 rc = VERR_VD I_IMAGE_READ_ONLY;721 rc = VERR_VD_IMAGE_READ_ONLY; 722 722 goto out; 723 723 } … … 727 727 } 728 728 else 729 rc = VERR_VD I_NOT_OPENED;729 rc = VERR_VD_NOT_OPENED; 730 730 731 731 out: … … 811 811 } 812 812 else 813 rc = VERR_VD I_NOT_OPENED;813 rc = VERR_VD_NOT_OPENED; 814 814 815 815 LogFlowFunc(("returns %Rrc comment='%s'\n", rc, pszComment)); … … 828 828 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 829 829 { 830 rc = VERR_VD I_IMAGE_READ_ONLY;830 rc = VERR_VD_IMAGE_READ_ONLY; 831 831 goto out; 832 832 } … … 835 835 rc = VERR_NOT_SUPPORTED; 836 836 else 837 rc = VERR_VD I_NOT_OPENED;837 rc = VERR_VD_NOT_OPENED; 838 838 839 839 out: … … 854 854 rc = VERR_NOT_SUPPORTED; 855 855 else 856 rc = VERR_VD I_NOT_OPENED;856 rc = VERR_VD_NOT_OPENED; 857 857 858 858 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 875 875 rc = VERR_NOT_SUPPORTED; 876 876 else 877 rc = VERR_VD I_IMAGE_READ_ONLY;878 } 879 else 880 rc = VERR_VD I_NOT_OPENED;877 rc = VERR_VD_IMAGE_READ_ONLY; 878 } 879 else 880 rc = VERR_VD_NOT_OPENED; 881 881 882 882 LogFlowFunc(("returns %Rrc\n", rc)); … … 896 896 rc = VERR_NOT_SUPPORTED; 897 897 else 898 rc = VERR_VD I_NOT_OPENED;898 rc = VERR_VD_NOT_OPENED; 899 899 900 900 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 916 916 rc = VERR_NOT_SUPPORTED; 917 917 else 918 rc = VERR_VD I_IMAGE_READ_ONLY;919 } 920 else 921 rc = VERR_VD I_NOT_OPENED;918 rc = VERR_VD_IMAGE_READ_ONLY; 919 } 920 else 921 rc = VERR_VD_NOT_OPENED; 922 922 923 923 LogFlowFunc(("returns %Rrc\n", rc)); … … 937 937 rc = VERR_NOT_SUPPORTED; 938 938 else 939 rc = VERR_VD I_NOT_OPENED;939 rc = VERR_VD_NOT_OPENED; 940 940 941 941 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 957 957 rc = VERR_NOT_SUPPORTED; 958 958 else 959 rc = VERR_VD I_IMAGE_READ_ONLY;960 } 961 else 962 rc = VERR_VD I_NOT_OPENED;959 rc = VERR_VD_IMAGE_READ_ONLY; 960 } 961 else 962 rc = VERR_VD_NOT_OPENED; 963 963 964 964 LogFlowFunc(("returns %Rrc\n", rc)); … … 978 978 rc = VERR_NOT_SUPPORTED; 979 979 else 980 rc = VERR_VD I_NOT_OPENED;980 rc = VERR_VD_NOT_OPENED; 981 981 982 982 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 998 998 rc = VERR_NOT_SUPPORTED; 999 999 else 1000 rc = VERR_VD I_IMAGE_READ_ONLY;1001 } 1002 else 1003 rc = VERR_VD I_NOT_OPENED;1000 rc = VERR_VD_IMAGE_READ_ONLY; 1001 } 1002 else 1003 rc = VERR_VD_NOT_OPENED; 1004 1004 1005 1005 LogFlowFunc(("returns %Rrc\n", rc)); -
trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp
r14967 r15366 190 190 for (unsigned i = 0; i < g_cBackends; i++) 191 191 { 192 if (! strcmp(pszBackend, g_apBackends[i]->pszBackendName))192 if (!RTStrICmp(pszBackend, g_apBackends[i]->pszBackendName)) 193 193 { 194 194 pBackend = g_apBackends[i]; … … 281 281 * stale data when different block sizes are used for the images. */ 282 282 cbThisRead = cbRead; 283 rc = VERR_VD I_BLOCK_FREE;283 rc = VERR_VD_BLOCK_FREE; 284 284 for (PVDIMAGE pCurrImage = pImage; 285 pCurrImage != NULL && rc == VERR_VD I_BLOCK_FREE;285 pCurrImage != NULL && rc == VERR_VD_BLOCK_FREE; 286 286 pCurrImage = pCurrImage->pPrev) 287 287 { … … 292 292 293 293 /* No image in the chain contains the data for the block. */ 294 if (rc == VERR_VD I_BLOCK_FREE)294 if (rc == VERR_VD_BLOCK_FREE) 295 295 { 296 296 memset(pvBuf, '\0', cbThisRead); … … 415 415 cbPreRead + cbThisWrite + cbPostRead, 416 416 NULL, &cbPreRead, &cbPostRead, 0); 417 Assert(rc != VERR_VD I_BLOCK_FREE);417 Assert(rc != VERR_VD_BLOCK_FREE); 418 418 Assert(cbPreRead == 0); 419 419 Assert(cbPostRead == 0); … … 494 494 cbPreRead + cbThisWrite + cbPostRead, 495 495 NULL, &cbPreRead, &cbPostRead, 0); 496 Assert(rc != VERR_VD I_BLOCK_FREE);496 Assert(rc != VERR_VD_BLOCK_FREE); 497 497 Assert(cbPreRead == 0); 498 498 Assert(cbPostRead == 0); … … 528 528 cbThisWrite, &cbThisWrite, &cbPreRead, 529 529 &cbPostRead, fWrite); 530 if (rc == VERR_VD I_BLOCK_FREE)530 if (rc == VERR_VD_BLOCK_FREE) 531 531 { 532 532 void *pvTmp = RTMemTmpAlloc(cbPreRead + cbThisWrite + cbPostRead); … … 800 800 for (unsigned i = 0; i < g_cBackends; i++) 801 801 { 802 if (! strcmp(pszBackend, g_apBackends[i]->pszBackendName))802 if (!RTStrICmp(pszBackend, g_apBackends[i]->pszBackendName)) 803 803 { 804 804 pEntry->pszBackend = g_apBackends[i]->pszBackendName; … … 921 921 { 922 922 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)) 924 934 { 925 935 /* Copy the name into the new string. */ … … 934 944 break; 935 945 } 946 rc = VERR_NOT_SUPPORTED; 936 947 } 937 948 } … … 1058 1069 && enmImageType != VD_IMAGE_TYPE_NORMAL) 1059 1070 { 1060 rc = VERR_VD I_INVALID_TYPE;1071 rc = VERR_VD_INVALID_TYPE; 1061 1072 break; 1062 1073 } … … 1066 1077 && enmImageType != VD_IMAGE_TYPE_DIFF) 1067 1078 { 1068 rc = VERR_VD I_INVALID_TYPE;1079 rc = VERR_VD_INVALID_TYPE; 1069 1080 break; 1070 1081 } … … 1260 1271 AssertMsgBreakStmt(pDisk->cImages == 0, 1261 1272 ("Create base image cannot be done with other images open\n"), 1262 rc = VERR_VD I_INVALID_STATE);1273 rc = VERR_VD_INVALID_STATE); 1263 1274 1264 1275 /* Set up image descriptor. */ … … 1460 1471 AssertMsgBreakStmt(pDisk->cImages != 0, 1461 1472 ("Create diff image cannot be done without other images open\n"), 1462 rc = VERR_VD I_INVALID_STATE);1473 rc = VERR_VD_INVALID_STATE); 1463 1474 1464 1475 /* Set up image descriptor. */ … … 1597 1608 * 1598 1609 * @returns VBox status code. 1599 * @returns VERR_VD I_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. 1600 1611 * @param pDisk Pointer to HDD container. 1601 1612 * @param nImageFrom Name of the image file to merge from. … … 1628 1639 if (!pImageFrom || !pImageTo) 1629 1640 { 1630 rc = VERR_VD I_IMAGE_NOT_FOUND;1641 rc = VERR_VD_IMAGE_NOT_FOUND; 1631 1642 break; 1632 1643 } … … 1674 1685 uOffset, pvBuf, cbThisRead, 1675 1686 &cbThisRead); 1676 if (rc == VERR_VD I_BLOCK_FREE)1687 if (rc == VERR_VD_BLOCK_FREE) 1677 1688 { 1678 1689 /* Search for image with allocated block. Do not attempt to … … 1681 1692 * block sizes are used for the images. */ 1682 1693 for (PVDIMAGE pCurrImage = pImageTo->pPrev; 1683 pCurrImage != NULL && pCurrImage != pImageFrom->pPrev && rc == VERR_VD I_BLOCK_FREE;1694 pCurrImage != NULL && pCurrImage != pImageFrom->pPrev && rc == VERR_VD_BLOCK_FREE; 1684 1695 pCurrImage = pCurrImage->pPrev) 1685 1696 { … … 1690 1701 } 1691 1702 1692 if (rc != VERR_VD I_BLOCK_FREE)1703 if (rc != VERR_VD_BLOCK_FREE) 1693 1704 { 1694 1705 if (RT_FAILURE(rc)) … … 1728 1739 { 1729 1740 size_t cbThisRead = RT_MIN(VD_MERGE_BUFFER_SIZE, cbRemaining); 1730 rc = VERR_VD I_BLOCK_FREE;1741 rc = VERR_VD_BLOCK_FREE; 1731 1742 /* Search for image with allocated block. Do not attempt to 1732 1743 * read more than the previous reads marked as valid. Otherwise … … 1734 1745 * used for the images. */ 1735 1746 for (PVDIMAGE pCurrImage = pImageFrom; 1736 pCurrImage != NULL && pCurrImage != pImageTo && rc == VERR_VD I_BLOCK_FREE;1747 pCurrImage != NULL && pCurrImage != pImageTo && rc == VERR_VD_BLOCK_FREE; 1737 1748 pCurrImage = pCurrImage->pPrev) 1738 1749 { … … 1742 1753 } 1743 1754 1744 if (rc != VERR_VD I_BLOCK_FREE)1755 if (rc != VERR_VD_BLOCK_FREE) 1745 1756 { 1746 1757 if (RT_FAILURE(rc)) … … 1846 1857 * 1847 1858 * @returns VBox status code. 1848 * @returns VERR_VD I_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. 1849 1860 * @param pDiskFrom Pointer to source HDD container. 1850 1861 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 1894 1905 1895 1906 PVDIMAGE pImageFrom = vdGetImageByNumber(pDiskFrom, nImage); 1896 AssertPtrBreakStmt(pImageFrom, rc = VERR_VD I_IMAGE_NOT_FOUND);1907 AssertPtrBreakStmt(pImageFrom, rc = VERR_VD_IMAGE_NOT_FOUND); 1897 1908 AssertMsgBreakStmt(VALID_PTR(pDiskTo), ("pDiskTo=%#p\n", pDiskTo), 1898 1909 rc = VERR_INVALID_PARAMETER); … … 1902 1913 /* If the containers are equal and the backend is the same, rename the image. */ 1903 1914 if ( (pDiskFrom == pDiskTo) 1904 && (! strcmp(pszBackend, pImageFrom->Backend->pszBackendName)))1915 && (!RTStrICmp(pszBackend, pImageFrom->Backend->pszBackendName))) 1905 1916 { 1906 1917 /* Rename the image. */ … … 1911 1922 /* If the fMoveByRename flag is set and the backend is the same, rename the image. */ 1912 1923 if ( (fMoveByRename == true) 1913 && (! strcmp(pszBackend, pImageFrom->Backend->pszBackendName)))1924 && (!RTStrICmp(pszBackend, pImageFrom->Backend->pszBackendName))) 1914 1925 { 1915 1926 /* Close the source image. */ … … 1962 1973 if (cbSizeFrom == 0) 1963 1974 { 1964 rc = VERR_VD I_VALUE_NOT_FOUND;1975 rc = VERR_VD_VALUE_NOT_FOUND; 1965 1976 break; 1966 1977 } … … 1998 2009 1999 2010 pImageTo = pDiskTo->pLast; 2000 AssertPtrBreakStmt(pImageTo, rc = VERR_VD I_IMAGE_NOT_FOUND);2011 AssertPtrBreakStmt(pImageTo, rc = VERR_VD_IMAGE_NOT_FOUND); 2001 2012 2002 2013 /* Allocate tmp buffer. */ … … 2049 2060 /* If fMoveByRename is set but the backend is different, close and delete pImageFrom. */ 2050 2061 if ( (fMoveByRename == true) 2051 && ( strcmp(pszBackend, pImageFrom->Backend->pszBackendName)))2062 && (RTStrICmp(pszBackend, pImageFrom->Backend->pszBackendName))) 2052 2063 { 2053 2064 vdRemoveImageFromList(pDiskFrom, pImageFrom); … … 2107 2118 * 2108 2119 * @returns VBox status code. 2109 * @returns VERR_VD I_NOT_OPENED if no image is opened in HDD container.2120 * @returns VERR_VD_NOT_OPENED if no image is opened in HDD container. 2110 2121 * @param pDisk Pointer to HDD container. 2111 2122 * @param fDelete If true, delete the image from the host disk. … … 2123 2134 2124 2135 PVDIMAGE pImage = pDisk->pLast; 2125 AssertPtrBreakStmt(pImage, rc = VERR_VD I_NOT_OPENED);2136 AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED); 2126 2137 unsigned uOpenFlags = pImage->Backend->pfnGetOpenFlags(pImage->pvBackendData); 2127 2138 /* Remove image from list of opened images. */ … … 2234 2245 * 2235 2246 * @returns VBox status code. 2236 * @returns VERR_VD I_NOT_OPENED if no image is opened in HDD container.2247 * @returns VERR_VD_NOT_OPENED if no image is opened in HDD container. 2237 2248 * @param pDisk Pointer to HDD container. 2238 2249 * @param uOffset Offset of first reading byte from start of disk. … … 2266 2277 2267 2278 PVDIMAGE pImage = pDisk->pLast; 2268 AssertPtrBreakStmt(pImage, rc = VERR_VD I_NOT_OPENED);2279 AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED); 2269 2280 2270 2281 rc = vdReadHelper(pDisk, pImage, uOffset, pvBuf, cbRead); … … 2279 2290 * 2280 2291 * @returns VBox status code. 2281 * @returns VERR_VD I_NOT_OPENED if no image is opened in HDD container.2292 * @returns VERR_VD_NOT_OPENED if no image is opened in HDD container. 2282 2293 * @param pDisk Pointer to HDD container. 2283 2294 * @param uOffset Offset of the first byte being … … 2312 2323 2313 2324 PVDIMAGE pImage = pDisk->pLast; 2314 AssertPtrBreakStmt(pImage, rc = VERR_VD I_NOT_OPENED);2325 AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED); 2315 2326 2316 2327 vdSetModifiedFlag(pDisk); … … 2326 2337 * 2327 2338 * @returns VBox status code. 2328 * @returns VERR_VD I_NOT_OPENED if no image is opened in HDD container.2339 * @returns VERR_VD_NOT_OPENED if no image is opened in HDD container. 2329 2340 * @param pDisk Pointer to HDD container. 2330 2341 */ … … 2341 2352 2342 2353 PVDIMAGE pImage = pDisk->pLast; 2343 AssertPtrBreakStmt(pImage, rc = VERR_VD I_NOT_OPENED);2354 AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED); 2344 2355 2345 2356 vdResetModifiedFlag(pDisk); … … 2465 2476 * 2466 2477 * @returns VBox status code. 2467 * @returns VERR_VD I_IMAGE_NOT_FOUND if image with specified number was not opened.2468 * @returns VERR_VD I_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. 2469 2480 * @param pDisk Pointer to HDD container. 2470 2481 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 2490 2501 2491 2502 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 2492 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);2503 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 2493 2504 2494 2505 if (pImage == pDisk->pLast) … … 2498 2509 *pPCHSGeometry = pDisk->PCHSGeometry; 2499 2510 else 2500 rc = VERR_VD I_GEOMETRY_NOT_SET;2511 rc = VERR_VD_GEOMETRY_NOT_SET; 2501 2512 } 2502 2513 else … … 2517 2528 * 2518 2529 * @returns VBox status code. 2519 * @returns VERR_VD I_IMAGE_NOT_FOUND if image with specified number was not opened.2520 * @returns VERR_VD I_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. 2521 2532 * @param pDisk Pointer to HDD container. 2522 2533 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 2548 2559 2549 2560 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 2550 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);2561 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 2551 2562 2552 2563 if (pImage == pDisk->pLast) … … 2611 2622 * 2612 2623 * @returns VBox status code. 2613 * @returns VERR_VD I_IMAGE_NOT_FOUND if image with specified number was not opened.2614 * @returns VERR_VD I_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. 2615 2626 * @param pDisk Pointer to HDD container. 2616 2627 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 2636 2647 2637 2648 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 2638 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);2649 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 2639 2650 2640 2651 if (pImage == pDisk->pLast) … … 2644 2655 *pLCHSGeometry = pDisk->LCHSGeometry; 2645 2656 else 2646 rc = VERR_VD I_GEOMETRY_NOT_SET;2657 rc = VERR_VD_GEOMETRY_NOT_SET; 2647 2658 } 2648 2659 else … … 2663 2674 * 2664 2675 * @returns VBox status code. 2665 * @returns VERR_VD I_IMAGE_NOT_FOUND if image with specified number was not opened.2666 * @returns VERR_VD I_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. 2667 2678 * @param pDisk Pointer to HDD container. 2668 2679 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 2694 2705 2695 2706 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 2696 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);2707 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 2697 2708 2698 2709 if (pImage == pDisk->pLast) … … 2757 2768 * 2758 2769 * @returns VBox status code. 2759 * @returns VERR_VD I_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. 2760 2771 * @param pDisk Pointer to HDD container. 2761 2772 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 2781 2792 2782 2793 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 2783 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);2794 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 2784 2795 2785 2796 *puVersion = pImage->Backend->pfnGetVersion(pImage->pvBackendData); … … 2794 2805 * 2795 2806 * @returns VBox status code. 2796 * @returns VERR_VD I_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. 2797 2808 * @param pDisk Pointer to HDD container. 2798 2809 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 2818 2829 2819 2830 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 2820 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);2831 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 2821 2832 2822 2833 if ( pImage->enmImageType >= VD_IMAGE_TYPE_FIRST … … 2827 2838 } 2828 2839 else 2829 rc = VERR_VD I_INVALID_TYPE;2840 rc = VERR_VD_INVALID_TYPE; 2830 2841 } while (0); 2831 2842 … … 2839 2850 * 2840 2851 * @returns VBox status code. 2841 * @returns VERR_VD I_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. 2842 2853 * @param pDisk Pointer to the HDD container. 2843 2854 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 2863 2874 2864 2875 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 2865 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);2876 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 2866 2877 2867 2878 if ( pImage->enmImageType >= VD_IMAGE_TYPE_FIRST … … 2875 2886 } 2876 2887 else 2877 rc = VERR_VD I_INVALID_TYPE;2888 rc = VERR_VD_INVALID_TYPE; 2878 2889 } while (0); 2879 2890 … … 2886 2897 * 2887 2898 * @returns VBox status code. 2888 * @returns VERR_VD I_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. 2889 2900 * @param pDisk Pointer to HDD container. 2890 2901 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 2910 2921 2911 2922 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 2912 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);2923 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 2913 2924 2914 2925 *puImageFlags = pImage->Backend->pfnGetImageFlags(pImage->pvBackendData); … … 2923 2934 * 2924 2935 * @returns VBox status code. 2925 * @returns VERR_VD I_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. 2926 2937 * @param pDisk Pointer to HDD container. 2927 2938 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 2947 2958 2948 2959 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 2949 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);2960 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 2950 2961 2951 2962 *puOpenFlags = pImage->Backend->pfnGetOpenFlags(pImage->pvBackendData); … … 2962 2973 * 2963 2974 * @returns VBox status code. 2964 * @returns VERR_VD I_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. 2965 2976 * @param pDisk Pointer to HDD container. 2966 2977 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 2985 2996 2986 2997 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 2987 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);2998 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 2988 2999 2989 3000 rc = pImage->Backend->pfnSetOpenFlags(pImage->pvBackendData, … … 3001 3012 * 3002 3013 * @returns VBox status code. 3003 * @returns VERR_VD I_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. 3004 3015 * @returns VERR_BUFFER_OVERFLOW if pszFilename buffer too small to hold filename. 3005 3016 * @param pDisk Pointer to HDD container. … … 3030 3041 3031 3042 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 3032 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);3043 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 3033 3044 3034 3045 size_t cb = strlen(pImage->pszFilename); … … 3054 3065 * 3055 3066 * @returns VBox status code. 3056 * @returns VERR_VD I_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. 3057 3068 * @returns VERR_BUFFER_OVERFLOW if pszComment buffer too small to hold comment text. 3058 3069 * @param pDisk Pointer to HDD container. … … 3083 3094 3084 3095 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 3085 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);3096 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 3086 3097 3087 3098 rc = pImage->Backend->pfnGetComment(pImage->pvBackendData, pszComment, … … 3097 3108 * 3098 3109 * @returns VBox status code. 3099 * @returns VERR_VD I_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. 3100 3111 * @param pDisk Pointer to HDD container. 3101 3112 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 3121 3132 3122 3133 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 3123 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);3134 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 3124 3135 3125 3136 rc = pImage->Backend->pfnSetComment(pImage->pvBackendData, pszComment); … … 3135 3146 * 3136 3147 * @returns VBox status code. 3137 * @returns VERR_VD I_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. 3138 3149 * @param pDisk Pointer to HDD container. 3139 3150 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 3157 3168 3158 3169 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 3159 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);3170 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 3160 3171 3161 3172 rc = pImage->Backend->pfnGetUuid(pImage->pvBackendData, pUuid); … … 3170 3181 * 3171 3182 * @returns VBox status code. 3172 * @returns VERR_VD I_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. 3173 3184 * @param pDisk Pointer to HDD container. 3174 3185 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 3192 3203 3193 3204 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 3194 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);3205 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 3195 3206 3196 3207 RTUUID Uuid; … … 3211 3222 * 3212 3223 * @returns VBox status code. 3213 * @returns VERR_VD I_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. 3214 3225 * @param pDisk Pointer to HDD container. 3215 3226 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 3233 3244 3234 3245 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 3235 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);3246 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 3236 3247 3237 3248 rc = pImage->Backend->pfnGetModificationUuid(pImage->pvBackendData, … … 3247 3258 * 3248 3259 * @returns VBox status code. 3249 * @returns VERR_VD I_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. 3250 3261 * @param pDisk Pointer to HDD container. 3251 3262 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 3270 3281 3271 3282 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 3272 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);3283 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 3273 3284 3274 3285 RTUUID Uuid; … … 3290 3301 * 3291 3302 * @returns VBox status code. 3292 * @returns VERR_VD I_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. 3293 3304 * @param pDisk Pointer to HDD container. 3294 3305 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 3313 3324 3314 3325 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 3315 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);3326 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 3316 3327 3317 3328 rc = pImage->Backend->pfnGetParentUuid(pImage->pvBackendData, pUuid); … … 3349 3360 3350 3361 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 3351 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);3362 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 3352 3363 3353 3364 RTUUID Uuid; … … 3392 3403 * 3393 3404 * @returns VBox status code. 3394 * @returns VERR_VD I_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. 3395 3406 * @param pDisk Pointer to the HDD container. 3396 3407 * @param nImage Image number, counts from 0. 0 is always base image of container. … … 3414 3425 3415 3426 PVDIMAGE pImage = vdGetImageByNumber(pDisk, nImage); 3416 AssertPtrBreakStmt(pImage, rc = VERR_VD I_IMAGE_NOT_FOUND);3427 AssertPtrBreakStmt(pImage, rc = VERR_VD_IMAGE_NOT_FOUND); 3417 3428 3418 3429 if (pImage->Backend->uBackendCaps & VD_CAP_ASYNC) … … 3441 3452 void *pvUser) 3442 3453 { 3443 int rc = VERR_VD I_BLOCK_FREE;3454 int rc = VERR_VD_BLOCK_FREE; 3444 3455 3445 3456 LogFlowFunc(("pDisk=%#p uOffset=%llu paSeg=%p cSeg=%u cbRead=%zu\n", … … 3468 3479 3469 3480 PVDIMAGE pImage = pDisk->pLast; 3470 AssertPtrBreakStmt(pImage, rc = VERR_VD I_NOT_OPENED);3481 AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED); 3471 3482 3472 3483 /* @todo: This does not work for images which do not have all meta data in memory. */ 3473 3484 for (PVDIMAGE pCurrImage = pImage; 3474 pCurrImage != NULL && rc == VERR_VD I_BLOCK_FREE;3485 pCurrImage != NULL && rc == VERR_VD_BLOCK_FREE; 3475 3486 pCurrImage = pCurrImage->pPrev) 3476 3487 { … … 3481 3492 3482 3493 /* No image in the chain contains the data for the block. */ 3483 if (rc == VERR_VD I_BLOCK_FREE)3494 if (rc == VERR_VD_BLOCK_FREE) 3484 3495 { 3485 3496 for (unsigned i = 0; i < cSeg && (cbRead > 0); i++) … … 3489 3500 } 3490 3501 /* Request finished without the need to enqueue a async I/O request. Tell caller. */ 3491 rc = VINF_VD I_ASYNC_IO_FINISHED;3502 rc = VINF_VD_ASYNC_IO_FINISHED; 3492 3503 } 3493 3504 … … 3541 3552 3542 3553 PVDIMAGE pImage = pDisk->pLast; 3543 AssertPtrBreakStmt(pImage, rc = VERR_VD I_NOT_OPENED);3554 AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED); 3544 3555 3545 3556 vdSetModifiedFlag(pDisk); -
trunk/src/VBox/Devices/Storage/VBoxHDD-newInternal.h
r14967 r15366 161 161 * 162 162 * @returns VBox status code. 163 * @returns VINF_VD I_BLOCK_FREE if this image contains no data for this block.164 * @returns VINF_VD I_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. 165 165 * @param pvBackendData Opaque state data for this image. 166 166 * @param off Offset to start reading from. … … 177 177 * 178 178 * @returns VBox status code. 179 * @returns VINF_VD I_BLOCK_FREE if this image contains no data for this block and179 * @returns VINF_VD_BLOCK_FREE if this image contains no data for this block and 180 180 * this is not a full-block write. The write must be repeated with 181 181 * the correct amount of prefix/postfix data read from the images below … … 189 189 * @param pcbWriteProcess Pointer to returned number of bytes that could 190 190 * be processed. In case the function returned 191 * VINF_VD I_BLOCK_FREE this is the number of bytes191 * VINF_VD_BLOCK_FREE this is the number of bytes 192 192 * that could be written in a full block write, 193 193 * when prefixed/postfixed by the appropriate … … 250 250 * 251 251 * @returns VBox status code. 252 * @returns VERR_VD I_GEOMETRY_NOT_SET if no geometry present in the image.252 * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the image. 253 253 * @param pvBackendData Opaque state data for this image. 254 254 * @param pPCHSGeometry Where to store the geometry. Not NULL. … … 270 270 * 271 271 * @returns VBox status code. 272 * @returns VERR_VD I_GEOMETRY_NOT_SET if no geometry present in the image.272 * @returns VERR_VD_GEOMETRY_NOT_SET if no geometry present in the image. 273 273 * @param pvBackendData Opaque state data for this image. 274 274 * @param pLCHSGeometry Where to store the geometry. Not NULL. -
trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
r14967 r15366 117 117 { 118 118 if (pPreHdr->u32Signature != VDI_IMAGE_SIGNATURE) 119 return VERR_VD I_INVALID_SIGNATURE;119 return VERR_VD_VDI_INVALID_SIGNATURE; 120 120 121 121 if ( VDI_GET_VERSION_MAJOR(pPreHdr->u32Version) != VDI_IMAGE_VERSION_MAJOR 122 122 && pPreHdr->u32Version != 0x00000002) /* old version. */ 123 return VERR_VD I_UNSUPPORTED_VERSION;123 return VERR_VD_VDI_UNSUPPORTED_VERSION; 124 124 125 125 return VINF_SUCCESS; … … 246 246 LogRel(("VDI: v1 header size wrong (%d < %d)\n", 247 247 pHeader->u.v1.cbHeader, sizeof(VDIHEADER1))); 248 return VERR_VD I_INVALID_HEADER;248 return VERR_VD_VDI_INVALID_HEADER; 249 249 } 250 250 … … 253 253 LogRel(("VDI: v1 blocks offset wrong (%d < %d)\n", 254 254 getImageBlocksOffset(pHeader), sizeof(VDIPREHEADER) + sizeof(VDIHEADER1))); 255 return VERR_VD I_INVALID_HEADER;255 return VERR_VD_VDI_INVALID_HEADER; 256 256 } 257 257 … … 260 260 LogRel(("VDI: v1 image data offset wrong (%d < %d)\n", 261 261 getImageDataOffset(pHeader), getImageBlocksOffset(pHeader) + getImageBlocks(pHeader) * sizeof(VDIIMAGEBLOCKPOINTER))); 262 return VERR_VD I_INVALID_HEADER;262 return VERR_VD_VDI_INVALID_HEADER; 263 263 } 264 264 … … 267 267 default: 268 268 /* Unsupported. */ 269 return VERR_VD I_UNSUPPORTED_VERSION;269 return VERR_VD_VDI_UNSUPPORTED_VERSION; 270 270 } 271 271 … … 342 342 } 343 343 344 return fFailed ? VERR_VD I_INVALID_HEADER : VINF_SUCCESS;344 return fFailed ? VERR_VD_VDI_INVALID_HEADER : VINF_SUCCESS; 345 345 } 346 346 … … 381 381 && strlen(pszComment) >= VDI_IMAGE_COMMENT_SIZE) 382 382 { 383 rc = vdiError(pImage, VERR_VD I_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); 384 384 goto out; 385 385 } … … 656 656 break; 657 657 default: 658 rc = vdiError(pImage, VERR_VD I_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); 659 659 goto out; 660 660 } … … 663 663 if (RT_FAILURE(rc)) 664 664 { 665 rc = vdiError(pImage, VERR_VD I_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); 666 666 goto out; 667 667 } … … 707 707 break; 708 708 default: 709 rc = VERR_VD I_UNSUPPORTED_VERSION;709 rc = VERR_VD_VDI_UNSUPPORTED_VERSION; 710 710 break; 711 711 } … … 1030 1030 1031 1031 if (pImage->paBlocks[uBlock] == VDI_IMAGE_BLOCK_FREE) 1032 rc = VERR_VD I_BLOCK_FREE;1032 rc = VERR_VD_BLOCK_FREE; 1033 1033 else if (pImage->paBlocks[uBlock] == VDI_IMAGE_BLOCK_ZERO) 1034 1034 { … … 1069 1069 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 1070 1070 { 1071 rc = VERR_VD I_IMAGE_READ_ONLY;1071 rc = VERR_VD_IMAGE_READ_ONLY; 1072 1072 goto out; 1073 1073 } … … 1138 1138 *pcbPreRead = offWrite % getImageBlockSize(&pImage->Header); 1139 1139 *pcbPostRead = getImageBlockSize(&pImage->Header) - cbToWrite - *pcbPreRead; 1140 rc = VERR_VD I_BLOCK_FREE;1140 rc = VERR_VD_BLOCK_FREE; 1141 1141 } 1142 1142 } … … 1201 1201 *penmImageType = vdiTranslateTypeVDI2VD(getImageType(&pImage->Header)); 1202 1202 else 1203 rc = VERR_VD I_NOT_OPENED;1203 rc = VERR_VD_NOT_OPENED; 1204 1204 1205 1205 LogFlowFunc(("returns %Rrc enmImageType=%u\n", rc, *penmImageType)); … … 1267 1267 } 1268 1268 else 1269 rc = VERR_VD I_GEOMETRY_NOT_SET;1270 } 1271 else 1272 rc = VERR_VD I_NOT_OPENED;1269 rc = VERR_VD_GEOMETRY_NOT_SET; 1270 } 1271 else 1272 rc = VERR_VD_NOT_OPENED; 1273 1273 1274 1274 LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors)); … … 1290 1290 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 1291 1291 { 1292 rc = VERR_VD I_IMAGE_READ_ONLY;1292 rc = VERR_VD_IMAGE_READ_ONLY; 1293 1293 goto out; 1294 1294 } … … 1298 1298 } 1299 1299 else 1300 rc = VERR_VD I_NOT_OPENED;1300 rc = VERR_VD_NOT_OPENED; 1301 1301 1302 1302 out: … … 1332 1332 } 1333 1333 else 1334 rc = VERR_VD I_GEOMETRY_NOT_SET;1335 } 1336 else 1337 rc = VERR_VD I_NOT_OPENED;1334 rc = VERR_VD_GEOMETRY_NOT_SET; 1335 } 1336 else 1337 rc = VERR_VD_NOT_OPENED; 1338 1338 1339 1339 LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors)); … … 1356 1356 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 1357 1357 { 1358 rc = VERR_VD I_IMAGE_READ_ONLY;1358 rc = VERR_VD_IMAGE_READ_ONLY; 1359 1359 goto out; 1360 1360 } … … 1374 1374 } 1375 1375 else 1376 rc = VERR_VD I_NOT_OPENED;1376 rc = VERR_VD_NOT_OPENED; 1377 1377 1378 1378 out: … … 1466 1466 } 1467 1467 else 1468 rc = VERR_VD I_NOT_OPENED;1468 rc = VERR_VD_NOT_OPENED; 1469 1469 1470 1470 LogFlowFunc(("returns %Rrc comment=\"%s\"\n", rc, pszComment)); … … 1483 1483 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 1484 1484 { 1485 rc = VERR_VD I_IMAGE_READ_ONLY;1485 rc = VERR_VD_IMAGE_READ_ONLY; 1486 1486 goto out; 1487 1487 } … … 1493 1493 { 1494 1494 LogFunc(("pszComment is too long, %d bytes!\n", cchComment)); 1495 rc = VERR_VD I_COMMENT_TOO_LONG;1495 rc = VERR_VD_VDI_COMMENT_TOO_LONG; 1496 1496 goto out; 1497 1497 } … … 1510 1510 } 1511 1511 else 1512 rc = VERR_VD I_UNSUPPORTED_VERSION;1513 } 1514 else 1515 rc = VERR_VD I_NOT_OPENED;1512 rc = VERR_VD_VDI_UNSUPPORTED_VERSION; 1513 } 1514 else 1515 rc = VERR_VD_NOT_OPENED; 1516 1516 1517 1517 out: … … 1535 1535 } 1536 1536 else 1537 rc = VERR_VD I_NOT_OPENED;1537 rc = VERR_VD_NOT_OPENED; 1538 1538 1539 1539 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 1562 1562 { 1563 1563 LogFunc(("Version is not supported!\n")); 1564 rc = VERR_VD I_UNSUPPORTED_VERSION;1564 rc = VERR_VD_VDI_UNSUPPORTED_VERSION; 1565 1565 } 1566 1566 } 1567 1567 else 1568 rc = VERR_VD I_IMAGE_READ_ONLY;1569 } 1570 else 1571 rc = VERR_VD I_NOT_OPENED;1568 rc = VERR_VD_IMAGE_READ_ONLY; 1569 } 1570 else 1571 rc = VERR_VD_NOT_OPENED; 1572 1572 1573 1573 LogFlowFunc(("returns %Rrc\n", rc)); … … 1590 1590 } 1591 1591 else 1592 rc = VERR_VD I_NOT_OPENED;1592 rc = VERR_VD_NOT_OPENED; 1593 1593 1594 1594 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 1617 1617 { 1618 1618 LogFunc(("Version is not supported!\n")); 1619 rc = VERR_VD I_UNSUPPORTED_VERSION;1619 rc = VERR_VD_VDI_UNSUPPORTED_VERSION; 1620 1620 } 1621 1621 } 1622 1622 else 1623 rc = VERR_VD I_IMAGE_READ_ONLY;1624 } 1625 else 1626 rc = VERR_VD I_NOT_OPENED;1623 rc = VERR_VD_IMAGE_READ_ONLY; 1624 } 1625 else 1626 rc = VERR_VD_NOT_OPENED; 1627 1627 1628 1628 LogFlowFunc(("returns %Rrc\n", rc)); … … 1645 1645 } 1646 1646 else 1647 rc = VERR_VD I_NOT_OPENED;1647 rc = VERR_VD_NOT_OPENED; 1648 1648 1649 1649 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 1672 1672 { 1673 1673 LogFunc(("Version is not supported!\n")); 1674 rc = VERR_VD I_UNSUPPORTED_VERSION;1674 rc = VERR_VD_VDI_UNSUPPORTED_VERSION; 1675 1675 } 1676 1676 } 1677 1677 else 1678 rc = VERR_VD I_IMAGE_READ_ONLY;1679 } 1680 else 1681 rc = VERR_VD I_NOT_OPENED;1678 rc = VERR_VD_IMAGE_READ_ONLY; 1679 } 1680 else 1681 rc = VERR_VD_NOT_OPENED; 1682 1682 1683 1683 LogFlowFunc(("returns %Rrc\n", rc)); … … 1700 1700 } 1701 1701 else 1702 rc = VERR_VD I_NOT_OPENED;1702 rc = VERR_VD_NOT_OPENED; 1703 1703 1704 1704 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 1724 1724 { 1725 1725 LogFunc(("Version is not supported!\n")); 1726 rc = VERR_VD I_UNSUPPORTED_VERSION;1726 rc = VERR_VD_VDI_UNSUPPORTED_VERSION; 1727 1727 } 1728 1728 } 1729 1729 else 1730 rc = VERR_VD I_IMAGE_READ_ONLY;1731 } 1732 else 1733 rc = VERR_VD I_NOT_OPENED;1730 rc = VERR_VD_IMAGE_READ_ONLY; 1731 } 1732 else 1733 rc = VERR_VD_NOT_OPENED; 1734 1734 1735 1735 LogFlowFunc(("returns %Rrc\n", rc)); -
trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp
r14967 r15366 344 344 345 345 if (!pImage) 346 return VERR_VD I_NOT_OPENED;346 return VERR_VD_NOT_OPENED; 347 347 348 348 rc = RTFileReadAt(pImage->File, pImage->u64DataOffset, &ddh, sizeof(ddh), NULL); … … 351 351 if (memcmp(ddh.Cookie, VHD_DYNAMIC_DISK_HEADER_COOKIE, VHD_DYNAMIC_DISK_HEADER_COOKIE_SIZE) != 0) 352 352 { 353 return VERR_VD I_INVALID_HEADER;353 return VERR_VD_VHD_INVALID_HEADER; 354 354 } 355 355 uint32_t u32Checksum = RT_BE2H_U32(ddh.Checksum); … … 357 357 if (u32Checksum != vhdChecksum(&ddh, sizeof(ddh))) 358 358 { 359 return VERR_VD I_INVALID_HEADER;359 return VERR_VD_VHD_INVALID_HEADER; 360 360 } 361 361 /* Update parent's timestamp. */ … … 423 423 rc = RTFileReadAt(File, pImage->uCurrentEndOfFile, &vhdFooter, sizeof(VHDFooter), NULL); 424 424 if (memcmp(vhdFooter.Cookie, VHD_FOOTER_COOKIE, VHD_FOOTER_COOKIE_SIZE) != 0) { 425 return VERR_VD I_INVALID_HEADER;425 return VERR_VD_VHD_INVALID_HEADER; 426 426 } 427 427 … … 588 588 rc = RTFileOpen(&File, pszFilename, RTFILE_O_READ | RTFILE_O_OPEN); 589 589 if (RT_FAILURE(rc)) 590 return VERR_VD I_INVALID_HEADER;590 return VERR_VD_VHD_INVALID_HEADER; 591 591 592 592 rc = RTFileGetSize(File, &cbFile); … … 594 594 { 595 595 RTFileClose(File); 596 return VERR_VD I_INVALID_HEADER;596 return VERR_VD_VHD_INVALID_HEADER; 597 597 } 598 598 599 599 rc = RTFileReadAt(File, cbFile - sizeof(VHDFooter), &vhdFooter, sizeof(VHDFooter), NULL); 600 600 if (RT_FAILURE(rc) || (memcmp(vhdFooter.Cookie, VHD_FOOTER_COOKIE, VHD_FOOTER_COOKIE_SIZE) != 0)) 601 rc = VERR_VD I_INVALID_HEADER;601 rc = VERR_VD_VHD_INVALID_HEADER; 602 602 else 603 603 rc = VINF_SUCCESS; … … 631 631 *penmImageType = pImage->enmImageType; 632 632 else 633 rc = VERR_VD I_NOT_OPENED;633 rc = VERR_VD_NOT_OPENED; 634 634 635 635 return rc; … … 651 651 } 652 652 else 653 rc = VERR_VD I_GEOMETRY_NOT_SET;654 } 655 else 656 rc = VERR_VD I_NOT_OPENED;653 rc = VERR_VD_GEOMETRY_NOT_SET; 654 } 655 else 656 rc = VERR_VD_NOT_OPENED; 657 657 658 658 LogFlowFunc(("returned %Rrc (CHS=%u/%u/%u)\n", rc, pImage->PCHSGeometry.cCylinders, pImage->PCHSGeometry.cHeads, pImage->PCHSGeometry.cSectors)); … … 671 671 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 672 672 { 673 rc = VERR_VD I_IMAGE_READ_ONLY;673 rc = VERR_VD_IMAGE_READ_ONLY; 674 674 goto out; 675 675 } … … 679 679 } 680 680 else 681 rc = VERR_VD I_NOT_OPENED;681 rc = VERR_VD_NOT_OPENED; 682 682 683 683 out: … … 701 701 } 702 702 else 703 rc = VERR_VD I_GEOMETRY_NOT_SET;704 } 705 else 706 rc = VERR_VD I_NOT_OPENED;703 rc = VERR_VD_GEOMETRY_NOT_SET; 704 } 705 else 706 rc = VERR_VD_NOT_OPENED; 707 707 708 708 LogFlowFunc(("returned %Rrc (CHS=%u/%u/%u)\n", rc, pImage->LCHSGeometry.cCylinders, pImage->LCHSGeometry.cHeads, pImage->LCHSGeometry.cSectors)); … … 721 721 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 722 722 { 723 rc = VERR_VD I_IMAGE_READ_ONLY;723 rc = VERR_VD_IMAGE_READ_ONLY; 724 724 goto out; 725 725 } … … 729 729 } 730 730 else 731 rc = VERR_VD I_NOT_OPENED;731 rc = VERR_VD_NOT_OPENED; 732 732 733 733 out: … … 891 891 /* Return block size as read. */ 892 892 *pcbActuallyRead = RT_MIN(cbRead, pImage->cSectorsPerDataBlock * VHD_SECTOR_SIZE); 893 return VERR_VD I_BLOCK_FREE;893 return VERR_VD_BLOCK_FREE; 894 894 } 895 895 … … 976 976 cbRead = cSectors * VHD_SECTOR_SIZE; 977 977 Log(("%s: Sectors free: uVhdOffset=%llu cbRead=%u\n", uVhdOffset, cbRead)); 978 rc = VERR_VD I_BLOCK_FREE;978 rc = VERR_VD_BLOCK_FREE; 979 979 } 980 980 } … … 1187 1187 } 1188 1188 else 1189 rc = VERR_VD I_NOT_OPENED;1189 rc = VERR_VD_NOT_OPENED; 1190 1190 LogFlowFunc(("returned %Rrc (%RTuuid)\n", rc, pUuid)); 1191 1191 return rc; … … 1207 1207 } 1208 1208 else 1209 rc = VERR_VD I_NOT_OPENED;1209 rc = VERR_VD_NOT_OPENED; 1210 1210 LogFlowFunc(("returned %Rrc\n", rc)); 1211 1211 return rc; … … 1221 1221 if (pImage) 1222 1222 { 1223 rc = VERR_ VDI_VALUE_NOT_FOUND;1224 } 1225 else 1226 rc = VERR_VD I_NOT_OPENED;1223 rc = VERR_NOT_SUPPORTED; 1224 } 1225 else 1226 rc = VERR_VD_NOT_OPENED; 1227 1227 1228 1228 LogFlowFunc(("returned %Rrc comment='%s'\n", rc, pszComment)); … … 1244 1244 } 1245 1245 else 1246 rc = VERR_VD I_NOT_OPENED;1246 rc = VERR_VD_NOT_OPENED; 1247 1247 1248 1248 LogFlowFunc(("returned %Rrc\n", rc)); … … 1259 1259 if (pImage) 1260 1260 { 1261 rc = VERR_ VDI_VALUE_NOT_FOUND;1262 } 1263 else 1264 rc = VERR_VD I_NOT_OPENED;1261 rc = VERR_NOT_SUPPORTED; 1262 } 1263 else 1264 rc = VERR_VD_NOT_OPENED; 1265 1265 LogFlowFunc(("returned %Rrc (%RTuuid)\n", rc, pUuid)); 1266 1266 return rc; … … 1280 1280 } 1281 1281 else 1282 rc = VERR_VD I_NOT_OPENED;1282 rc = VERR_VD_NOT_OPENED; 1283 1283 LogFlowFunc(("returned %Rrc\n", rc)); 1284 1284 return rc; … … 1298 1298 } 1299 1299 else 1300 rc = VERR_VD I_NOT_OPENED;1300 rc = VERR_VD_NOT_OPENED; 1301 1301 LogFlowFunc(("returned %Rrc (%RTuuid)\n", rc, pUuid)); 1302 1302 return rc; … … 1322 1322 } 1323 1323 else 1324 rc = VERR_VD I_NOT_OPENED;1324 rc = VERR_VD_NOT_OPENED; 1325 1325 LogFlowFunc(("returned %Rrc\n", rc)); 1326 1326 return rc; … … 1336 1336 if (pImage) 1337 1337 { 1338 rc = VERR_ VDI_VALUE_NOT_FOUND;1339 } 1340 else 1341 rc = VERR_VD I_NOT_OPENED;1338 rc = VERR_NOT_SUPPORTED; 1339 } 1340 else 1341 rc = VERR_VD_NOT_OPENED; 1342 1342 LogFlowFunc(("returned %Rrc (%RTuuid)\n", rc, pUuid)); 1343 1343 return rc; … … 1357 1357 } 1358 1358 else 1359 rc = VERR_VD I_NOT_OPENED;1359 rc = VERR_VD_NOT_OPENED; 1360 1360 LogFlowFunc(("returned %Rrc\n", rc)); 1361 1361 return rc; … … 1759 1759 } 1760 1760 else 1761 rc = VERR_VD I_NOT_OPENED;1761 rc = VERR_VD_NOT_OPENED; 1762 1762 LogFlowFunc(("returned %Rrc\n", rc)); 1763 1763 return rc; … … 1773 1773 vhdTime2RtTime(pTimeStamp, pImage->u32ParentTimeStamp); 1774 1774 else 1775 rc = VERR_VD I_NOT_OPENED;1775 rc = VERR_VD_NOT_OPENED; 1776 1776 LogFlowFunc(("returned %Rrc\n", rc)); 1777 1777 return rc; … … 1787 1787 { 1788 1788 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 1789 rc = VERR_VD I_IMAGE_READ_ONLY;1789 rc = VERR_VD_IMAGE_READ_ONLY; 1790 1790 else 1791 1791 { … … 1795 1795 } 1796 1796 else 1797 rc = VERR_VD I_NOT_OPENED;1797 rc = VERR_VD_NOT_OPENED; 1798 1798 LogFlowFunc(("returned %Rrc\n", rc)); 1799 1799 return rc; … … 1809 1809 *ppszParentFilename = RTStrDup(pImage->pszParentFilename); 1810 1810 else 1811 rc = VERR_VD I_NOT_OPENED;1811 rc = VERR_VD_NOT_OPENED; 1812 1812 LogFlowFunc(("returned %Rrc\n", rc)); 1813 1813 return rc; … … 1823 1823 { 1824 1824 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 1825 rc = VERR_VD I_IMAGE_READ_ONLY;1825 rc = VERR_VD_IMAGE_READ_ONLY; 1826 1826 else 1827 1827 { … … 1836 1836 } 1837 1837 else 1838 rc = VERR_VD I_NOT_OPENED;1838 rc = VERR_VD_NOT_OPENED; 1839 1839 LogFlowFunc(("returned %Rrc\n", rc)); 1840 1840 return rc; -
trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
r14967 r15366 758 758 else if (CpQ == '\0') 759 759 { 760 rc = VERR_VD I_INVALID_HEADER;760 rc = VERR_VD_VMDK_INVALID_HEADER; 761 761 break; 762 762 } … … 859 859 RTMemTmpFree(pTmpGT1); 860 860 RTMemTmpFree(pTmpGT2); 861 rc = vmdkError(pExtent->pImage, VERR_VD I_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); 862 862 goto out; 863 863 } … … 884 884 RTMemTmpFree(pTmpGT1); 885 885 RTMemTmpFree(pTmpGT2); 886 rc = vmdkError(pExtent->pImage, VERR_VD I_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); 887 887 goto out; 888 888 } … … 1003 1003 pszStr++; 1004 1004 if (*pszStr++ != '"') 1005 return vmdkError(pImage, VERR_VD I_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); 1006 1006 1007 1007 pszQ = (char *)strchr(pszStr, '"'); 1008 1008 if (pszQ == NULL) 1009 return vmdkError(pImage, VERR_VD I_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); 1010 1010 pszUnquoted = (char *)RTMemTmpAlloc(pszQ - pszStr + 1); 1011 1011 if (!pszUnquoted) … … 1183 1183 if (!vmdkDescGetStr(pDescriptor, pDescriptor->uFirstDesc, pszKey, 1184 1184 &pszValue)) 1185 return VERR_VD I_VALUE_NOT_FOUND;1185 return VERR_VD_VMDK_VALUE_NOT_FOUND; 1186 1186 return RTStrToUInt32Ex(pszValue, NULL, 10, puValue); 1187 1187 } … … 1195 1195 if (!vmdkDescGetStr(pDescriptor, pDescriptor->uFirstDesc, pszKey, 1196 1196 &pszValue)) 1197 return VERR_VD I_VALUE_NOT_FOUND;1197 return VERR_VD_VMDK_VALUE_NOT_FOUND; 1198 1198 int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL); 1199 1199 if (RT_FAILURE(rc)) … … 1324 1324 if (!vmdkDescGetStr(pDescriptor, pDescriptor->uFirstDDB, pszKey, 1325 1325 &pszValue)) 1326 return VERR_VD I_VALUE_NOT_FOUND;1326 return VERR_VD_VMDK_VALUE_NOT_FOUND; 1327 1327 int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL); 1328 1328 if (RT_FAILURE(rc)) … … 1340 1340 if (!vmdkDescGetStr(pDescriptor, pDescriptor->uFirstDDB, pszKey, 1341 1341 &pszValue)) 1342 return VERR_VD I_VALUE_NOT_FOUND;1342 return VERR_VD_VMDK_VALUE_NOT_FOUND; 1343 1343 int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL); 1344 1344 if (RT_FAILURE(rc)) … … 1357 1357 if (!vmdkDescGetStr(pDescriptor, pDescriptor->uFirstDDB, pszKey, 1358 1358 &pszValue)) 1359 return VERR_VD I_VALUE_NOT_FOUND;1359 return VERR_VD_VMDK_VALUE_NOT_FOUND; 1360 1360 int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL); 1361 1361 if (RT_FAILURE(rc)) … … 1429 1429 if (cLine >= VMDK_DESCRIPTOR_LINES_MAX) 1430 1430 { 1431 rc = vmdkError(pImage, VERR_VD I_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); 1432 1432 goto out; 1433 1433 } … … 1439 1439 if (*(pTmp + 1) != '\n') 1440 1440 { 1441 rc = vmdkError(pImage, VERR_VD I_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); 1442 1442 goto out; 1443 1443 } … … 1464 1464 && strcmp(pDescriptor->aLines[0], "# Disk Descriptor File")) 1465 1465 { 1466 rc = vmdkError(pImage, VERR_VD I_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); 1467 1467 goto out; 1468 1468 } … … 1484 1484 { 1485 1485 /* Incorrect ordering of entries. */ 1486 rc = vmdkError(pImage, VERR_VD I_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); 1487 1487 goto out; 1488 1488 } … … 1499 1499 { 1500 1500 /* Incorrect ordering of entries. */ 1501 rc = vmdkError(pImage, VERR_VD I_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); 1502 1502 goto out; 1503 1503 } … … 1514 1514 { 1515 1515 /* Incorrect ordering of entries. */ 1516 rc = vmdkError(pImage, VERR_VD I_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); 1517 1517 goto out; 1518 1518 } … … 1659 1659 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error finding key 'version' in descriptor in '%s'"), pImage->pszFilename); 1660 1660 if (uVersion != 1) 1661 return vmdkError(pImage, VERR_VD I_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); 1662 1662 1663 1663 /* Get image creation type and determine image flags. */ … … 1686 1686 { 1687 1687 /* Monolithic image, must have only one extent (already opened). */ 1688 return vmdkError(pImage, VERR_VD I_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); 1689 1689 } 1690 1690 … … 1719 1719 } 1720 1720 else 1721 return vmdkError(pImage, VERR_VD I_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); 1722 1722 if (*pszLine++ != ' ') 1723 return vmdkError(pImage, VERR_VD I_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); 1724 1724 1725 1725 /* Nominal size of the extent. */ … … 1727 1727 &pImage->pExtents[i].cNominalSectors); 1728 1728 if (RT_FAILURE(rc)) 1729 return vmdkError(pImage, VERR_VD I_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); 1730 1730 if (*pszLine++ != ' ') 1731 return vmdkError(pImage, VERR_VD I_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); 1732 1732 1733 1733 /* Type of the extent. */ … … 1753 1753 } 1754 1754 else 1755 return vmdkError(pImage, VERR_VD I_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); 1756 1756 if (pImage->pExtents[i].enmType == VMDKETYPE_ZERO) 1757 1757 { … … 1760 1760 pszLine++; 1761 1761 if (*pszLine != '\0') 1762 return vmdkError(pImage, VERR_VD I_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); 1763 1763 pImage->pExtents[i].pszBasename = NULL; 1764 1764 } … … 1767 1767 /* All other extent types have basename and optional offset. */ 1768 1768 if (*pszLine++ != ' ') 1769 return vmdkError(pImage, VERR_VD I_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); 1770 1770 1771 1771 /* Basename of the image. Surrounded by quotes. */ … … 1784 1784 &pImage->pExtents[i].uSectorOffset); 1785 1785 if (RT_FAILURE(rc)) 1786 return vmdkError(pImage, VERR_VD I_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); 1787 1787 } 1788 1788 } 1789 1789 1790 1790 if (*pszLine != '\0') 1791 return vmdkError(pImage, VERR_VD I_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); 1792 1792 } 1793 1793 } … … 1797 1797 VMDK_DDB_GEO_PCHS_CYLINDERS, 1798 1798 &pImage->PCHSGeometry.cCylinders); 1799 if (rc == VERR_VD I_VALUE_NOT_FOUND)1799 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 1800 1800 pImage->PCHSGeometry.cCylinders = 0; 1801 1801 else if (RT_FAILURE(rc)) … … 1804 1804 VMDK_DDB_GEO_PCHS_HEADS, 1805 1805 &pImage->PCHSGeometry.cHeads); 1806 if (rc == VERR_VD I_VALUE_NOT_FOUND)1806 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 1807 1807 pImage->PCHSGeometry.cHeads = 0; 1808 1808 else if (RT_FAILURE(rc)) … … 1811 1811 VMDK_DDB_GEO_PCHS_SECTORS, 1812 1812 &pImage->PCHSGeometry.cSectors); 1813 if (rc == VERR_VD I_VALUE_NOT_FOUND)1813 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 1814 1814 pImage->PCHSGeometry.cSectors = 0; 1815 1815 else if (RT_FAILURE(rc)) … … 1832 1832 VMDK_DDB_GEO_LCHS_CYLINDERS, 1833 1833 &pImage->LCHSGeometry.cCylinders); 1834 if (rc == VERR_VD I_VALUE_NOT_FOUND)1834 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 1835 1835 pImage->LCHSGeometry.cCylinders = 0; 1836 1836 else if (RT_FAILURE(rc)) … … 1839 1839 VMDK_DDB_GEO_LCHS_HEADS, 1840 1840 &pImage->LCHSGeometry.cHeads); 1841 if (rc == VERR_VD I_VALUE_NOT_FOUND)1841 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 1842 1842 pImage->LCHSGeometry.cHeads = 0; 1843 1843 else if (RT_FAILURE(rc)) … … 1846 1846 VMDK_DDB_GEO_LCHS_SECTORS, 1847 1847 &pImage->LCHSGeometry.cSectors); 1848 if (rc == VERR_VD I_VALUE_NOT_FOUND)1848 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 1849 1849 pImage->LCHSGeometry.cSectors = 0; 1850 1850 else if (RT_FAILURE(rc)) … … 1862 1862 rc = vmdkDescDDBGetUuid(pImage, &pImage->Descriptor, VMDK_DDB_IMAGE_UUID, 1863 1863 &pImage->ImageUuid); 1864 if (rc == VERR_VD I_VALUE_NOT_FOUND)1864 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 1865 1865 { 1866 1866 /* Image without UUID. Probably created by VMware and not yet used … … 1887 1887 VMDK_DDB_MODIFICATION_UUID, 1888 1888 &pImage->ModificationUuid); 1889 if (rc == VERR_VD I_VALUE_NOT_FOUND)1889 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 1890 1890 { 1891 1891 /* Image without UUID. Probably created by VMware and not yet used … … 1912 1912 rc = vmdkDescDDBGetUuid(pImage, &pImage->Descriptor, VMDK_DDB_PARENT_UUID, 1913 1913 &pImage->ParentUuid); 1914 if (rc == VERR_VD I_VALUE_NOT_FOUND)1914 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 1915 1915 { 1916 1916 /* Image without UUID. Probably created by VMware and not yet used … … 1937 1937 VMDK_DDB_PARENT_MODIFICATION_UUID, 1938 1938 &pImage->ParentModificationUuid); 1939 if (rc == VERR_VD I_VALUE_NOT_FOUND)1939 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 1940 1940 { 1941 1941 /* Image without UUID. Probably created by VMware and not yet used … … 2040 2040 goto out; 2041 2041 } 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); 2046 2050 goto out; 2047 2051 } … … 2052 2056 || Header.doubleEndLineChar2 != '\n') ) 2053 2057 { 2054 rc = vmdkError(pExtent->pImage, VERR_VD I_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); 2055 2059 goto out; 2056 2060 } … … 2062 2066 if (pExtent->uDescriptorSector && !pExtent->cDescriptorSectors) 2063 2067 { 2064 rc = vmdkError(pExtent->pImage, VERR_VD I_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); 2065 2069 goto out; 2066 2070 } … … 2083 2087 if (!cSectorsPerGDE || cSectorsPerGDE > UINT32_MAX) 2084 2088 { 2085 rc = vmdkError(pExtent->pImage, VERR_VD I_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); 2086 2090 goto out; 2087 2091 } … … 2131 2135 && (pExtent->enmType != VMDKETYPE_FLAT || pExtent->cNominalSectors + pExtent->uSectorOffset > VMDK_BYTE2SECTOR(cbExtentSize))) 2132 2136 { 2133 rc = vmdkError(pExtent->pImage, VERR_VD I_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); 2134 2138 goto out; 2135 2139 } … … 2143 2147 || pExtent->cSectorsPerGrain < 8) 2144 2148 { 2145 rc = vmdkError(pExtent->pImage, VERR_VD I_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); 2146 2150 goto out; 2147 2151 } … … 2152 2156 || pExtent->cGTEntries < VMDK_GT_CACHELINE_SIZE) 2153 2157 { 2154 rc = vmdkError(pExtent->pImage, VERR_VD I_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); 2155 2159 goto out; 2156 2160 } … … 2226 2230 || RT_LE2H_U32(Header.flags) != 3) 2227 2231 { 2228 rc = VERR_VD I_INVALID_HEADER;2232 rc = VERR_VD_VMDK_INVALID_HEADER; 2229 2233 goto out; 2230 2234 } … … 2238 2242 || pExtent->cSectorsPerGrain > 2048) 2239 2243 { 2240 rc = VERR_VD I_INVALID_HEADER;2244 rc = VERR_VD_VMDK_INVALID_HEADER; 2241 2245 goto out; 2242 2246 } … … 2250 2254 if (!cSectorsPerGDE || cSectorsPerGDE > UINT32_MAX) 2251 2255 { 2252 rc = VERR_VD I_INVALID_HEADER;2256 rc = VERR_VD_VMDK_INVALID_HEADER; 2253 2257 goto out; 2254 2258 } … … 2259 2263 /* Inconsistency detected. Computed number of GD entries doesn't match 2260 2264 * stored value. Better be safe than sorry. */ 2261 rc = VERR_VD I_INVALID_HEADER;2265 rc = VERR_VD_VMDK_INVALID_HEADER; 2262 2266 goto out; 2263 2267 } … … 2444 2448 if (!pExtent->uDescriptorSector || !pExtent->cDescriptorSectors) 2445 2449 { 2446 rc = vmdkError(pImage, VERR_VD I_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); 2447 2451 goto out; 2448 2452 } … … 2503 2507 /* Likely the read is truncated. Better fail a bit too early 2504 2508 * (normally the descriptor is much smaller than our buffer). */ 2505 rc = vmdkError(pImage, VERR_VD I_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); 2506 2510 goto out; 2507 2511 } … … 3612 3616 * ever happen on a valid extent. */ 3613 3617 if (uGTSector > UINT32_MAX) 3614 return VERR_VD I_INVALID_HEADER;3618 return VERR_VD_VMDK_INVALID_HEADER; 3615 3619 /* Write grain table by writing the required number of grain table 3616 3620 * cache chunks. Avoids dynamic memory allocation, but is a bit … … 3630 3634 if (pExtent->pRGD) 3631 3635 { 3632 AssertReturn(!uRGTSector, VERR_VD I_INVALID_HEADER);3636 AssertReturn(!uRGTSector, VERR_VD_VMDK_INVALID_HEADER); 3633 3637 rc = vmdkFileGetSize(pExtent->pFile, &cbExtentSize); 3634 3638 if (RT_FAILURE(rc)) … … 3640 3644 * this shouldn't ever happen on a valid extent. */ 3641 3645 if (uRGTSector > UINT32_MAX) 3642 return VERR_VD I_INVALID_HEADER;3646 return VERR_VD_VMDK_INVALID_HEADER; 3643 3647 /* Write backup grain table by writing the required number of grain 3644 3648 * table cache chunks. Avoids dynamic memory allocation, but is a … … 4259 4263 if (pExtent->enmAccess == VMDKACCESS_NOACCESS) 4260 4264 { 4261 rc = VERR_VD I_INVALID_STATE;4265 rc = VERR_VD_VMDK_INVALID_STATE; 4262 4266 goto out; 4263 4267 } … … 4281 4285 Assert(!(cbToRead % 512)); 4282 4286 if (uSectorExtentAbs == 0) 4283 rc = VERR_VD I_BLOCK_FREE;4287 rc = VERR_VD_BLOCK_FREE; 4284 4288 else 4285 4289 rc = vmdkFileReadAt(pExtent->pFile, … … 4322 4326 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 4323 4327 { 4324 rc = VERR_VD I_IMAGE_READ_ONLY;4328 rc = VERR_VD_IMAGE_READ_ONLY; 4325 4329 goto out; 4326 4330 } … … 4347 4351 if (pExtent->enmAccess != VMDKACCESS_READWRITE) 4348 4352 { 4349 rc = VERR_VD I_INVALID_STATE;4353 rc = VERR_VD_VMDK_INVALID_STATE; 4350 4354 goto out; 4351 4355 } … … 4377 4381 } 4378 4382 else 4379 rc = VERR_VD I_BLOCK_FREE;4383 rc = VERR_VD_BLOCK_FREE; 4380 4384 *pcbPreRead = 0; 4381 4385 *pcbPostRead = 0; … … 4387 4391 *pcbPreRead = VMDK_SECTOR2BYTE(uSectorExtentRel % pExtent->cSectorsPerGrain); 4388 4392 *pcbPostRead = VMDK_SECTOR2BYTE(pExtent->cSectorsPerGrain) - cbToWrite - *pcbPreRead; 4389 rc = VERR_VD I_BLOCK_FREE;4393 rc = VERR_VD_BLOCK_FREE; 4390 4394 } 4391 4395 } … … 4456 4460 *penmImageType = pImage->enmImageType; 4457 4461 else 4458 rc = VERR_VD I_NOT_OPENED;4462 rc = VERR_VD_NOT_OPENED; 4459 4463 4460 4464 LogFlowFunc(("returns %Rrc enmImageType=%u\n", rc, *penmImageType)); … … 4527 4531 } 4528 4532 else 4529 rc = VERR_VD I_GEOMETRY_NOT_SET;4533 rc = VERR_VD_GEOMETRY_NOT_SET; 4530 4534 } 4531 4535 else 4532 rc = VERR_VD I_NOT_OPENED;4536 rc = VERR_VD_NOT_OPENED; 4533 4537 4534 4538 LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors)); … … 4550 4554 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 4551 4555 { 4552 rc = VERR_VD I_IMAGE_READ_ONLY;4556 rc = VERR_VD_IMAGE_READ_ONLY; 4553 4557 goto out; 4554 4558 } … … 4561 4565 } 4562 4566 else 4563 rc = VERR_VD I_NOT_OPENED;4567 rc = VERR_VD_NOT_OPENED; 4564 4568 4565 4569 out: … … 4586 4590 } 4587 4591 else 4588 rc = VERR_VD I_GEOMETRY_NOT_SET;4592 rc = VERR_VD_GEOMETRY_NOT_SET; 4589 4593 } 4590 4594 else 4591 rc = VERR_VD I_NOT_OPENED;4595 rc = VERR_VD_NOT_OPENED; 4592 4596 4593 4597 LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors)); … … 4609 4613 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 4610 4614 { 4611 rc = VERR_VD I_IMAGE_READ_ONLY;4615 rc = VERR_VD_IMAGE_READ_ONLY; 4612 4616 goto out; 4613 4617 } … … 4620 4624 } 4621 4625 else 4622 rc = VERR_VD I_NOT_OPENED;4626 rc = VERR_VD_NOT_OPENED; 4623 4627 4624 4628 out: … … 4702 4706 rc = vmdkDescDDBGetStr(pImage, &pImage->Descriptor, 4703 4707 "ddb.comment", &pszCommentEncoded); 4704 if (rc == VERR_VD I_VALUE_NOT_FOUND)4708 if (rc == VERR_VD_VMDK_VALUE_NOT_FOUND) 4705 4709 pszCommentEncoded = NULL; 4706 4710 else if (RT_FAILURE(rc)) … … 4715 4719 } 4716 4720 else 4717 rc = VERR_VD I_NOT_OPENED;4721 rc = VERR_VD_NOT_OPENED; 4718 4722 4719 4723 out: … … 4733 4737 if (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) 4734 4738 { 4735 rc = VERR_VD I_IMAGE_READ_ONLY;4739 rc = VERR_VD_IMAGE_READ_ONLY; 4736 4740 goto out; 4737 4741 } … … 4740 4744 rc = vmdkSetImageComment(pImage, pszComment); 4741 4745 else 4742 rc = VERR_VD I_NOT_OPENED;4746 rc = VERR_VD_NOT_OPENED; 4743 4747 4744 4748 out: … … 4762 4766 } 4763 4767 else 4764 rc = VERR_VD I_NOT_OPENED;4768 rc = VERR_VD_NOT_OPENED; 4765 4769 4766 4770 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 4790 4794 } 4791 4795 else 4792 rc = VERR_VD I_IMAGE_READ_ONLY;4796 rc = VERR_VD_IMAGE_READ_ONLY; 4793 4797 } 4794 4798 else 4795 rc = VERR_VD I_NOT_OPENED;4799 rc = VERR_VD_NOT_OPENED; 4796 4800 4797 4801 LogFlowFunc(("returns %Rrc\n", rc)); … … 4814 4818 } 4815 4819 else 4816 rc = VERR_VD I_NOT_OPENED;4820 rc = VERR_VD_NOT_OPENED; 4817 4821 4818 4822 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 4841 4845 } 4842 4846 else 4843 rc = VERR_VD I_IMAGE_READ_ONLY;4847 rc = VERR_VD_IMAGE_READ_ONLY; 4844 4848 } 4845 4849 else 4846 rc = VERR_VD I_NOT_OPENED;4850 rc = VERR_VD_NOT_OPENED; 4847 4851 4848 4852 LogFlowFunc(("returns %Rrc\n", rc)); … … 4865 4869 } 4866 4870 else 4867 rc = VERR_VD I_NOT_OPENED;4871 rc = VERR_VD_NOT_OPENED; 4868 4872 4869 4873 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 4892 4896 } 4893 4897 else 4894 rc = VERR_VD I_IMAGE_READ_ONLY;4898 rc = VERR_VD_IMAGE_READ_ONLY; 4895 4899 } 4896 4900 else 4897 rc = VERR_VD I_NOT_OPENED;4901 rc = VERR_VD_NOT_OPENED; 4898 4902 4899 4903 LogFlowFunc(("returns %Rrc\n", rc)); … … 4916 4920 } 4917 4921 else 4918 rc = VERR_VD I_NOT_OPENED;4922 rc = VERR_VD_NOT_OPENED; 4919 4923 4920 4924 LogFlowFunc(("returns %Rrc (%RTuuid)\n", rc, pUuid)); … … 4943 4947 } 4944 4948 else 4945 rc = VERR_VD I_IMAGE_READ_ONLY;4949 rc = VERR_VD_IMAGE_READ_ONLY; 4946 4950 } 4947 4951 else 4948 rc = VERR_VD I_NOT_OPENED;4952 rc = VERR_VD_NOT_OPENED; 4949 4953 4950 4954 LogFlowFunc(("returns %Rrc\n", rc)); … … 5065 5069 if (pExtent->enmAccess == VMDKACCESS_NOACCESS) 5066 5070 { 5067 rc = VERR_VD I_INVALID_STATE;5071 rc = VERR_VD_VMDK_INVALID_STATE; 5068 5072 goto out; 5069 5073 } … … 5149 5153 { 5150 5154 /* The request was completely in a ZERO extent nothing to do. */ 5151 rc = VINF_VD I_ASYNC_IO_FINISHED;5155 rc = VINF_VD_ASYNC_IO_FINISHED; 5152 5156 } 5153 5157 else … … 5201 5205 if (pExtent->enmAccess == VMDKACCESS_NOACCESS) 5202 5206 { 5203 rc = VERR_VD I_INVALID_STATE;5207 rc = VERR_VD_VMDK_INVALID_STATE; 5204 5208 goto out; 5205 5209 } … … 5285 5289 { 5286 5290 /* The request was completely in a ZERO extent nothing to do. */ 5287 rc = VINF_VD I_ASYNC_IO_FINISHED;5291 rc = VINF_VD_ASYNC_IO_FINISHED; 5288 5292 } 5289 5293 else -
trunk/src/VBox/Devices/Storage/testcase/Makefile.kmk
r14787 r15366 27 27 # probably will go away soon. Testcase only now. 28 28 # 29 ifdef VBOX_WITH_TESTCASES30 PROGRAMS += vditool31 ifeq ($(KBUILD_TARGET),l4)32 vditool_TEMPLATE = VBOXLNXHOSTR3EXE33 vditool_LIBS = \34 $(PATH_LIB)/VBoxDDULnxHostR3.a \35 $(PATH_LIB)/RuntimeLnxHostR3.a36 else37 vditool_TEMPLATE = VBOXR3TSTEXE38 vditool_LIBS = $(LIB_DDU) $(LIB_RUNTIME)39 endif40 vditool_SOURCES = vditool.cpp41 endif29 #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 42 42 43 43 … … 45 45 # Basic testcase for the VDI code. 46 46 # 47 ifdef VBOX_WITH_TESTCASES48 PROGRAMS += tstVDI49 ifeq ($(KBUILD_TARGET),l4)50 tstVDI_TEMPLATE = VBOXLNXHOSTR3EXE51 else52 tstVDI_TEMPLATE = VBOXR3TSTEXE53 endif54 tstVDI_LIBS = $(vditool_LIBS)55 tstVDI_SOURCES = tstVDI.cpp56 endif47 #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 57 57 58 58 # … … 68 68 tstVD-2_TEMPLATE = VBOXR3TSTEXE 69 69 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) 72 72 tstVD_SOURCES = tstVD.cpp 73 73 tstVD-2_SOURCES = tstVD-2.cpp -
trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
r14838 r15366 36 36 #include <VBox/com/VirtualBox.h> 37 37 38 #include <VBox/VBoxHDD.h>39 38 #include <VBox/VBoxHDD-new.h> 40 39 #include <VBox/sup.h> … … 140 139 "\n" 141 140 : "", 142 (u64Cmd & USAGE_SET VDIUUID) ?143 " set vdiuuid <filepath>\n"144 " Assigns a new UUID to the given VDIfile. This way, multiple copies\n"145 " of VDI containerscan 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" 146 145 "\n" 147 146 : "", … … 187 186 "\n" 188 187 : "", 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 : "",195 188 #ifdef RT_OS_WINDOWS 196 189 (u64Cmd & USAGE_MODINSTALL) ? … … 469 462 } 470 463 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 else490 {491 RTPrintf("UUID changed to: %s\n", uuid.toString().raw());492 }493 494 return 0;495 }496 497 464 498 465 static DECLCALLBACK(void) handleVDError(void *pvUser, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va) … … 502 469 RTPrintf("\n"); 503 470 RTPrintf("Error code %Rrc at %s(%u) in function %s\n", rc, RT_SRC_POS_ARGS); 471 } 472 473 static 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); 504 531 } 505 532 … … 1164 1191 AssertRC(vrc); 1165 1192 1166 vrc = VDCreate( &vdInterfaceError, &pDisk);1193 vrc = VDCreate(pVDIfs, &pDisk); 1167 1194 if (RT_FAILURE(vrc)) 1168 1195 { … … 1273 1300 AssertRC(vrc); 1274 1301 1275 vrc = VDCreate( &vdInterfaceError, &pDisk);1302 vrc = VDCreate(pVDIfs, &pDisk); 1276 1303 if (RT_FAILURE(vrc)) 1277 1304 { … … 1354 1381 AssertRC(vrc); 1355 1382 1356 vrc = VDCreate( &vdInterfaceError, &pDisk);1383 vrc = VDCreate(pVDIfs, &pDisk); 1357 1384 if (RT_FAILURE(vrc)) 1358 1385 { … … 1456 1483 } 1457 1484 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 else1498 {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 do1521 {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 1584 1485 /** 1585 1486 * Unloads the neccessary driver. … … 1636 1537 //if (!strcmp(pszCmd, "unloadsyms")) 1637 1538 // return CmdUnloadSyms(argc - 1 , &argv[1]); 1638 if (!strcmp(pszCmd, "set vdiuuid"))1639 return handleSet VDIUUID(argc - 1, &argv[1], aVirtualBox, aSession);1539 if (!strcmp(pszCmd, "sethduuid") || !strcmp(pszCmd, "setvdiuuid")) 1540 return handleSetHDUUID(argc - 1, &argv[1], aVirtualBox, aSession); 1640 1541 if (!strcmp(pszCmd, "listpartitions")) 1641 1542 return CmdListPartitions(argc - 1, &argv[1], aVirtualBox, aSession); … … 1646 1547 if (!strcmp(pszCmd, "converttoraw")) 1647 1548 return CmdConvertToRaw(argc - 1, &argv[1], aVirtualBox, aSession); 1648 if (!strcmp(pszCmd, "convertdisk"))1649 return CmdConvertDisk(argc - 1, &argv[1], aVirtualBox, aSession);1650 1549 1651 1550 if (!strcmp(pszCmd, "modinstall")) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r15267 r15366 54 54 #include <iprt/uuid.h> 55 55 #include <VBox/version.h> 56 #include <VBox/VBoxHDD .h>56 #include <VBox/VBoxHDD-new.h> 57 57 #include <VBox/log.h> 58 58 … … 512 512 RTPrintf("VBoxManage createhd -filename <filename>\n" 513 513 " -size <megabytes>\n" 514 " [-format VDI|VMDK]\n" 514 515 " [-static]\n" 515 516 " [-comment <comment>]\n" … … 533 534 } 534 535 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 535 544 if (u64Cmd & USAGE_CONVERTDD) 536 545 { 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" 539 550 "\n"); 540 551 } … … 550 561 " [-password <password>]\n" 551 562 " [-comment <comment>]\n" 563 " [-intnet]\n" 552 564 "\n"); 553 565 } … … 816 828 } 817 829 830 831 static 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 818 840 static int handleCreateHardDisk(int argc, char *argv[], 819 841 ComPtr<IVirtualBox> virtualBox, ComPtr<ISession> session) … … 822 844 Bstr filename; 823 845 uint64_t sizeMB = 0; 846 Bstr format = "VDI"; 824 847 bool fStatic = false; 825 848 Bstr comment; … … 844 867 sizeMB = RTStrToUInt64(argv[i]); 845 868 } 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 } 846 876 else if (strcmp(argv[i], "-static") == 0) 847 877 { … … 877 907 878 908 ComPtr<IHardDisk2> hardDisk; 879 CHECK_ERROR(virtualBox, CreateHardDisk2( Bstr("VDI"), filename, hardDisk.asOutParam()));909 CHECK_ERROR(virtualBox, CreateHardDisk2(format, filename, hardDisk.asOutParam())); 880 910 if (SUCCEEDED(rc) && hardDisk) 881 911 { … … 939 969 } 940 970 971 #if 0 /* disabled until disk shrinking is implemented based on VBoxHDD-new */ 941 972 static DECLCALLBACK(int) hardDiskProgressCallback(PVM pVM, unsigned uPercent, void *pvUser) 942 973 { … … 954 985 return VINF_SUCCESS; 955 986 } 987 #endif 956 988 957 989 … … 1020 1052 else if (strcmp(argv[1], "compact") == 0) 1021 1053 { 1054 #if 1 1055 RTPrintf("Error: Shrink hard disk operation is temporarily unavailable!\n"); 1056 return 1; 1057 #else 1022 1058 /* the hard disk image might not be registered */ 1023 1059 if (!hardDisk) … … 1048 1084 rc = E_FAIL; 1049 1085 } 1086 #endif 1050 1087 } 1051 1088 else … … 1104 1141 } 1105 1142 1143 static 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 1106 1269 static int handleConvertDDImage(int argc, char *argv[]) 1107 1270 { 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]; 1116 1311 #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"); 1120 1313 #endif 1121 1122 if ((!fReadFromStdIn && argc != arg + 2) || (fReadFromStdIn && argc != arg + 3))1123 return errorSyntax(USAGE_CONVERTDD, "Incorrect number of parameters");1314 } 1315 } 1316 } 1124 1317 1125 1318 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); 1127 1334 1128 1335 /* open raw image file. */ 1129 1336 RTFILE File; 1130 int rc = VINF_SUCCESS;1131 1337 if (fReadFromStdIn) 1132 1338 File = 0; 1133 1339 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); 1135 1341 if (RT_FAILURE(rc)) 1136 1342 { 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; 1139 1345 } 1140 1346 … … 1142 1348 /* get image size. */ 1143 1349 if (fReadFromStdIn) 1144 cbFile = RTStrToUInt64( argv[arg + 2]);1350 cbFile = RTStrToUInt64(filesize); 1145 1351 else 1146 1352 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 ? 1172 1406 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 1419 out: 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); 1203 1428 } 1204 1429 … … 1214 1439 Bstr password; 1215 1440 Bstr comment; 1441 bool fIntNet = false; 1216 1442 1217 1443 /* at least server and target */ … … 1299 1525 comment = argv[i]; 1300 1526 } 1527 else if (strcmp(argv[i], "-intnet") == 0) 1528 { 1529 i++; 1530 fIntNet = true; 1531 } 1301 1532 else 1302 1533 return errorSyntax(USAGE_ADDISCSIDISK, "Invalid parameter '%s'", Utf8Str(argv[i]).raw()); … … 1351 1582 1352 1583 /// @todo add -targetName and -targetPassword options 1584 1585 if (fIntNet) 1586 { 1587 Bstr ("HostIPStack").detachTo (names.appendedRaw()); 1588 Bstr ("0").detachTo (values.appendedRaw()); 1589 } 1353 1590 1354 1591 CHECK_ERROR_BREAK (hardDisk, … … 5567 5804 //////////////////////////////////////////////////////////////////////////// 5568 5805 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. */ 5570 5814 if (argc >= iCmdArg && (strcmp(argv[iCmd], "convertdd") == 0)) 5571 5815 { … … 5623 5867 { "modifyhd", handleModifyHardDisk }, 5624 5868 { "modifyvdi", handleModifyHardDisk }, /* backward compatiblity */ 5869 { "clonehd", handleCloneHardDisk }, 5870 { "clonevdi", handleCloneHardDisk }, /* backward compatiblity */ 5625 5871 { "addiscsidisk", handleAddiSCSIDisk }, 5626 5872 { "createvm", handleCreateVM }, 5627 5873 { "modifyvm", handleModifyVM }, 5628 { "clonehd", handleCloneHardDisk },5629 { "clonevdi", handleCloneHardDisk }, /* backward compatiblity */5630 5874 { "startvm", handleStartVM }, 5631 5875 { "controlvm", handleControlVM }, -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r14732 r15366 70 70 #define USAGE_LOADSYMS RT_BIT_64(29) 71 71 #define USAGE_UNLOADSYMS RT_BIT_64(30) 72 #define USAGE_SET VDIUUIDRT_BIT_64(31)72 #define USAGE_SETHDUUID RT_BIT_64(31) 73 73 #define USAGE_CONVERTDD RT_BIT_64(32) 74 74 #define USAGE_LISTPARTITIONS RT_BIT_64(33) … … 84 84 #define USAGE_CONVERTTORAW RT_BIT_64(41) 85 85 #define USAGE_METRICS RT_BIT_64(42) 86 #define USAGE_CONVERT DISKRT_BIT_64(43)86 #define USAGE_CONVERTHD RT_BIT_64(43) 87 87 #define USAGE_ALL (~(uint64_t)0) 88 88 /** @} */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r14814 r15366 33 33 #include <VBox/com/VirtualBox.h> 34 34 35 #include <VBox/VBoxHDD.h>36 35 #include <VBox/log.h> 37 36 #include <iprt/stream.h> -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r15318 r15366 58 58 #include <VBox/err.h> 59 59 #include <VBox/param.h> 60 #include <VBox/VBoxHDD.h>61 60 #include <VBox/VBoxHDD-new.h> 62 61 #include <VBox/version.h>
Note:
See TracChangeset
for help on using the changeset viewer.