Changeset 57064 in vbox
- Timestamp:
- Jul 23, 2015 4:22:04 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101786
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vd.h
r56291 r57064 127 127 /** @} */ 128 128 129 /** @name VBox raw disk or partition flags 130 * @{ 131 */ 132 /** No special treatment. */ 133 #define VBOXHDDRAW_NORMAL 0 134 /** Whether this is a raw disk (where the partition information is ignored) or 135 * not. Valid only in the raw disk descriptor. */ 136 #define VBOXHDDRAW_DISK RT_BIT(0) 137 /** Open the corresponding raw disk or partition for reading only, no matter 138 * how the image is created or opened. */ 139 #define VBOXHDDRAW_READONLY RT_BIT(1) 140 /** @} */ 141 129 142 /** 130 143 * Auxiliary type for describing partitions on raw disks. The entries must be … … 150 163 /** Size of the data area. */ 151 164 uint64_t cbData; 165 /** Flags for special treatment, see VBOXHDDRAW_FLAGS_*. */ 166 uint32_t uFlags; 152 167 } VBOXHDDRAWPARTDESC, *PVBOXHDDRAWPARTDESC; 153 168 … … 170 185 * to make logging of the comment string produce sensible results. */ 171 186 char szSignature[4]; 187 /** Flags for special treatment, see VBOXHDDRAW_FLAGS_*. */ 172 188 /** Flag whether access to full disk should be given (ignoring the 173 189 * partition information below). */ 174 bool fRawDisk;190 uint32_t uFlags; 175 191 /** Filename for the raw disk. Ignored for partitioned raw disks. 176 192 * For Linux e.g. /dev/sda, and for Windows e.g. \\\\.\\PhysicalDisk0. */ … … 182 198 /** Partitioning type of the disk */ 183 199 VBOXHDDPARTTYPE uPartitioningType; 184 185 200 } VBOXHDDRAW, *PVBOXHDDRAW; 186 201 -
trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
r56918 r57064 1502 1502 if (!pszPartitions) 1503 1503 { 1504 RawDescriptor. fRawDisk = true;1504 RawDescriptor.uFlags = VBOXHDDRAW_DISK; 1505 1505 RawDescriptor.pszRawDisk = rawdisk.c_str(); 1506 1506 } 1507 1507 else 1508 1508 { 1509 RawDescriptor. fRawDisk = false;1509 RawDescriptor.uFlags = VBOXHDDRAW_NORMAL; 1510 1510 RawDescriptor.pszRawDisk = NULL; 1511 1511 RawDescriptor.cPartDescs = 0; … … 1513 1513 1514 1514 uint32_t uPartitions = 0; 1515 uint32_t uPartitionsRO = 0; 1515 1516 1516 1517 const char *p = pszPartitions; … … 1527 1528 uPartitions |= RT_BIT(u32); 1528 1529 p = pszNext; 1530 if (*p == 'r') 1531 { 1532 uPartitionsRO |= RT_BIT(u32); 1533 p++; 1534 } 1529 1535 if (*p == ',') 1530 1536 p++; … … 1647 1653 if (uPartitions & RT_BIT(partitions.aPartitions[i].uIndex)) 1648 1654 { 1655 if (uPartitionsRO & RT_BIT(partitions.aPartitions[i].uIndex)) 1656 pPartDesc->uFlags |= VBOXHDDRAW_READONLY; 1657 1649 1658 if (fRelative) 1650 1659 { … … 1759 1768 1760 1769 #ifdef DEBUG_klaus 1761 if (! RawDescriptor.fRawDisk)1770 if (!(RawDescriptor.uFlags & VBOXHDDRAW_DISK)) 1762 1771 { 1763 1772 RTPrintf("# start length startoffset partdataptr device\n"); -
trunk/src/VBox/Storage/VMDK.cpp
r57007 r57064 3246 3246 case VMDKETYPE_HOSTED_SPARSE: 3247 3247 rc = vmdkFileOpen(pImage, &pExtent->pFile, pExtent->pszFullname, 3248 VDOpenFlagsToFileOpenFlags(uOpenFlags ,3248 VDOpenFlagsToFileOpenFlags(uOpenFlags | (pExtent->enmAccess == VMDKACCESS_READONLY) ? VD_OPEN_FLAGS_READONLY : 0, 3249 3249 false /* fCreate */)); 3250 3250 if (RT_FAILURE(rc)) … … 3273 3273 case VMDKETYPE_FLAT: 3274 3274 rc = vmdkFileOpen(pImage, &pExtent->pFile, pExtent->pszFullname, 3275 VDOpenFlagsToFileOpenFlags(uOpenFlags ,3275 VDOpenFlagsToFileOpenFlags(uOpenFlags | (pExtent->enmAccess == VMDKACCESS_READONLY) ? VD_OPEN_FLAGS_READONLY : 0, 3276 3276 false /* fCreate */)); 3277 3277 if (RT_FAILURE(rc)) … … 3365 3365 PVMDKEXTENT pExtent; 3366 3366 3367 if (pRaw-> fRawDisk)3367 if (pRaw->uFlags & VBOXHDDRAW_DISK) 3368 3368 { 3369 3369 /* Full raw disk access. This requires setting up a descriptor … … 3394 3394 pExtent->cNominalSectors = VMDK_BYTE2SECTOR(cbSize); 3395 3395 pExtent->uSectorOffset = 0; 3396 pExtent->enmAccess = VMDKACCESS_READWRITE;3396 pExtent->enmAccess = (pRaw->uFlags & VBOXHDDRAW_READONLY) ? VMDKACCESS_READONLY : VMDKACCESS_READWRITE; 3397 3397 pExtent->fMetaDirty = false; 3398 3398 3399 3399 /* Open flat image, the raw disk. */ 3400 3400 rc = vmdkFileOpen(pImage, &pExtent->pFile, pExtent->pszFullname, 3401 VDOpenFlagsToFileOpenFlags(pImage->uOpenFlags & ~VD_OPEN_FLAGS_READONLY,3401 VDOpenFlagsToFileOpenFlags(pImage->uOpenFlags | (pExtent->enmAccess == VMDKACCESS_READONLY) ? VD_OPEN_FLAGS_READONLY : 0, 3402 3402 false /* fCreate */)); 3403 3403 if (RT_FAILURE(rc)) … … 3507 3507 /* Create partition table flat image. */ 3508 3508 rc = vmdkFileOpen(pImage, &pExtent->pFile, pExtent->pszFullname, 3509 VDOpenFlagsToFileOpenFlags(pImage->uOpenFlags ,3509 VDOpenFlagsToFileOpenFlags(pImage->uOpenFlags | (pExtent->enmAccess == VMDKACCESS_READONLY) ? VD_OPEN_FLAGS_READONLY : 0, 3510 3510 true /* fCreate */)); 3511 3511 if (RT_FAILURE(rc)) … … 3537 3537 pExtent->cNominalSectors = VMDK_BYTE2SECTOR(pPart->cbData); 3538 3538 pExtent->uSectorOffset = VMDK_BYTE2SECTOR(pPart->uStartOffset); 3539 pExtent->enmAccess = VMDKACCESS_READWRITE;3539 pExtent->enmAccess = (pPart->uFlags & VBOXHDDRAW_READONLY) ? VMDKACCESS_READONLY : VMDKACCESS_READWRITE; 3540 3540 pExtent->fMetaDirty = false; 3541 3541 3542 3542 /* Open flat image, the raw partition. */ 3543 3543 rc = vmdkFileOpen(pImage, &pExtent->pFile, pExtent->pszFullname, 3544 VDOpenFlagsToFileOpenFlags(pImage->uOpenFlags & ~VD_OPEN_FLAGS_READONLY,3544 VDOpenFlagsToFileOpenFlags(pImage->uOpenFlags | (pExtent->enmAccess == VMDKACCESS_READONLY) ? VD_OPEN_FLAGS_READONLY : 0, 3545 3545 false /* fCreate */)); 3546 3546 if (RT_FAILURE(rc)) … … 3574 3574 3575 3575 rc = vmdkDescBaseSetStr(pImage, &pImage->Descriptor, "createType", 3576 pRaw->fRawDisk?3576 (pRaw->uFlags & VBOXHDDRAW_DISK) ? 3577 3577 "fullDevice" : "partitionedDevice"); 3578 3578 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.