Changeset 8512 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Apr 30, 2008 3:13:02 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VDICore.cpp
r8155 r8512 441 441 } 442 442 } 443 443 #ifndef RT_OS_WINDOWS 444 444 rc = RTFileLock(pImage->File, 445 445 RTFILE_LOCK_WRITE | RTFILE_LOCK_IMMEDIATELY, 0, cbLock); … … 449 449 goto l_create_failed; 450 450 } 451 451 #endif 452 452 if (enmType == VDI_IMAGE_TYPE_FIXED) 453 453 { … … 542 542 l_create_failed: 543 543 544 #ifndef RT_OS_WINDOWS 544 545 if (cbLock) 545 546 RTFileUnlock(pImage->File, 0, cbLock); 546 547 #endif 547 548 RTFileClose(pImage->File); 548 549 … … 601 602 fOpen & VDI_OPEN_FLAGS_READONLY 602 603 ? RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE 603 : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_ NONE);604 : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 604 605 if (VBOX_FAILURE(rc)) 605 606 { … … 622 623 pImage->fReadOnly = !!(pImage->fOpen & VDI_OPEN_FLAGS_READONLY); 623 624 625 #ifndef RT_OS_WINDOWS 624 626 /* 625 627 * Set initial file lock for reading header only. … … 633 635 goto l_open_failed; 634 636 } 637 #endif 635 638 636 639 /* Read pre-header. */ … … 734 737 pImage->fModified = VDI_IMAGE_MODIFIED_FIRST; 735 738 739 #ifndef RT_OS_WINDOWS 736 740 /* Image is validated, set working file lock on it. */ 737 741 rc = RTFileUnlock(pImage->File, 0, cbLock); … … 759 763 goto l_open_failed; 760 764 } 765 #endif 761 766 762 767 /* Allocate memory for blocks array. */ … … 785 790 if (pImage->paBlocks) 786 791 RTMemFree(pImage->paBlocks); 792 #ifndef RT_OS_WINDOWS 787 793 if (cbLock) 788 794 RTFileUnlock(pImage->File, 0, cbLock); 795 #endif 789 796 RTFileClose(pImage->File); 790 797 RTMemFree(pImage); … … 964 971 965 972 VDIFlushImage(pImage); 973 #ifndef RT_OS_WINDOWS 966 974 RTFileUnlock(pImage->File, 967 975 0, 968 976 pImage->offStartData 969 977 + ((uint64_t)getImageBlocks(&pImage->Header) << pImage->uShiftIndex2Offset)); 978 #endif 970 979 RTFileClose(pImage->File); 971 980 … … 1946 1955 if (VBOX_SUCCESS(rc)) 1947 1956 { 1957 #ifndef RT_OS_WINDOWS 1948 1958 /* lock new image exclusively to close any wrong access by VDI API calls. */ 1949 1959 rc = RTFileLock(File, RTFILE_LOCK_WRITE | RTFILE_LOCK_IMMEDIATELY, 0, cbFile); 1950 1960 if (VBOX_SUCCESS(rc)) 1961 #endif 1951 1962 { 1952 1963 /* Set the size of a new file. */ … … 2038 2049 } 2039 2050 2051 #ifndef RT_OS_WINDOWS 2040 2052 RTFileUnlock(File, 0, cbFile); 2053 #endif 2041 2054 } 2042 2055 … … 3319 3332 VDIFlushImage(pImage); 3320 3333 3334 #ifdef RT_OS_WINDOWS 3335 int rc = VINF_SUCCESS; 3336 #else 3321 3337 /* Change image locking. */ 3322 3338 uint64_t cbLock = pImage->offStartData … … 3328 3344 0, 3329 3345 cbLock); 3346 #endif 3330 3347 if (VBOX_SUCCESS(rc)) 3331 3348 { … … 3336 3353 } 3337 3354 3355 #ifndef RT_OS_WINDOWS 3338 3356 /* Check for the most bad error in the world. Damn! It must never happens in real life! */ 3339 3357 if (rc == VERR_FILE_LOCK_LOST) … … 3352 3370 rc = VERR_FILE_LOCK_VIOLATION; 3353 3371 } 3372 #endif 3354 3373 3355 3374 Log(("vdiChangeImageMode: Image \"%s\" mode change failed with rc=%Vrc, mode is %s\n",
Note:
See TracChangeset
for help on using the changeset viewer.