~ubuntu-branches/ubuntu/raring/virtualbox-ose/raring

« back to all changes in this revision

Viewing changes to src/VBox/Main/include/Global.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
        const uint32_t              recommendedVRAM;
61
61
        const uint32_t              recommendedHDD;
62
62
        const NetworkAdapterType_T  networkAdapterType;
 
63
        const uint32_t              numSerialEnabled;
63
64
    };
64
65
 
65
 
    static const OSType sOSTypes [SchemaDefs::OSTypeId_COUNT];
 
66
    static const OSType sOSTypes[SchemaDefs::OSTypeId_COUNT];
66
67
 
67
 
    static const char *OSTypeId (VBOXOSTYPE aOSType);
 
68
    static const char *OSTypeId(VBOXOSTYPE aOSType);
68
69
 
69
70
    /**
70
71
     * Returns @c true if the given machine state is an online state. This is a
71
72
     * recommended way to detect if the VM is online (being executed in a
72
73
     * dedicated process) or not. Note that some online states are also
73
74
     * transitional states (see #IsTransitional()).
 
75
     *
 
76
     * @remarks Saving may actually be an offline state according to the
 
77
     *          documentation (offline snapshot).
74
78
     */
75
 
    static bool IsOnline (MachineState_T aState)
 
79
    static bool IsOnline(MachineState_T aState)
76
80
    {
 
81
#if 0
77
82
        return aState >= MachineState_FirstOnline &&
78
83
               aState <= MachineState_LastOnline;
 
84
#else
 
85
        switch (aState)
 
86
        {
 
87
            case MachineState_Running:
 
88
            case MachineState_Paused:
 
89
            case MachineState_Teleporting:
 
90
            case MachineState_LiveSnapshotting:
 
91
            case MachineState_Stuck:
 
92
            case MachineState_Starting:
 
93
            case MachineState_Stopping:
 
94
            case MachineState_Saving:
 
95
            case MachineState_Restoring:
 
96
            case MachineState_TeleportingPausedVM:
 
97
            case MachineState_TeleportingIn:
 
98
                return true;
 
99
            default:
 
100
                return false;
 
101
        }
 
102
#endif
79
103
    }
80
104
 
81
105
    /**
85
109
     * snapshot, etc.). Note some (but not all) transitional states are also
86
110
     * online states (see #IsOnline()).
87
111
     */
88
 
    static bool IsTransient (MachineState_T aState)
 
112
    static bool IsTransient(MachineState_T aState)
89
113
    {
 
114
#if 0
90
115
        return aState >= MachineState_FirstTransient &&
91
116
               aState <= MachineState_LastTransient;
 
117
#else
 
118
        switch (aState)
 
119
        {
 
120
            case MachineState_Teleporting:
 
121
            case MachineState_LiveSnapshotting:
 
122
            case MachineState_Starting:
 
123
            case MachineState_Stopping:
 
124
            case MachineState_Saving:
 
125
            case MachineState_Restoring:
 
126
            case MachineState_TeleportingPausedVM:
 
127
            case MachineState_TeleportingIn:
 
128
            case MachineState_RestoringSnapshot:
 
129
            case MachineState_DeletingSnapshot:
 
130
            case MachineState_SettingUp:
 
131
                return true;
 
132
            default:
 
133
                return false;
 
134
        }
 
135
#endif
92
136
    }
93
137
 
94
138
    /**
95
 
     * Shortcut to <tt>IsOnline (aState) || IsTransient (aState)</tt>. When it
96
 
     * returns @false, the VM is turned off (no VM process) and not busy with
 
139
     * Shortcut to <tt>IsOnline(aState) || IsTransient(aState)</tt>. When it returns
 
140
     * @false, the VM is turned off (no VM process) and not busy with
97
141
     * another exclusive operation.
98
142
     */
99
 
    static bool IsOnlineOrTransient (MachineState_T aState)
100
 
    {
101
 
        return IsOnline (aState) || IsTransient (aState);
102
 
    }
103
 
 
104
 
    /**
105
 
     * Shortcut to <tt>IsOnline (aState) && !IsTransient (aState)</tt>. This is
106
 
     * a recommended way to detect if the VM emulation thread is in action
107
 
     * (either running, suspended, or stuck). When this method returns @false,
108
 
     * then either the VM is not online or the emulation thread is being started
109
 
     * or stopped, etc.
110
 
     */
111
 
    static bool IsActive (MachineState_T aState)
112
 
    {
113
 
        return IsOnline (aState) && !IsTransient (aState);
114
 
    }
 
143
    static bool IsOnlineOrTransient(MachineState_T aState)
 
144
    {
 
145
        return IsOnline(aState) || IsTransient(aState);
 
146
    }
 
147
 
 
148
    /**
 
149
     * Stringify a machine state.
 
150
     *
 
151
     * @returns Pointer to a read only string.
 
152
     * @param   aState      Valid machine state.
 
153
     */
 
154
    static const char *stringifyMachineState(MachineState_T aState);
 
155
 
 
156
    /**
 
157
     * Stringify a session state.
 
158
     *
 
159
     * @returns Pointer to a read only string.
 
160
     * @param   aState      Valid session state.
 
161
     */
 
162
    static const char *stringifySessionState(SessionState_T aState);
 
163
 
 
164
    /**
 
165
     * Stringify a device type.
 
166
     *
 
167
     * @returns Pointer to a read only string.
 
168
     * @param   aType       The device type.
 
169
     */
 
170
    static const char *stringifyDeviceType(DeviceType_T aType);
 
171
 
 
172
    /**
 
173
     * Try convert a COM status code to a VirtualBox status code (VBox/err.h).
 
174
     *
 
175
     * @returns VBox status code.
 
176
     * @param   aComStatus      COM status code.
 
177
     */
 
178
    static int vboxStatusCodeFromCOM(HRESULT aComStatus);
 
179
 
 
180
    /**
 
181
     * Try convert a VirtualBox status code (VBox/err.h) to a COM status code.
 
182
     *
 
183
     * This is mainly inteded for dealing with vboxStatusCodeFromCOM() return
 
184
     * values.  If used on anything else, it won't be able to cope with most of the
 
185
     * input!
 
186
     *
 
187
     * @returns COM status code.
 
188
     * @param   aVBoxStatus      VBox status code.
 
189
     */
 
190
    static HRESULT vboxStatusCodeToCOM(int aVBoxStatus);
115
191
};
116
192
 
117
 
#endif /* ____H_GLOBAL */
 
193
#endif /* !____H_GLOBAL */
118
194
/* vi: set tabstop=4 shiftwidth=4 expandtab: */