Changeset 79742 in vbox for trunk/src/VBox
- Timestamp:
- Jul 12, 2019 4:11:19 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 132104
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/MediumImpl.h
r77857 r79742 350 350 static DECLCALLBACK(int) i_vdConfigQuerySize(void *pvUser, const char *pszName, 351 351 size_t *pcbValue); 352 static DECLCALLBACK(int) i_vdConfigUpdate(void *pvUser, bool fCreate, 353 const char *pszName, const char *pszValue); 354 352 355 static DECLCALLBACK(int) i_vdConfigQuery(void *pvUser, const char *pszName, 353 356 char *pszValue, size_t cchValue); -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r79479 r79742 847 847 m->vdIfConfig.pfnQuerySize = i_vdConfigQuerySize; 848 848 m->vdIfConfig.pfnQuery = i_vdConfigQuery; 849 m->vdIfConfig.pfnUpdate = i_vdConfigUpdate; 849 850 m->vdIfConfig.pfnQueryBytes = NULL; 850 851 … … 4674 4675 const Utf8Str &name = it->first; 4675 4676 const Utf8Str &value = it->second; 4676 /* do NOT store the plain InitiatorSecret */ 4677 if ( !fHaveInitiatorSecretEncrypted 4678 || !name.equals("InitiatorSecret")) 4679 data.properties[name] = value; 4680 } 4677 bool fCreateOnly = false; 4678 for (MediumFormat::PropertyArray::const_iterator itf = m->formatObj->i_getProperties().begin(); 4679 itf != m->formatObj->i_getProperties().end(); 4680 ++itf) 4681 { 4682 if (itf->strName.equals(name) && 4683 (itf->flags & VD_CFGKEY_CREATEONLY)) 4684 { 4685 fCreateOnly = true; 4686 break; 4687 } 4688 } 4689 if (!fCreateOnly) 4690 /* do NOT store the plain InitiatorSecret */ 4691 if ( !fHaveInitiatorSecretEncrypted 4692 || !name.equals("InitiatorSecret")) 4693 data.properties[name] = value; } 4681 4694 } 4682 4695 if (fHaveInitiatorSecretEncrypted) … … 8018 8031 memcpy(pszValue, psz, cch + 1); 8019 8032 return VINF_SUCCESS; 8033 } 8034 8035 DECLCALLBACK(int) Medium::i_vdConfigUpdate(void *pvUser, 8036 bool fCreate, 8037 const char *pszName, 8038 const char *pszValue) 8039 { 8040 int rv = VINF_SUCCESS; 8041 Utf8Str pName = Utf8Str(pszName); 8042 Medium *that = (Medium *)pvUser; 8043 AutoWriteLock mlock(that COMMA_LOCKVAL_SRC_POS); 8044 settings::StringsMap::const_iterator it = that->m->mapProperties.find(pName); 8045 if (it == that->m->mapProperties.end() && !fCreate) 8046 rv = VERR_CFGM_VALUE_NOT_FOUND; 8047 else 8048 that->m->mapProperties[pName] = Utf8Str(pszValue); 8049 mlock.release(); 8050 return rv; 8020 8051 } 8021 8052 -
trunk/src/VBox/Storage/VDI.cpp
r77622 r79742 44 44 static const VDCONFIGINFO vdiConfigInfo[] = 45 45 { 46 { "AllocationBlockSize", vdiAllocationBlockSize, VDCFGVALUETYPE_INTEGER, 0},46 { "AllocationBlockSize", vdiAllocationBlockSize, VDCFGVALUETYPE_INTEGER, VD_CFGKEY_CREATEONLY }, 47 47 { NULL, NULL, VDCFGVALUETYPE_INTEGER, 0 } 48 48 }; … … 541 541 pImage->uShiftOffset2Index = getPowerOfTwo(getImageBlockSize(&pImage->Header)); 542 542 pImage->offStartBlockData = getImageExtraBlockSize(&pImage->Header); 543 pImage->cbTotalBlockData = pImage->offStartBlockData 543 pImage->cbAllocationBlock = getImageBlockSize(&pImage->Header); 544 pImage->cbTotalBlockData = pImage->offStartBlockData 544 545 + getImageBlockSize(&pImage->Header); 545 546 } … … 706 707 int rc = VINF_SUCCESS; 707 708 uint32_t cbDataAlign = VDI_DATA_ALIGN; 708 uint32_t cbAllocationBlock = VDI_IMAGE_DEFAULT_BLOCK_SIZE;709 709 AssertPtr(pPCHSGeometry); 710 710 AssertPtr(pLCHSGeometry); … … 723 723 if (pImgCfg) 724 724 { 725 rc = VDCFGQueryU32Def(pImgCfg, "AllocationBlockSize", &cbAllocationBlock, VDI_IMAGE_DEFAULT_BLOCK_SIZE); 725 rc = VDCFGQueryU32Def(pImgCfg, "AllocationBlockSize", 726 &pImage->cbAllocationBlock, VDI_IMAGE_DEFAULT_BLOCK_SIZE); 726 727 if (RT_FAILURE(rc)) 727 728 rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, … … 741 742 742 743 rc = vdiSetupImageState(pImage, uImageFlags, pszComment, cbSize, 743 cbAllocationBlock, cbDataAlign, pPCHSGeometry, pLCHSGeometry); 744 pImage->cbAllocationBlock, cbDataAlign, pPCHSGeometry, pLCHSGeometry); 745 744 746 if (RT_SUCCESS(rc)) 745 747 { … … 1013 1015 pRegion->cbMetadata = 0; 1014 1016 pRegion->cRegionBlocksOrBytes = getImageDiskSize(&pImage->Header); 1017 if (uOpenFlags & VD_OPEN_FLAGS_INFO) 1018 { 1019 PVDINTERFACECONFIG pImgCfg = VDIfConfigGet(pImage->pVDIfsImage); 1020 if (pImgCfg) 1021 { 1022 rc = VDCFGUpdateU64(pImgCfg, true, "AllocationBlockSize", pImage->cbAllocationBlock); 1023 if (RT_FAILURE(rc)) 1024 return rc; 1025 } 1026 } 1015 1027 } 1016 1028 else -
trunk/src/VBox/Storage/VDICore.h
r76578 r79742 554 554 /** Total size of image block (including the extra data). */ 555 555 unsigned cbTotalBlockData; 556 /** Allocation Block Size */ 557 unsigned cbAllocationBlock; 556 558 /** Container filename. (UTF-8) */ 557 559 const char *pszFilename;
Note:
See TracChangeset
for help on using the changeset viewer.