1 | /* $Id: GuestFsObjInfoImpl.cpp 50528 2014-02-20 19:13:18Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Main - Guest file system object information handling.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-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 |
|
---|
19 | /*******************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *******************************************************************************/
|
---|
22 | #include "GuestFsObjInfoImpl.h"
|
---|
23 | #include "GuestCtrlImplPrivate.h"
|
---|
24 |
|
---|
25 | #include "Global.h"
|
---|
26 | #include "AutoCaller.h"
|
---|
27 |
|
---|
28 | #include <VBox/com/array.h>
|
---|
29 |
|
---|
30 | #ifdef LOG_GROUP
|
---|
31 | #undef LOG_GROUP
|
---|
32 | #endif
|
---|
33 | #define LOG_GROUP LOG_GROUP_GUEST_CONTROL
|
---|
34 | #include <VBox/log.h>
|
---|
35 |
|
---|
36 |
|
---|
37 | // constructor / destructor
|
---|
38 | /////////////////////////////////////////////////////////////////////////////
|
---|
39 |
|
---|
40 | DEFINE_EMPTY_CTOR_DTOR(GuestFsObjInfo)
|
---|
41 |
|
---|
42 | HRESULT GuestFsObjInfo::FinalConstruct(void)
|
---|
43 | {
|
---|
44 | LogFlowThisFunc(("\n"));
|
---|
45 | return BaseFinalConstruct();
|
---|
46 | }
|
---|
47 |
|
---|
48 | void GuestFsObjInfo::FinalRelease(void)
|
---|
49 | {
|
---|
50 | LogFlowThisFuncEnter();
|
---|
51 | uninit();
|
---|
52 | BaseFinalRelease();
|
---|
53 | LogFlowThisFuncLeave();
|
---|
54 | }
|
---|
55 |
|
---|
56 | // public initializer/uninitializer for internal purposes only
|
---|
57 | /////////////////////////////////////////////////////////////////////////////
|
---|
58 |
|
---|
59 | int GuestFsObjInfo::init(const GuestFsObjData &objData)
|
---|
60 | {
|
---|
61 | LogFlowThisFuncEnter();
|
---|
62 |
|
---|
63 | /* Enclose the state transition NotReady->InInit->Ready. */
|
---|
64 | AutoInitSpan autoInitSpan(this);
|
---|
65 | AssertReturn(autoInitSpan.isOk(), E_FAIL);
|
---|
66 |
|
---|
67 | mData = objData;
|
---|
68 |
|
---|
69 | /* Confirm a successful initialization when it's the case. */
|
---|
70 | autoInitSpan.setSucceeded();
|
---|
71 |
|
---|
72 | return VINF_SUCCESS;
|
---|
73 | }
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Uninitializes the instance.
|
---|
77 | * Called from FinalRelease().
|
---|
78 | */
|
---|
79 | void GuestFsObjInfo::uninit(void)
|
---|
80 | {
|
---|
81 | LogFlowThisFunc(("\n"));
|
---|
82 |
|
---|
83 | /* Enclose the state transition Ready->InUninit->NotReady. */
|
---|
84 | AutoUninitSpan autoUninitSpan(this);
|
---|
85 | if (autoUninitSpan.uninitDone())
|
---|
86 | return;
|
---|
87 | }
|
---|
88 |
|
---|
89 | // implementation of wrapped private getters/setters for attributes
|
---|
90 | /////////////////////////////////////////////////////////////////////////////
|
---|
91 |
|
---|
92 | HRESULT GuestFsObjInfo::getAccessTime(LONG64 *aAccessTime)
|
---|
93 | {
|
---|
94 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
95 | ReturnComNotImplemented();
|
---|
96 | #else
|
---|
97 |
|
---|
98 | *aAccessTime = mData.mAccessTime;
|
---|
99 |
|
---|
100 | return S_OK;
|
---|
101 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
102 | }
|
---|
103 |
|
---|
104 | HRESULT GuestFsObjInfo::getAllocatedSize(LONG64 *aAllocatedSize)
|
---|
105 | {
|
---|
106 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
107 | ReturnComNotImplemented();
|
---|
108 | #else
|
---|
109 |
|
---|
110 | *aAllocatedSize = mData.mAllocatedSize;
|
---|
111 |
|
---|
112 | return S_OK;
|
---|
113 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
114 | }
|
---|
115 |
|
---|
116 | HRESULT GuestFsObjInfo::getBirthTime(LONG64 *aBirthTime)
|
---|
117 | {
|
---|
118 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
119 | ReturnComNotImplemented();
|
---|
120 | #else
|
---|
121 |
|
---|
122 | *aBirthTime = mData.mBirthTime;
|
---|
123 |
|
---|
124 | return S_OK;
|
---|
125 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
126 | }
|
---|
127 |
|
---|
128 | HRESULT GuestFsObjInfo::getChangeTime(LONG64 *aChangeTime)
|
---|
129 | {
|
---|
130 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
131 | ReturnComNotImplemented();
|
---|
132 | #else
|
---|
133 |
|
---|
134 | *aChangeTime = mData.mChangeTime;
|
---|
135 |
|
---|
136 | return S_OK;
|
---|
137 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
138 | }
|
---|
139 |
|
---|
140 |
|
---|
141 |
|
---|
142 | HRESULT GuestFsObjInfo::getDeviceNumber(ULONG *aDeviceNumber)
|
---|
143 | {
|
---|
144 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
145 | ReturnComNotImplemented();
|
---|
146 | #else
|
---|
147 |
|
---|
148 | *aDeviceNumber = mData.mDeviceNumber;
|
---|
149 |
|
---|
150 | return S_OK;
|
---|
151 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
152 | }
|
---|
153 |
|
---|
154 | HRESULT GuestFsObjInfo::getFileAttributes(com::Utf8Str &aFileAttributes)
|
---|
155 | {
|
---|
156 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
157 | ReturnComNotImplemented();
|
---|
158 | #else
|
---|
159 |
|
---|
160 | aFileAttributes = mData.mFileAttrs;
|
---|
161 |
|
---|
162 | return S_OK;
|
---|
163 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
164 | }
|
---|
165 |
|
---|
166 | HRESULT GuestFsObjInfo::getGenerationId(ULONG *aGenerationId)
|
---|
167 | {
|
---|
168 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
169 | ReturnComNotImplemented();
|
---|
170 | #else
|
---|
171 |
|
---|
172 | *aGenerationId = mData.mGenerationID;
|
---|
173 |
|
---|
174 | return S_OK;
|
---|
175 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
176 | }
|
---|
177 |
|
---|
178 | HRESULT GuestFsObjInfo::getGID(ULONG *aGID)
|
---|
179 | {
|
---|
180 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
181 | ReturnComNotImplemented();
|
---|
182 | #else
|
---|
183 |
|
---|
184 | *aGID = mData.mGID;
|
---|
185 |
|
---|
186 | return S_OK;
|
---|
187 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
188 | }
|
---|
189 |
|
---|
190 | HRESULT GuestFsObjInfo::getGroupName(com::Utf8Str &aGroupName)
|
---|
191 | {
|
---|
192 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
193 | ReturnComNotImplemented();
|
---|
194 | #else
|
---|
195 |
|
---|
196 | aGroupName = mData.mGroupName;
|
---|
197 |
|
---|
198 | return S_OK;
|
---|
199 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
200 | }
|
---|
201 |
|
---|
202 | HRESULT GuestFsObjInfo::getHardLinks(ULONG *aHardLinks)
|
---|
203 | {
|
---|
204 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
205 | ReturnComNotImplemented();
|
---|
206 | #else
|
---|
207 |
|
---|
208 | *aHardLinks = mData.mNumHardLinks;
|
---|
209 |
|
---|
210 | return S_OK;
|
---|
211 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
212 | }
|
---|
213 |
|
---|
214 | HRESULT GuestFsObjInfo::getModificationTime(LONG64 *aModificationTime)
|
---|
215 | {
|
---|
216 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
217 | ReturnComNotImplemented();
|
---|
218 | #else
|
---|
219 |
|
---|
220 | *aModificationTime = mData.mModificationTime;
|
---|
221 |
|
---|
222 | return S_OK;
|
---|
223 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
224 | }
|
---|
225 |
|
---|
226 | HRESULT GuestFsObjInfo::getName(com::Utf8Str &aName)
|
---|
227 | {
|
---|
228 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
229 | ReturnComNotImplemented();
|
---|
230 | #else
|
---|
231 |
|
---|
232 | aName = mData.mName;
|
---|
233 |
|
---|
234 | return S_OK;
|
---|
235 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
236 | }
|
---|
237 |
|
---|
238 | HRESULT GuestFsObjInfo::getNodeId(LONG64 *aNodeId)
|
---|
239 | {
|
---|
240 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
241 | ReturnComNotImplemented();
|
---|
242 | #else
|
---|
243 |
|
---|
244 | *aNodeId = mData.mNodeID;
|
---|
245 |
|
---|
246 | return S_OK;
|
---|
247 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
248 | }
|
---|
249 |
|
---|
250 | HRESULT GuestFsObjInfo::getNodeIdDevice(ULONG *aNodeIdDevice)
|
---|
251 | {
|
---|
252 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
253 | ReturnComNotImplemented();
|
---|
254 | #else
|
---|
255 |
|
---|
256 | *aNodeIdDevice = mData.mNodeIDDevice;
|
---|
257 |
|
---|
258 | return S_OK;
|
---|
259 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
260 | }
|
---|
261 |
|
---|
262 | HRESULT GuestFsObjInfo::getObjectSize(LONG64 *aObjectSize)
|
---|
263 | {
|
---|
264 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
265 | ReturnComNotImplemented();
|
---|
266 | #else
|
---|
267 |
|
---|
268 | *aObjectSize = mData.mObjectSize;
|
---|
269 |
|
---|
270 | return S_OK;
|
---|
271 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
272 | }
|
---|
273 |
|
---|
274 | HRESULT GuestFsObjInfo::getType(FsObjType_T *aType)
|
---|
275 | {
|
---|
276 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
277 | ReturnComNotImplemented();
|
---|
278 | #else
|
---|
279 |
|
---|
280 | *aType = mData.mType;
|
---|
281 |
|
---|
282 | return S_OK;
|
---|
283 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
284 | }
|
---|
285 |
|
---|
286 | HRESULT GuestFsObjInfo::getUID(ULONG *aUID)
|
---|
287 | {
|
---|
288 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
289 | ReturnComNotImplemented();
|
---|
290 | #else
|
---|
291 |
|
---|
292 | *aUID = mData.mUID;
|
---|
293 |
|
---|
294 | return S_OK;
|
---|
295 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
296 | }
|
---|
297 |
|
---|
298 | HRESULT GuestFsObjInfo::getUserFlags(ULONG *aUserFlags)
|
---|
299 | {
|
---|
300 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
301 | ReturnComNotImplemented();
|
---|
302 | #else
|
---|
303 |
|
---|
304 | *aUserFlags = mData.mUserFlags;
|
---|
305 |
|
---|
306 | return S_OK;
|
---|
307 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
308 | }
|
---|
309 |
|
---|
310 | HRESULT GuestFsObjInfo::getUserName(com::Utf8Str &aUserName)
|
---|
311 | {
|
---|
312 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
313 | ReturnComNotImplemented();
|
---|
314 | #else
|
---|
315 |
|
---|
316 | aUserName = mData.mUserName;
|
---|
317 |
|
---|
318 | return S_OK;
|
---|
319 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
320 | }
|
---|