VirtualBox

source: vbox/trunk/src/VBox/Main/src-client/GuestFsObjInfoImpl.cpp@ 97698

Last change on this file since 97698 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

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