GuestDirectoryImpl.cpp revision 7b9f0c34e9ea328981c99e97054bdf8684d9d620
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/* $Id$ */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/** @file
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * VirtualBox Main - XXX.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/*
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Copyright (C) 2012 Oracle Corporation
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync *
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * available from http://www.virtualbox.org. This file is free software;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * General Public License (GPL) as published by the Free Software
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/*******************************************************************************
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync* Header Files *
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync*******************************************************************************/
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include "GuestDirectoryImpl.h"
7b9f0c34e9ea328981c99e97054bdf8684d9d620vboxsync#include "GuestCtrlImplPrivate.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include "Global.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include "AutoCaller.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include <VBox/com/array.h>
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync// constructor / destructor
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/////////////////////////////////////////////////////////////////////////////
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncDEFINE_EMPTY_CTOR_DTOR(GuestDirectory)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
13f1ce3859ee77d9b9f4d2ca9f93e1633cb133bcvboxsyncHRESULT GuestDirectory::FinalConstruct(void)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFunc(("\n"));
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return BaseFinalConstruct();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncvoid GuestDirectory::FinalRelease(void)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync uninit();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync BaseFinalRelease();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFuncLeave();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync// public initializer/uninitializer for internal purposes only
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/////////////////////////////////////////////////////////////////////////////
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncHRESULT GuestDirectory::init(void)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /* Enclose the state transition NotReady->InInit->Ready. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoInitSpan autoInitSpan(this);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AssertReturn(autoInitSpan.isOk(), E_FAIL);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /* Confirm a successful initialization when it's the case. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync autoInitSpan.setSucceeded();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return S_OK;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/**
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Uninitializes the instance.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Called from FinalRelease().
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncvoid GuestDirectory::uninit(void)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFunc(("\n"));
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /* Enclose the state transition Ready->InUninit->NotReady. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoUninitSpan autoUninitSpan(this);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (autoUninitSpan.uninitDone())
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync// implementation of public getters/setters for attributes
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/////////////////////////////////////////////////////////////////////////////
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncSTDMETHODIMP GuestDirectory::COMGETTER(DirectoryName)(BSTR *aName)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync CheckComArgOutPointerValid(aName);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller autoCaller(this);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync mData.mName.cloneTo(aName);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return S_OK;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync// implementation of public methods
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/////////////////////////////////////////////////////////////////////////////
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncSTDMETHODIMP GuestDirectory::Read(IGuestFsObjInfo **aInfo)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#else
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller autoCaller(this);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync