VirtualBox

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

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

The Giant CDDL Dual-License Header Change.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.8 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 (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#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 HRESULT deleteImage (bool aIgnoreErrors = false);
285
286 // for VirtualBoxSupportErrorInfoImpl
287 static const wchar_t *getComponentName() { return L"VirtualDiskImage"; }
288
289private:
290
291 HRESULT setFilePath (const BSTR aFilePath);
292 HRESULT queryInformation (Bstr *aAccessError);
293 HRESULT createImage (ULONG64 aSize, BOOL aDynamic, IProgress **aProgress);
294
295 /** VDI asynchronous operation thread function */
296 static DECLCALLBACK(int) VDITaskThread (RTTHREAD thread, void *pvUser);
297
298 enum State
299 {
300 NotCreated,
301 Created,
302 /* the following must be greater than Created */
303 Accessible,
304 };
305
306 State mState;
307
308 RTSEMEVENTMULTI mStateCheckSem;
309 ULONG mStateCheckWaiters;
310
311 Bstr mDescription;
312
313 ULONG64 mSize;
314 ULONG64 mActualSize;
315
316 Bstr mFilePath;
317 Bstr mFilePathFull;
318
319 friend class HardDisk;
320};
321
322// dependent inline members
323////////////////////////////////////////////////////////////////////////////////
324
325inline HVirtualDiskImage *HardDisk::asVDI()
326{
327 AssertReturn (mStorageType == HardDiskStorageType_VirtualDiskImage, 0);
328 return static_cast <HVirtualDiskImage *> (this);
329}
330
331////////////////////////////////////////////////////////////////////////////////
332
333class ATL_NO_VTABLE HISCSIHardDisk :
334 public HardDisk,
335 public VirtualBoxSupportTranslation <HISCSIHardDisk>,
336 public IISCSIHardDisk
337{
338
339public:
340
341 VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE(HISCSIHardDisk)
342
343 DECLARE_NOT_AGGREGATABLE(HISCSIHardDisk)
344
345 DECLARE_PROTECT_FINAL_CONSTRUCT()
346
347 BEGIN_COM_MAP(HISCSIHardDisk)
348 COM_INTERFACE_ENTRY(ISupportErrorInfo)
349 COM_INTERFACE_ENTRY(IHardDisk)
350 COM_INTERFACE_ENTRY(IISCSIHardDisk)
351 END_COM_MAP()
352
353 NS_DECL_ISUPPORTS
354
355 HRESULT FinalConstruct();
356 void FinalRelease();
357
358 // public initializer/uninitializer for internal purposes only
359
360 HRESULT init (VirtualBox *aVirtualBox,
361 CFGNODE aHDNode, CFGNODE aISCSINode);
362 HRESULT init (VirtualBox *aVirtualBox);
363 void uninit();
364
365 // IHardDisk properties
366 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
367 STDMETHOD(COMSETTER(Description)) (INPTR BSTR aDescription);
368 STDMETHOD(COMGETTER(Size)) (ULONG64 *aSize);
369 STDMETHOD(COMGETTER(ActualSize)) (ULONG64 *aActualSize);
370
371 // IISCSIHardDisk properties
372 STDMETHOD(COMGETTER(Server)) (BSTR *aServer);
373 STDMETHOD(COMSETTER(Server)) (INPTR BSTR aServer);
374 STDMETHOD(COMGETTER(Port)) (USHORT *aPort);
375 STDMETHOD(COMSETTER(Port)) (USHORT aPort);
376 STDMETHOD(COMGETTER(Target)) (BSTR *aTarget);
377 STDMETHOD(COMSETTER(Target)) (INPTR BSTR aTarget);
378 STDMETHOD(COMGETTER(Lun)) (ULONG64 *aLun);
379 STDMETHOD(COMSETTER(Lun)) (ULONG64 aLun);
380 STDMETHOD(COMGETTER(UserName)) (BSTR *aUserName);
381 STDMETHOD(COMSETTER(UserName)) (INPTR BSTR aUserName);
382 STDMETHOD(COMGETTER(Password)) (BSTR *aPassword);
383 STDMETHOD(COMSETTER(Password)) (INPTR BSTR aPassword);
384
385 // public methods for internal purposes only
386
387 const Bstr &server() const { return mServer; }
388 USHORT port() const { return mPort; }
389 const Bstr &target() const { return mTarget; }
390 ULONG64 lun() const { return mLun; }
391 const Bstr &userName() const { return mUserName; }
392 const Bstr &password() const { return mPassword; }
393
394 HRESULT trySetRegistered (BOOL aRegistered);
395 HRESULT getAccessible (Bstr &aAccessError);
396
397 HRESULT saveSettings (CFGNODE aHDNode, CFGNODE aStorageNode);
398
399 Bstr toString (bool aShort = false);
400
401 HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath,
402 Progress *aProgress, bool &aDeleteTarget);
403 HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath,
404 Progress *aProgress);
405
406public:
407
408 // for VirtualBoxSupportErrorInfoImpl
409 static const wchar_t *getComponentName() { return L"ISCSIHardDisk"; }
410
411private:
412
413 HRESULT queryInformation (Bstr &aAccessError);
414
415 Bstr mDescription;
416
417 ULONG64 mSize;
418 ULONG64 mActualSize;
419
420 Bstr mServer;
421 USHORT mPort;
422 Bstr mTarget;
423 ULONG64 mLun;
424 Bstr mUserName;
425 Bstr mPassword;
426};
427
428////////////////////////////////////////////////////////////////////////////////
429
430class ATL_NO_VTABLE HVMDKImage :
431 public HardDisk,
432 public VirtualBoxSupportTranslation <HVMDKImage>,
433 public IVMDKImage
434{
435
436public:
437
438 VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE(HVMDKImage)
439
440 DECLARE_NOT_AGGREGATABLE(HVMDKImage)
441
442 DECLARE_PROTECT_FINAL_CONSTRUCT()
443
444 BEGIN_COM_MAP(HVMDKImage)
445 COM_INTERFACE_ENTRY(ISupportErrorInfo)
446 COM_INTERFACE_ENTRY(IHardDisk)
447 COM_INTERFACE_ENTRY(IVMDKImage)
448 END_COM_MAP()
449
450 NS_DECL_ISUPPORTS
451
452 HRESULT FinalConstruct();
453 void FinalRelease();
454
455 // public initializer/uninitializer for internal purposes only
456
457 HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
458 CFGNODE aHDNode, CFGNODE aVMDKNode);
459 HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
460 INPTR BSTR aFilePath, BOOL aRegistered = FALSE);
461 void uninit();
462
463 // IHardDisk properties
464 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
465 STDMETHOD(COMSETTER(Description)) (INPTR BSTR aDescription);
466 STDMETHOD(COMGETTER(Size)) (ULONG64 *aSize);
467 STDMETHOD(COMGETTER(ActualSize)) (ULONG64 *aActualSize);
468
469 // IVirtualDiskImage properties
470 STDMETHOD(COMGETTER(FilePath)) (BSTR *aFilePath);
471 STDMETHOD(COMSETTER(FilePath)) (INPTR BSTR aFilePath);
472 STDMETHOD(COMGETTER(Created)) (BOOL *aCreated);
473
474 // IVirtualDiskImage methods
475 STDMETHOD(CreateDynamicImage) (ULONG64 aSize, IProgress **aProgress);
476 STDMETHOD(CreateFixedImage) (ULONG64 aSize, IProgress **aProgress);
477 STDMETHOD(DeleteImage)();
478
479 // public methods for internal purposes only
480
481 const Bstr &filePath() const { return mFilePath; }
482 const Bstr &filePathFull() const { return mFilePathFull; }
483
484 HRESULT trySetRegistered (BOOL aRegistered);
485 HRESULT getAccessible (Bstr &aAccessError);
486
487 HRESULT saveSettings (CFGNODE aHDNode, CFGNODE aStorageNode);
488
489 void updatePath (const char *aOldPath, const char *aNewPath);
490
491 Bstr toString (bool aShort = false);
492
493 HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath,
494 Progress *aProgress, bool &aDeleteTarget);
495 HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath,
496 Progress *aProgress);
497
498 // for VirtualBoxSupportErrorInfoImpl
499 static const wchar_t *getComponentName() { return L"VMDKImage"; }
500
501private:
502
503 HRESULT setFilePath (const BSTR aFilePath);
504 HRESULT queryInformation (Bstr *aAccessError);
505 HRESULT createImage (ULONG64 aSize, BOOL aDynamic, IProgress **aProgress);
506
507 /** VDI asynchronous operation thread function */
508 static DECLCALLBACK(int) VDITaskThread (RTTHREAD thread, void *pvUser);
509
510 static DECLCALLBACK(void) VDError (void *pvUser, int rc, RT_SRC_POS_DECL,
511 const char *pszFormat, va_list va);
512
513 enum State
514 {
515 NotCreated,
516 Created,
517 /* the following must be greater than Created */
518 Accessible,
519 };
520
521 State mState;
522
523 RTSEMEVENTMULTI mStateCheckSem;
524 ULONG mStateCheckWaiters;
525
526 Bstr mDescription;
527
528 ULONG64 mSize;
529 ULONG64 mActualSize;
530
531 Bstr mFilePath;
532 Bstr mFilePathFull;
533
534 PVBOXHDD mContainer;
535
536 Utf8Str mLastVDError;
537
538 friend class HardDisk;
539};
540
541////////////////////////////////////////////////////////////////////////////////
542
543class ATL_NO_VTABLE HCustomHardDisk :
544 public HardDisk,
545 public VirtualBoxSupportTranslation <HCustomHardDisk>,
546 public ICustomHardDisk
547{
548
549public:
550
551 VIRTUALBOXSUPPORTTRANSLATION_OVERRIDE(HCustomHardDisk)
552
553 DECLARE_NOT_AGGREGATABLE(HCustomHardDisk)
554
555 DECLARE_PROTECT_FINAL_CONSTRUCT()
556
557 BEGIN_COM_MAP(HCustomHardDisk)
558 COM_INTERFACE_ENTRY(ISupportErrorInfo)
559 COM_INTERFACE_ENTRY(IHardDisk)
560 COM_INTERFACE_ENTRY(ICustomHardDisk)
561 END_COM_MAP()
562
563 NS_DECL_ISUPPORTS
564
565 HRESULT FinalConstruct();
566 void FinalRelease();
567
568 // public initializer/uninitializer for internal purposes only
569
570 HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
571 CFGNODE aHDNode, CFGNODE aCustomNode);
572 HRESULT init (VirtualBox *aVirtualBox, HardDisk *aParent,
573 INPTR BSTR aLocation, BOOL aRegistered = FALSE);
574 void uninit();
575
576 // IHardDisk properties
577 STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
578 STDMETHOD(COMSETTER(Description)) (INPTR BSTR aDescription);
579 STDMETHOD(COMGETTER(Size)) (ULONG64 *aSize);
580 STDMETHOD(COMGETTER(ActualSize)) (ULONG64 *aActualSize);
581
582 // IVirtualDiskImage properties
583 STDMETHOD(COMGETTER(Location)) (BSTR *aLocation);
584 STDMETHOD(COMSETTER(Location)) (INPTR BSTR aLocation);
585 STDMETHOD(COMGETTER(Format)) (BSTR *aFormat);
586 STDMETHOD(COMGETTER(Created)) (BOOL *aCreated);
587
588 // IVirtualDiskImage methods
589 STDMETHOD(CreateDynamicImage) (ULONG64 aSize, IProgress **aProgress);
590 STDMETHOD(CreateFixedImage) (ULONG64 aSize, IProgress **aProgress);
591 STDMETHOD(DeleteImage)();
592
593 // public methods for internal purposes only
594
595 const Bstr &Location() const { return mLocation; }
596
597 HRESULT trySetRegistered (BOOL aRegistered);
598 HRESULT getAccessible (Bstr &aAccessError);
599
600 HRESULT saveSettings (CFGNODE aHDNode, CFGNODE aStorageNode);
601
602 Bstr toString (bool aShort = false);
603
604 HRESULT cloneToImage (const Guid &aId, const Utf8Str &aTargetPath,
605 Progress *aProgress, bool &aDeleteTarget);
606 HRESULT createDiffImage (const Guid &aId, const Utf8Str &aTargetPath,
607 Progress *aProgress);
608
609 // for VirtualBoxSupportErrorInfoImpl
610 static const wchar_t *getComponentName() { return L"CustomHardDisk"; }
611
612private:
613
614 HRESULT setLocation (const BSTR aLocation);
615 HRESULT queryInformation (Bstr *aAccessError);
616 HRESULT createImage (ULONG64 aSize, BOOL aDynamic, IProgress **aProgress);
617
618 /** VDI asynchronous operation thread function */
619 static DECLCALLBACK(int) VDITaskThread (RTTHREAD thread, void *pvUser);
620
621 static DECLCALLBACK(void) VDError (void *pvUser, int rc, RT_SRC_POS_DECL,
622 const char *pszFormat, va_list va);
623
624 enum State
625 {
626 NotCreated,
627 Created,
628 /* the following must be greater than Created */
629 Accessible,
630 };
631
632 State mState;
633
634 RTSEMEVENTMULTI mStateCheckSem;
635 ULONG mStateCheckWaiters;
636
637 Bstr mDescription;
638
639 ULONG64 mSize;
640 ULONG64 mActualSize;
641
642 Bstr mLocation;
643 Bstr mLocationFull;
644 Bstr mFormat;
645
646 PVBOXHDD mContainer;
647
648 Utf8Str mLastVDError;
649
650 friend class HardDisk;
651};
652
653
654COM_DECL_READONLY_ENUM_AND_COLLECTION (HardDisk)
655
656#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