1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2014 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include "BIOSSettingsImpl.h"
|
---|
19 | #include "MachineImpl.h"
|
---|
20 | #include "GuestOSTypeImpl.h"
|
---|
21 |
|
---|
22 | #include <iprt/cpp/utils.h>
|
---|
23 | #include <VBox/settings.h>
|
---|
24 |
|
---|
25 | #include "AutoStateDep.h"
|
---|
26 | #include "AutoCaller.h"
|
---|
27 | #include "Logging.h"
|
---|
28 |
|
---|
29 | ////////////////////////////////////////////////////////////////////////////////
|
---|
30 | //
|
---|
31 | // BIOSSettings private data definition
|
---|
32 | //
|
---|
33 | ////////////////////////////////////////////////////////////////////////////////
|
---|
34 |
|
---|
35 | struct BIOSSettings::Data
|
---|
36 | {
|
---|
37 | Data()
|
---|
38 | : pMachine(NULL)
|
---|
39 | { }
|
---|
40 |
|
---|
41 | Machine * const pMachine;
|
---|
42 | ComObjPtr<BIOSSettings> pPeer;
|
---|
43 |
|
---|
44 | // use the XML settings structure in the members for simplicity
|
---|
45 | Backupable<settings::BIOSSettings> bd;
|
---|
46 | };
|
---|
47 |
|
---|
48 | // constructor / destructor
|
---|
49 | /////////////////////////////////////////////////////////////////////////////
|
---|
50 |
|
---|
51 | DEFINE_EMPTY_CTOR_DTOR(BIOSSettings)
|
---|
52 |
|
---|
53 | HRESULT BIOSSettings::FinalConstruct()
|
---|
54 | {
|
---|
55 | return BaseFinalConstruct();
|
---|
56 | }
|
---|
57 |
|
---|
58 | void BIOSSettings::FinalRelease()
|
---|
59 | {
|
---|
60 | uninit ();
|
---|
61 | BaseFinalRelease();
|
---|
62 | }
|
---|
63 |
|
---|
64 | // public initializer/uninitializer for internal purposes only
|
---|
65 | /////////////////////////////////////////////////////////////////////////////
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Initializes the audio adapter object.
|
---|
69 | *
|
---|
70 | * @returns COM result indicator
|
---|
71 | */
|
---|
72 | HRESULT BIOSSettings::init(Machine *aParent)
|
---|
73 | {
|
---|
74 | LogFlowThisFuncEnter();
|
---|
75 | LogFlowThisFunc(("aParent: %p\n", aParent));
|
---|
76 |
|
---|
77 | ComAssertRet(aParent, E_INVALIDARG);
|
---|
78 |
|
---|
79 | /* Enclose the state transition NotReady->InInit->Ready */
|
---|
80 | AutoInitSpan autoInitSpan(this);
|
---|
81 | AssertReturn(autoInitSpan.isOk(), E_FAIL);
|
---|
82 |
|
---|
83 | m = new Data();
|
---|
84 |
|
---|
85 | /* share the parent weakly */
|
---|
86 | unconst(m->pMachine) = aParent;
|
---|
87 |
|
---|
88 | m->bd.allocate();
|
---|
89 |
|
---|
90 | autoInitSpan.setSucceeded();
|
---|
91 |
|
---|
92 | LogFlowThisFuncLeave();
|
---|
93 | return S_OK;
|
---|
94 | }
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * Initializes the audio adapter object given another audio adapter object
|
---|
98 | * (a kind of copy constructor). This object shares data with
|
---|
99 | * the object passed as an argument.
|
---|
100 | *
|
---|
101 | * @note This object must be destroyed before the original object
|
---|
102 | * it shares data with is destroyed.
|
---|
103 | */
|
---|
104 | HRESULT BIOSSettings::init(Machine *aParent, BIOSSettings *that)
|
---|
105 | {
|
---|
106 | LogFlowThisFuncEnter();
|
---|
107 | LogFlowThisFunc(("aParent: %p, that: %p\n", aParent, that));
|
---|
108 |
|
---|
109 | ComAssertRet(aParent && that, E_INVALIDARG);
|
---|
110 |
|
---|
111 | /* Enclose the state transition NotReady->InInit->Ready */
|
---|
112 | AutoInitSpan autoInitSpan(this);
|
---|
113 | AssertReturn(autoInitSpan.isOk(), E_FAIL);
|
---|
114 |
|
---|
115 | m = new Data();
|
---|
116 |
|
---|
117 | unconst(m->pMachine) = aParent;
|
---|
118 | m->pPeer = that;
|
---|
119 |
|
---|
120 | AutoWriteLock thatlock(that COMMA_LOCKVAL_SRC_POS);
|
---|
121 | m->bd.share(that->m->bd);
|
---|
122 |
|
---|
123 | autoInitSpan.setSucceeded();
|
---|
124 |
|
---|
125 | LogFlowThisFuncLeave();
|
---|
126 | return S_OK;
|
---|
127 | }
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * Initializes the guest object given another guest object
|
---|
131 | * (a kind of copy constructor). This object makes a private copy of data
|
---|
132 | * of the original object passed as an argument.
|
---|
133 | */
|
---|
134 | HRESULT BIOSSettings::initCopy(Machine *aParent, BIOSSettings *that)
|
---|
135 | {
|
---|
136 | LogFlowThisFuncEnter();
|
---|
137 | LogFlowThisFunc(("aParent: %p, that: %p\n", aParent, that));
|
---|
138 |
|
---|
139 | ComAssertRet(aParent && that, E_INVALIDARG);
|
---|
140 |
|
---|
141 | /* Enclose the state transition NotReady->InInit->Ready */
|
---|
142 | AutoInitSpan autoInitSpan(this);
|
---|
143 | AssertReturn(autoInitSpan.isOk(), E_FAIL);
|
---|
144 |
|
---|
145 | m = new Data();
|
---|
146 |
|
---|
147 | unconst(m->pMachine) = aParent;
|
---|
148 | // mPeer is left null
|
---|
149 |
|
---|
150 | AutoWriteLock thatlock(that COMMA_LOCKVAL_SRC_POS);
|
---|
151 | m->bd.attachCopy(that->m->bd);
|
---|
152 |
|
---|
153 | autoInitSpan.setSucceeded();
|
---|
154 |
|
---|
155 | LogFlowThisFuncLeave();
|
---|
156 | return S_OK;
|
---|
157 | }
|
---|
158 |
|
---|
159 | /**
|
---|
160 | * Uninitializes the instance and sets the ready flag to FALSE.
|
---|
161 | * Called either from FinalRelease() or by the parent when it gets destroyed.
|
---|
162 | */
|
---|
163 | void BIOSSettings::uninit()
|
---|
164 | {
|
---|
165 | LogFlowThisFuncEnter();
|
---|
166 |
|
---|
167 | /* Enclose the state transition Ready->InUninit->NotReady */
|
---|
168 | AutoUninitSpan autoUninitSpan(this);
|
---|
169 | if (autoUninitSpan.uninitDone())
|
---|
170 | return;
|
---|
171 |
|
---|
172 | m->bd.free();
|
---|
173 |
|
---|
174 | unconst(m->pPeer) = NULL;
|
---|
175 | unconst(m->pMachine) = NULL;
|
---|
176 |
|
---|
177 | delete m;
|
---|
178 | m = NULL;
|
---|
179 |
|
---|
180 | LogFlowThisFuncLeave();
|
---|
181 | }
|
---|
182 |
|
---|
183 | // IBIOSSettings properties
|
---|
184 | /////////////////////////////////////////////////////////////////////////////
|
---|
185 |
|
---|
186 |
|
---|
187 | HRESULT BIOSSettings::getLogoFadeIn(BOOL *enabled)
|
---|
188 | {
|
---|
189 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
190 |
|
---|
191 | *enabled = m->bd->fLogoFadeIn;
|
---|
192 |
|
---|
193 | return S_OK;
|
---|
194 | }
|
---|
195 |
|
---|
196 | HRESULT BIOSSettings::setLogoFadeIn(BOOL enable)
|
---|
197 | {
|
---|
198 | /* the machine needs to be mutable */
|
---|
199 | AutoMutableStateDependency adep(m->pMachine);
|
---|
200 | if (FAILED(adep.rc())) return adep.rc();
|
---|
201 |
|
---|
202 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
203 |
|
---|
204 | m->bd.backup();
|
---|
205 | m->bd->fLogoFadeIn = !!enable;
|
---|
206 |
|
---|
207 | alock.release();
|
---|
208 | AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking
|
---|
209 | m->pMachine->i_setModified(Machine::IsModified_BIOS);
|
---|
210 |
|
---|
211 | return S_OK;
|
---|
212 | }
|
---|
213 |
|
---|
214 |
|
---|
215 | HRESULT BIOSSettings::getLogoFadeOut(BOOL *enabled)
|
---|
216 | {
|
---|
217 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
218 |
|
---|
219 | *enabled = m->bd->fLogoFadeOut;
|
---|
220 |
|
---|
221 | return S_OK;
|
---|
222 | }
|
---|
223 |
|
---|
224 |
|
---|
225 | HRESULT BIOSSettings::setLogoFadeOut(BOOL enable)
|
---|
226 | {
|
---|
227 | /* the machine needs to be mutable */
|
---|
228 | AutoMutableStateDependency adep(m->pMachine);
|
---|
229 | if (FAILED(adep.rc())) return adep.rc();
|
---|
230 |
|
---|
231 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
232 |
|
---|
233 | m->bd.backup();
|
---|
234 | m->bd->fLogoFadeOut = !!enable;
|
---|
235 |
|
---|
236 | alock.release();
|
---|
237 | AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking
|
---|
238 | m->pMachine->i_setModified(Machine::IsModified_BIOS);
|
---|
239 |
|
---|
240 | return S_OK;
|
---|
241 | }
|
---|
242 |
|
---|
243 |
|
---|
244 | HRESULT BIOSSettings::getLogoDisplayTime(ULONG *displayTime)
|
---|
245 | {
|
---|
246 | if (!displayTime)
|
---|
247 | return E_POINTER;
|
---|
248 |
|
---|
249 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
250 |
|
---|
251 | *displayTime = m->bd->ulLogoDisplayTime;
|
---|
252 |
|
---|
253 | return S_OK;
|
---|
254 | }
|
---|
255 |
|
---|
256 |
|
---|
257 | HRESULT BIOSSettings::setLogoDisplayTime(ULONG displayTime)
|
---|
258 | {
|
---|
259 | /* the machine needs to be mutable */
|
---|
260 | AutoMutableStateDependency adep(m->pMachine);
|
---|
261 | if (FAILED(adep.rc())) return adep.rc();
|
---|
262 |
|
---|
263 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
264 |
|
---|
265 | m->bd.backup();
|
---|
266 | m->bd->ulLogoDisplayTime = displayTime;
|
---|
267 |
|
---|
268 | alock.release();
|
---|
269 | AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking
|
---|
270 | m->pMachine->i_setModified(Machine::IsModified_BIOS);
|
---|
271 |
|
---|
272 | return S_OK;
|
---|
273 | }
|
---|
274 |
|
---|
275 |
|
---|
276 | HRESULT BIOSSettings::getLogoImagePath(com::Utf8Str &imagePath)
|
---|
277 | {
|
---|
278 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
279 |
|
---|
280 | imagePath = m->bd->strLogoImagePath;
|
---|
281 | return S_OK;
|
---|
282 | }
|
---|
283 |
|
---|
284 |
|
---|
285 | HRESULT BIOSSettings::setLogoImagePath(const com::Utf8Str &imagePath)
|
---|
286 | {
|
---|
287 | /* the machine needs to be mutable */
|
---|
288 | AutoMutableStateDependency adep(m->pMachine);
|
---|
289 | if (FAILED(adep.rc())) return adep.rc();
|
---|
290 |
|
---|
291 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
292 |
|
---|
293 | m->bd.backup();
|
---|
294 | m->bd->strLogoImagePath = imagePath;
|
---|
295 |
|
---|
296 | alock.release();
|
---|
297 | AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking
|
---|
298 | m->pMachine->i_setModified(Machine::IsModified_BIOS);
|
---|
299 |
|
---|
300 | return S_OK;
|
---|
301 | }
|
---|
302 |
|
---|
303 | HRESULT BIOSSettings::getBootMenuMode(BIOSBootMenuMode_T *bootMenuMode)
|
---|
304 | {
|
---|
305 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
306 |
|
---|
307 | *bootMenuMode = m->bd->biosBootMenuMode;
|
---|
308 | return S_OK;
|
---|
309 | }
|
---|
310 |
|
---|
311 |
|
---|
312 | HRESULT BIOSSettings::setBootMenuMode(BIOSBootMenuMode_T bootMenuMode)
|
---|
313 | {
|
---|
314 | /* the machine needs to be mutable */
|
---|
315 | AutoMutableStateDependency adep(m->pMachine);
|
---|
316 | if (FAILED(adep.rc())) return adep.rc();
|
---|
317 |
|
---|
318 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
319 |
|
---|
320 | m->bd.backup();
|
---|
321 | m->bd->biosBootMenuMode = bootMenuMode;
|
---|
322 |
|
---|
323 | alock.release();
|
---|
324 | AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking
|
---|
325 | m->pMachine->i_setModified(Machine::IsModified_BIOS);
|
---|
326 |
|
---|
327 | return S_OK;
|
---|
328 | }
|
---|
329 |
|
---|
330 |
|
---|
331 | HRESULT BIOSSettings::getACPIEnabled(BOOL *enabled)
|
---|
332 | {
|
---|
333 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
334 |
|
---|
335 | *enabled = m->bd->fACPIEnabled;
|
---|
336 |
|
---|
337 | return S_OK;
|
---|
338 | }
|
---|
339 |
|
---|
340 |
|
---|
341 | HRESULT BIOSSettings::setACPIEnabled(BOOL enable)
|
---|
342 | {
|
---|
343 | /* the machine needs to be mutable */
|
---|
344 | AutoMutableStateDependency adep(m->pMachine);
|
---|
345 | if (FAILED(adep.rc())) return adep.rc();
|
---|
346 |
|
---|
347 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
348 |
|
---|
349 | m->bd.backup();
|
---|
350 | m->bd->fACPIEnabled = !!enable;
|
---|
351 |
|
---|
352 | alock.release();
|
---|
353 | AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking
|
---|
354 | m->pMachine->i_setModified(Machine::IsModified_BIOS);
|
---|
355 |
|
---|
356 | return S_OK;
|
---|
357 | }
|
---|
358 |
|
---|
359 |
|
---|
360 | HRESULT BIOSSettings::getIOAPICEnabled(BOOL *aIOAPICEnabled)
|
---|
361 | {
|
---|
362 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
363 |
|
---|
364 | *aIOAPICEnabled = m->bd->fIOAPICEnabled;
|
---|
365 |
|
---|
366 | return S_OK;
|
---|
367 | }
|
---|
368 |
|
---|
369 |
|
---|
370 | HRESULT BIOSSettings::setIOAPICEnabled(BOOL aIOAPICEnabled)
|
---|
371 | {
|
---|
372 | /* the machine needs to be mutable */
|
---|
373 | AutoMutableStateDependency adep(m->pMachine);
|
---|
374 | if (FAILED(adep.rc())) return adep.rc();
|
---|
375 |
|
---|
376 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
377 |
|
---|
378 | m->bd.backup();
|
---|
379 |
|
---|
380 | m->bd->fIOAPICEnabled = !!aIOAPICEnabled;
|
---|
381 | alock.release();
|
---|
382 | AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking
|
---|
383 | m->pMachine->i_setModified(Machine::IsModified_BIOS);
|
---|
384 |
|
---|
385 | return S_OK;
|
---|
386 | }
|
---|
387 |
|
---|
388 |
|
---|
389 | HRESULT BIOSSettings::getPXEDebugEnabled(BOOL *enabled)
|
---|
390 | {
|
---|
391 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
392 |
|
---|
393 | *enabled = m->bd->fPXEDebugEnabled;
|
---|
394 |
|
---|
395 | return S_OK;
|
---|
396 | }
|
---|
397 |
|
---|
398 |
|
---|
399 | HRESULT BIOSSettings::setPXEDebugEnabled(BOOL enable)
|
---|
400 | {
|
---|
401 | /* the machine needs to be mutable */
|
---|
402 | AutoMutableStateDependency adep(m->pMachine);
|
---|
403 | if (FAILED(adep.rc())) return adep.rc();
|
---|
404 |
|
---|
405 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
406 |
|
---|
407 | m->bd.backup();
|
---|
408 | m->bd->fPXEDebugEnabled = !!enable;
|
---|
409 |
|
---|
410 | alock.release();
|
---|
411 | AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking
|
---|
412 | m->pMachine->i_setModified(Machine::IsModified_BIOS);
|
---|
413 |
|
---|
414 | return S_OK;
|
---|
415 | }
|
---|
416 |
|
---|
417 | HRESULT BIOSSettings::getTimeOffset(LONG64 *offset)
|
---|
418 | {
|
---|
419 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
420 |
|
---|
421 | *offset = m->bd->llTimeOffset;
|
---|
422 |
|
---|
423 | return S_OK;
|
---|
424 | }
|
---|
425 |
|
---|
426 |
|
---|
427 | HRESULT BIOSSettings::setTimeOffset(LONG64 offset)
|
---|
428 | {
|
---|
429 | /* the machine needs to be mutable */
|
---|
430 | AutoMutableStateDependency adep(m->pMachine);
|
---|
431 | if (FAILED(adep.rc())) return adep.rc();
|
---|
432 |
|
---|
433 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
434 |
|
---|
435 | m->bd.backup();
|
---|
436 | m->bd->llTimeOffset = offset;
|
---|
437 |
|
---|
438 | alock.release();
|
---|
439 | AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS); // mParent is const, needs no locking
|
---|
440 | m->pMachine->i_setModified(Machine::IsModified_BIOS);
|
---|
441 |
|
---|
442 | return S_OK;
|
---|
443 | }
|
---|
444 |
|
---|
445 | HRESULT BIOSSettings::getNonVolatileStorageFile(com::Utf8Str &aNonVolatileStorageFile)
|
---|
446 | {
|
---|
447 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
448 |
|
---|
449 | aNonVolatileStorageFile = "";
|
---|
450 |
|
---|
451 | return S_OK;
|
---|
452 | }
|
---|
453 |
|
---|
454 |
|
---|
455 |
|
---|
456 | // IBIOSSettings methods
|
---|
457 | /////////////////////////////////////////////////////////////////////////////
|
---|
458 |
|
---|
459 | // public methods only for internal purposes
|
---|
460 | /////////////////////////////////////////////////////////////////////////////
|
---|
461 |
|
---|
462 | /**
|
---|
463 | * Loads settings from the given machine node.
|
---|
464 | * May be called once right after this object creation.
|
---|
465 | *
|
---|
466 | * @param aMachineNode <Machine> node.
|
---|
467 | *
|
---|
468 | * @note Locks this object for writing.
|
---|
469 | */
|
---|
470 | HRESULT BIOSSettings::i_loadSettings(const settings::BIOSSettings &data)
|
---|
471 | {
|
---|
472 | AutoCaller autoCaller(this);
|
---|
473 | AssertComRCReturnRC(autoCaller.rc());
|
---|
474 |
|
---|
475 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
476 |
|
---|
477 | // simply copy
|
---|
478 | *m->bd.data() = data;
|
---|
479 |
|
---|
480 | return S_OK;
|
---|
481 | }
|
---|
482 |
|
---|
483 | /**
|
---|
484 | * Saves settings to the given machine node.
|
---|
485 | *
|
---|
486 | * @param aMachineNode <Machine> node.
|
---|
487 | *
|
---|
488 | * @note Locks this object for reading.
|
---|
489 | */
|
---|
490 | HRESULT BIOSSettings::i_saveSettings(settings::BIOSSettings &data)
|
---|
491 | {
|
---|
492 | AutoCaller autoCaller(this);
|
---|
493 | AssertComRCReturnRC(autoCaller.rc());
|
---|
494 |
|
---|
495 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
496 |
|
---|
497 | data = *m->bd.data();
|
---|
498 |
|
---|
499 | return S_OK;
|
---|
500 | }
|
---|
501 |
|
---|
502 | void BIOSSettings::i_rollback()
|
---|
503 | {
|
---|
504 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
505 | m->bd.rollback();
|
---|
506 | }
|
---|
507 |
|
---|
508 | void BIOSSettings::i_commit()
|
---|
509 | {
|
---|
510 | /* sanity */
|
---|
511 | AutoCaller autoCaller(this);
|
---|
512 | AssertComRCReturnVoid(autoCaller.rc());
|
---|
513 |
|
---|
514 | /* sanity too */
|
---|
515 | AutoCaller peerCaller(m->pPeer);
|
---|
516 | AssertComRCReturnVoid(peerCaller.rc());
|
---|
517 |
|
---|
518 | /* lock both for writing since we modify both (mPeer is "master" so locked
|
---|
519 | * first) */
|
---|
520 | AutoMultiWriteLock2 alock(m->pPeer, this COMMA_LOCKVAL_SRC_POS);
|
---|
521 |
|
---|
522 | if (m->bd.isBackedUp())
|
---|
523 | {
|
---|
524 | m->bd.commit();
|
---|
525 | if (m->pPeer)
|
---|
526 | {
|
---|
527 | /* attach new data to the peer and reshare it */
|
---|
528 | AutoWriteLock peerlock(m->pPeer COMMA_LOCKVAL_SRC_POS);
|
---|
529 | m->pPeer->m->bd.attach(m->bd);
|
---|
530 | }
|
---|
531 | }
|
---|
532 | }
|
---|
533 |
|
---|
534 | void BIOSSettings::i_copyFrom (BIOSSettings *aThat)
|
---|
535 | {
|
---|
536 | AssertReturnVoid (aThat != NULL);
|
---|
537 |
|
---|
538 | /* sanity */
|
---|
539 | AutoCaller autoCaller(this);
|
---|
540 | AssertComRCReturnVoid (autoCaller.rc());
|
---|
541 |
|
---|
542 | /* sanity too */
|
---|
543 | AutoCaller thatCaller (aThat);
|
---|
544 | AssertComRCReturnVoid (thatCaller.rc());
|
---|
545 |
|
---|
546 | /* peer is not modified, lock it for reading (aThat is "master" so locked
|
---|
547 | * first) */
|
---|
548 | AutoReadLock rl(aThat COMMA_LOCKVAL_SRC_POS);
|
---|
549 | AutoWriteLock wl(this COMMA_LOCKVAL_SRC_POS);
|
---|
550 |
|
---|
551 | /* this will back up current data */
|
---|
552 | m->bd.assignCopy(aThat->m->bd);
|
---|
553 | }
|
---|
554 |
|
---|
555 | void BIOSSettings::i_applyDefaults (GuestOSType *aOsType)
|
---|
556 | {
|
---|
557 | AssertReturnVoid (aOsType != NULL);
|
---|
558 |
|
---|
559 | /* sanity */
|
---|
560 | AutoCaller autoCaller(this);
|
---|
561 | AssertComRCReturnVoid (autoCaller.rc());
|
---|
562 |
|
---|
563 | AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
564 |
|
---|
565 | /* Initialize default BIOS settings here */
|
---|
566 | m->bd->fIOAPICEnabled = aOsType->i_recommendedIOAPIC();
|
---|
567 | }
|
---|
568 |
|
---|
569 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|