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