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