1 | /* $Id: GuestFsObjInfoImpl.cpp 57358 2015-08-14 15:16:38Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Main - Guest file system object information handling.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2015 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 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
23 | # error "VBOX_WITH_GUEST_CONTROL must defined in this file"
|
---|
24 | #endif
|
---|
25 | #include "GuestFsObjInfoImpl.h"
|
---|
26 | #include "GuestCtrlImplPrivate.h"
|
---|
27 |
|
---|
28 | #include "Global.h"
|
---|
29 | #include "AutoCaller.h"
|
---|
30 |
|
---|
31 | #include <VBox/com/array.h>
|
---|
32 |
|
---|
33 | #ifdef LOG_GROUP
|
---|
34 | #undef LOG_GROUP
|
---|
35 | #endif
|
---|
36 | #define LOG_GROUP LOG_GROUP_GUEST_CONTROL
|
---|
37 | #include <VBox/log.h>
|
---|
38 |
|
---|
39 |
|
---|
40 | // constructor / destructor
|
---|
41 | /////////////////////////////////////////////////////////////////////////////
|
---|
42 |
|
---|
43 | DEFINE_EMPTY_CTOR_DTOR(GuestFsObjInfo)
|
---|
44 |
|
---|
45 | HRESULT GuestFsObjInfo::FinalConstruct(void)
|
---|
46 | {
|
---|
47 | LogFlowThisFunc(("\n"));
|
---|
48 | return BaseFinalConstruct();
|
---|
49 | }
|
---|
50 |
|
---|
51 | void GuestFsObjInfo::FinalRelease(void)
|
---|
52 | {
|
---|
53 | LogFlowThisFuncEnter();
|
---|
54 | uninit();
|
---|
55 | BaseFinalRelease();
|
---|
56 | LogFlowThisFuncLeave();
|
---|
57 | }
|
---|
58 |
|
---|
59 | // public initializer/uninitializer for internal purposes only
|
---|
60 | /////////////////////////////////////////////////////////////////////////////
|
---|
61 |
|
---|
62 | int GuestFsObjInfo::init(const GuestFsObjData &objData)
|
---|
63 | {
|
---|
64 | LogFlowThisFuncEnter();
|
---|
65 |
|
---|
66 | /* Enclose the state transition NotReady->InInit->Ready. */
|
---|
67 | AutoInitSpan autoInitSpan(this);
|
---|
68 | AssertReturn(autoInitSpan.isOk(), E_FAIL); /** @todo r=bird: returning COM or IPRT status codes here?*/
|
---|
69 |
|
---|
70 | mData = objData;
|
---|
71 |
|
---|
72 | /* Confirm a successful initialization when it's the case. */
|
---|
73 | autoInitSpan.setSucceeded();
|
---|
74 |
|
---|
75 | return VINF_SUCCESS;
|
---|
76 | }
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Uninitializes the instance.
|
---|
80 | * Called from FinalRelease().
|
---|
81 | */
|
---|
82 | void GuestFsObjInfo::uninit(void)
|
---|
83 | {
|
---|
84 | LogFlowThisFunc(("\n"));
|
---|
85 |
|
---|
86 | /* Enclose the state transition Ready->InUninit->NotReady. */
|
---|
87 | AutoUninitSpan autoUninitSpan(this);
|
---|
88 | if (autoUninitSpan.uninitDone())
|
---|
89 | return;
|
---|
90 | }
|
---|
91 |
|
---|
92 | // implementation of wrapped private getters/setters for attributes
|
---|
93 | /////////////////////////////////////////////////////////////////////////////
|
---|
94 |
|
---|
95 | HRESULT GuestFsObjInfo::getAccessTime(LONG64 *aAccessTime)
|
---|
96 | {
|
---|
97 | *aAccessTime = mData.mAccessTime;
|
---|
98 |
|
---|
99 | return S_OK;
|
---|
100 | }
|
---|
101 |
|
---|
102 | HRESULT GuestFsObjInfo::getAllocatedSize(LONG64 *aAllocatedSize)
|
---|
103 | {
|
---|
104 | *aAllocatedSize = mData.mAllocatedSize;
|
---|
105 |
|
---|
106 | return S_OK;
|
---|
107 | }
|
---|
108 |
|
---|
109 | HRESULT GuestFsObjInfo::getBirthTime(LONG64 *aBirthTime)
|
---|
110 | {
|
---|
111 | *aBirthTime = mData.mBirthTime;
|
---|
112 |
|
---|
113 | return S_OK;
|
---|
114 | }
|
---|
115 |
|
---|
116 | HRESULT GuestFsObjInfo::getChangeTime(LONG64 *aChangeTime)
|
---|
117 | {
|
---|
118 | *aChangeTime = mData.mChangeTime;
|
---|
119 |
|
---|
120 | return S_OK;
|
---|
121 | }
|
---|
122 |
|
---|
123 |
|
---|
124 |
|
---|
125 | HRESULT GuestFsObjInfo::getDeviceNumber(ULONG *aDeviceNumber)
|
---|
126 | {
|
---|
127 | *aDeviceNumber = mData.mDeviceNumber;
|
---|
128 |
|
---|
129 | return S_OK;
|
---|
130 | }
|
---|
131 |
|
---|
132 | HRESULT GuestFsObjInfo::getFileAttributes(com::Utf8Str &aFileAttributes)
|
---|
133 | {
|
---|
134 | aFileAttributes = mData.mFileAttrs;
|
---|
135 |
|
---|
136 | return S_OK;
|
---|
137 | }
|
---|
138 |
|
---|
139 | HRESULT GuestFsObjInfo::getGenerationId(ULONG *aGenerationId)
|
---|
140 | {
|
---|
141 | *aGenerationId = mData.mGenerationID;
|
---|
142 |
|
---|
143 | return S_OK;
|
---|
144 | }
|
---|
145 |
|
---|
146 | HRESULT GuestFsObjInfo::getGID(ULONG *aGID)
|
---|
147 | {
|
---|
148 | *aGID = mData.mGID;
|
---|
149 |
|
---|
150 | return S_OK;
|
---|
151 | }
|
---|
152 |
|
---|
153 | HRESULT GuestFsObjInfo::getGroupName(com::Utf8Str &aGroupName)
|
---|
154 | {
|
---|
155 | aGroupName = mData.mGroupName;
|
---|
156 |
|
---|
157 | return S_OK;
|
---|
158 | }
|
---|
159 |
|
---|
160 | HRESULT GuestFsObjInfo::getHardLinks(ULONG *aHardLinks)
|
---|
161 | {
|
---|
162 | *aHardLinks = mData.mNumHardLinks;
|
---|
163 |
|
---|
164 | return S_OK;
|
---|
165 | }
|
---|
166 |
|
---|
167 | HRESULT GuestFsObjInfo::getModificationTime(LONG64 *aModificationTime)
|
---|
168 | {
|
---|
169 | *aModificationTime = mData.mModificationTime;
|
---|
170 |
|
---|
171 | return S_OK;
|
---|
172 | }
|
---|
173 |
|
---|
174 | HRESULT GuestFsObjInfo::getName(com::Utf8Str &aName)
|
---|
175 | {
|
---|
176 | aName = mData.mName;
|
---|
177 |
|
---|
178 | return S_OK;
|
---|
179 | }
|
---|
180 |
|
---|
181 | HRESULT GuestFsObjInfo::getNodeId(LONG64 *aNodeId)
|
---|
182 | {
|
---|
183 | *aNodeId = mData.mNodeID;
|
---|
184 |
|
---|
185 | return S_OK;
|
---|
186 | }
|
---|
187 |
|
---|
188 | HRESULT GuestFsObjInfo::getNodeIdDevice(ULONG *aNodeIdDevice)
|
---|
189 | {
|
---|
190 | *aNodeIdDevice = mData.mNodeIDDevice;
|
---|
191 |
|
---|
192 | return S_OK;
|
---|
193 | }
|
---|
194 |
|
---|
195 | HRESULT GuestFsObjInfo::getObjectSize(LONG64 *aObjectSize)
|
---|
196 | {
|
---|
197 | *aObjectSize = mData.mObjectSize;
|
---|
198 |
|
---|
199 | return S_OK;
|
---|
200 | }
|
---|
201 |
|
---|
202 | HRESULT GuestFsObjInfo::getType(FsObjType_T *aType)
|
---|
203 | {
|
---|
204 | *aType = mData.mType;
|
---|
205 |
|
---|
206 | return S_OK;
|
---|
207 | }
|
---|
208 |
|
---|
209 | HRESULT GuestFsObjInfo::getUID(ULONG *aUID)
|
---|
210 | {
|
---|
211 | *aUID = mData.mUID;
|
---|
212 |
|
---|
213 | return S_OK;
|
---|
214 | }
|
---|
215 |
|
---|
216 | HRESULT GuestFsObjInfo::getUserFlags(ULONG *aUserFlags)
|
---|
217 | {
|
---|
218 | *aUserFlags = mData.mUserFlags;
|
---|
219 |
|
---|
220 | return S_OK;
|
---|
221 | }
|
---|
222 |
|
---|
223 | HRESULT GuestFsObjInfo::getUserName(com::Utf8Str &aUserName)
|
---|
224 | {
|
---|
225 | aUserName = mData.mUserName;
|
---|
226 |
|
---|
227 | return S_OK;
|
---|
228 | }
|
---|
229 |
|
---|