- Timestamp:
- Jul 27, 2009 10:14:11 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50410
- Location:
- trunk/src/VBox
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r20374 r21806 838 838 pThis->VDIErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR; 839 839 pThis->VDIErrorCallbacks.pfnError = drvvdErrorCallback; 840 pThis->VDIErrorCallbacks.pfnMessage = NULL; 840 841 841 842 rc = VDInterfaceAdd(&pThis->VDIError, "DrvVD_VDIError", VDINTERFACETYPE_ERROR, -
trunk/src/VBox/Devices/Storage/ISCSIHDDCore.cpp
r18678 r21806 3336 3336 { 3337 3337 /** @todo put something useful here */ 3338 RTLogPrintf("Header: cVolume=%u\n", pImage->cVolume);3338 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: cVolume=%u\n", pImage->cVolume); 3339 3339 } 3340 3340 } -
trunk/src/VBox/Devices/Storage/ParallelsHDDCore.cpp
r21373 r21806 960 960 if (pImage) 961 961 { 962 RTLogPrintf("Header: Geometry PCHS=%u/%u/%u LCHS=%u/%u/%u\n",962 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: Geometry PCHS=%u/%u/%u LCHS=%u/%u/%u\n", 963 963 pImage->PCHSGeometry.cCylinders, pImage->PCHSGeometry.cHeads, pImage->PCHSGeometry.cSectors, 964 964 pImage->LCHSGeometry.cCylinders, pImage->LCHSGeometry.cHeads, pImage->LCHSGeometry.cSectors); -
trunk/src/VBox/Devices/Storage/RawHDDCore.cpp
r18066 r21806 987 987 if (pImage) 988 988 { 989 RTLogPrintf("Header: Geometry PCHS=%u/%u/%u LCHS=%u/%u/%u cbSector=%llu\n",989 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: Geometry PCHS=%u/%u/%u LCHS=%u/%u/%u cbSector=%llu\n", 990 990 pImage->PCHSGeometry.cCylinders, pImage->PCHSGeometry.cHeads, pImage->PCHSGeometry.cSectors, 991 991 pImage->LCHSGeometry.cCylinders, pImage->LCHSGeometry.cHeads, pImage->LCHSGeometry.cSectors, -
trunk/src/VBox/Devices/Storage/VBoxHDD.cpp
r21371 r21806 706 706 return rc; 707 707 } 708 709 /** 710 * internal: send output to the log (unconditionally). 711 */ 712 int vdLogMessage(void *pvUser, const char *pszFormat, ...) 713 { 714 NOREF(pvUser); 715 va_list args; 716 va_start(args, pszFormat); 717 RTLogPrintf(pszFormat, args); 718 va_end(args); 719 return VINF_SUCCESS; 720 } 721 708 722 709 723 /** … … 1533 1547 1534 1548 pImage->uOpenFlags = uOpenFlags & VD_OPEN_FLAGS_HONOR_SAME; 1549 uImageFlags |= VD_IMAGE_FLAGS_DIFF; 1535 1550 rc = pImage->Backend->pfnCreate(pImage->pszFilename, pDisk->cbSize, 1536 uImageFlags , pszComment,1537 &pDisk->PCHSGeometry,1551 uImageFlags | VD_IMAGE_FLAGS_DIFF, 1552 pszComment, &pDisk->PCHSGeometry, 1538 1553 &pDisk->LCHSGeometry, pUuid, 1539 1554 uOpenFlags & ~VD_OPEN_FLAGS_HONOR_SAME, … … 1546 1561 if (RT_SUCCESS(rc) && pDisk->cImages != 0) 1547 1562 { 1548 pImage->uImageFlags |= VD_IMAGE_FLAGS_DIFF;1563 pImage->uImageFlags = uImageFlags; 1549 1564 1550 1565 /* Switch previous image to read-only mode. */ … … 3475 3490 AssertMsg(pDisk->u32Signature == VBOXHDDDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature)); 3476 3491 3477 RTLogPrintf("--- Dumping VD Disk, Images=%u\n", pDisk->cImages); 3492 int (*pfnMessage)(void *, const char *, ...) = NULL; 3493 void *pvUser = pDisk->pInterfaceError->pvUser; 3494 3495 if (pDisk->pInterfaceErrorCallbacks && VALID_PTR(pDisk->pInterfaceErrorCallbacks->pfnMessage)) 3496 pfnMessage = pDisk->pInterfaceErrorCallbacks->pfnMessage; 3497 else 3498 { 3499 pDisk->pInterfaceErrorCallbacks->pfnMessage = vdLogMessage; 3500 pfnMessage = vdLogMessage; 3501 } 3502 3503 pfnMessage(pvUser, "--- Dumping VD Disk, Images=%u\n", pDisk->cImages); 3478 3504 for (PVDIMAGE pImage = pDisk->pBase; pImage; pImage = pImage->pNext) 3479 3505 { 3480 RTLogPrintf("Dumping VD image \"%s\" (Backend=%s)\n",3481 3506 pfnMessage(pvUser, "Dumping VD image \"%s\" (Backend=%s)\n", 3507 pImage->pszFilename, pImage->Backend->pszBackendName); 3482 3508 pImage->Backend->pfnDump(pImage->pvBackendData); 3483 3509 } -
trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
r19251 r21806 1721 1721 PVDIIMAGEDESC pImage = (PVDIIMAGEDESC)pBackendData; 1722 1722 1723 RTLogPrintf("Dumping VDI image \"%s\" mode=%s uOpenFlags=%X File=%08X\n",1723 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Dumping VDI image \"%s\" mode=%s uOpenFlags=%X File=%08X\n", 1724 1724 pImage->pszFilename, 1725 1725 (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY) ? "r/o" : "r/w", 1726 1726 pImage->uOpenFlags, 1727 1727 pImage->File); 1728 RTLogPrintf("Header: Version=%08X Type=%X Flags=%X Size=%llu\n",1728 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: Version=%08X Type=%X Flags=%X Size=%llu\n", 1729 1729 pImage->PreHeader.u32Version, 1730 1730 getImageType(&pImage->Header), 1731 1731 getImageFlags(&pImage->Header), 1732 1732 getImageDiskSize(&pImage->Header)); 1733 RTLogPrintf("Header: cbBlock=%u cbBlockExtra=%u cBlocks=%u cBlocksAllocated=%u\n",1733 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: cbBlock=%u cbBlockExtra=%u cBlocks=%u cBlocksAllocated=%u\n", 1734 1734 getImageBlockSize(&pImage->Header), 1735 1735 getImageExtraBlockSize(&pImage->Header), 1736 1736 getImageBlocks(&pImage->Header), 1737 1737 getImageBlocksAllocated(&pImage->Header)); 1738 RTLogPrintf("Header: offBlocks=%u offData=%u\n",1738 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: offBlocks=%u offData=%u\n", 1739 1739 getImageBlocksOffset(&pImage->Header), 1740 1740 getImageDataOffset(&pImage->Header)); 1741 1741 PVDIDISKGEOMETRY pg = getImageLCHSGeometry(&pImage->Header); 1742 1742 if (pg) 1743 RTLogPrintf("Header: Geometry: C/H/S=%u/%u/%u cbSector=%u\n",1743 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: Geometry: C/H/S=%u/%u/%u cbSector=%u\n", 1744 1744 pg->cCylinders, pg->cHeads, pg->cSectors, pg->cbSector); 1745 RTLogPrintf("Header: uuidCreation={%RTuuid}\n", getImageCreationUUID(&pImage->Header));1746 RTLogPrintf("Header: uuidModification={%RTuuid}\n", getImageModificationUUID(&pImage->Header));1747 RTLogPrintf("Header: uuidParent={%RTuuid}\n", getImageParentUUID(&pImage->Header));1745 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidCreation={%RTuuid}\n", getImageCreationUUID(&pImage->Header)); 1746 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidModification={%RTuuid}\n", getImageModificationUUID(&pImage->Header)); 1747 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidParent={%RTuuid}\n", getImageParentUUID(&pImage->Header)); 1748 1748 if (GET_MAJOR_HEADER_VERSION(&pImage->Header) >= 1) 1749 RTLogPrintf("Header: uuidParentModification={%RTuuid}\n", getImageParentModificationUUID(&pImage->Header));1750 RTLogPrintf("Image: fFlags=%08X offStartBlocks=%u offStartData=%u\n",1749 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidParentModification={%RTuuid}\n", getImageParentModificationUUID(&pImage->Header)); 1750 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Image: fFlags=%08X offStartBlocks=%u offStartData=%u\n", 1751 1751 pImage->uImageFlags, pImage->offStartBlocks, pImage->offStartData); 1752 RTLogPrintf("Image: uBlockMask=%08X cbTotalBlockData=%u uShiftOffset2Index=%u offStartBlockData=%u\n",1752 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Image: uBlockMask=%08X cbTotalBlockData=%u uShiftOffset2Index=%u offStartBlockData=%u\n", 1753 1753 pImage->uBlockMask, 1754 1754 pImage->cbTotalBlockData, … … 1768 1768 if (cBlocksNotFree != getImageBlocksAllocated(&pImage->Header)) 1769 1769 { 1770 RTLogPrintf("!! WARNING: %u blocks actually allocated (cBlocksAllocated=%u) !!\n",1770 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "!! WARNING: %u blocks actually allocated (cBlocksAllocated=%u) !!\n", 1771 1771 cBlocksNotFree, getImageBlocksAllocated(&pImage->Header)); 1772 1772 } 1773 1773 if (cBadBlocks) 1774 1774 { 1775 RTLogPrintf("!! WARNING: %u bad blocks found !!\n",1775 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "!! WARNING: %u bad blocks found !!\n", 1776 1776 cBadBlocks); 1777 1777 } -
trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
r21060 r21806 5682 5682 if (pImage) 5683 5683 { 5684 RTLogPrintf("Header: Geometry PCHS=%u/%u/%u LCHS=%u/%u/%u cbSector=%llu\n",5684 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: Geometry PCHS=%u/%u/%u LCHS=%u/%u/%u cbSector=%llu\n", 5685 5685 pImage->PCHSGeometry.cCylinders, pImage->PCHSGeometry.cHeads, pImage->PCHSGeometry.cSectors, 5686 5686 pImage->LCHSGeometry.cCylinders, pImage->LCHSGeometry.cHeads, pImage->LCHSGeometry.cSectors, 5687 5687 VMDK_BYTE2SECTOR(pImage->cbSize)); 5688 RTLogPrintf("Header: uuidCreation={%RTuuid}\n", &pImage->ImageUuid);5689 RTLogPrintf("Header: uuidModification={%RTuuid}\n", &pImage->ModificationUuid);5690 RTLogPrintf("Header: uuidParent={%RTuuid}\n", &pImage->ParentUuid);5691 RTLogPrintf("Header: uuidParentModification={%RTuuid}\n", &pImage->ParentModificationUuid);5688 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidCreation={%RTuuid}\n", &pImage->ImageUuid); 5689 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidModification={%RTuuid}\n", &pImage->ModificationUuid); 5690 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidParent={%RTuuid}\n", &pImage->ParentUuid); 5691 pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidParentModification={%RTuuid}\n", &pImage->ParentModificationUuid); 5692 5692 } 5693 5693 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
r21556 r21806 156 156 " Assigns a new UUID to the given image file. This way, multiple copies\n" 157 157 " of a container can be registered.\n" 158 "\n" 159 : "", 160 (u64Cmd & USAGE_DUMPHDINFO) ? 161 " dumphdinfo <filepath>\n" 162 " Prints information about the image at the given location.\n" 158 163 "\n" 159 164 : "", … … 491 496 } 492 497 493 static int handleSetHDUUID(int argc, char **argv, ComPtr<IVirtualBox> aVirtualBox, ComPtr<ISession> aSession)498 static int CmdSetHDUUID(int argc, char **argv, ComPtr<IVirtualBox> aVirtualBox, ComPtr<ISession> aSession) 494 499 { 495 500 /* we need exactly one parameter: the image file */ … … 520 525 vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR; 521 526 vdInterfaceErrorCallbacks.pfnError = handleVDError; 527 vdInterfaceErrorCallbacks.pfnMessage = NULL; 522 528 523 529 rc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR, … … 545 551 else 546 552 RTPrintf("UUID changed to: %s\n", uuid.toString().raw()); 553 554 VDCloseAll(pDisk); 555 556 return RT_FAILURE(rc); 557 } 558 559 560 static int handleVDMessage(void *pvUser, const char *pszFormat, ...) 561 { 562 NOREF(pvUser); 563 va_list args; 564 va_start(args, pszFormat); 565 int rc = RTPrintfV(pszFormat, args); 566 va_end(args); 567 return rc; 568 } 569 570 static int CmdDumpHDInfo(int argc, char **argv, ComPtr<IVirtualBox> aVirtualBox, ComPtr<ISession> aSession) 571 { 572 /* we need exactly one parameter: the image file */ 573 if (argc != 1) 574 { 575 return errorSyntax(USAGE_SETHDUUID, "Not enough parameters"); 576 } 577 578 /* just try it */ 579 char *pszFormat = NULL; 580 int rc = VDGetFormat(argv[0], &pszFormat); 581 if (RT_FAILURE(rc)) 582 { 583 RTPrintf("Format autodetect failed: %Rrc\n", rc); 584 return 1; 585 } 586 587 PVBOXHDD pDisk = NULL; 588 589 PVDINTERFACE pVDIfs = NULL; 590 VDINTERFACE vdInterfaceError; 591 VDINTERFACEERROR vdInterfaceErrorCallbacks; 592 vdInterfaceErrorCallbacks.cbSize = sizeof(VDINTERFACEERROR); 593 vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR; 594 vdInterfaceErrorCallbacks.pfnError = handleVDError; 595 vdInterfaceErrorCallbacks.pfnMessage = handleVDMessage; 596 597 rc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR, 598 &vdInterfaceErrorCallbacks, NULL, &pVDIfs); 599 AssertRC(rc); 600 601 rc = VDCreate(pVDIfs, &pDisk); 602 if (RT_FAILURE(rc)) 603 { 604 RTPrintf("Error while creating the virtual disk container: %Rrc\n", rc); 605 return 1; 606 } 607 608 /* Open the image */ 609 rc = VDOpen(pDisk, pszFormat, argv[0], VD_OPEN_FLAGS_NORMAL, NULL); 610 if (RT_FAILURE(rc)) 611 { 612 RTPrintf("Error while opening the image: %Rrc\n", rc); 613 return 1; 614 } 615 616 VDDumpImages(pDisk); 547 617 548 618 VDCloseAll(pDisk); … … 1227 1297 vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR; 1228 1298 vdInterfaceErrorCallbacks.pfnError = handleVDError; 1299 vdInterfaceErrorCallbacks.pfnMessage = NULL; 1229 1300 1230 1301 vrc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR, … … 1336 1407 vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR; 1337 1408 vdInterfaceErrorCallbacks.pfnError = handleVDError; 1409 vdInterfaceErrorCallbacks.pfnMessage = NULL; 1338 1410 1339 1411 int vrc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR, … … 1417 1489 vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR; 1418 1490 vdInterfaceErrorCallbacks.pfnError = handleVDError; 1491 vdInterfaceErrorCallbacks.pfnMessage = NULL; 1419 1492 1420 1493 int vrc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR, … … 1581 1654 vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR; 1582 1655 vdInterfaceErrorCallbacks.pfnError = handleVDError; 1656 vdInterfaceErrorCallbacks.pfnMessage = NULL; 1583 1657 1584 1658 vrc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR, … … 1703 1777 // return CmdUnloadSyms(argc - 1 , &a->argv[1]); 1704 1778 if (!strcmp(pszCmd, "sethduuid") || !strcmp(pszCmd, "setvdiuuid")) 1705 return handleSetHDUUID(a->argc - 1, &a->argv[1], a->virtualBox, a->session); 1779 return CmdSetHDUUID(a->argc - 1, &a->argv[1], a->virtualBox, a->session); 1780 if (!strcmp(pszCmd, "dumphdinfo")) 1781 return CmdDumpHDInfo(a->argc - 1, &a->argv[1], a->virtualBox, a->session); 1706 1782 if (!strcmp(pszCmd, "listpartitions")) 1707 1783 return CmdListPartitions(a->argc - 1, &a->argv[1], a->virtualBox, a->session); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r21612 r21806 96 96 #define USAGE_HOSTONLYIFS RT_BIT_64(46) 97 97 #define USAGE_DHCPSERVER RT_BIT_64(47) 98 #define USAGE_DUMPHDINFO RT_BIT_64(48) 98 99 #define USAGE_ALL (~(uint64_t)0) 99 100 /** @} */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r21038 r21806 814 814 vdInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR; 815 815 vdInterfaceErrorCallbacks.pfnError = handleVDError; 816 vdInterfaceErrorCallbacks.pfnMessage = NULL; 816 817 817 818 rc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR, -
trunk/src/VBox/Main/HardDiskImpl.cpp
r21394 r21806 665 665 mm.vdIfCallsError.enmInterface = VDINTERFACETYPE_ERROR; 666 666 mm.vdIfCallsError.pfnError = vdErrorCall; 667 mm.vdIfCallsError.pfnMessage = NULL; 667 668 668 669 /* Initialize the callbacks of the VD progress interface */ … … 3250 3251 3251 3252 /** @todo This kind of opening of images is assuming that diff 3252 * images can be opened as base images. Not very clean, and should 3253 * be fixed eventually. */ 3253 * images can be opened as base images. Should be fixed ASAP. */ 3254 3254 vrc = VDOpen(hdd, 3255 3255 Utf8Str(mm.format), … … 3275 3275 if (mm.setParentId) 3276 3276 { 3277 vrc = VDSet Uuid(hdd, 0, mm.parentId);3277 vrc = VDSetParentUuid(hdd, 0, mm.parentId); 3278 3278 ComAssertRCThrow(vrc, E_FAIL); 3279 3279 } … … 3900 3900 that->mm.vdProgress = task->progress; 3901 3901 3902 /** @todo add VD_IMAGE_FLAGS_DIFF to the image flags, to 3903 * be on the safe side. */ 3902 3904 vrc = VDCreateDiff (hdd, targetFormat, targetLocation, 3903 3905 task->d.variant,
Note:
See TracChangeset
for help on using the changeset viewer.