Changeset 124 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Jan 17, 2007 5:38:24 PM (18 years ago)
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VBoxHDD.cpp
r1 r124 711 711 712 712 if (pHeader->u.v1.cbHeader < sizeof(VDIHEADER1)) 713 { 714 LogRel(("VDI: v1 header size wrong (%d < %d)\n", 715 pHeader->u.v1.cbHeader, sizeof(VDIHEADER1))); 713 716 return VERR_VDI_INVALID_HEADER; 717 } 714 718 715 719 if (getImageBlocksOffset(pHeader) < (sizeof(VDIPREHEADER) + sizeof(VDIHEADER1))) 720 { 721 LogRel(("VDI: v1 blocks offset wrong (%d < %d)\n", 722 getImageBlocksOffset(pHeader), sizeof(VDIPREHEADER) + sizeof(VDIHEADER1))); 716 723 return VERR_VDI_INVALID_HEADER; 724 } 717 725 718 726 if (getImageDataOffset(pHeader) < (getImageBlocksOffset(pHeader) + getImageBlocks(pHeader) * sizeof(VDIIMAGEBLOCKPOINTER))) 727 { 728 LogRel(("VDI: v1 image data offset wrong (%d < %d)\n", 729 getImageDataOffset(pHeader), getImageBlocksOffset(pHeader) + getImageBlocks(pHeader) * sizeof(VDIIMAGEBLOCKPOINTER))); 719 730 return VERR_VDI_INVALID_HEADER; 731 } 720 732 721 733 if ( getImageType(pHeader) == VDI_IMAGE_TYPE_UNDO … … 723 735 { 724 736 if (RTUuidIsNull(getImageParentUUID(pHeader))) 737 { 738 LogRel(("VDI: v1 uuid of parent is 0)\n")); 725 739 return VERR_VDI_INVALID_HEADER; 740 } 726 741 if (RTUuidIsNull(getImageParentModificationUUID(pHeader))) 742 { 743 LogRel(("VDI: v1 uuid of parent modification is 0\n")); 727 744 return VERR_VDI_INVALID_HEADER; 745 } 728 746 } 729 747 … … 745 763 746 764 if ((getImageGeometry(pHeader))->cbSector != VDI_GEOMETRY_SECTOR_SIZE) 765 { 766 LogRel(("VDI: wrong section size (%d != %d)\n", 767 (getImageGeometry(pHeader))->cbSector, VDI_GEOMETRY_SECTOR_SIZE)); 747 768 return VERR_VDI_INVALID_HEADER; 769 } 748 770 749 771 if ( getImageDiskSize(pHeader) == 0 750 772 || getImageBlockSize(pHeader) == 0 751 773 || getImageBlocks(pHeader) == 0 752 || getPowerOfTwo(getImageBlockSize(pHeader)) == 0 753 || getImageBlocksAllocated(pHeader) > getImageBlocks(pHeader)) 774 || getPowerOfTwo(getImageBlockSize(pHeader)) == 0) 775 { 776 LogRel(("VDI: wrong size (%lld, %d, %d, %d)\n", 777 getImageDiskSize(pHeader), getImageBlockSize(pHeader), 778 getImageBlocks(pHeader), getPowerOfTwo(getImageBlockSize(pHeader)))); 754 779 return VERR_VDI_INVALID_HEADER; 780 } 781 782 if (getImageBlocksAllocated(pHeader) > getImageBlocks(pHeader)) 783 { 784 LogRel(("VDI: too many blocks allocated (%d > %d)\n" 785 " blocksize=%d disksize=%lld\n", 786 getImageBlocksAllocated(pHeader), getImageBlocks(pHeader), 787 getImageBlockSize(pHeader), getImageDiskSize(pHeader))); 788 return VERR_VDI_INVALID_HEADER; 789 } 755 790 756 791 if ( getImageExtraBlockSize(pHeader) != 0 757 792 && getPowerOfTwo(getImageExtraBlockSize(pHeader)) == 0) 793 { 794 LogRel(("VDI: wrong extra size (%d, %d)\n", 795 getImageExtraBlockSize(pHeader), getPowerOfTwo(getImageExtraBlockSize(pHeader)))); 758 796 return VERR_VDI_INVALID_HEADER; 797 } 759 798 760 799 if ( (uint64_t)getImageBlockSize(pHeader) * getImageBlocks(pHeader) < getImageDiskSize(pHeader)) 800 { 801 LogRel(("VDI: wrong disk size (%d, %d, %lld)\n", 802 getImageBlockSize(pHeader), 803 getImageBlocks(pHeader), 804 getImageDiskSize(pHeader))); 761 805 return VERR_VDI_INVALID_HEADER; 806 } 762 807 763 808 if (RTUuidIsNull(getImageCreationUUID(pHeader))) 809 { 810 LogRel(("VDI: uuid of creator is 0\n")); 764 811 return VERR_VDI_INVALID_HEADER; 812 } 765 813 if (RTUuidIsNull(getImageModificationUUID(pHeader))) 814 { 815 LogRel(("VDI: uuid of modificator is 0\n")); 766 816 return VERR_VDI_INVALID_HEADER; 817 } 767 818 768 819 return VINF_SUCCESS; -
trunk/src/VBox/Devices/Storage/testcase/vhddtool.cpp
r1 r124 74 74 RTPrintf("The operation completed successfully! (rc=%Rrc)\n", rc); 75 75 else 76 RTPrintf(" failure: %Rrf (%Rrc)\n", rc, rc);76 RTPrintf("FAILURE: %Rrf (%Rrc)\n", rc, rc); 77 77 return rc; 78 78 } … … 80 80 static int NewImage(const char *pszFilename, uint32_t cMBs) 81 81 { 82 RTPrintf(" creating VDI: file=\"%s\" size=%u MB...\n",82 RTPrintf("Creating VDI: file=\"%s\" size=%u MB...\n", 83 83 pszFilename, cMBs); 84 84 int rc = VDICreateBaseImage(pszFilename, … … 91 91 static int ConvertDDImage(const char *pszFilename, const char *pszDDFilename) 92 92 { 93 RTPrintf(" converting VDI: from DD image file=\"%s\" to file=\"%s\"...\n",93 RTPrintf("Converting VDI: from DD image file=\"%s\" to file=\"%s\"...\n", 94 94 pszDDFilename, pszFilename); 95 95 … … 108 108 if (VBOX_SUCCESS(rc)) 109 109 { 110 RTPrintf(" creating fixed image with size %u Bytes...\n", (unsigned)cbFile);110 RTPrintf("Creating fixed image with size %u Bytes...\n", (unsigned)cbFile); 111 111 rc = VDICreateBaseImage(pszFilename, 112 112 VDI_IMAGE_TYPE_FIXED, … … 116 116 if (VBOX_SUCCESS(rc)) 117 117 { 118 RTPrintf(" writing data...\n");118 RTPrintf("Writing data...\n"); 119 119 PVDIDISK pVdi = VDIDiskCreate(); 120 120 rc = VDIDiskOpenImage(pVdi, pszFilename, VDI_OPEN_FLAGS_NORMAL); … … 177 177 static int ConvertOldImage(const char *pszFilename) 178 178 { 179 RTPrintf(" converting VDI image file=\"%s\" to a new format...\n"179 RTPrintf("Converting VDI image file=\"%s\" to a new format...\n" 180 180 "progress: 0%%", 181 181 pszFilename); … … 188 188 static int DumpImage(const char *pszFilename) 189 189 { 190 RTPrintf(" dumping VDI image file=\"%s\" into the log file...\n", pszFilename);190 RTPrintf("Dumping VDI image file=\"%s\" into the log file...\n", pszFilename); 191 191 PVDIDISK pVdi = VDIDiskCreate(); 192 192 int rc = VDIDiskOpenImage(pVdi, pszFilename, VDI_OPEN_FLAGS_READONLY); … … 201 201 static int ResetImageGeometry(const char *pszFilename) 202 202 { 203 RTPrintf(" resetting geometry info of VDI image file=\"%s\"\n", pszFilename);203 RTPrintf("Resetting geometry info of VDI image file=\"%s\"\n", pszFilename); 204 204 PVDIDISK pVdi = VDIDiskCreate(); 205 205 int rc = VDIDiskOpenImage(pVdi, pszFilename, VDI_OPEN_FLAGS_NORMAL); … … 216 216 static int CopyImage(const char *pszDstFile, const char *pszSrcFile) 217 217 { 218 RTPrintf(" copying VDI image file=\"%s\" to image file=\"%s\"...\n"218 RTPrintf("Copying VDI image file=\"%s\" to image file=\"%s\"...\n" 219 219 "progress: 0%%", 220 220 pszSrcFile, pszDstFile); … … 227 227 static int CopyToDD(const char *pszDstFile, const char *pszSrcFile) 228 228 { 229 RTPrintf(" copying VDI image file=\"%s\" to DD file=\"%s\"...\n",229 RTPrintf("Copying VDI image file=\"%s\" to DD file=\"%s\"...\n", 230 230 pszSrcFile, pszDstFile); 231 231 PVDIDISK pVdi = VDIDiskCreate(); … … 264 264 static int ShrinkImage(const char *pszFilename) 265 265 { 266 RTPrintf(" shrinking VDI image file=\"%s\"...\n"266 RTPrintf("Shrinking VDI image file=\"%s\"...\n" 267 267 "progress: 0%%", 268 268 pszFilename); … … 290 290 ascii2upper(szCmd); 291 291 292 int rc; 292 PRTLOGGER pLogger; 293 static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES; 294 int rc = RTLogCreate(&pLogger, 0, "all", 295 NULL, ELEMENTS(s_apszGroups), s_apszGroups, 296 RTLOGDEST_STDOUT, NULL); 297 RTLogRelSetDefaultInstance(pLogger); 298 293 299 if (strcmp(szCmd, "NEW") == 0) 294 300 { … … 355 361 return SyntaxError("Invalid command!"); 356 362 363 RTLogFlush(NULL); 357 364 return !VBOX_SUCCESS(rc); 358 365 }
Note:
See TracChangeset
for help on using the changeset viewer.