mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Add libvirt-admin library
Initial scratch of the admin library. It has its own virAdmConnectPtr that inherits from virAbstractConnectPtr and thus trivially supports error reporting. There's pkg-config file added and spec-file adjusted as well. Since the library should be "minimalistic" and not depend on any other library, the list of files is especially crafted for it. Most of them could've been put to it's own sub-libraries that would be LIBADD'd to libvirt_util, libvirt_net_rpc and libvirt_setuid_rpc_client to minimize the number of object files being built, but that's a refactoring that isn't the orginal aim of this commit. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
@@ -41,6 +41,8 @@ extern virClassPtr virStreamClass;
|
||||
extern virClassPtr virStorageVolClass;
|
||||
extern virClassPtr virStoragePoolClass;
|
||||
|
||||
extern virClassPtr virAdmConnectClass;
|
||||
|
||||
# define virCheckConnectReturn(obj, retval) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virConnectClass)) { \
|
||||
@@ -295,6 +297,26 @@ extern virClassPtr virStoragePoolClass;
|
||||
dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
# define virCheckAdmConnectReturn(obj, retval) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
virDispatchError(NULL); \
|
||||
return retval; \
|
||||
} \
|
||||
} while (0)
|
||||
# define virCheckAdmConnectGoto(obj, label) \
|
||||
do { \
|
||||
if (!virObjectIsClass(obj, virAdmConnectClass)) { \
|
||||
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
||||
__FILE__, __FUNCTION__, __LINE__, \
|
||||
__FUNCTION__); \
|
||||
goto label; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* VIR_DOMAIN_DEBUG:
|
||||
* @dom: domain
|
||||
@@ -368,6 +390,19 @@ struct _virConnect {
|
||||
virConnectCloseCallbackDataPtr closeCallback;
|
||||
};
|
||||
|
||||
/**
|
||||
* _virAdmConnect:
|
||||
*
|
||||
* Internal structure associated to an admin connection
|
||||
*/
|
||||
struct _virAdmConnect {
|
||||
virObjectLockable object;
|
||||
|
||||
void *privateData;
|
||||
virFreeCallback privateDataFreeFunc;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* _virDomain:
|
||||
*
|
||||
@@ -549,4 +584,6 @@ virNWFilterPtr virGetNWFilter(virConnectPtr conn,
|
||||
virDomainSnapshotPtr virGetDomainSnapshot(virDomainPtr domain,
|
||||
const char *name);
|
||||
|
||||
virAdmConnectPtr virAdmConnectNew(void);
|
||||
|
||||
#endif /* __VIR_DATATYPES_H__ */
|
||||
|
||||
Reference in New Issue
Block a user