2008-11-04 23:22:06 +00:00
|
|
|
/*
|
|
|
|
* datatypes.h: management of structs for public data types
|
|
|
|
*
|
2015-04-09 07:43:53 +00:00
|
|
|
* Copyright (C) 2006-2015 Red Hat, Inc.
|
2008-11-04 23:22:06 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2008-11-04 23:22:06 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
#ifndef __VIR_DATATYPES_H_
|
|
|
|
# define __VIR_DATATYPES_H_
|
2008-11-04 23:22:06 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
2008-11-04 23:22:06 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "driver.h"
|
2012-12-13 15:49:48 +00:00
|
|
|
# include "virthread.h"
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
# include "virobject.h"
|
2014-10-22 15:29:09 +00:00
|
|
|
# include "viruuid.h"
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
|
|
|
extern virClassPtr virConnectClass;
|
|
|
|
extern virClassPtr virDomainClass;
|
|
|
|
extern virClassPtr virDomainSnapshotClass;
|
|
|
|
extern virClassPtr virInterfaceClass;
|
|
|
|
extern virClassPtr virNetworkClass;
|
|
|
|
extern virClassPtr virNodeDeviceClass;
|
|
|
|
extern virClassPtr virNWFilterClass;
|
|
|
|
extern virClassPtr virSecretClass;
|
|
|
|
extern virClassPtr virStreamClass;
|
|
|
|
extern virClassPtr virStorageVolClass;
|
|
|
|
extern virClassPtr virStoragePoolClass;
|
|
|
|
|
2013-12-28 03:31:17 +00:00
|
|
|
# define virCheckConnectReturn(obj, retval) \
|
|
|
|
do { \
|
2013-12-27 17:28:36 +00:00
|
|
|
if (!virObjectIsClass(obj, virConnectClass)) { \
|
2013-12-28 03:31:17 +00:00
|
|
|
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
# define virCheckConnectGoto(obj, label) \
|
|
|
|
do { \
|
2013-12-27 17:28:36 +00:00
|
|
|
if (!virObjectIsClass(obj, virConnectClass)) { \
|
2013-12-28 03:31:17 +00:00
|
|
|
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
goto label; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
2014-01-07 21:38:12 +00:00
|
|
|
# define virCheckDomainReturn(obj, retval) \
|
|
|
|
do { \
|
|
|
|
virDomainPtr _dom = (obj); \
|
|
|
|
if (!virObjectIsClass(_dom, virDomainClass) || \
|
|
|
|
!virObjectIsClass(_dom->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_DOM, VIR_ERR_INVALID_DOMAIN, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
# define virCheckDomainGoto(obj, label) \
|
|
|
|
do { \
|
|
|
|
virDomainPtr _dom = (obj); \
|
|
|
|
if (!virObjectIsClass(_dom, virDomainClass) || \
|
|
|
|
!virObjectIsClass(_dom->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_DOM, VIR_ERR_INVALID_DOMAIN, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
goto label; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
2013-12-27 23:52:40 +00:00
|
|
|
# define virCheckNetworkReturn(obj, retval) \
|
|
|
|
do { \
|
|
|
|
virNetworkPtr _net = (obj); \
|
|
|
|
if (!virObjectIsClass(_net, virNetworkClass) || \
|
|
|
|
!virObjectIsClass(_net->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_NETWORK, \
|
|
|
|
VIR_ERR_INVALID_NETWORK, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
# define virCheckNetworkGoto(obj, label) \
|
|
|
|
do { \
|
|
|
|
virNetworkPtr _net = (obj); \
|
|
|
|
if (!virObjectIsClass(_net, virNetworkClass) || \
|
|
|
|
!virObjectIsClass(_net->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_NETWORK, \
|
|
|
|
VIR_ERR_INVALID_NETWORK, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
goto label; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
2013-12-28 01:08:16 +00:00
|
|
|
# define virCheckInterfaceReturn(obj, retval) \
|
|
|
|
do { \
|
|
|
|
virInterfacePtr _iface = (obj); \
|
|
|
|
if (!virObjectIsClass(_iface, virInterfaceClass) || \
|
|
|
|
!virObjectIsClass(_iface->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_INTERFACE, \
|
|
|
|
VIR_ERR_INVALID_INTERFACE, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
2013-12-28 01:12:05 +00:00
|
|
|
# define virCheckStoragePoolReturn(obj, retval) \
|
|
|
|
do { \
|
|
|
|
virStoragePoolPtr _pool = (obj); \
|
|
|
|
if (!virObjectIsClass(_pool, virStoragePoolClass) || \
|
|
|
|
!virObjectIsClass(_pool->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_STORAGE, \
|
|
|
|
VIR_ERR_INVALID_STORAGE_POOL, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
2013-12-28 01:12:05 +00:00
|
|
|
# define virCheckStorageVolReturn(obj, retval) \
|
|
|
|
do { \
|
|
|
|
virStorageVolPtr _vol = (obj); \
|
|
|
|
if (!virObjectIsClass(_vol, virStorageVolClass) || \
|
|
|
|
!virObjectIsClass(_vol->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_STORAGE, \
|
|
|
|
VIR_ERR_INVALID_STORAGE_VOL, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
# define virCheckStorageVolGoto(obj, label) \
|
|
|
|
do { \
|
|
|
|
virStorageVolPtr _vol = (obj); \
|
|
|
|
if (!virObjectIsClass(_vol, virStorageVolClass) || \
|
|
|
|
!virObjectIsClass(_vol->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_STORAGE, \
|
|
|
|
VIR_ERR_INVALID_STORAGE_VOL, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
goto label; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
2013-12-28 01:12:05 +00:00
|
|
|
# define virCheckNodeDeviceReturn(obj, retval) \
|
|
|
|
do { \
|
|
|
|
virNodeDevicePtr _node = (obj); \
|
|
|
|
if (!virObjectIsClass(_node, virNodeDeviceClass) || \
|
|
|
|
!virObjectIsClass(_node->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_NODEDEV, \
|
|
|
|
VIR_ERR_INVALID_NODE_DEVICE, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
2013-12-28 01:12:05 +00:00
|
|
|
# define virCheckSecretReturn(obj, retval) \
|
|
|
|
do { \
|
|
|
|
virSecretPtr _secret = (obj); \
|
|
|
|
if (!virObjectIsClass(_secret, virSecretClass) || \
|
|
|
|
!virObjectIsClass(_secret->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_SECRET, \
|
|
|
|
VIR_ERR_INVALID_SECRET, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
2013-12-28 01:12:05 +00:00
|
|
|
# define virCheckStreamReturn(obj, retval) \
|
|
|
|
do { \
|
|
|
|
virStreamPtr _st = (obj); \
|
|
|
|
if (!virObjectIsClass(_st, virStreamClass) || \
|
|
|
|
!virObjectIsClass(_st->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_STREAMS, \
|
|
|
|
VIR_ERR_INVALID_STREAM, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
# define virCheckStreamGoto(obj, label) \
|
|
|
|
do { \
|
|
|
|
virStreamPtr _st = (obj); \
|
|
|
|
if (!virObjectIsClass(_st, virStreamClass) || \
|
|
|
|
!virObjectIsClass(_st->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_STREAMS, \
|
|
|
|
VIR_ERR_INVALID_STREAM, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
goto label; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
2013-12-28 01:12:05 +00:00
|
|
|
# define virCheckNWFilterReturn(obj, retval) \
|
|
|
|
do { \
|
|
|
|
virNWFilterPtr _nw = (obj); \
|
|
|
|
if (!virObjectIsClass(_nw, virNWFilterClass) || \
|
|
|
|
!virObjectIsClass(_nw->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_NWFILTER, \
|
|
|
|
VIR_ERR_INVALID_NWFILTER, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
|
2013-12-28 01:12:05 +00:00
|
|
|
# define virCheckDomainSnapshotReturn(obj, retval) \
|
|
|
|
do { \
|
|
|
|
virDomainSnapshotPtr _snap = (obj); \
|
|
|
|
if (!virObjectIsClass(_snap, virDomainSnapshotClass) || \
|
|
|
|
!virObjectIsClass(_snap->domain, virDomainClass) || \
|
|
|
|
!virObjectIsClass(_snap->domain->conn, virConnectClass)) { \
|
|
|
|
virReportErrorHelper(VIR_FROM_DOMAIN_SNAPSHOT, \
|
|
|
|
VIR_ERR_INVALID_DOMAIN_SNAPSHOT, \
|
|
|
|
__FILE__, __FUNCTION__, __LINE__, \
|
|
|
|
__FUNCTION__); \
|
|
|
|
virDispatchError(NULL); \
|
|
|
|
return retval; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2010-03-25 17:46:02 +00:00
|
|
|
|
2013-03-29 17:21:19 +00:00
|
|
|
|
2013-12-19 22:43:46 +00:00
|
|
|
/* Helper macros to implement VIR_DOMAIN_DEBUG using just C99. This
|
|
|
|
* assumes you pass fewer than 15 arguments to VIR_DOMAIN_DEBUG, but
|
|
|
|
* can easily be expanded if needed.
|
|
|
|
*
|
|
|
|
* Note that gcc provides extensions of "define a(b...) b" or
|
|
|
|
* "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)
|
|
|
|
|
|
|
|
/* 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, ...) \
|
|
|
|
VIR_DOMAIN_DEBUG_PASTE(a, b, __VA_ARGS__)
|
|
|
|
# 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) \
|
|
|
|
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, ...) \
|
|
|
|
VIR_DOMAIN_DEBUG_2(dom, ", " fmt, __VA_ARGS__)
|
|
|
|
|
|
|
|
/* Internal use only, with final format. */
|
|
|
|
# define VIR_DOMAIN_DEBUG_2(dom, fmt, ...) \
|
|
|
|
do { \
|
|
|
|
char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
|
|
|
|
const char *_domname = NULL; \
|
|
|
|
\
|
2013-12-27 23:08:16 +00:00
|
|
|
if (!virObjectIsClass(dom, virDomainClass)) { \
|
2013-12-19 22:43:46 +00:00
|
|
|
memset(_uuidstr, 0, sizeof(_uuidstr)); \
|
|
|
|
} else { \
|
|
|
|
virUUIDFormat((dom)->uuid, _uuidstr); \
|
|
|
|
_domname = (dom)->name; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
VIR_DEBUG("dom=%p, (VM: name=%s, uuid=%s)" fmt, \
|
|
|
|
dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* VIR_DOMAIN_DEBUG:
|
|
|
|
* @dom: domain
|
|
|
|
* @fmt: optional format for additional information
|
|
|
|
* @...: optional arguments corresponding to @fmt.
|
|
|
|
*/
|
|
|
|
# define VIR_DOMAIN_DEBUG(...) \
|
|
|
|
VIR_DOMAIN_DEBUG_EXPAND(VIR_DOMAIN_DEBUG_, \
|
|
|
|
VIR_HAS_COMMA(__VA_ARGS__), \
|
|
|
|
__VA_ARGS__)
|
|
|
|
|
|
|
|
|
2013-03-29 17:21:19 +00:00
|
|
|
typedef struct _virConnectCloseCallbackData virConnectCloseCallbackData;
|
|
|
|
typedef virConnectCloseCallbackData *virConnectCloseCallbackDataPtr;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal structure holding data related to connection close callbacks.
|
|
|
|
*/
|
|
|
|
struct _virConnectCloseCallbackData {
|
|
|
|
virObjectLockable parent;
|
|
|
|
|
|
|
|
virConnectPtr conn;
|
|
|
|
virConnectCloseFunc callback;
|
|
|
|
void *opaque;
|
|
|
|
virFreeCallback freeCallback;
|
|
|
|
};
|
|
|
|
|
2008-11-04 23:22:06 +00:00
|
|
|
/**
|
|
|
|
* _virConnect:
|
|
|
|
*
|
|
|
|
* Internal structure associated to a connection
|
|
|
|
*/
|
|
|
|
struct _virConnect {
|
2015-04-09 07:43:53 +00:00
|
|
|
virObjectLockable object;
|
|
|
|
|
|
|
|
/* All the variables from here, until declared otherwise in one of
|
|
|
|
* the following comments, are setup at time of connection open
|
|
|
|
* and never changed since. Thus no need to lock when accessing
|
|
|
|
* them.
|
2009-01-20 12:01:45 +00:00
|
|
|
*/
|
2011-07-07 23:29:42 +00:00
|
|
|
unsigned int flags; /* a set of connection flags */
|
2012-02-24 18:48:55 +00:00
|
|
|
virURIPtr uri; /* connection URI */
|
2008-11-04 23:22:06 +00:00
|
|
|
|
|
|
|
/* The underlying hypervisor driver and network driver. */
|
2014-10-16 09:25:59 +00:00
|
|
|
virHypervisorDriverPtr driver;
|
2008-11-04 23:22:06 +00:00
|
|
|
virNetworkDriverPtr networkDriver;
|
2009-05-20 14:26:49 +00:00
|
|
|
virInterfaceDriverPtr interfaceDriver;
|
2008-11-04 23:22:06 +00:00
|
|
|
virStorageDriverPtr storageDriver;
|
2014-10-16 09:25:59 +00:00
|
|
|
virNodeDeviceDriverPtr nodeDeviceDriver;
|
2009-08-14 19:42:19 +00:00
|
|
|
virSecretDriverPtr secretDriver;
|
2010-03-25 17:46:02 +00:00
|
|
|
virNWFilterDriverPtr nwfilterDriver;
|
2008-11-04 23:22:06 +00:00
|
|
|
|
|
|
|
/* Private data pointer which can be used by driver and
|
|
|
|
* network driver as they wish.
|
|
|
|
* NB: 'private' is a reserved word in C++.
|
|
|
|
*/
|
|
|
|
void * privateData;
|
|
|
|
|
|
|
|
/*
|
2015-04-09 07:43:53 +00:00
|
|
|
* Object lock must be acquired before accessing/changing any of
|
|
|
|
* members following this point, or changing the ref count of any
|
|
|
|
* virDomain/virNetwork object associated with this connection.
|
2008-11-04 23:22:06 +00:00
|
|
|
*/
|
2009-01-20 12:01:45 +00:00
|
|
|
|
|
|
|
/* Per-connection error. */
|
|
|
|
virError err; /* the last error */
|
|
|
|
virErrorFunc handler; /* associated handlet */
|
|
|
|
void *userData; /* the user data */
|
|
|
|
|
2012-07-19 10:01:07 +00:00
|
|
|
/* Per-connection close callback */
|
2013-03-29 17:21:19 +00:00
|
|
|
virConnectCloseCallbackDataPtr closeCallback;
|
2008-11-04 23:22:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* _virDomain:
|
|
|
|
*
|
|
|
|
* Internal structure associated to a domain
|
|
|
|
*/
|
|
|
|
struct _virDomain {
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
virObject object;
|
2008-11-04 23:22:06 +00:00
|
|
|
virConnectPtr conn; /* pointer back to the connection */
|
|
|
|
char *name; /* the domain external name */
|
|
|
|
int id; /* the domain ID */
|
|
|
|
unsigned char uuid[VIR_UUID_BUFLEN]; /* the domain unique identifier */
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* _virNetwork:
|
|
|
|
*
|
|
|
|
* Internal structure associated to a domain
|
|
|
|
*/
|
|
|
|
struct _virNetwork {
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
virObject object;
|
2008-11-04 23:22:06 +00:00
|
|
|
virConnectPtr conn; /* pointer back to the connection */
|
|
|
|
char *name; /* the network external name */
|
|
|
|
unsigned char uuid[VIR_UUID_BUFLEN]; /* the network unique identifier */
|
|
|
|
};
|
|
|
|
|
2009-05-20 14:26:49 +00:00
|
|
|
/**
|
|
|
|
* _virInterface:
|
|
|
|
*
|
|
|
|
* Internal structure associated to a physical host interface
|
|
|
|
*/
|
|
|
|
struct _virInterface {
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
virObject object;
|
2009-05-20 14:26:49 +00:00
|
|
|
virConnectPtr conn; /* pointer back to the connection */
|
|
|
|
char *name; /* the network external name */
|
|
|
|
char *mac; /* the interface MAC address */
|
|
|
|
};
|
|
|
|
|
2008-11-04 23:22:06 +00:00
|
|
|
/**
|
|
|
|
* _virStoragePool:
|
|
|
|
*
|
|
|
|
* Internal structure associated to a storage pool
|
|
|
|
*/
|
|
|
|
struct _virStoragePool {
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
virObject object;
|
2008-11-04 23:22:06 +00:00
|
|
|
virConnectPtr conn; /* pointer back to the connection */
|
|
|
|
char *name; /* the storage pool external name */
|
|
|
|
unsigned char uuid[VIR_UUID_BUFLEN]; /* the storage pool unique identifier */
|
2012-11-10 07:18:07 +00:00
|
|
|
|
|
|
|
/* Private data pointer which can be used by driver as they wish.
|
|
|
|
* Cleanup function pointer can be hooked to provide custom cleanup
|
|
|
|
* operation.
|
|
|
|
*/
|
|
|
|
void *privateData;
|
|
|
|
virFreeCallback privateDataFreeFunc;
|
2008-11-04 23:22:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* _virStorageVol:
|
|
|
|
*
|
|
|
|
* Internal structure associated to a storage volume
|
|
|
|
*/
|
|
|
|
struct _virStorageVol {
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
virObject object;
|
2008-11-04 23:22:06 +00:00
|
|
|
virConnectPtr conn; /* pointer back to the connection */
|
|
|
|
char *pool; /* Pool name of owner */
|
|
|
|
char *name; /* the storage vol external name */
|
2011-06-22 19:51:32 +00:00
|
|
|
char *key; /* unique key for storage vol */
|
2012-11-10 07:18:07 +00:00
|
|
|
|
|
|
|
/* Private data pointer which can be used by driver as they wish.
|
|
|
|
* Cleanup function pointer can be hooked to provide custom cleanup
|
|
|
|
* operation.
|
|
|
|
*/
|
|
|
|
void *privateData;
|
|
|
|
virFreeCallback privateDataFreeFunc;
|
2008-11-04 23:22:06 +00:00
|
|
|
};
|
|
|
|
|
2008-11-21 12:19:22 +00:00
|
|
|
/**
|
|
|
|
* _virNodeDevice:
|
|
|
|
*
|
|
|
|
* Internal structure associated with a node device
|
|
|
|
*/
|
|
|
|
struct _virNodeDevice {
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
virObject object;
|
2008-11-21 12:19:22 +00:00
|
|
|
virConnectPtr conn; /* pointer back to the connection */
|
|
|
|
char *name; /* device name (unique on node) */
|
2008-12-04 21:46:34 +00:00
|
|
|
char *parent; /* parent device name */
|
2008-11-21 12:19:22 +00:00
|
|
|
};
|
|
|
|
|
2009-08-14 19:42:19 +00:00
|
|
|
/**
|
|
|
|
* _virSecret:
|
|
|
|
*
|
|
|
|
* Internal structure associated with a secret
|
|
|
|
*/
|
|
|
|
struct _virSecret {
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
virObject object;
|
2009-08-14 19:42:19 +00:00
|
|
|
virConnectPtr conn; /* pointer back to the connection */
|
2014-04-29 02:10:19 +00:00
|
|
|
unsigned char uuid[VIR_UUID_BUFLEN]; /* the secret unique identifier */
|
Add usage type/id as a public API property of virSecret
* include/libvirt/libvirt.h, include/libvirt/libvirt.h.in: Add
virSecretGetUsageType, virSecretGetUsageID and virLookupSecretByUsage
* python/generator.py: Mark virSecretGetUsageType, virSecretGetUsageID
as not throwing exceptions
* qemud/remote.c: Implement dispatch for virLookupSecretByUsage
* qemud/remote_protocol.x: Add usage type & ID as attributes of
remote_nonnull_secret. Add RPC calls for new public APIs
* qemud/remote_dispatch_args.h, qemud/remote_dispatch_prototypes.h,
qemud/remote_dispatch_ret.h, qemud/remote_dispatch_table.h,
qemud/remote_protocol.c, qemud/remote_protocol.h: Re-generate
* src/datatypes.c, src/datatypes.h: Add usageType and usageID as
properties of virSecretPtr
* src/driver.h: Add virLookupSecretByUsage driver entry point
* src/libvirt.c: Implement virSecretGetUsageType, virSecretGetUsageID
and virLookupSecretByUsage
* src/libvirt_public.syms: Export virSecretGetUsageType, virSecretGetUsageID
and virLookupSecretByUsage
* src/remote_internal.c: Implement virLookupSecretByUsage entry
* src/secret_conf.c, src/secret_conf.h: Remove the
virSecretUsageType enum, now in public API. Make volume
path mandatory when parsing XML
* src/secret_driver.c: Enforce usage uniqueness when defining secrets.
Implement virSecretLookupByUsage api method
* src/virsh.c: Include usage for secret-list command
2009-09-11 13:06:15 +00:00
|
|
|
int usageType; /* the type of usage */
|
|
|
|
char *usageID; /* the usage's unique identifier */
|
2009-08-14 19:42:19 +00:00
|
|
|
};
|
|
|
|
|
2008-11-21 12:19:22 +00:00
|
|
|
|
2009-07-10 11:18:12 +00:00
|
|
|
typedef int (*virStreamAbortFunc)(virStreamPtr, void *opaque);
|
|
|
|
typedef int (*virStreamFinishFunc)(virStreamPtr, void *opaque);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* _virStream:
|
|
|
|
*
|
|
|
|
* Internal structure associated with an input stream
|
|
|
|
*/
|
|
|
|
struct _virStream {
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
virObject object;
|
2009-07-10 11:18:12 +00:00
|
|
|
virConnectPtr conn;
|
2011-07-07 23:29:42 +00:00
|
|
|
unsigned int flags;
|
2009-07-10 11:18:12 +00:00
|
|
|
|
|
|
|
virStreamDriverPtr driver;
|
|
|
|
void *privateData;
|
|
|
|
};
|
|
|
|
|
2010-03-31 20:33:13 +00:00
|
|
|
/**
|
|
|
|
* _virDomainSnapshot
|
|
|
|
*
|
|
|
|
* Internal structure associated with a domain snapshot
|
|
|
|
*/
|
|
|
|
struct _virDomainSnapshot {
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
virObject object;
|
2010-03-31 20:33:13 +00:00
|
|
|
char *name;
|
|
|
|
virDomainPtr domain;
|
|
|
|
};
|
2009-07-10 11:18:12 +00:00
|
|
|
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
/**
|
|
|
|
* _virNWFilter:
|
|
|
|
*
|
|
|
|
* Internal structure associated to a network filter
|
|
|
|
*/
|
|
|
|
struct _virNWFilter {
|
|
|
|
virObject object;
|
|
|
|
virConnectPtr conn; /* pointer back to the connection */
|
|
|
|
char *name; /* the network filter external name */
|
|
|
|
unsigned char uuid[VIR_UUID_BUFLEN]; /* the network filter unique identifier */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Helper APIs for allocating new object instances
|
|
|
|
*/
|
2008-11-04 23:22:06 +00:00
|
|
|
|
|
|
|
virConnectPtr virGetConnect(void);
|
2008-11-17 11:03:25 +00:00
|
|
|
virDomainPtr virGetDomain(virConnectPtr conn,
|
2012-07-20 14:24:51 +00:00
|
|
|
const char *name,
|
|
|
|
const unsigned char *uuid);
|
2008-11-17 11:03:25 +00:00
|
|
|
virNetworkPtr virGetNetwork(virConnectPtr conn,
|
2012-07-20 14:24:51 +00:00
|
|
|
const char *name,
|
|
|
|
const unsigned char *uuid);
|
2009-05-20 14:26:49 +00:00
|
|
|
virInterfacePtr virGetInterface(virConnectPtr conn,
|
|
|
|
const char *name,
|
|
|
|
const char *mac);
|
2008-11-17 11:03:25 +00:00
|
|
|
virStoragePoolPtr virGetStoragePool(virConnectPtr conn,
|
2012-11-10 07:18:07 +00:00
|
|
|
const char *name,
|
|
|
|
const unsigned char *uuid,
|
|
|
|
void *privateData,
|
|
|
|
virFreeCallback freeFunc);
|
2008-11-17 11:03:25 +00:00
|
|
|
virStorageVolPtr virGetStorageVol(virConnectPtr conn,
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
const char *pool,
|
|
|
|
const char *name,
|
2012-11-10 07:18:07 +00:00
|
|
|
const char *key,
|
|
|
|
void *privateData,
|
|
|
|
virFreeCallback freeFunc);
|
2008-11-21 12:19:22 +00:00
|
|
|
virNodeDevicePtr virGetNodeDevice(virConnectPtr conn,
|
|
|
|
const char *name);
|
2009-08-14 19:42:19 +00:00
|
|
|
virSecretPtr virGetSecret(virConnectPtr conn,
|
Add usage type/id as a public API property of virSecret
* include/libvirt/libvirt.h, include/libvirt/libvirt.h.in: Add
virSecretGetUsageType, virSecretGetUsageID and virLookupSecretByUsage
* python/generator.py: Mark virSecretGetUsageType, virSecretGetUsageID
as not throwing exceptions
* qemud/remote.c: Implement dispatch for virLookupSecretByUsage
* qemud/remote_protocol.x: Add usage type & ID as attributes of
remote_nonnull_secret. Add RPC calls for new public APIs
* qemud/remote_dispatch_args.h, qemud/remote_dispatch_prototypes.h,
qemud/remote_dispatch_ret.h, qemud/remote_dispatch_table.h,
qemud/remote_protocol.c, qemud/remote_protocol.h: Re-generate
* src/datatypes.c, src/datatypes.h: Add usageType and usageID as
properties of virSecretPtr
* src/driver.h: Add virLookupSecretByUsage driver entry point
* src/libvirt.c: Implement virSecretGetUsageType, virSecretGetUsageID
and virLookupSecretByUsage
* src/libvirt_public.syms: Export virSecretGetUsageType, virSecretGetUsageID
and virLookupSecretByUsage
* src/remote_internal.c: Implement virLookupSecretByUsage entry
* src/secret_conf.c, src/secret_conf.h: Remove the
virSecretUsageType enum, now in public API. Make volume
path mandatory when parsing XML
* src/secret_driver.c: Enforce usage uniqueness when defining secrets.
Implement virSecretLookupByUsage api method
* src/virsh.c: Include usage for secret-list command
2009-09-11 13:06:15 +00:00
|
|
|
const unsigned char *uuid,
|
|
|
|
int usageType,
|
|
|
|
const char *usageID);
|
2009-07-10 11:18:12 +00:00
|
|
|
virStreamPtr virGetStream(virConnectPtr conn);
|
2010-03-25 17:46:02 +00:00
|
|
|
virNWFilterPtr virGetNWFilter(virConnectPtr conn,
|
2012-07-20 14:24:51 +00:00
|
|
|
const char *name,
|
|
|
|
const unsigned char *uuid);
|
2010-03-31 20:33:13 +00:00
|
|
|
virDomainSnapshotPtr virGetDomainSnapshot(virDomainPtr domain,
|
|
|
|
const char *name);
|
|
|
|
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-07-31 16:55:36 +00:00
|
|
|
#endif /* __VIR_DATATYPES_H__ */
|