1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

src/vbox: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jonathon Jongsma 2019-06-18 11:13:09 -05:00 committed by Ján Tomko
parent 2ad45811e2
commit 6d5e1df53f
7 changed files with 106 additions and 127 deletions

View File

@ -19,10 +19,9 @@
* *
*/ */
#ifndef LIBVIRT_VBOX_MSCOMGLUE_H #pragma once
# define LIBVIRT_VBOX_MSCOMGLUE_H
# include "vbox_CAPI_v3_2.h" #include "vbox_CAPI_v3_2.h"
extern PFNVBOXGETXPCOMCFUNCTIONS g_pfnGetFunctions; extern PFNVBOXGETXPCOMCFUNCTIONS g_pfnGetFunctions;
@ -37,12 +36,10 @@ struct _vboxArray {
void *handle; void *handle;
}; };
# define VBOX_ARRAY_INITIALIZER { NULL, 0, NULL } #define VBOX_ARRAY_INITIALIZER { NULL, 0, NULL }
nsresult vboxArrayGet(vboxArray *array, void *self, void *getter); nsresult vboxArrayGet(vboxArray *array, void *self, void *getter);
nsresult vboxArrayGetWithPtrArg(vboxArray *array, void *self, void *getter, void *arg); nsresult vboxArrayGetWithPtrArg(vboxArray *array, void *self, void *getter, void *arg);
nsresult vboxArrayGetWithUintArg(vboxArray *array, void *self, void *getter, PRUint32 arg); nsresult vboxArrayGetWithUintArg(vboxArray *array, void *self, void *getter, PRUint32 arg);
void vboxArrayRelease(vboxArray *array); void vboxArrayRelease(vboxArray *array);
# define vboxArrayUnalloc vboxArrayRelease #define vboxArrayUnalloc vboxArrayRelease
#endif /* LIBVIRT_VBOX_MSCOMGLUE_H */

View File

