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