g_autoptr, g_auto on an object whose cleanup function
is declared with the libvirt macros and vice-verca.
</dd>
+
+ <dt>VIR_AUTOUNREF</dt>
+ <dd>The GLib macros g_autoptr and G_DEFINE_AUTOPTR_CLEANUP_FUNC
+ should be used to manage autoclean of virObject classes.
+ This matches usage with GObject classes.</dd>
</dl>
<h2><a id="file_handling">File handling</a></h2>
virCapsStoragePoolPtr *pools;
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCaps, virObjectUnref);
+
+
struct _virCapsDomainData {
int ostype;
int arch;
/* add new domain features here */
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainCaps, virObjectUnref);
+
+
virDomainCapsPtr virDomainCapsNew(const char *path,
const char *machine,
virArch arch,
* restore will be required later */
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainObj, virObjectUnref);
+
+
typedef bool (*virDomainObjListACLFilter)(virConnectPtr conn,
virDomainDefPtr def);
virObjectPtr cookie;
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainSnapshotDef, virObjectUnref);
+
+
typedef enum {
VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE = 1 << 0,
VIR_DOMAIN_SNAPSHOT_PARSE_DISKS = 1 << 1,
virCapsPtr driverCaps;
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStoragePoolCaps, virObjectUnref);
+
+
virStoragePoolCapsPtr
virStoragePoolCapsNew(virCapsPtr driverCaps);
void *userData; /* the user data */
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virConnect, virObjectUnref);
+
+
/**
* _virAdmConnect:
*
unsigned char uuid[VIR_UUID_BUFLEN]; /* the network unique identifier */
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetwork, virObjectUnref);
+
+
/**
* _virNetworkPort:
*
unsigned char uuid[VIR_UUID_BUFLEN]; /* the network unique identifier */
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetworkPort, virObjectUnref);
+
+
/**
* _virInterface:
*
virFreeCallback privateDataFreeFunc;
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStoragePool, virObjectUnref);
+
+
/**
* _virStorageVol:
*
virFreeCallback privateDataFreeFunc;
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStorageVol, virObjectUnref);
+
+
/**
* _virNodeDevice:
*
size_t nfirmwares;
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(libxlDriverConfig, virObjectUnref);
+
struct _libxlDriverPrivate {
virMutex lock;
bool invalidData; /* the job data (except name) is not valid */
bool reconnected; /* internal field for tracking whether job is live after reconnect to qemu */
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuBlockJobData, virObjectUnref);
int
qemuBlockJobRegister(qemuBlockJobDataPtr job,
typedef struct _virQEMUCaps virQEMUCaps;
typedef virQEMUCaps *virQEMUCapsPtr;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUCaps, virObjectUnref);
+
virQEMUCapsPtr virQEMUCapsNew(void);
void virQEMUCapsSet(virQEMUCapsPtr qemuCaps,
char **capabilityfilters;
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDriverConfig, virObjectUnref);
+
+
/* Main driver state */
struct _virQEMUDriver {
virMutex lock;
virMediatedDeviceListPtr activeMediatedHostdevs;
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virHostdevManager, virObjectUnref);
+
+
virHostdevManagerPtr virHostdevManagerGetDefault(void);
int
virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
typedef struct _virIdentity virIdentity;
typedef virIdentity *virIdentityPtr;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virIdentity, virObjectUnref);
+
virIdentityPtr virIdentityGetCurrent(void);
int virIdentitySetCurrent(virIdentityPtr ident);
typedef struct _virMediatedDeviceList virMediatedDeviceList;
typedef virMediatedDeviceList *virMediatedDeviceListPtr;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virMediatedDeviceList, virObjectUnref);
+
+
typedef struct _virMediatedDeviceType virMediatedDeviceType;
typedef virMediatedDeviceType *virMediatedDeviceTypePtr;
struct _virMediatedDeviceType {
* VIR_AUTOUNREF:
* @type: type of an virObject subclass to be unref'd automatically
*
+ * DEPRECATED: Use g_autoptr(type) instead
+ *
* Declares a variable of @type which will be automatically unref'd when
* control goes out of the scope.
*/
#define VIR_AUTOUNREF(type) \
__attribute__((cleanup(virObjectAutoUnref))) type
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virObject, virObjectUnref);
+
void *
virObjectRef(void *obj);
typedef struct _virPCIDeviceList virPCIDeviceList;
typedef virPCIDeviceList *virPCIDeviceListPtr;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virPCIDeviceList, virObjectUnref);
+
+
#define VIR_DOMAIN_DEVICE_ZPCI_MAX_UID UINT16_MAX
#define VIR_DOMAIN_DEVICE_ZPCI_MAX_FID UINT32_MAX
#include "internal.h"
+#include "virobject.h"
#include "virbitmap.h"
#include "virutil.h"
#include "virenum.h"
typedef struct _virResctrlAlloc virResctrlAlloc;
typedef virResctrlAlloc *virResctrlAllocPtr;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virResctrlAlloc, virObjectUnref);
+
+
typedef int virResctrlAllocForeachCacheCallback(unsigned int level,
virCacheType type,
unsigned int cache,
typedef struct _virSCSIDeviceList virSCSIDeviceList;
typedef virSCSIDeviceList *virSCSIDeviceListPtr;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSCSIDeviceList, virObjectUnref);
+
+
char *virSCSIDeviceGetSgName(const char *sysfs_prefix,
const char *adapter,
unsigned int bus,
typedef struct _virSCSIVHostDeviceList virSCSIVHostDeviceList;
typedef virSCSIVHostDeviceList *virSCSIVHostDeviceListPtr;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSCSIVHostDeviceList, virObjectUnref);
+
+
typedef int (*virSCSIVHostDeviceFileActor)(virSCSIVHostDevicePtr dev,
const char *name, void *opaque);
bool hostcdrom; /* backing device is a cdrom */
};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStorageSource, virObjectUnref);
+
#ifndef DEV_BSIZE
# define DEV_BSIZE 512
typedef struct _virUSBDeviceList virUSBDeviceList;
typedef virUSBDeviceList *virUSBDeviceListPtr;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(virUSBDeviceList, virObjectUnref);
+
+
virUSBDevicePtr virUSBDeviceNew(unsigned int bus,
unsigned int devno,
const char *vroot);