- Timestamp:
- Mar 8, 2019 2:55:07 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129234
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
r76553 r77606 1 #include <signal.h> 1 2 /* $Id$ */ 2 3 /** @file … … 50 51 MEDIUMCATEGORY_FLOPPY 51 52 } MEDIUMCATEGORY; 52 53 54 53 55 54 // funcs … … 244 243 { "--variant", 'm', RTGETOPT_REQ_STRING }, 245 244 { "-variant", 'm', RTGETOPT_REQ_STRING }, // deprecated 245 { "--property", 'p', RTGETOPT_REQ_STRING } 246 246 }; 247 247 … … 253 253 const char *diffparent = NULL; 254 254 uint64_t size = 0; 255 typedef struct MEDIUMPROPERTY_LIST { 256 struct MEDIUMPROPERTY_LIST *next; 257 char *key; 258 char *value; 259 } MEDIUMPROPERTY, *PMEDIUMPROPERTY; 260 PMEDIUMPROPERTY pMediumProps = NULL; 255 261 enum { 256 262 CMD_NONE, … … 312 318 break; 313 319 320 case 'p': // --property 321 { 322 /* allocate property kvp, parse, and append to end of singly linked list */ 323 # define PROP_MAXLEN 256 324 PMEDIUMPROPERTY pNewProp = (PMEDIUMPROPERTY)RTMemAlloc(sizeof(MEDIUMPROPERTY)); 325 if (!pNewProp) 326 return errorArgument("Can't allocate memory for property '%s'", ValueUnion.psz); 327 int cbKvp = RTStrNLen(ValueUnion.psz, PROP_MAXLEN); 328 char *cp; 329 for (cp = (char *)ValueUnion.psz; *cp != '=' && cp < ValueUnion.psz + cbKvp; cp++) 330 continue; 331 if (cp < ValueUnion.psz + cbKvp) 332 { 333 *cp = '\0'; 334 pNewProp->next = NULL; 335 pNewProp->key = (char *)ValueUnion.psz; 336 pNewProp->value = cp + 1; 337 } 338 if (pMediumProps) { 339 PMEDIUMPROPERTY pProp; 340 for (pProp = pMediumProps; pProp->next; pProp = pProp->next) 341 continue; 342 pProp->next = pNewProp; 343 } 344 else 345 pMediumProps = pNewProp; 346 } 314 347 case 'F': // --static ("fixed"/"flat") 315 348 { … … 441 474 rc = E_INVALIDARG; /* cannot happen but make gcc happy */ 442 475 476 443 477 if (SUCCEEDED(rc) && pMedium) 444 478 { 479 if (pMediumProps) 480 for (PMEDIUMPROPERTY pProp = pMediumProps; pProp; pProp = pProp->next) 481 CHECK_ERROR(pMedium, SetProperty(Bstr(pProp->key).raw(), Bstr(pProp->value).raw())); 482 } 483 445 484 ComPtr<IProgress> pProgress; 446 485 com::SafeArray<MediumVariant_T> l_variants(sizeof(MediumVariant_T)*8); … … 461 500 rc = showProgress(pProgress); 462 501 CHECK_PROGRESS_ERROR(pProgress, ("Failed to create medium")); 463 }464 502 } 465 503 … … 1000 1038 else if (cmd == CMD_DVD) 1001 1039 rc = createMedium(a, strFormat.c_str(), pszDst, DeviceType_DVD, 1002 AccessMode_ReadOnly, pDstMedium);1040 AccessMode_ReadOnly, pDstMedium); 1003 1041 else if (cmd == CMD_FLOPPY) 1004 1042 rc = createMedium(a, strFormat.c_str(), pszDst, DeviceType_Floppy, -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r77595 r77606 993 993 " [--variant Standard,Fixed,Split2G,Stream,ESX,\n" 994 994 " Formatted]\n" 995 " [[--property <name>=<value>] --property <name>=<value]...\n" 995 996 "\n", SEP); 996 997 -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r76592 r77606 2439 2439 switch (m->state) 2440 2440 { 2441 case MediumState_NotCreated: 2441 2442 case MediumState_Created: 2442 2443 case MediumState_Inaccessible: -
trunk/src/VBox/Storage/VDI.cpp
r76553 r77606 39 39 #define SET_ENDIAN_U32(conv, u32) (conv == VDIECONV_H2F ? RT_H2LE_U32(u32) : RT_LE2H_U32(u32)) 40 40 #define SET_ENDIAN_U64(conv, u64) (conv == VDIECONV_H2F ? RT_H2LE_U64(u64) : RT_LE2H_U64(u64)) 41 42 static const char *vdiAllocationBlockSize = "1048576"; 43 44 static const VDCONFIGINFO vdiConfigInfo[] = { 45 { "AllocationBlockSize", vdiAllocationBlockSize, VDCFGVALUETYPE_INTEGER, 0 } 46 }; 41 47 42 48 … … 178 184 } 179 185 186 180 187 /** 181 188 * Internal: Set the appropriate endianess on all the Blocks pointed. … … 549 556 */ 550 557 static int vdiSetupImageState(PVDIIMAGEDESC pImage, unsigned uImageFlags, const char *pszComment, 551 uint64_t cbSize, uint32_t cb DataAlign, PCVDGEOMETRY pPCHSGeometry,558 uint64_t cbSize, uint32_t cbAllocationBlock, uint32_t cbDataAlign, PCVDGEOMETRY pPCHSGeometry, 552 559 PCVDGEOMETRY pLCHSGeometry) 553 560 { … … 555 562 556 563 vdiInitPreHeader(&pImage->PreHeader); 557 vdiInitHeader(&pImage->Header, uImageFlags, pszComment, cbSize, VDI_IMAGE_DEFAULT_BLOCK_SIZE, 0,564 vdiInitHeader(&pImage->Header, uImageFlags, pszComment, cbSize, cbAllocationBlock, 0, 558 565 cbDataAlign); 559 566 /* Save PCHS geometry. Not much work, and makes the flow of information … … 696 703 int rc = VINF_SUCCESS; 697 704 uint32_t cbDataAlign = VDI_DATA_ALIGN; 698 705 uint32_t cbAllocationBlock = VDI_IMAGE_DEFAULT_BLOCK_SIZE; 699 706 AssertPtr(pPCHSGeometry); 700 707 AssertPtr(pLCHSGeometry); … … 710 717 N_("VDI: comment is too long for '%s'"), pImage->pszFilename); 711 718 719 PVDINTERFACECONFIG pImgCfg = VDIfConfigGet(pImage->pVDIfsImage); 720 if (pImgCfg) { 721 rc = VDCFGQueryU32Def(pImgCfg, "AllocationBlockSize", &cbAllocationBlock, VDI_IMAGE_DEFAULT_BLOCK_SIZE); 722 if (RT_FAILURE(rc)) 723 rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, 724 N_("VDI: Getting AllocationBlockSize for '%s' failed (%Rrc)"), pImage->pszFilename, rc); 725 } 726 712 727 if (pIfCfg) 713 728 { … … 720 735 if (RT_SUCCESS(rc)) 721 736 { 722 rc = vdiSetupImageState(pImage, uImageFlags, pszComment, cbSize, cbDataAlign, 723 pPCHSGeometry, pLCHSGeometry); 737 738 rc = vdiSetupImageState(pImage, uImageFlags, pszComment, cbSize, 739 cbAllocationBlock, cbDataAlign, pPCHSGeometry, pLCHSGeometry); 724 740 if (RT_SUCCESS(rc)) 725 741 { … … 1484 1500 PVDINTERFACEPROGRESS pIfProgress = VDIfProgressGet(pVDIfsOperation); 1485 1501 PVDINTERFACECONFIG pIfCfg = VDIfConfigGet(pVDIfsOperation); 1486 1487 1502 pImage->pszFilename = pszFilename; 1488 1503 pImage->pStorage = NULL; … … 3132 3147 s_aVdiFileExtensions, 3133 3148 /* paConfigInfo */ 3134 NULL,3149 vdiConfigInfo, 3135 3150 /* pfnProbe */ 3136 3151 vdiProbe,
Note:
See TracChangeset
for help on using the changeset viewer.