VirtualBox

source: vbox/trunk/src/VBox/Main/include/HardDiskImpl.h@ 5122

Last change on this file since 5122 was 5122, checked in by vboxsync, 17 years ago

Main: So far, assume that the custom hard disk location is always a file name.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.7 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_HARDDISKIMPL
19#define ____H_HARDDISKIMPL
20
21#include "VirtualBoxBase.h"
22#include "Collection.h"
23
24#include <VBox/cfgldr.h>
25#include <VBox/VBoxHDD-new.h>
26
27#include <iprt/semaphore.h>
28
29#include <list>
30
31class VirtualBox;
32class Progress;
33class HVirtualDiskImage;
34
35////////////////////////////////////////////////////////////////////////////////
36
37class ATL_NO_VTABLE HardDisk :
38 public VirtualBoxSupportErrorInfoImpl <HardDisk, IHardDisk>,
39 public VirtualBoxSupportTranslation <HardDisk>,
40 public VirtualBoxBaseWithTypedChildren <HardDisk>,
41 public IHardDisk
42{
43
44public:
45
46 typedef VirtualBoxBaseWithTypedChildren <HardDisk>::DependentChildren
47 HardDiskList;
48
49 DECLARE_NOT_AGGREGATABLE(HardDisk)
50
51 DECLARE_PROTECT_FINAL_CONSTRUCT()
52
53 BEGIN_COM_MAP(HardDisk)
54 COM_INTERFACE_ENTRY(ISupportErrorInfo)
55 COM_INTERFACE_ENTRY(IHardDisk)
56 END_COM_MAP()
57
58 NS_DECL_ISUPPORTS
59
60 HRESULT FinalConstruct();
61 void FinalRelease();
62
63protected:
64
65 // protected initializer/uninitializer for internal purposes only
66 HRESULT protectedInit (VirtualBox *aVirtualBox, HardDisk *aParent);
67 void protectedUninit (AutoLock &alock);
68
69public:
70
71 // IHardDisk properties
72 STDMETHOD(COMGETTER(Id)) (GUIDPARAMOUT aId);
73 STDMETHOD(COMGETTER(StorageType)) (HardDiskStorageType_T *aStorageType);
74 STDMETHOD(COMGETTER(Location)) (BSTR *aLocation);
75 STDMETHOD(COMGETTER(Type)) (HardDiskType_T *aType);
76 STDMETHOD(COMSETTER(Type)) (HardDiskType_T aType);
77 STDMETHOD(COMGETTER(Parent)) (IHardDisk **aParent);
78 STDMETHOD(COMGETTER(Children)) (IHardDiskCollection **aChildren);
79 STDMETHOD(COMGETTER(Root)) (IHardDisk **aRoot);
80 STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
81 STDMETHOD(COMGETTER(AllAccessible)) (BOOL *aAllAccessible);
82 STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
83 STDMETHOD(COMGETTER(MachineId)) (GUIDPARAMOUT aMachineId);
84 STDMETHOD(COMGETTER(SnapshotId)) (GUIDPARAMOUT aSnapshotId);
85
86 // IHardDisk methods
87 STDMETHOD(CloneToImage) (INPTR BSTR aFilePath, IVirtualDiskImage **aImage,
88 IProgress **aProgress);
89
90 // public methods for internal purposes only
91
92 const Guid &id() const { return mId; }
93 HardDiskStorageType_T storageType() const { return mStorageType; }
94 HardDiskType_T type() const { return mType; }
95 const Guid &machineId() const { return mMachineId; }
96 const Guid &snapshotId() const { return mSnapshotId; }
97
98 void setMachineId (const Guid &aId) { mMachineId = aId; }
99 void setSnapshotId (const Guid &aId) { mSnapshotId = aId; }
100
101 bool isDifferencing() const
102 {
103 return mType == HardDiskType_NormalHardDisk &&
104 mStorageType == HardDiskStorageType_VirtualDiskImage &&
105 !mParent.isNull();
106 }
107 bool isParentImmutable() const
108 {
109 AutoLock parentLock (mParent);
110 return !mParent.isNull() && mParent->type() == HardDiskType_ImmutableHardDisk;
111 }
112
113 inline HVirtualDiskImage *asVDI();
114
115 ComObjPtr <HardDisk> parent() const { return static_cast <HardDisk *> (mParent); }
116
117 /** Shortcut to #dependentChildrenLock() */
118 AutoLock::Handle &childrenLock() const { return dependentChildrenLock(); }
119
120 /**
121 * Shortcut to #dependentChildren().
122 * Do |AutoLock alock (childrenLock());| before acceessing the returned list!
123 */
124 const HardDiskList &children() const { return dependentChildren(); }
125
126 ComObjPtr <HardDisk> root() const;
127
128 HRESULT getBaseAccessible (Bstr &aAccessError, bool aCheckBusy = false,
129 bool aCheckReaders = false);
130
131 // virtual methods that need to be [re]implemented by every subclass
132
133 virtual HRESULT trySetRegistered (BOOL aRegistered);
134 virtual HRESULT getAccessible (Bstr &aAccessError) = 0;
135
136 virtual HRESULT saveSettings (CFGNODE aHDNode, CFGNODE aStorageNode) = 0;
137
138 virtual void updatePath (const char *aOldPath, const char *aNewPath) {}
139
140 virtual Bstr toString (bool aShort = false) = 0;
141 virtual bool sameAs (HardDisk *that);
142
143 virtual HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath,
144 Progress *aProgress, bool &aDeleteTarget) = 0;
145 virtual HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath,
146 Progress *aProgress) = 0;
147public:
148
149 void setBusy();
150 void clearBusy();
151 void addReader();
152 void releaseReader();
153 void addReaderOnAncestors();
154 void releaseReaderOnAncestors();
155 bool hasForeignChildren();
156
157 HRESULT setBusyWithChildren();
158 void clearBusyWithChildren();
159 HRESULT getAccessibleWithChildren (Bstr &aAccessError);
160
161 HRESULT checkConsistency();
162
163 HRESULT createDiffHardDisk (const Bstr &aFolder, const Guid &aMachineId,
164 ComObjPtr <HVirtualDiskImage> &aHardDisk,
165 Progress *aProgress);
166
167 void updatePaths (const char *aOldPath, const char *aNewPath);
168
169 /* the following must be called from under the lock */
170 bool isBusy() { isLockedOnCurrentThread(); return mBusy; }
171 unsigned readers() { isLockedOnCurrentThread(); return mReaders; }
172 const Bstr &lastAccessError() const { return mLastAccessError; }
173
174 static HRESULT openHardDisk (VirtualBox *aVirtualBox, INPTR BSTR aLocation,
175 ComObjPtr <HardDisk> &hardDisk);
176
177 // for VirtualBoxSupportErrorInfoImpl
178 static const wchar_t *getComponentName() { return L"HardDisk"; }
179
180protected:
181
182 HRESULT loadSettings (CFGNODE aHDNode);
183 HRESULT saveSettings (CFGNODE aHDNode);
184
185 /** weak VirualBox parent */
186 ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
187
188 BOOL mRegistered;
189
190 ComObjPtr <HardDisk, ComWeakRef> mParent;
191
192 Guid mId;
193 HardDiskStorageType_T mStorageType;
194 HardDiskType_T mType;
195 Guid mMachineId;
196 Guid mSnapshotId;
197
198private:
199
200 Bstr mLastAccessError;
201
202 bool mBusy;
203 unsigned mReaders;
204};
205
206////////////////////////////////////////////////////////////////////////////////
207
208class ATL_NO_VTABLE HVirtualDiskImage :
209 public HardDisk,
210 public VirtualBoxSupportTranslation <HVirtualDiskImage>,
211 public IVirtualDiskImage
212{
213
214public:
215
216 VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE(HVirtualDiskImage)
217
218 DECLARE_NOT_AGGREGATABLE(HVirtualDiskImage)
219
220 DECLARE_PROTECT_FINAL_CONSTRUCT()
221
222 BEGIN_COM_MAP(HVirtualDiskImage)
223 COM_INTERFACE_ENTRY(ISupportErrorInfo)
224 COM_INTERFACE_ENTRY(IHardDisk)
225 COM_INTERFACE_ENTRY(IVirtualDiskImage)
226 END_COM_MAP()
227
228 NS_DECL_ISUPPORTS
229
230 HRESULT FinalConstruct();
231 void FinalRelease();
232
233 // public initializer/uninitializer for internal purposes only
234
235 HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
236 CFGNODE aHDNode, CFGNODE aVDINode);
237 HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
238 const BSTR aFilePath, BOOL aRegistered = FALSE);
239 void uninit();
240
241 // IHardDisk properties
242 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
243 STDMETHOD(COMSETTER(Description)) (INPTR BSTR aDescription);
244 STDMETHOD(COMGETTER(Size)) (ULONG64 *aSize);
245 STDMETHOD(COMGETTER(ActualSize)) (ULONG64 *aActualSize);
246
247 // IVirtualDiskImage properties
248 STDMETHOD(COMGETTER(FilePath)) (BSTR *aFilePath);
249 STDMETHOD(COMSETTER(FilePath)) (INPTR BSTR aFilePath);
250 STDMETHOD(COMGETTER(Created)) (BOOL *aCreated);
251
252 // IVirtualDiskImage methods
253 STDMETHOD(CreateDynamicImage) (ULONG64 aSize, IProgress **aProgress);
254 STDMETHOD(CreateFixedImage) (ULONG64 aSize, IProgress **aProgress);
255 STDMETHOD(DeleteImage)();
256
257 // public methods for internal purposes only
258
259 const Bstr &filePath() const { return mFilePath; }
260 const Bstr &filePathFull() const { return mFilePathFull; }
261
262 HRESULT trySetRegistered (BOOL aRegistered);
263 HRESULT getAccessible (Bstr &aAccessError);
264
265 HRESULT saveSettings (CFGNODE aHDNode, CFGNODE aStorageNode);
266
267 void updatePath (const char *aOldPath, const char *aNewPath);
268
269 Bstr toString (bool aShort = false);
270
271 HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath,
272 Progress *aProgress, bool &aDeleteTarget);
273 HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath,
274 Progress *aProgress);
275
276 HRESULT cloneDiffImage (const Bstr &aFolder, const Guid &aMachineId,
277 ComObjPtr <HVirtualDiskImage> &aHardDisk,
278 Progress *aProgress);
279
280 HRESULT mergeImageToParent (Progress *aProgress);
281 HRESULT mergeImageToChildren (Progress *aProgress);
282
283 HRESULT wipeOutImage();
284
285 // for VirtualBoxSupportErrorInfoImpl
286 static const wchar_t *getComponentName() { return L"VirtualDiskImage"; }
287
288private:
289
290 HRESULT setFilePath (const BSTR aFilePath);
291 HRESULT queryInformation (Bstr *aAccessError);
292 HRESULT createImage (ULONG64 aSize, BOOL aDynamic, IProgress **aProgress);
293
294 /** VDI asynchronous operation thread function */
295 static DECLCALLBACK(int) VDITaskThread (RTTHREAD thread, void *pvUser);
296
297 enum State
298 {
299 NotCreated,
300 Created,
301 /* the following must be greater than Created */
302 Accessible,
303 };
304
305 State mState;
306
307 RTSEMEVENTMULTI mStateCheckSem;
308 ULONG mStateCheckWaiters;
309
310 Bstr mDescription;
311
312 ULONG64 mSize;
313 ULONG64 mActualSize;
314
315 Bstr mFilePath;
316 Bstr mFilePathFull;
317
318 friend class HardDisk;
319};
320
321// dependent inline members
322////////////////////////////////////////////////////////////////////////////////
323
324inline HVirtualDiskImage *HardDisk::asVDI()
325{
326 AssertReturn (mStorageType == HardDiskStorageType_VirtualDiskImage, 0);
327 return static_cast <HVirtualDiskImage *> (this);
328}
329
330////////////////////////////////////////////////////////////////////////////////
331
332class ATL_NO_VTABLE HISCSIHardDisk :
333 public HardDisk,
334 public VirtualBoxSupportTranslation <HISCSIHardDisk>,
335 public IISCSIHardDisk
336{
337
338public:
339
340 VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE(HISCSIHardDisk)
341
342 DECLARE_NOT_AGGREGATABLE(HISCSIHardDisk)
343
344 DECLARE_PROTECT_FINAL_CONSTRUCT()
345
346 BEGIN_COM_MAP(HISCSIHardDisk)
347 COM_INTERFACE_ENTRY(ISupportErrorInfo)
348 COM_INTERFACE_ENTRY(IHardDisk)
349 COM_INTERFACE_ENTRY(IISCSIHardDisk)
350 END_COM_MAP()
351
352 NS_DECL_ISUPPORTS
353
354 HRESULT FinalConstruct();
355 void FinalRelease();
356
357 // public initializer/uninitializer for internal purposes only
358
359 HRESULT init (VirtualBox *aVirtualBox,
360 CFGNODE aHDNode, CFGNODE aISCSINode);
361 HRESULT init (VirtualBox *aVirtualBox);
362 void uninit();
363
364 // IHardDisk properties
365 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
366 STDMETHOD(COMSETTER(Description)) (INPTR BSTR aDescription);
367 STDMETHOD(COMGETTER(Size)) (ULONG64 *aSize);
368 STDMETHOD(COMGETTER(ActualSize)) (ULONG64 *aActualSize);
369
370 // IISCSIHardDisk properties
371 STDMETHOD(COMGETTER(Server)) (BSTR *aServer);
372 STDMETHOD(COMSETTER(Server)) (INPTR BSTR aServer);
373 STDMETHOD(COMGETTER(Port)) (USHORT *aPort);
374 STDMETHOD(COMSETTER(Port)) (USHORT aPort);
375 STDMETHOD(COMGETTER(Target)) (BSTR *aTarget);
376 STDMETHOD(COMSETTER(Target)) (INPTR BSTR aTarget);
377 STDMETHOD(COMGETTER(Lun)) (ULONG64 *aLun);
378 STDMETHOD(COMSETTER(Lun)) (ULONG64 aLun);
379 STDMETHOD(COMGETTER(UserName)) (BSTR *aUserName);
380 STDMETHOD(COMSETTER(UserName)) (INPTR BSTR aUserName);
381 STDMETHOD(COMGETTER(Password)) (BSTR *aPassword);
382 STDMETHOD(COMSETTER(Password)) (INPTR BSTR aPassword);
383
384 // public methods for internal purposes only
385
386 const Bstr &server() const { return mServer; }
387 USHORT port() const { return mPort; }
388 const Bstr &target() const { return mTarget; }
389 ULONG64 lun() const { return mLun; }
390 const Bstr &userName() const { return mUserName; }
391 const Bstr &password() const { return mPassword; }
392
393 HRESULT trySetRegistered (BOOL aRegistered);
394 HRESULT getAccessible (Bstr &aAccessError);
395
396 HRESULT saveSettings (CFGNODE aHDNode, CFGNODE aStorageNode);
397
398 Bstr toString (bool aShort = false);
399
400 HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath,
401 Progress *aProgress, bool &aDeleteTarget);
402 HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath,
403 Progress *aProgress);
404
405public:
406
407 // for VirtualBoxSupportErrorInfoImpl
408 static const wchar_t *getComponentName() { return L"ISCSIHardDisk"; }
409
410private:
411
412 HRESULT queryInformation (Bstr &aAccessError);
413
414 Bstr mDescription;
415
416 ULONG64 mSize;
417 ULONG64 mActualSize;
418
419 Bstr mServer;
420 USHORT mPort;
421 Bstr mTarget;
422 ULONG64 mLun;
423 Bstr mUserName;
424 Bstr mPassword;
425};
426
427////////////////////////////////////////////////////////////////////////////////
428
429class ATL_NO_VTABLE HVMDKImage :
430 public HardDisk,
431 public VirtualBoxSupportTranslation <HVMDKImage>,
432 public IVMDKImage
433{
434
435public:
436
437 VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE(HVMDKImage)
438
439 DECLARE_NOT_AGGREGATABLE(HVMDKImage)
440
441 DECLARE_PROTECT_FINAL_CONSTRUCT()
442
443 BEGIN_COM_MAP(HVMDKImage)
444 COM_INTERFACE_ENTRY(ISupportErrorInfo)
445 COM_INTERFACE_ENTRY(IHardDisk)
446 COM_INTERFACE_ENTRY(IVMDKImage)
447 END_COM_MAP()
448
449 NS_DECL_ISUPPORTS
450
451 HRESULT FinalConstruct();
452 void FinalRelease();
453
454 // public initializer/uninitializer for internal purposes only
455
456 HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
457 CFGNODE aHDNode, CFGNODE aVMDKNode);
458 HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
459 INPTR BSTR aFilePath, BOOL aRegistered = FALSE);
460 void uninit();
461
462 // IHardDisk properties
463 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
464 STDMETHOD(COMSETTER(Description)) (INPTR BSTR aDescription);
465 STDMETHOD(COMGETTER(Size)) (ULONG64 *aSize);
466 STDMETHOD(COMGETTER(ActualSize)) (ULONG64 *aActualSize);
467
468 // IVirtualDiskImage properties
469 STDMETHOD(COMGETTER(FilePath)) (BSTR *aFilePath);
470 STDMETHOD(COMSETTER(FilePath)) (INPTR BSTR aFilePath);
471 STDMETHOD(COMGETTER(Created)) (BOOL *aCreated);
472
473 // IVirtualDiskImage methods
474 STDMETHOD(CreateDynamicImage) (ULONG64 aSize, IProgress **aProgress);
475 STDMETHOD(CreateFixedImage) (ULONG64 aSize, IProgress **aProgress);
476 STDMETHOD(DeleteImage)();
477
478 // public methods for internal purposes only
479
480 const Bstr &filePath() const { return mFilePath; }
481 const Bstr &filePathFull() const { return mFilePathFull; }
482
483 HRESULT trySetRegistered (BOOL aRegistered);
484 HRESULT getAccessible (Bstr &aAccessError);
485
486 HRESULT saveSettings (CFGNODE aHDNode, CFGNODE aStorageNode);
487
488 void updatePath (const char *aOldPath, const char *aNewPath);
489
490 Bstr toString (bool aShort = false);
491
492 HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath,
493 Progress *aProgress, bool &aDeleteTarget);
494 HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath,
495 Progress *aProgress);
496
497 // for VirtualBoxSupportErrorInfoImpl
498 static const wchar_t *getComponentName() { return L"VMDKImage"; }
499
500private:
501
502 HRESULT setFilePath (const BSTR aFilePath);
503 HRESULT queryInformation (Bstr *aAccessError);
504 HRESULT createImage (ULONG64 aSize, BOOL aDynamic, IProgress **aProgress);
505
506 /** VDI asynchronous operation thread function */
507 static DECLCALLBACK(int) VDITaskThread (RTTHREAD thread, void *pvUser);
508
509 static DECLCALLBACK(void) VDError (void *pvUser, int rc, RT_SRC_POS_DECL,
510 const char *pszFormat, va_list va);
511
512 enum State
513 {
514 NotCreated,
515 Created,
516 /* the following must be greater than Created */
517 Accessible,
518 };
519
520 State mState;
521
522 RTSEMEVENTMULTI mStateCheckSem;
523 ULONG mStateCheckWaiters;
524
525 Bstr mDescription;
526
527 ULONG64 mSize;
528 ULONG64 mActualSize;
529
530 Bstr mFilePath;
531 Bstr mFilePathFull;
532
533 PVBOXHDD mContainer;
534
535 Utf8Str mLastVDError;
536
537 friend class HardDisk;
538};
539
540////////////////////////////////////////////////////////////////////////////////
541
542class ATL_NO_VTABLE HCustomHardDisk :
543 public HardDisk,
544 public VirtualBoxSupportTranslation <HCustomHardDisk>,
545 public ICustomHardDisk
546{
547
548public:
549
550 VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE(HCustomHardDisk)
551
552 DECLARE_NOT_AGGREGATABLE(HCustomHardDisk)
553
554 DECLARE_PROTECT_FINAL_CONSTRUCT()
555
556 BEGIN_COM_MAP(HCustomHardDisk)
557 COM_INTERFACE_ENTRY(ISupportErrorInfo)
558 COM_INTERFACE_ENTRY(IHardDisk)
559 COM_INTERFACE_ENTRY(ICustomHardDisk)
560 END_COM_MAP()
561
562 NS_DECL_ISUPPORTS
563
564 HRESULT FinalConstruct();
565 void FinalRelease();
566
567 // public initializer/uninitializer for internal purposes only
568
569 HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
570 CFGNODE aHDNode, CFGNODE aCustomNode);
571 HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
572 INPTR BSTR aLocation, BOOL aRegistered = FALSE);
573 void uninit();
574
575 // IHardDisk properties
576 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
577 STDMETHOD(COMSETTER(Description)) (INPTR BSTR aDescription);
578 STDMETHOD(COMGETTER(Size)) (ULONG64 *aSize);
579 STDMETHOD(COMGETTER(ActualSize)) (ULONG64 *aActualSize);
580
581 // IVirtualDiskImage properties
582 STDMETHOD(COMGETTER(Location)) (BSTR *aLocation);
583 STDMETHOD(COMSETTER(Location)) (INPTR BSTR aLocation);
584 STDMETHOD(COMGETTER(Format)) (BSTR *aFormat);
585 STDMETHOD(COMGETTER(Created)) (BOOL *aCreated);
586
587 // IVirtualDiskImage methods
588 STDMETHOD(CreateDynamicImage) (ULONG64 aSize, IProgress **aProgress);
589 STDMETHOD(CreateFixedImage) (ULONG64 aSize, IProgress **aProgress);
590 STDMETHOD(DeleteImage)();
591
592 // public methods for internal purposes only
593
594 const Bstr &Location() const { return mLocation; }
595
596 HRESULT trySetRegistered (BOOL aRegistered);
597 HRESULT getAccessible (Bstr &aAccessError);
598
599 HRESULT saveSettings (CFGNODE aHDNode, CFGNODE aStorageNode);
600
601 Bstr toString (bool aShort = false);
602
603 HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath,
604 Progress *aProgress, bool &aDeleteTarget);
605 HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath,
606 Progress *aProgress);
607
608 // for VirtualBoxSupportErrorInfoImpl
609 static const wchar_t *getComponentName() { return L"CustomHardDisk"; }
610
611private:
612
613 HRESULT setLocation (const BSTR aLocation);
614 HRESULT queryInformation (Bstr *aAccessError);
615 HRESULT createImage (ULONG64 aSize, BOOL aDynamic, IProgress **aProgress);
616
617 /** VDI asynchronous operation thread function */
618 static DECLCALLBACK(int) VDITaskThread (RTTHREAD thread, void *pvUser);
619
620 static DECLCALLBACK(void) VDError (void *pvUser, int rc, RT_SRC_POS_DECL,
621 const char *pszFormat, va_list va);
622
623 enum State
624 {
625 NotCreated,
626 Created,
627 /* the following must be greater than Created */
628 Accessible,
629 };
630
631 State mState;
632
633 RTSEMEVENTMULTI mStateCheckSem;
634 ULONG mStateCheckWaiters;
635
636 Bstr mDescription;
637
638 ULONG64 mSize;
639 ULONG64 mActualSize;
640
641 Bstr mLocation;
642 Bstr mLocationFull;
643 Bstr mFormat;
644
645 PVBOXHDD mContainer;
646
647 Utf8Str mLastVDError;
648
649 friend class HardDisk;
650};
651
652
653COM_DECL_READONLY_ENUM_AND_COLLECTION (HardDisk)
654
655#endif // ____H_HARDDISKIMPL
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette