blob: df4d1c5978cf167e750344576ceb281bf8e0b5e9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
/* $Id: GuestFsObjInfoImpl.cpp $ */
/** @file
* VirtualBox Main - Guest file system object information handling.
*/
/*
* Copyright (C) 2012-2022 Oracle and/or its affiliates.
*
* This file is part of VirtualBox base platform packages, as
* available from https://www.virtualbox.org.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, in version 3 of the
* License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses>.
*
* SPDX-License-Identifier: GPL-3.0-only
*/
/*********************************************************************************************************************************
* Header Files *
*********************************************************************************************************************************/
#define LOG_GROUP LOG_GROUP_MAIN_GUESTFSOBJINFO
#include "LoggingNew.h"
#ifndef VBOX_WITH_GUEST_CONTROL
# error "VBOX_WITH_GUEST_CONTROL must defined in this file"
#endif
#include "GuestFsObjInfoImpl.h"
#include "GuestCtrlImplPrivate.h"
#include "Global.h"
#include "AutoCaller.h"
#include <VBox/com/array.h>
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
DEFINE_EMPTY_CTOR_DTOR(GuestFsObjInfo)
HRESULT GuestFsObjInfo::FinalConstruct(void)
{
LogFlowThisFuncEnter();
return BaseFinalConstruct();
}
void GuestFsObjInfo::FinalRelease(void)
{
LogFlowThisFuncEnter();
uninit();
BaseFinalRelease();
LogFlowThisFuncLeave();
}
// public initializer/uninitializer for internal purposes only
/////////////////////////////////////////////////////////////////////////////
int GuestFsObjInfo::init(const GuestFsObjData &objData)
{
LogFlowThisFuncEnter();
/* Enclose the state transition NotReady->InInit->Ready. */
AutoInitSpan autoInitSpan(this);
AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
mData = objData;
/* Confirm a successful initialization when it's the case. */
autoInitSpan.setSucceeded();
return VINF_SUCCESS;
}
/**
* Uninitializes the instance.
* Called from FinalRelease().
*/
void GuestFsObjInfo::uninit(void)
{
/* Enclose the state transition Ready->InUninit->NotReady. */
AutoUninitSpan autoUninitSpan(this);
if (autoUninitSpan.uninitDone())
return;
LogFlowThisFuncEnter();
}
// implementation of wrapped private getters/setters for attributes
/////////////////////////////////////////////////////////////////////////////
HRESULT GuestFsObjInfo::getAccessTime(LONG64 *aAccessTime)
{
*aAccessTime = mData.mAccessTime;
return S_OK;
}
HRESULT GuestFsObjInfo::getAllocatedSize(LONG64 *aAllocatedSize)
{
*aAllocatedSize = mData.mAllocatedSize;
return S_OK;
}
HRESULT GuestFsObjInfo::getBirthTime(LONG64 *aBirthTime)
{
*aBirthTime = mData.mBirthTime;
return S_OK;
}
HRESULT GuestFsObjInfo::getChangeTime(LONG64 *aChangeTime)
{
*aChangeTime = mData.mChangeTime;
return S_OK;
}
HRESULT GuestFsObjInfo::getDeviceNumber(ULONG *aDeviceNumber)
{
*aDeviceNumber = mData.mDeviceNumber;
return S_OK;
}
HRESULT GuestFsObjInfo::getFileAttributes(com::Utf8Str &aFileAttributes)
{
aFileAttributes = mData.mFileAttrs;
return S_OK;
}
HRESULT GuestFsObjInfo::getGenerationId(ULONG *aGenerationId)
{
*aGenerationId = mData.mGenerationID;
return S_OK;
}
HRESULT GuestFsObjInfo::getGID(LONG *aGID)
{
*aGID = mData.mGID;
return S_OK;
}
HRESULT GuestFsObjInfo::getGroupName(com::Utf8Str &aGroupName)
{
aGroupName = mData.mGroupName;
return S_OK;
}
HRESULT GuestFsObjInfo::getHardLinks(ULONG *aHardLinks)
{
*aHardLinks = mData.mNumHardLinks;
return S_OK;
}
HRESULT GuestFsObjInfo::getModificationTime(LONG64 *aModificationTime)
{
*aModificationTime = mData.mModificationTime;
return S_OK;
}
HRESULT GuestFsObjInfo::getName(com::Utf8Str &aName)
{
aName = mData.mName;
return S_OK;
}
HRESULT GuestFsObjInfo::getNodeId(LONG64 *aNodeId)
{
*aNodeId = mData.mNodeID;
return S_OK;
}
HRESULT GuestFsObjInfo::getNodeIdDevice(ULONG *aNodeIdDevice)
{
*aNodeIdDevice = mData.mNodeIDDevice;
return S_OK;
}
HRESULT GuestFsObjInfo::getObjectSize(LONG64 *aObjectSize)
{
*aObjectSize = mData.mObjectSize;
return S_OK;
}
HRESULT GuestFsObjInfo::getType(FsObjType_T *aType)
{
*aType = mData.mType;
return S_OK;
}
HRESULT GuestFsObjInfo::getUID(LONG *aUID)
{
*aUID = mData.mUID;
return S_OK;
}
HRESULT GuestFsObjInfo::getUserFlags(ULONG *aUserFlags)
{
*aUserFlags = mData.mUserFlags;
return S_OK;
}
HRESULT GuestFsObjInfo::getUserName(com::Utf8Str &aUserName)
{
aUserName = mData.mUserName;
return S_OK;
}
|