@ -17,16 +17,15 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VBOX_COMMON_H #pragma once
# define LIBVIRT_VBOX_COMMON_H
# ifdef ___VirtualBox_CXPCOM_h #ifdef ___VirtualBox_CXPCOM_h
# error this file should not be included after vbox_CAPI_v*.h # error this file should not be included after vbox_CAPI_v*.h
# endif #endif
# include "internal.h" #include "internal.h"
# include <stddef.h> #include <stddef.h>
# include "wchar.h" #include "wchar.h"
/* This file extracts some symbols defined in /* This file extracts some symbols defined in
* vbox_CAPI_v*.h. It tells the vbox_common.c * vbox_CAPI_v*.h. It tells the vbox_common.c
@ -42,34 +41,34 @@
* We must MAKE SURE these codes are compatible. */ * We must MAKE SURE these codes are compatible. */
typedef unsigned char PRUint8; typedef unsigned char PRUint8;
# if (defined(HPUX) && defined(__cplusplus) \ #if (defined(HPUX) && defined(__cplusplus) \
&& !defined(__GNUC__) && __cplusplus < 199707L) \ && !defined(__GNUC__) && __cplusplus < 199707L) \
|| (defined(SCO) && defined(__cplusplus) \ || (defined(SCO) && defined(__cplusplus) \
&& !defined(__GNUC__) && __cplusplus == 1L) && !defined(__GNUC__) && __cplusplus == 1L)
typedef char PRInt8; typedef char PRInt8;
# else #else
typedef signed char PRInt8; typedef signed char PRInt8;
# endif #endif
# define PR_INT8_MAX 127 #define PR_INT8_MAX 127
# define PR_INT8_MIN (-128) #define PR_INT8_MIN (-128)
# define PR_UINT8_MAX 255U #define PR_UINT8_MAX 255U
typedef unsigned short PRUint16; typedef unsigned short PRUint16;
typedef short PRInt16; typedef short PRInt16;
# define PR_INT16_MAX 32767 #define PR_INT16_MAX 32767
# define PR_INT16_MIN (-32768) #define PR_INT16_MIN (-32768)
# define PR_UINT16_MAX 65535U #define PR_UINT16_MAX 65535U
typedef unsigned int PRUint32; typedef unsigned int PRUint32;
typedef int PRInt32; typedef int PRInt32;
# define PR_INT32(x) x #define PR_INT32(x) x
# define PR_UINT32(x) x ## U #define PR_UINT32(x) x ## U
# define PR_INT32_MAX PR_INT32(2147483647) #define PR_INT32_MAX PR_INT32(2147483647)
# define PR_INT32_MIN (-PR_INT32_MAX - 1) #define PR_INT32_MIN (-PR_INT32_MAX - 1)
# define PR_UINT32_MAX PR_UINT32(4294967295) #define PR_UINT32_MAX PR_UINT32(4294967295)
typedef long PRInt64; typedef long PRInt64;
typedef unsigned long PRUint64; typedef unsigned long PRUint64;
@ -85,8 +84,8 @@ typedef unsigned long PRUptrdiff;
typedef PRIntn PRBool; typedef PRIntn PRBool;
# define PR_TRUE 1 #define PR_TRUE 1
# define PR_FALSE 0 #define PR_FALSE 0
typedef PRUint8 PRPackedBool; typedef PRUint8 PRPackedBool;
@ -96,31 +95,31 @@ typedef PRUint8 PRPackedBool;
*/ */
typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus; typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
# ifndef __PRUNICHAR__ #ifndef __PRUNICHAR__
# define __PRUNICHAR__ # define __PRUNICHAR__
# if defined(WIN32) || defined(XP_MAC) # if defined(WIN32) || defined(XP_MAC)
typedef wchar_t PRUnichar; typedef wchar_t PRUnichar;
# else # else
typedef PRUint16 PRUnichar; typedef PRUint16 PRUnichar;
# endif # endif
# endif #endif
typedef long PRWord; typedef long PRWord;
typedef unsigned long PRUword; typedef unsigned long PRUword;
# define nsnull 0 #define nsnull 0
typedef PRUint32 nsresult; typedef PRUint32 nsresult;
# if defined(__GNUC__) && (__GNUC__ > 2) #if defined(__GNUC__) && (__GNUC__ > 2)
# define NS_LIKELY(x) (__builtin_expect((x), 1)) # define NS_LIKELY(x) (__builtin_expect((x), 1))
# define NS_UNLIKELY(x) (__builtin_expect((x), 0)) # define NS_UNLIKELY(x) (__builtin_expect((x), 0))
# else #else
# define NS_LIKELY(x) (x) # define NS_LIKELY(x) (x)
# define NS_UNLIKELY(x) (x) # define NS_UNLIKELY(x) (x)
# endif #endif
# define NS_FAILED(_nsresult) (NS_UNLIKELY((_nsresult) & 0x80000000)) #define NS_FAILED(_nsresult) (NS_UNLIKELY((_nsresult) & 0x80000000))
# define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) & 0x80000000))) #define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) & 0x80000000)))
/** /**
* An "interface id" which can be used to uniquely identify a given * An "interface id" which can be used to uniquely identify a given
@ -140,7 +139,7 @@ typedef nsID nsIID;
typedef struct _vboxArray vboxArray; typedef struct _vboxArray vboxArray;
# ifdef WIN32 #ifdef WIN32
struct _vboxArray { struct _vboxArray {
void **items; void **items;
@ -149,7 +148,7 @@ struct _vboxArray {
}; };
# define VBOX_ARRAY_INITIALIZER { NULL, 0, NULL } # define VBOX_ARRAY_INITIALIZER { NULL, 0, NULL }
# else /* !WIN32 */ #else /* !WIN32 */
struct _vboxArray { struct _vboxArray {
void **items; void **items;
@ -157,7 +156,7 @@ struct _vboxArray {
}; };
# define VBOX_ARRAY_INITIALIZER { NULL, 0 } # define VBOX_ARRAY_INITIALIZER { NULL, 0 }
# endif /* !WIN32 */ #endif /* !WIN32 */
/* We make the assumption that these enum flags /* We make the assumption that these enum flags
* are compatible in all vbox API version. * are compatible in all vbox API version.
@ -313,26 +312,26 @@ enum HardDiskVariant
HardDiskVariant_Diff = 0x20000 HardDiskVariant_Diff = 0x20000
}; };
# define VBOX_E_OBJECT_NOT_FOUND 0x80BB0001 #define VBOX_E_OBJECT_NOT_FOUND 0x80BB0001
# define VBOX_E_INVALID_VM_STATE 0x80BB0002 #define VBOX_E_INVALID_VM_STATE 0x80BB0002
# define VBOX_E_VM_ERROR 0x80BB0003 #define VBOX_E_VM_ERROR 0x80BB0003
# define VBOX_E_FILE_ERROR 0x80BB0004 #define VBOX_E_FILE_ERROR 0x80BB0004
# define VBOX_E_IPRT_ERROR 0x80BB0005 #define VBOX_E_IPRT_ERROR 0x80BB0005
# define VBOX_E_PDM_ERROR 0x80BB0006 #define VBOX_E_PDM_ERROR 0x80BB0006
# define VBOX_E_INVALID_OBJECT_STATE 0x80BB0007 #define VBOX_E_INVALID_OBJECT_STATE 0x80BB0007
# define VBOX_E_HOST_ERROR 0x80BB0008 #define VBOX_E_HOST_ERROR 0x80BB0008
# define VBOX_E_NOT_SUPPORTED 0x80BB0009 #define VBOX_E_NOT_SUPPORTED 0x80BB0009
# define VBOX_E_XML_ERROR 0x80BB000A #define VBOX_E_XML_ERROR 0x80BB000A
# define VBOX_E_INVALID_SESSION_STATE 0x80BB000B #define VBOX_E_INVALID_SESSION_STATE 0x80BB000B
# define VBOX_E_OBJECT_IN_USE 0x80BB000C #define VBOX_E_OBJECT_IN_USE 0x80BB000C
/* VBOX storage controller name definitions */ /* VBOX storage controller name definitions */
# define VBOX_CONTROLLER_IDE_NAME "IDE Controller" #define VBOX_CONTROLLER_IDE_NAME "IDE Controller"
# define VBOX_CONTROLLER_FLOPPY_NAME "Floppy Controller" #define VBOX_CONTROLLER_FLOPPY_NAME "Floppy Controller"
# define VBOX_CONTROLLER_SATA_NAME "SATA Controller" #define VBOX_CONTROLLER_SATA_NAME "SATA Controller"
# define VBOX_CONTROLLER_SCSI_NAME "SCSI Controller" #define VBOX_CONTROLLER_SCSI_NAME "SCSI Controller"
# define VBOX_CONTROLLER_SAS_NAME "SAS Controller" #define VBOX_CONTROLLER_SAS_NAME "SAS Controller"
/* Simplied definitions in vbox_CAPI_*.h */ /* Simplied definitions in vbox_CAPI_*.h */
@ -365,10 +364,10 @@ typedef nsISupports IKeyboard;
/* Macros for all vbox drivers. */ /* Macros for all vbox drivers. */
# define RC_SUCCEEDED(rc) NS_SUCCEEDED(rc.resultCode) #define RC_SUCCEEDED(rc) NS_SUCCEEDED(rc.resultCode)
# define RC_FAILED(rc) NS_FAILED(rc.resultCode) #define RC_FAILED(rc) NS_FAILED(rc.resultCode)
# define VBOX_UTF16_FREE(arg) \ #define VBOX_UTF16_FREE(arg) \
do { \ do { \
if (arg) { \ if (arg) { \
gVBoxAPI.UPFN.Utf16Free(data->pFuncs, arg); \ gVBoxAPI.UPFN.Utf16Free(data->pFuncs, arg); \
@ -376,7 +375,7 @@ typedef nsISupports IKeyboard;
} \ } \
} while (0) } while (0)
# define VBOX_UTF8_FREE(arg) \ #define VBOX_UTF8_FREE(arg) \
do { \ do { \
if (arg) { \ if (arg) { \
gVBoxAPI.UPFN.Utf8Free(data->pFuncs, arg); \ gVBoxAPI.UPFN.Utf8Free(data->pFuncs, arg); \
@ -384,7 +383,7 @@ typedef nsISupports IKeyboard;
} \ } \
} while (0) } while (0)
# define VBOX_COM_UNALLOC_MEM(arg) \ #define VBOX_COM_UNALLOC_MEM(arg) \
do { \ do { \
if (arg) { \ if (arg) { \
gVBoxAPI.UPFN.ComUnallocMem(data->pFuncs, arg); \ gVBoxAPI.UPFN.ComUnallocMem(data->pFuncs, arg); \
@ -392,12 +391,12 @@ typedef nsISupports IKeyboard;
} \ } \
} while (0) } while (0)
# define VBOX_UTF16_TO_UTF8(arg1, arg2) gVBoxAPI.UPFN.Utf16ToUtf8(data->pFuncs, arg1, arg2) #define VBOX_UTF16_TO_UTF8(arg1, arg2) gVBoxAPI.UPFN.Utf16ToUtf8(data->pFuncs, arg1, arg2)
# define VBOX_UTF8_TO_UTF16(arg1, arg2) gVBoxAPI.UPFN.Utf8ToUtf16(data->pFuncs, arg1, arg2) #define VBOX_UTF8_TO_UTF16(arg1, arg2) gVBoxAPI.UPFN.Utf8ToUtf16(data->pFuncs, arg1, arg2)
# define VBOX_ADDREF(arg) gVBoxAPI.nsUISupports.AddRef((void *)(arg)) #define VBOX_ADDREF(arg) gVBoxAPI.nsUISupports.AddRef((void *)(arg))
# define VBOX_RELEASE(arg) \ #define VBOX_RELEASE(arg) \
do { \ do { \
if (arg) { \ if (arg) { \
gVBoxAPI.nsUISupports.Release((void *)arg); \ gVBoxAPI.nsUISupports.Release((void *)arg); \
@ -405,7 +404,7 @@ typedef nsISupports IKeyboard;
} \ } \
} while (0) } while (0)
# define VBOX_MEDIUM_RELEASE(arg) \ #define VBOX_MEDIUM_RELEASE(arg) \
do { \ do { \
if (arg) { \ if (arg) { \
gVBoxAPI.UIMedium.Release(arg); \ gVBoxAPI.UIMedium.Release(arg); \
@ -413,21 +412,21 @@ typedef nsISupports IKeyboard;
} \ } \
} while (0) } while (0)
# define vboxIIDUnalloc(iid) gVBoxAPI.UIID.vboxIIDUnalloc(data, iid) #define vboxIIDUnalloc(iid) gVBoxAPI.UIID.vboxIIDUnalloc(data, iid)
# define vboxIIDToUUID(iid, uuid) gVBoxAPI.UIID.vboxIIDToUUID(data, iid, uuid) #define vboxIIDToUUID(iid, uuid) gVBoxAPI.UIID.vboxIIDToUUID(data, iid, uuid)
# define vboxIIDFromUUID(iid, uuid) gVBoxAPI.UIID.vboxIIDFromUUID(data, iid, uuid) #define vboxIIDFromUUID(iid, uuid) gVBoxAPI.UIID.vboxIIDFromUUID(data, iid, uuid)
# define vboxIIDIsEqual(iid1, iid2) gVBoxAPI.UIID.vboxIIDIsEqual(data, iid1, iid2) #define vboxIIDIsEqual(iid1, iid2) gVBoxAPI.UIID.vboxIIDIsEqual(data, iid1, iid2)
# define DEBUGIID(msg, iid) gVBoxAPI.UIID.DEBUGIID(data, msg, iid) #define DEBUGIID(msg, iid) gVBoxAPI.UIID.DEBUGIID(data, msg, iid)
# define vboxIIDFromArrayItem(iid, array, idx) \ #define vboxIIDFromArrayItem(iid, array, idx) \
gVBoxAPI.UIID.vboxIIDFromArrayItem(data, iid, array, idx) gVBoxAPI.UIID.vboxIIDFromArrayItem(data, iid, array, idx)
# define VBOX_IID_INITIALIZE(iid) gVBoxAPI.UIID.vboxIIDInitialize(iid) #define VBOX_IID_INITIALIZE(iid) gVBoxAPI.UIID.vboxIIDInitialize(iid)
# define ARRAY_GET_MACHINES \ #define ARRAY_GET_MACHINES \
(gVBoxAPI.UArray.handleGetMachines(data->vboxObj)) (gVBoxAPI.UArray.handleGetMachines(data->vboxObj))
/* Set result to -1 in case of failure. */ /* Set result to -1 in case of failure. */
# define installUniformedAPI(gVBoxAPI, result) \ #define installUniformedAPI(gVBoxAPI, result) \
do { \ do { \
result = 0; \ result = 0; \
if (uVersion >= 5000000 && uVersion < 5000051) { \ if (uVersion >= 5000000 && uVersion < 5000051) { \
@ -440,5 +439,3 @@ typedef nsISupports IKeyboard;
result = -1; \ result = -1; \
} \ } \
} while (0) } while (0)
#endif /* LIBVIRT_VBOX_COMMON_H */

View File

@ -22,21 +22,18 @@
* additional information or have any questions. * additional information or have any questions.
*/ */
#ifndef LIBVIRT_VBOX_DRIVER_H #pragma once
# define LIBVIRT_VBOX_DRIVER_H
# include "internal.h" #include "internal.h"
# if defined(VBOX_NETWORK_DRIVER) #if defined(VBOX_NETWORK_DRIVER)
int vboxNetworkRegister(void); int vboxNetworkRegister(void);
# endif #endif
# if defined(VBOX_STORAGE_DRIVER) #if defined(VBOX_STORAGE_DRIVER)
int vboxStorageRegister(void); int vboxStorageRegister(void);
# endif #endif
# if defined(VBOX_DRIVER) #if defined(VBOX_DRIVER)
int vboxRegister(void); int vboxRegister(void);
# endif #endif
#endif /* LIBVIRT_VBOX_DRIVER_H */

View File

@ -16,13 +16,10 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VBOX_GET_DRIVER_H #pragma once
# define LIBVIRT_VBOX_GET_DRIVER_H
# include "internal.h" #include "internal.h"
virHypervisorDriverPtr vboxGetHypervisorDriver(uint32_t uVersion); virHypervisorDriverPtr vboxGetHypervisorDriver(uint32_t uVersion);
virNetworkDriverPtr vboxGetNetworkDriver(uint32_t uVersion); virNetworkDriverPtr vboxGetNetworkDriver(uint32_t uVersion);
virStorageDriverPtr vboxGetStorageDriver(uint32_t uVersion); virStorageDriverPtr vboxGetStorageDriver(uint32_t uVersion);
#endif /* LIBVIRT_VBOX_GET_DRIVER_H */

View File

@ -19,13 +19,10 @@
* *
*/ */
#ifndef LIBVIRT_VBOX_GLUE_H #pragma once
# define LIBVIRT_VBOX_GLUE_H
# ifdef WIN32 #ifdef WIN32
# include "vbox_MSCOMGlue.h" # include "vbox_MSCOMGlue.h"
# else #else
# include "vbox_XPCOMCGlue.h" # include "vbox_XPCOMCGlue.h"
# endif #endif
#endif /* LIBVIRT_VBOX_GLUE_H */

View File

@ -16,12 +16,11 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VBOX_SNAPSHOT_CONF_H #pragma once
# define LIBVIRT_VBOX_SNAPSHOT_CONF_H
# include "internal.h" #include "internal.h"
# define VBOX_UUID_REGEX "([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})" #define VBOX_UUID_REGEX "([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})"
/*Stores VirtualBox xml hard disk information /*Stores VirtualBox xml hard disk information
A hard disk can have a parent and children*/ A hard disk can have a parent and children*/
@ -137,5 +136,3 @@ virVBoxSnapshotConfHardDiskPtrByLocation(virVBoxSnapshotConfMachinePtr machine,
virVBoxSnapshotConfSnapshotPtr virVBoxSnapshotConfSnapshotPtr
virVBoxSnapshotConfSnapshotByName(virVBoxSnapshotConfSnapshotPtr snapshot, virVBoxSnapshotConfSnapshotByName(virVBoxSnapshotConfSnapshotPtr snapshot,
const char *snapshotName); const char *snapshotName);
#endif /* LIBVIRT_VBOX_SNAPSHOT_CONF_H */

View File

@ -16,10 +16,9 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#ifndef LIBVIRT_VBOX_UNIFORMED_API_H #pragma once
# define LIBVIRT_VBOX_UNIFORMED_API_H
# include "internal.h" #include "internal.h"
/* This file may be used in three place. That is vbox_tmpl.c, /* This file may be used in three place. That is vbox_tmpl.c,
* vbox_common.c and vbox_driver.c. The vboxUniformedAPI and some * vbox_common.c and vbox_driver.c. The vboxUniformedAPI and some
@ -85,9 +84,9 @@ struct _vboxDriver {
PCVBOXXPCOM pFuncs; PCVBOXXPCOM pFuncs;
IVirtualBox *vboxObj; IVirtualBox *vboxObj;
ISession *vboxSession; ISession *vboxSession;
# ifdef VBOX_API_VERSION #ifdef VBOX_API_VERSION
IVirtualBoxClient *vboxClient; IVirtualBoxClient *vboxClient;
# endif #endif
unsigned long version; unsigned long version;
@ -559,5 +558,3 @@ virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn,
void vbox50InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI); void vbox50InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox51InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI); void vbox51InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
void vbox52InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI); void vbox52InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
#endif /* LIBVIRT_VBOX_UNIFORMED_API_H */