/* $Id: GuestFsObjInfoImpl.cpp 57358 2015-08-14 15:16:38Z vboxsync $ */ /** @file * VirtualBox Main - Guest file system object information handling. */ /* * Copyright (C) 2012-2015 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. */ /********************************************************************************************************************************* * Header Files * *********************************************************************************************************************************/ #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 #ifdef LOG_GROUP #undef LOG_GROUP #endif #define LOG_GROUP LOG_GROUP_GUEST_CONTROL #include // constructor / destructor ///////////////////////////////////////////////////////////////////////////// DEFINE_EMPTY_CTOR_DTOR(GuestFsObjInfo) HRESULT GuestFsObjInfo::FinalConstruct(void) { LogFlowThisFunc(("\n")); 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(), E_FAIL); /** @todo r=bird: returning COM or IPRT status codes here?*/ 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) { LogFlowThisFunc(("\n")); /* Enclose the state transition Ready->InUninit->NotReady. */ AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; } // 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(ULONG *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(ULONG *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; }