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