Changeset 13223 in vbox for trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
- Timestamp:
- Oct 13, 2008 3:43:50 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
r12143 r13223 127 127 128 128 /** 129 * Internal: translate VD image type enum to VDI image type enum. 130 */ 131 static VDIIMAGETYPE vdiTranslateTypeVD2VDI(VDIMAGETYPE enmType) 132 { 133 switch (enmType) 134 { 135 case VD_IMAGE_TYPE_NORMAL: 136 return VDI_IMAGE_TYPE_NORMAL; 137 case VD_IMAGE_TYPE_FIXED: 138 return VDI_IMAGE_TYPE_FIXED; 139 case VD_IMAGE_TYPE_UNDO: 140 return VDI_IMAGE_TYPE_UNDO; 141 case VD_IMAGE_TYPE_DIFF: 142 return VDI_IMAGE_TYPE_DIFF; 143 default: 144 AssertMsgFailed(("invalid VDIMAGETYPE enmType=%d\n", (int)enmType)); 145 return VDI_IMAGE_TYPE_NORMAL; 146 } 147 } 148 149 /** 150 * Internal: translate VDI image type enum to VD image type enum. 151 */ 152 static VDIMAGETYPE vdiTranslateTypeVDI2VD(VDIIMAGETYPE enmType) 153 { 154 switch (enmType) 155 { 156 case VDI_IMAGE_TYPE_NORMAL: 157 return VD_IMAGE_TYPE_NORMAL; 158 case VDI_IMAGE_TYPE_FIXED: 159 return VD_IMAGE_TYPE_FIXED; 160 case VDI_IMAGE_TYPE_UNDO: 161 return VD_IMAGE_TYPE_UNDO; 162 case VDI_IMAGE_TYPE_DIFF: 163 return VD_IMAGE_TYPE_DIFF; 164 default: 165 AssertMsgFailed(("invalid VDIIMAGETYPE enmType=%d\n", (int)enmType)); 166 return VD_IMAGE_TYPE_INVALID; 167 } 168 } 169 170 /** 129 171 * Internal: Init VDI header. Always use latest header version. 130 172 * @param pHeader Assumes it was initially initialized to all zeros. … … 137 179 pHeader->uVersion = VDI_IMAGE_VERSION; 138 180 pHeader->u.v1.cbHeader = sizeof(VDIHEADER1); 139 pHeader->u.v1.u32Type = (uint32_t)( enmType == VD_IMAGE_TYPE_NORMAL 140 ? VDI_IMAGE_TYPE_NORMAL 141 : VDI_IMAGE_TYPE_DIFF); 181 pHeader->u.v1.u32Type = (uint32_t)vdiTranslateTypeVD2VDI(enmType); 142 182 pHeader->u.v1.fFlags = (uImageFlags & VD_VDI_IMAGE_FLAGS_ZERO_EXPAND) ? 1 : 0; 143 183 #ifdef VBOX_STRICT … … 1153 1193 1154 1194 if (pImage) 1155 *penmImageType = getImageType(&pImage->Header) == VDI_IMAGE_TYPE_NORMAL 1156 ? VD_IMAGE_TYPE_NORMAL 1157 : VD_IMAGE_TYPE_DIFF; 1195 *penmImageType = vdiTranslateTypeVDI2VD(getImageType(&pImage->Header)); 1158 1196 else 1159 1197 rc = VERR_VDI_NOT_OPENED;
Note:
See TracChangeset
for help on using the changeset viewer.