GuestFsObjInfoImpl.cpp revision 24a1823983f5efc3cf0dc13b099c30947cd325bc
1N/A/* $Id$ */
1N/A/** @file
1N/A * VirtualBox Main - Guest file system object information handling.
1N/A */
1N/A
1N/A/*
1N/A * Copyright (C) 2012-2014 Oracle Corporation
1N/A *
1N/A * This file is part of VirtualBox Open Source Edition (OSE), as
1N/A * available from http://www.virtualbox.org. This file is free software;
1N/A * you can redistribute it and/or modify it under the terms of the GNU
1N/A * General Public License (GPL) as published by the Free Software
1N/A * Foundation, in version 2 as it comes in the "COPYING" file of the
1N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1N/A */
1N/A
1N/A
1N/A/*******************************************************************************
1N/A* Header Files *
1N/A*******************************************************************************/
1N/A#include "GuestFsObjInfoImpl.h"
1N/A#include "GuestCtrlImplPrivate.h"
1N/A
1N/A#include "Global.h"
1N/A#include "AutoCaller.h"
1N/A
1N/A#include <VBox/com/array.h>
1N/A
1N/A#ifdef LOG_GROUP
1N/A #undef LOG_GROUP
1N/A#endif
1N/A#define LOG_GROUP LOG_GROUP_GUEST_CONTROL
1N/A#include <VBox/log.h>
1N/A
1N/A
1N/A// constructor / destructor
1N/A/////////////////////////////////////////////////////////////////////////////
1N/A
1N/ADEFINE_EMPTY_CTOR_DTOR(GuestFsObjInfo)
1N/A
1N/AHRESULT GuestFsObjInfo::FinalConstruct(void)
1N/A{
1N/A LogFlowThisFunc(("\n"));
1N/A return BaseFinalConstruct();
1N/A}
1N/A
1N/Avoid GuestFsObjInfo::FinalRelease(void)
1N/A{
1N/A LogFlowThisFuncEnter();
1N/A uninit();
1N/A BaseFinalRelease();
1N/A LogFlowThisFuncLeave();
1N/A}
1N/A
1N/A// public initializer/uninitializer for internal purposes only
1N/A/////////////////////////////////////////////////////////////////////////////
1N/A
1N/Aint GuestFsObjInfo::init(const GuestFsObjData &objData)
1N/A{
1N/A LogFlowThisFuncEnter();
1N/A
1N/A /* Enclose the state transition NotReady->InInit->Ready. */
1N/A AutoInitSpan autoInitSpan(this);
1N/A AssertReturn(autoInitSpan.isOk(), E_FAIL);
1N/A
1N/A mData = objData;
1N/A
1N/A /* Confirm a successful initialization when it's the case. */
1N/A autoInitSpan.setSucceeded();
1N/A
1N/A return VINF_SUCCESS;
1N/A}
1N/A
1N/A/**
1N/A * Uninitializes the instance.
1N/A * Called from FinalRelease().
1N/A */
1N/Avoid GuestFsObjInfo::uninit(void)
1N/A{
1N/A LogFlowThisFunc(("\n"));
1N/A
1N/A /* Enclose the state transition Ready->InUninit->NotReady. */
1N/A AutoUninitSpan autoUninitSpan(this);
1N/A if (autoUninitSpan.uninitDone())
1N/A return;
1N/A}
1N/A
1N/A// implementation of wrapped private getters/setters for attributes
1N/A/////////////////////////////////////////////////////////////////////////////
1N/A
1N/AHRESULT GuestFsObjInfo::getAccessTime(LONG64 *aAccessTime)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aAccessTime = mData.mAccessTime;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getAllocatedSize(LONG64 *aAllocatedSize)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aAllocatedSize = mData.mAllocatedSize;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getBirthTime(LONG64 *aBirthTime)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aBirthTime = mData.mBirthTime;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getChangeTime(LONG64 *aChangeTime)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aChangeTime = mData.mChangeTime;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/A
1N/A
1N/AHRESULT GuestFsObjInfo::getDeviceNumber(ULONG *aDeviceNumber)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aDeviceNumber = mData.mDeviceNumber;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getFileAttributes(com::Utf8Str &aFileAttributes)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A aFileAttributes = mData.mFileAttrs;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getGenerationId(ULONG *aGenerationId)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aGenerationId = mData.mGenerationID;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getGID(ULONG *aGID)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aGID = mData.mGID;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getGroupName(com::Utf8Str &aGroupName)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A aGroupName = mData.mGroupName;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getHardLinks(ULONG *aHardLinks)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aHardLinks = mData.mNumHardLinks;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getModificationTime(LONG64 *aModificationTime)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aModificationTime = mData.mModificationTime;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getName(com::Utf8Str &aName)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A aName = mData.mName;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getNodeId(LONG64 *aNodeId)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aNodeId = mData.mNodeID;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getNodeIdDevice(ULONG *aNodeIdDevice)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aNodeIdDevice = mData.mNodeIDDevice;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getObjectSize(LONG64 *aObjectSize)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
1N/A ReturnComNotImplemented();
1N/A#else
1N/A
1N/A *aObjectSize = mData.mObjectSize;
1N/A
1N/A return S_OK;
1N/A#endif /* VBOX_WITH_GUEST_CONTROL */
1N/A}
1N/A
1N/AHRESULT GuestFsObjInfo::getType(FsObjType_T *aType)
1N/A{
1N/A#ifndef VBOX_WITH_GUEST_CONTROL
ReturnComNotImplemented();
#else
*aType = mData.mType;
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
HRESULT GuestFsObjInfo::getUID(ULONG *aUID)
{
#ifndef VBOX_WITH_GUEST_CONTROL
ReturnComNotImplemented();
#else
*aUID = mData.mUID;
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
HRESULT GuestFsObjInfo::getUserFlags(ULONG *aUserFlags)
{
#ifndef VBOX_WITH_GUEST_CONTROL
ReturnComNotImplemented();
#else
*aUserFlags = mData.mUserFlags;
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
HRESULT GuestFsObjInfo::getUserName(com::Utf8Str &aUserName)
{
#ifndef VBOX_WITH_GUEST_CONTROL
ReturnComNotImplemented();
#else
aUserName = mData.mUserName;
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}