Changeset 75816 in vbox for trunk/src/VBox
- Timestamp:
- Nov 29, 2018 2:58:30 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ImageMounter/vboxraw/vboxraw.cpp
r75815 r75816 20 20 * Header Files * 21 21 *********************************************************************************************************************************/ 22 23 /*** PKK TEMPORARY FOR DEBUGGING DON'T PUT INTO PRODUCTION CODE */24 #include <stdio.h>25 /*** END OF ADMONITION */26 27 22 28 23 #define LOG_GROUP LOG_GROUP_DEFAULT /** @todo log group */ … … 83 78 #include "SelfSizingTable.h" 84 79 85 /*86 * PKK: REMOVE AFTER DEBUGGING87 */88 #pragma GCC diagnostic ignored "-Wunused-variable"89 #pragma GCC diagnostic ignored "-Wunused-parameter"90 #pragma GCC diagnostic ignored "-Wunused-function"91 92 80 using namespace com; 93 81 … … 108 96 const uint64_t TB = GB * KB; 109 97 const uint64_t PB = TB * KB; 110 111 112 98 113 99 enum { PARTITION_TABLE_MBR = 1, PARTITION_TABLE_GPT = 2 }; … … 136 122 137 123 #define SAFENULL(strPtr) (strPtr ? strPtr : "") 138 139 124 #define CSTR(arg) Utf8Str(arg).c_str() /* Converts XPCOM string type to C string type */ 140 141 125 142 126 static struct fuse_operations g_vboxrawOps; /** FUSE structure that defines allowed ops for this FS */ … … 165 149 int idxPartition; /** partition number */ 166 150 char *pszName; 167 off_t offPartition; /** partition offset from start of disk, in bytes */168 uint64_t cbPartition; /** partition size in bytes */151 off_t offPartition; /** partition offset from start of disk, in bytes */ 152 uint64_t cbPartition; /** partition size in bytes */ 169 153 uint8_t fBootable; /** partition bootable */ 170 154 union … … 173 157 uint128_t gptGuidTypeSpecifier; /** partition type GPT */ 174 158 } partitionType; /** uint8_t for MBR/EBR (legacy) and GUID for GPT */ 175 176 159 union 177 160 { 178 MBRPARTITIONENTRY mbrEntry; 179 GPTPARTITIONENTRY gptEntry; 161 MBRPARTITIONENTRY mbrEntry; /** MBR (also EBR partition entry) */ 162 GPTPARTITIONENTRY gptEntry; /** GPT partition entry */ 180 163 } partitionEntry; 181 164 } PARTITIONINFO; … … 268 251 RTPrintf("It is the vhdd file that the user or a utility will subsequently mount on\n"); 269 252 RTPrintf("the host OS to gain access to the virtual disk contents.\n\n"); 270 RTPrintf("If any of the partition, size or offset related options are used the\n");271 RTPrintf(" Theconstraining start offset (in bytes) and size (in bytes) will be\n");253 RTPrintf("If any of the partition, size or offset related options are used, the\n"); 254 RTPrintf("constraining start offset (in bytes) and size (in bytes) will be\n"); 272 255 RTPrintf("appended in brackets to the symbolic link basename to indicate\n"); 273 RTPrintf("wh atpart of the image is exposed by the FUSE filesystem implementation.\n\n");256 RTPrintf("which part of the image is exposed by the FUSE filesystem implementation.\n\n"); 274 257 } 275 258 … … 956 939 * Parse the four physical partition entires in the MBR (any one, and only one, can be an EBR) 957 940 */ 958 int ebridxPartitionInMbr = 0;941 int idxEbrPartitionInMbr = 0; 959 942 for (int idxPartition = 1; 960 943 idxPartition <= MBR_PARTITIONS_MAX; … … 970 953 if (PARTTYPE_IS_EXT(pMbrPartitionEntry->type)) 971 954 { 972 if ( ebridxPartitionInMbr)955 if (idxEbrPartitionInMbr) 973 956 return RTMsgErrorExitFailure("Multiple EBRs found found in MBR\n"); 974 ebridxPartitionInMbr = idxPartition;957 idxEbrPartitionInMbr = idxPartition; 975 958 } 976 959 … … 979 962 ppi->idxPartition = idxPartition; 980 963 ppi->offPartition = (off_t) pMbrPartitionEntry->partitionLba * BLOCKSIZE; 981 ppi->cbPartition = (off_t) pMbrPartitionEntry->partitionBlkCnt * BLOCKSIZE;982 ppi->fBootable = pMbrPartitionEntry->bootIndicator == 0x80;983 (ppi->partitionType).legacy = pMbrPartitionEntry->type;964 ppi->cbPartition = (off_t) pMbrPartitionEntry->partitionBlkCnt * BLOCKSIZE; 965 ppi->fBootable = pMbrPartitionEntry->bootIndicator == 0x80; 966 ppi->partitionType.legacy = pMbrPartitionEntry->type; 984 967 985 968 g_lastPartNbr = idxPartition; … … 1045 1028 PARTITIONINFO *ppi = &g_aParsedPartitionInfo[g_lastPartNbr]; 1046 1029 memcpy(&(ppi->partitionEntry).gptEntry, pEntry, sizeof(GPTPARTITIONENTRY)); 1047 uint64_t firstLba = pEntry->firstLba; 1048 uint64_t lastLba = pEntry->lastLba; 1049 if (!firstLba) 1030 if (!pEntry->firstLba) 1050 1031 break; 1051 ppi->offPartition = firstLba * BLOCKSIZE;1052 ppi->cbPartition = ( lastLba -firstLba) * BLOCKSIZE;1032 ppi->offPartition = pEntry->firstLba * BLOCKSIZE; 1033 ppi->cbPartition = (pEntry->lastLba - pEntry->firstLba) * BLOCKSIZE; 1053 1034 ppi->fBootable = pEntry->attrFlags & (1 << GPT_LEGACY_BIOS_BOOTABLE); 1054 1035 ppi->partitionType.gptGuidTypeSpecifier = pEntry->partitionTypeGuid; 1055 1036 size_t cwName = sizeof (pEntry->partitionName) / 2; 1056 char *pszTmp = NULL, **pPszTmp = &pszTmp;1057 1037 RTUtf16LittleToUtf8Ex((PRTUTF16)pEntry->partitionName, RTSTR_MAX, &ppi->pszName, cwName, NULL); 1058 1038 ppi->idxPartition = g_lastPartNbr++; … … 1065 1045 * Starting with EBR located in MBR, walk EBR chain to parse the logical partition entries 1066 1046 */ 1067 if ( ebridxPartitionInMbr)1047 if (idxEbrPartitionInMbr) 1068 1048 { 1069 1049 uint32_t firstEbrLba 1070 = g_aParsedPartitionInfo[ ebridxPartitionInMbr].partitionEntry.mbrEntry.partitionLba;1050 = g_aParsedPartitionInfo[idxEbrPartitionInMbr].partitionEntry.mbrEntry.partitionLba; 1071 1051 off_t firstEbrOffset = (off_t)firstEbrLba * BLOCKSIZE; 1072 1052 off_t chainedEbrOffset = 0; … … 1099 1079 PARTITIONINFO *ppi = &g_aParsedPartitionInfo[idxPartition]; 1100 1080 ppi->idxPartition = idxPartition; 1101 ppi->offPartition = currentEbrOffset + (off_t)pEbrPartitionEntry->partitionLba * BLOCKSIZE;1102 ppi->cbPartition = (off_t)pEbrPartitionEntry->partitionBlkCnt * BLOCKSIZE;1081 ppi->offPartition = currentEbrOffset + (off_t)pEbrPartitionEntry->partitionLba * BLOCKSIZE; 1082 ppi->cbPartition = (off_t)pEbrPartitionEntry->partitionBlkCnt * BLOCKSIZE; 1103 1083 ppi->fBootable = pEbrPartitionEntry->bootIndicator == 0x80; 1104 1084 ppi->partitionType.legacy = pEbrPartitionEntry->type;
Note:
See TracChangeset
for help on using the changeset viewer.