src/datatypes.h: use #pragma once

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-07 15:20:23 -05:00 committed by Ján Tomko
parent b7779b2938
commit d293ff8efc

View File

@ -19,15 +19,14 @@
*
*/
#ifndef LIBVIRT_DATATYPES_H
# define LIBVIRT_DATATYPES_H
#pragma once
# include "internal.h"
#include "internal.h"
# include "driver.h"
# include "virthread.h"
# include "virobject.h"
# include "viruuid.h"
#include "driver.h"
#include "virthread.h"
#include "virobject.h"
#include "viruuid.h"
extern virClassPtr virConnectClass;
extern virClassPtr virDomainClass;
@ -47,7 +46,7 @@ extern virClassPtr virAdmConnectClass;
extern virClassPtr virAdmServerClass;
extern virClassPtr virAdmClientClass;
# define virCheckConnectReturn(obj, retval) \
#define virCheckConnectReturn(obj, retval) \
do { \
if (!virObjectIsClass(obj, virConnectClass)) { \
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
@ -57,7 +56,7 @@ extern virClassPtr virAdmClientClass;
return retval; \
} \
} while (0)
# define virCheckConnectGoto(obj, label) \
#define virCheckConnectGoto(obj, label) \
do { \
if (!virObjectIsClass(obj, virConnectClass)) { \
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
@ -67,7 +66,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckDomainReturn(obj, retval) \
#define virCheckDomainReturn(obj, retval) \
do { \
virDomainPtr _dom = (obj); \
if (!virObjectIsClass(_dom, virDomainClass) || \
@ -79,7 +78,7 @@ extern virClassPtr virAdmClientClass;
return retval; \
} \
} while (0)
# define virCheckDomainGoto(obj, label) \
#define virCheckDomainGoto(obj, label) \
do { \
virDomainPtr _dom = (obj); \
if (!virObjectIsClass(_dom, virDomainClass) || \
@ -91,7 +90,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckNetworkReturn(obj, retval) \
#define virCheckNetworkReturn(obj, retval) \
do { \
virNetworkPtr _net = (obj); \
if (!virObjectIsClass(_net, virNetworkClass) || \
@ -104,7 +103,7 @@ extern virClassPtr virAdmClientClass;
return retval; \
} \
} while (0)
# define virCheckNetworkGoto(obj, label) \
#define virCheckNetworkGoto(obj, label) \
do { \
virNetworkPtr _net = (obj); \
if (!virObjectIsClass(_net, virNetworkClass) || \
@ -117,7 +116,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckInterfaceReturn(obj, retval) \
#define virCheckInterfaceReturn(obj, retval) \
do { \
virInterfacePtr _iface = (obj); \
if (!virObjectIsClass(_iface, virInterfaceClass) || \
@ -131,7 +130,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckStoragePoolReturn(obj, retval) \
#define virCheckStoragePoolReturn(obj, retval) \
do { \
virStoragePoolPtr _pool = (obj); \
if (!virObjectIsClass(_pool, virStoragePoolClass) || \
@ -145,7 +144,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckStoragePoolGoto(obj, label) \
#define virCheckStoragePoolGoto(obj, label) \
do { \
virStoragePoolPtr _pool= (obj); \
if (!virObjectIsClass(_pool, virStoragePoolClass) || \
@ -158,7 +157,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckStorageVolReturn(obj, retval) \
#define virCheckStorageVolReturn(obj, retval) \
do { \
virStorageVolPtr _vol = (obj); \
if (!virObjectIsClass(_vol, virStorageVolClass) || \
@ -171,7 +170,7 @@ extern virClassPtr virAdmClientClass;
return retval; \
} \
} while (0)
# define virCheckStorageVolGoto(obj, label) \
#define virCheckStorageVolGoto(obj, label) \
do { \
virStorageVolPtr _vol = (obj); \
if (!virObjectIsClass(_vol, virStorageVolClass) || \
@ -184,7 +183,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckNodeDeviceReturn(obj, retval) \
#define virCheckNodeDeviceReturn(obj, retval) \
do { \
virNodeDevicePtr _node = (obj); \
if (!virObjectIsClass(_node, virNodeDeviceClass) || \
@ -198,7 +197,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckNodeDeviceGoto(obj, label) \
#define virCheckNodeDeviceGoto(obj, label) \
do { \
virNodeDevicePtr _dev= (obj); \
if (!virObjectIsClass(_dev, virNodeDeviceClass) || \
@ -211,7 +210,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckSecretReturn(obj, retval) \
#define virCheckSecretReturn(obj, retval) \
do { \
virSecretPtr _secret = (obj); \
if (!virObjectIsClass(_secret, virSecretClass) || \
@ -225,7 +224,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckSecretGoto(obj, label) \
#define virCheckSecretGoto(obj, label) \
do { \
virSecretPtr _secret = (obj); \
if (!virObjectIsClass(_secret, virSecretClass) || \
@ -239,7 +238,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckStreamReturn(obj, retval) \
#define virCheckStreamReturn(obj, retval) \
do { \
virStreamPtr _st = (obj); \
if (!virObjectIsClass(_st, virStreamClass) || \
@ -252,7 +251,7 @@ extern virClassPtr virAdmClientClass;
return retval; \
} \
} while (0)
# define virCheckStreamGoto(obj, label) \
#define virCheckStreamGoto(obj, label) \
do { \
virStreamPtr _st = (obj); \
if (!virObjectIsClass(_st, virStreamClass) || \
@ -265,7 +264,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckNWFilterReturn(obj, retval) \
#define virCheckNWFilterReturn(obj, retval) \
do { \
virNWFilterPtr _nw = (obj); \
if (!virObjectIsClass(_nw, virNWFilterClass) || \
@ -279,7 +278,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckNWFilterBindingReturn(obj, retval) \
#define virCheckNWFilterBindingReturn(obj, retval) \
do { \
virNWFilterBindingPtr _nw = (obj); \
if (!virObjectIsClass(_nw, virNWFilterBindingClass) || \
@ -293,7 +292,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckDomainCheckpointReturn(obj, retval) \
#define virCheckDomainCheckpointReturn(obj, retval) \
do { \
virDomainCheckpointPtr _check = (obj); \
if (!virObjectIsClass(_check, virDomainCheckpointClass) || \
@ -308,7 +307,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckDomainSnapshotReturn(obj, retval) \
#define virCheckDomainSnapshotReturn(obj, retval) \
do { \
virDomainSnapshotPtr _snap = (obj); \
if (!virObjectIsClass(_snap, virDomainSnapshotClass) || \
@ -332,29 +331,29 @@ extern virClassPtr virAdmClientClass;
* "define a(b,...) b,##__VA_ARGS__" as a means of eliding a comma
* when no var-args are present, but we don't want to require gcc.
*/
# define VIR_ARG15(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
_11, _12, _13, _14, _15, ...) _15
# define VIR_HAS_COMMA(...) VIR_ARG15(__VA_ARGS__, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
#define VIR_ARG15(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
_11, _12, _13, _14, _15, ...) _15
#define VIR_HAS_COMMA(...) VIR_ARG15(__VA_ARGS__, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)
/* Form the name VIR_DOMAIN_DEBUG_[01], then call that macro,
* according to how many arguments are present. Two-phase due to
* macro expansion rules. */
# define VIR_DOMAIN_DEBUG_EXPAND(a, b, ...) \
#define VIR_DOMAIN_DEBUG_EXPAND(a, b, ...) \
VIR_DOMAIN_DEBUG_PASTE(a, b, __VA_ARGS__)
# define VIR_DOMAIN_DEBUG_PASTE(a, b, ...) \
#define VIR_DOMAIN_DEBUG_PASTE(a, b, ...) \
a##b(__VA_ARGS__)
/* Internal use only, when VIR_DOMAIN_DEBUG has one argument. */
# define VIR_DOMAIN_DEBUG_0(dom) \
#define VIR_DOMAIN_DEBUG_0(dom) \
VIR_DOMAIN_DEBUG_2(dom, "%s", "")
/* Internal use only, when VIR_DOMAIN_DEBUG has three or more arguments. */
# define VIR_DOMAIN_DEBUG_1(dom, fmt, ...) \
#define VIR_DOMAIN_DEBUG_1(dom, fmt, ...) \
VIR_DOMAIN_DEBUG_2(dom, ", " fmt, __VA_ARGS__)
/* Internal use only, with final format. */
# define VIR_DOMAIN_DEBUG_2(dom, fmt, ...) \
#define VIR_DOMAIN_DEBUG_2(dom, fmt, ...) \
do { \
char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
const char *_domname = NULL; \
@ -370,7 +369,7 @@ extern virClassPtr virAdmClientClass;
dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__); \
} while (0)
# define virCheckAdmConnectReturn(obj, retval) \
#define virCheckAdmConnectReturn(obj, retval) \
do { \
if (!virObjectIsClass(obj, virAdmConnectClass)) { \
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
@ -380,7 +379,7 @@ extern virClassPtr virAdmClientClass;
return retval; \
} \
} while (0)
# define virCheckAdmConnectGoto(obj, label) \
#define virCheckAdmConnectGoto(obj, label) \
do { \
if (!virObjectIsClass(obj, virAdmConnectClass)) { \
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
@ -390,7 +389,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0)
# define virCheckAdmServerReturn(obj, retval) \
#define virCheckAdmServerReturn(obj, retval) \
do { \
virAdmServerPtr _srv = (obj); \
if (!virObjectIsClass(_srv, virAdmServerClass) || \
@ -402,7 +401,7 @@ extern virClassPtr virAdmClientClass;
return retval; \
} \
} while (0)
# define virCheckAdmServerGoto(obj, label) \
#define virCheckAdmServerGoto(obj, label) \
do { \
virAdmServerPtr _srv = (obj); \
if (!virObjectIsClass(_srv, virAdmServerClass) || \
@ -414,7 +413,7 @@ extern virClassPtr virAdmClientClass;
} \
} while (0);
# define virCheckAdmClientReturn(obj, retval) \
#define virCheckAdmClientReturn(obj, retval) \
do { \
virAdmClientPtr _clt = (obj); \
if (!virObjectIsClass(_clt, virAdmClientClass) || \
@ -427,7 +426,7 @@ extern virClassPtr virAdmClientClass;
return retval; \
} \
} while (0)
# define virCheckAdmClientGoto(obj, label) \
#define virCheckAdmClientGoto(obj, label) \
do { \
virAdmClientPtr _clt = (obj); \
if (!virObjectIsClass(_clt, virAdmClientClass) || \
@ -446,7 +445,7 @@ extern virClassPtr virAdmClientClass;
* @fmt: optional format for additional information
* @...: optional arguments corresponding to @fmt.
*/
# define VIR_DOMAIN_DEBUG(...) \
#define VIR_DOMAIN_DEBUG(...) \
VIR_DOMAIN_DEBUG_EXPAND(VIR_DOMAIN_DEBUG_, \
VIR_HAS_COMMA(__VA_ARGS__), \
__VA_ARGS__)
@ -808,5 +807,3 @@ int virAdmConnectCloseCallbackDataRegister(virAdmConnectCloseCallbackDataPtr cbd
virFreeCallback freecb);
int virAdmConnectCloseCallbackDataUnregister(virAdmConnectCloseCallbackDataPtr cbdata,
virAdmConnectCloseFunc cb);
#endif /* LIBVIRT_DATATYPES_H */