1 |
|
---|
2 | /* $Id: GuestDirectoryImpl.cpp 42478 2012-07-31 13:20:37Z vboxsync $ */
|
---|
3 | /** @file
|
---|
4 | * VirtualBox Main - XXX.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2012 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 |
|
---|
20 | /*******************************************************************************
|
---|
21 | * Header Files *
|
---|
22 | *******************************************************************************/
|
---|
23 | #include "GuestDirectoryImpl.h"
|
---|
24 | #include "GuestCtrlImplPrivate.h"
|
---|
25 |
|
---|
26 | #include "Global.h"
|
---|
27 | #include "AutoCaller.h"
|
---|
28 |
|
---|
29 | #include <VBox/com/array.h>
|
---|
30 |
|
---|
31 |
|
---|
32 | // constructor / destructor
|
---|
33 | /////////////////////////////////////////////////////////////////////////////
|
---|
34 |
|
---|
35 | DEFINE_EMPTY_CTOR_DTOR(GuestDirectory)
|
---|
36 |
|
---|
37 | HRESULT GuestDirectory::FinalConstruct(void)
|
---|
38 | {
|
---|
39 | LogFlowThisFunc(("\n"));
|
---|
40 | return BaseFinalConstruct();
|
---|
41 | }
|
---|
42 |
|
---|
43 | void GuestDirectory::FinalRelease(void)
|
---|
44 | {
|
---|
45 | LogFlowThisFuncEnter();
|
---|
46 | uninit();
|
---|
47 | BaseFinalRelease();
|
---|
48 | LogFlowThisFuncLeave();
|
---|
49 | }
|
---|
50 |
|
---|
51 | // public initializer/uninitializer for internal purposes only
|
---|
52 | /////////////////////////////////////////////////////////////////////////////
|
---|
53 |
|
---|
54 | HRESULT GuestDirectory::init(void)
|
---|
55 | {
|
---|
56 | /* Enclose the state transition NotReady->InInit->Ready. */
|
---|
57 | AutoInitSpan autoInitSpan(this);
|
---|
58 | AssertReturn(autoInitSpan.isOk(), E_FAIL);
|
---|
59 |
|
---|
60 | /* Confirm a successful initialization when it's the case. */
|
---|
61 | autoInitSpan.setSucceeded();
|
---|
62 |
|
---|
63 | return S_OK;
|
---|
64 | }
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * Uninitializes the instance.
|
---|
68 | * Called from FinalRelease().
|
---|
69 | */
|
---|
70 | void GuestDirectory::uninit(void)
|
---|
71 | {
|
---|
72 | LogFlowThisFunc(("\n"));
|
---|
73 |
|
---|
74 | /* Enclose the state transition Ready->InUninit->NotReady. */
|
---|
75 | AutoUninitSpan autoUninitSpan(this);
|
---|
76 | if (autoUninitSpan.uninitDone())
|
---|
77 | return;
|
---|
78 | }
|
---|
79 |
|
---|
80 | // implementation of public getters/setters for attributes
|
---|
81 | /////////////////////////////////////////////////////////////////////////////
|
---|
82 |
|
---|
83 | STDMETHODIMP GuestDirectory::COMGETTER(DirectoryName)(BSTR *aName)
|
---|
84 | {
|
---|
85 | LogFlowThisFuncEnter();
|
---|
86 |
|
---|
87 | CheckComArgOutPointerValid(aName);
|
---|
88 |
|
---|
89 | AutoCaller autoCaller(this);
|
---|
90 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
91 |
|
---|
92 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
93 |
|
---|
94 | mData.mName.cloneTo(aName);
|
---|
95 |
|
---|
96 | return S_OK;
|
---|
97 | }
|
---|
98 |
|
---|
99 | // implementation of public methods
|
---|
100 | /////////////////////////////////////////////////////////////////////////////
|
---|
101 |
|
---|
102 | STDMETHODIMP GuestDirectory::Read(IGuestFsObjInfo **aInfo)
|
---|
103 | {
|
---|
104 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
105 | ReturnComNotImplemented();
|
---|
106 | #else
|
---|
107 | AutoCaller autoCaller(this);
|
---|
108 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
109 |
|
---|
110 | ReturnComNotImplemented();
|
---|
111 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
112 | }
|
---|
113 |
|
---|