Changeset 62747 in vbox for trunk/src/VBox
- Timestamp:
- Jul 30, 2016 4:01:43 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/RAW.cpp
r62482 r62747 234 234 unsigned uPercentStart, unsigned uPercentSpan) 235 235 { 236 RT_NOREF1(pszComment); 236 237 int rc; 237 238 RTFOFF cbFree = 0; … … 307 308 PVDINTERFACE pVDIfsImage, VDTYPE *penmType) 308 309 { 310 RT_NOREF1(pVDIfsDisk); 309 311 LogFlowFunc(("pszFilename=\"%s\" pVDIfsDisk=%#p pVDIfsImage=%#p\n", pszFilename, pVDIfsDisk, pVDIfsImage)); 310 312 PVDIOSTORAGE pStorage = NULL; … … 333 335 &pStorage); 334 336 if (RT_SUCCESS(rc)) 337 { 335 338 rc = vdIfIoIntFileGetSize(pIfIo, pStorage, &cbFile); 336 339 337 /* Try to guess the image type based on the extension. */ 338 if ( RT_SUCCESS(rc) 339 && pszSuffix) 340 { 341 if ( !RTStrICmp(pszSuffix, ".iso") 342 || !RTStrICmp(pszSuffix, ".cdr")) /* DVD images. */ 340 /* Try to guess the image type based on the extension. */ 341 if ( RT_SUCCESS(rc) 342 && pszSuffix) 343 343 { 344 /* Note that there are ISO images smaller than 1 MB; it is impossible to distinguish 345 * between raw floppy and CD images based on their size (and cannot be reliably done 346 * based on contents, either). 347 */ 348 if (cbFile % 2048) 349 rc = VERR_VD_RAW_SIZE_MODULO_2048; 350 else if (cbFile <= 32768) 351 rc = VERR_VD_RAW_SIZE_OPTICAL_TOO_SMALL; 344 if ( !RTStrICmp(pszSuffix, ".iso") 345 || !RTStrICmp(pszSuffix, ".cdr")) /* DVD images. */ 346 { 347 /* Note that there are ISO images smaller than 1 MB; it is impossible to distinguish 348 * between raw floppy and CD images based on their size (and cannot be reliably done 349 * based on contents, either). 350 */ 351 if (cbFile % 2048) 352 rc = VERR_VD_RAW_SIZE_MODULO_2048; 353 else if (cbFile <= 32768) 354 rc = VERR_VD_RAW_SIZE_OPTICAL_TOO_SMALL; 355 else 356 { 357 *penmType = VDTYPE_DVD; 358 rc = VINF_SUCCESS; 359 } 360 } 361 else if ( !RTStrICmp(pszSuffix, ".img") 362 || !RTStrICmp(pszSuffix, ".ima") 363 || !RTStrICmp(pszSuffix, ".dsk") 364 || !RTStrICmp(pszSuffix, ".flp") 365 || !RTStrICmp(pszSuffix, ".vfd")) /* Floppy images */ 366 { 367 if (cbFile % 512) 368 rc = VERR_VD_RAW_SIZE_MODULO_512; 369 else if (cbFile > RAW_MAX_FLOPPY_IMG_SIZE) 370 rc = VERR_VD_RAW_SIZE_FLOPPY_TOO_BIG; 371 else 372 { 373 *penmType = VDTYPE_FLOPPY; 374 rc = VINF_SUCCESS; 375 } 376 } 352 377 else 353 { 354 *penmType = VDTYPE_DVD; 355 rc = VINF_SUCCESS; 356 } 357 } 358 else if ( !RTStrICmp(pszSuffix, ".img") 359 || !RTStrICmp(pszSuffix, ".ima") 360 || !RTStrICmp(pszSuffix, ".dsk") 361 || !RTStrICmp(pszSuffix, ".flp") 362 || !RTStrICmp(pszSuffix, ".vfd")) /* Floppy images */ 363 { 364 if (cbFile % 512) 365 rc = VERR_VD_RAW_SIZE_MODULO_512; 366 else if (cbFile > RAW_MAX_FLOPPY_IMG_SIZE) 367 rc = VERR_VD_RAW_SIZE_FLOPPY_TOO_BIG; 368 else 369 { 370 *penmType = VDTYPE_FLOPPY; 371 rc = VINF_SUCCESS; 372 } 378 rc = VERR_VD_RAW_INVALID_HEADER; 373 379 } 374 380 else 375 381 rc = VERR_VD_RAW_INVALID_HEADER; 376 382 } 377 else378 rc = VERR_VD_RAW_INVALID_HEADER;379 383 380 384 if (pStorage) … … 451 455 void **ppBackendData) 452 456 { 457 RT_NOREF1(pUuid); 453 458 LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p", 454 459 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData)); … … 619 624 size_t *pcbPostRead, unsigned fWrite) 620 625 { 626 RT_NOREF1(fWrite); 621 627 int rc = VINF_SUCCESS; 622 628 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; … … 907 913 size_t cbComment) 908 914 { 915 RT_NOREF2(pszComment, cbComment); 909 916 LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment)); 910 917 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; … … 925 932 static DECLCALLBACK(int) rawSetComment(void *pBackendData, const char *pszComment) 926 933 { 934 RT_NOREF1(pszComment); 927 935 LogFlowFunc(("pBackendData=%#p pszComment=\"%s\"\n", pBackendData, pszComment)); 928 936 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; … … 948 956 static DECLCALLBACK(int) rawGetUuid(void *pBackendData, PRTUUID pUuid) 949 957 { 958 RT_NOREF1(pUuid); 950 959 LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid)); 951 960 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; … … 966 975 static DECLCALLBACK(int) rawSetUuid(void *pBackendData, PCRTUUID pUuid) 967 976 { 977 RT_NOREF1(pUuid); 968 978 LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid)); 969 979 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; … … 990 1000 static DECLCALLBACK(int) rawGetModificationUuid(void *pBackendData, PRTUUID pUuid) 991 1001 { 1002 RT_NOREF1(pUuid); 992 1003 LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid)); 993 1004 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; … … 1008 1019 static DECLCALLBACK(int) rawSetModificationUuid(void *pBackendData, PCRTUUID pUuid) 1009 1020 { 1021 RT_NOREF1(pUuid); 1010 1022 LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid)); 1011 1023 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; … … 1031 1043 static DECLCALLBACK(int) rawGetParentUuid(void *pBackendData, PRTUUID pUuid) 1032 1044 { 1045 RT_NOREF1(pUuid); 1033 1046 LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid)); 1034 1047 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; … … 1049 1062 static DECLCALLBACK(int) rawSetParentUuid(void *pBackendData, PCRTUUID pUuid) 1050 1063 { 1064 RT_NOREF1(pUuid); 1051 1065 LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid)); 1052 1066 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; … … 1072 1086 static DECLCALLBACK(int) rawGetParentModificationUuid(void *pBackendData, PRTUUID pUuid) 1073 1087 { 1088 RT_NOREF1(pUuid); 1074 1089 LogFlowFunc(("pBackendData=%#p pUuid=%#p\n", pBackendData, pUuid)); 1075 1090 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; … … 1090 1105 static DECLCALLBACK(int) rawSetParentModificationUuid(void *pBackendData, PCRTUUID pUuid) 1091 1106 { 1107 RT_NOREF1(pUuid); 1092 1108 LogFlowFunc(("pBackendData=%#p Uuid=%RTuuid\n", pBackendData, pUuid)); 1093 1109 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
Note:
See TracChangeset
for help on using the changeset viewer.