Changeset 33307 in vbox for trunk/src/VBox/Main
- Timestamp:
- Oct 21, 2010 1:05:39 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 66878
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r33244 r33307 2924 2924 2925 2925 if ( pMedium 2926 && ( 2926 && ( enmType == DeviceType_DVD 2927 2927 || enmType == DeviceType_Floppy 2928 2928 )) … … 2986 2986 InsertConfigString(pCfg, "Format", bstr); 2987 2987 2988 /* DVDs are always readonly, floppies may be readonly */ 2989 if (enmType == DeviceType_DVD) 2988 if (mediumType == MediumType_Readonly) 2990 2989 { 2991 2990 InsertConfigInteger(pCfg, "ReadOnly", 1); … … 3005 3004 * make DrvVD undo TempReadOnly. It gets interesting if we fail after 3006 3005 * that. Grumble. */ 3007 else if ( aMachineState == MachineState_TeleportingIn 3008 || aMachineState == MachineState_FaultTolerantSyncing) 3006 if ( enmType == DeviceType_HardDisk 3007 && ( aMachineState == MachineState_TeleportingIn 3008 || aMachineState == MachineState_FaultTolerantSyncing)) 3009 3009 { 3010 3010 InsertConfigInteger(pCfg, "TempReadOnly", 1); -
trunk/src/VBox/Main/MachineImpl.cpp
r33300 r33307 11349 11349 { 11350 11350 MediumType_T mediumType = pMedium->getType(); 11351 bool fIsReadOnly Image = devType == DeviceType_DVD11352 11351 bool fIsReadOnlyLock = mediumType == MediumType_Readonly 11352 || mediumType == MediumType_Shareable; 11353 11353 bool fIsVitalImage = (devType == DeviceType_HardDisk); 11354 11354 11355 11355 mrc = pMedium->createMediumLockList(fIsVitalImage /* fFailIfInaccessible */, 11356 !fIsReadOnly Image/* fMediumLockWrite */,11356 !fIsReadOnlyLock /* fMediumLockWrite */, 11357 11357 NULL, 11358 11358 *pMediumLockList); -
trunk/src/VBox/Main/MediumImpl.cpp
r33250 r33307 1192 1192 m->type = data.hdType; 1193 1193 } 1194 else if (aDeviceType == DeviceType_DVD) 1195 m->type = MediumType_Readonly; 1194 1196 else 1195 1197 m->type = MediumType_Writethrough; … … 1280 1282 unconst(m->id) = uuid; 1281 1283 1282 m->type = MediumType_Writethrough; 1284 if (aDeviceType == DeviceType_DVD) 1285 m->type = MediumType_Readonly; 1286 else 1287 m->type = MediumType_Writethrough; 1283 1288 m->devType = aDeviceType; 1284 1289 m->state = MediumState_Created; … … 1646 1651 case MediumType_Writethrough: 1647 1652 case MediumType_Shareable: 1648 { 1649 /* cannot change to writethrough or shareable if there are children */ 1653 case MediumType_Readonly: 1654 { 1655 /* cannot change to writethrough, shareable or readonly 1656 * if there are children */ 1650 1657 if (getChildren().size() != 0) 1651 1658 return setError(VBOX_E_OBJECT_IN_USE, … … 2427 2434 tr("Medium type of '%s' is Shareable"), 2428 2435 m->strLocationFull.c_str()); 2436 else if (m->type == MediumType_Readonly) 2437 return setError(VBOX_E_INVALID_OBJECT_STATE, 2438 tr("Medium type of '%s' is Readonly"), 2439 m->strLocationFull.c_str()); 2429 2440 2430 2441 /* Apply the normal locking logic to the entire chain. */ … … 3244 3255 case MediumType_Writethrough: 3245 3256 case MediumType_Shareable: 3257 case MediumType_Readonly: /* explicit readonly media has no diffs */ 3246 3258 return false; 3247 3259 default: … … 3772 3784 * generate an UUID if it is missing) */ 3773 3785 if ( (m->hddOpenMode == OpenReadOnly) 3786 || m->type == MediumType_Readonly 3774 3787 || !isImport 3775 3788 ) … … 4582 4595 4583 4596 ComAssertThrow( m->type != MediumType_Writethrough 4584 && m->type != MediumType_Shareable, E_FAIL); 4597 && m->type != MediumType_Shareable 4598 && m->type != MediumType_Readonly, E_FAIL); 4585 4599 ComAssertThrow(m->state == MediumState_LockedRead, E_FAIL); 4586 4600 -
trunk/src/VBox/Main/SnapshotImpl.cpp
r33300 r33307 2148 2148 // so do nothing for them 2149 2149 if ( type != MediumType_Writethrough 2150 && type != MediumType_Shareable) 2150 && type != MediumType_Shareable 2151 && type != MediumType_Readonly) 2151 2152 { 2152 2153 // normal or immutable media need attention … … 2364 2365 2365 2366 { 2366 // writethrough and shareable images are unaffected by2367 // snapshots, skip them2367 // writethrough, shareable and readonly images are 2368 // unaffected by snapshots, skip them 2368 2369 AutoReadLock medlock(pHD COMMA_LOCKVAL_SRC_POS); 2369 2370 MediumType_T type = pHD->getType(); 2370 2371 if ( type == MediumType_Writethrough 2371 || type == MediumType_Shareable) 2372 || type == MediumType_Shareable 2373 || type == MediumType_Readonly) 2372 2374 continue; 2373 2375 } … … 2843 2845 AutoWriteLock alock(aHD COMMA_LOCKVAL_SRC_POS); 2844 2846 2845 // Medium must not be writethrough/shareable at this point2847 // Medium must not be writethrough/shareable/readonly at this point 2846 2848 MediumType_T type = aHD->getType(); 2847 2849 AssertReturn( type != MediumType_Writethrough 2848 && type != MediumType_Shareable, E_FAIL); 2850 && type != MediumType_Shareable 2851 && type != MediumType_Readonly, E_FAIL); 2849 2852 2850 2853 aMediumLockList = NULL; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r33301 r33307 8393 8393 <enum 8394 8394 name="MediumType" 8395 uuid=" 46bf1fd4-ad86-4ded-8c49-28bd2d148e5a"8395 uuid="19388a99-8e70-4bd4-9a95-90cbc513ef6d" 8396 8396 > 8397 8397 <desc> … … 8422 8422 Allow using this medium concurrently by several machines. 8423 8423 <note>Present since VirtualBox 3.2.0, and accepted since 3.2.8.</note> 8424 </desc> 8425 </const> 8426 <const name="Readonly" value="4"> 8427 <desc> 8428 A readonly medium, which can of course be used by several machines. 8429 <note>Present and accepted since VirtualBox 4.0.</note> 8424 8430 </desc> 8425 8431 </const>
Note:
See TracChangeset
for help on using the changeset viewer.