VBoxAutostartUtils.cpp revision 8d15759c7700c61997ac412b86c718a0c9e44c39
/* $Id$ */
/** @file
* VBoxAutostart - VirtualBox Autostart service, start machines during system boot.
* Utils used by the windows and posix frontends.
*/
/*
* Copyright (C) 2012 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.
*/
#include <VBox/com/com.h>
#include <VBox/com/string.h>
#include <VBox/com/Guid.h>
#include <VBox/com/array.h>
#include <VBox/com/ErrorInfo.h>
#include <VBox/com/errorprint.h>
#include <iprt/message.h>
#include <iprt/thread.h>
#include <iprt/stream.h>
#include <iprt/log.h>
#include <algorithm>
#include <list>
#include <string>
#include "VBoxAutostart.h"
using namespace com;
DECLHIDDEN(const char *) machineStateToName(MachineState_T machineState, bool fShort)
{
switch (machineState)
{
case MachineState_PoweredOff:
return fShort ? "poweroff" : "powered off";
case MachineState_Saved:
return "saved";
case MachineState_Aborted:
return "aborted";
case MachineState_Teleported:
return "teleported";
case MachineState_Running:
return "running";
case MachineState_Paused:
return "paused";
case MachineState_Stuck:
return fShort ? "gurumeditation" : "guru meditation";
case MachineState_LiveSnapshotting:
return fShort ? "livesnapshotting" : "live snapshotting";
case MachineState_Teleporting:
return "teleporting";
case MachineState_Starting:
return "starting";
case MachineState_Stopping:
return "stopping";
case MachineState_Saving:
return "saving";
case MachineState_Restoring:
return "restoring";
case MachineState_TeleportingPausedVM:
return fShort ? "teleportingpausedvm" : "teleporting paused vm";
case MachineState_TeleportingIn:
return fShort ? "teleportingin" : "teleporting (incoming)";
case MachineState_RestoringSnapshot:
return fShort ? "restoringsnapshot" : "restoring snapshot";
case MachineState_DeletingSnapshot:
return fShort ? "deletingsnapshot" : "deleting snapshot";
case MachineState_DeletingSnapshotOnline:
return fShort ? "deletingsnapshotlive" : "deleting snapshot live";
case MachineState_DeletingSnapshotPaused:
return fShort ? "deletingsnapshotlivepaused" : "deleting snapshot live paused";
case MachineState_SettingUp:
return fShort ? "settingup" : "setting up";
default:
break;
}
return "unknown";
}