1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

Introduce annotations for virQEMUDriverPtr fields

Annotate the fields in virQEMUDriverPtr to indicate the locking
rules for their use

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-01-16 13:24:55 +00:00
parent 011cf7ad10
commit 34589575bd

View File

@ -154,45 +154,67 @@ struct _virQEMUDriverConfig {
struct _virQEMUDriver { struct _virQEMUDriver {
virMutex lock; virMutex lock;
/* Require lock to get reference on 'config',
* then lockless thereafter */
virQEMUDriverConfigPtr config; virQEMUDriverConfigPtr config;
/* Immutable pointer, self-locking APIs */
virThreadPoolPtr workerPool; virThreadPoolPtr workerPool;
/* Atomic increment only */
int nextvmid; int nextvmid;
/* Immutable pointer. Unsafe APIs XXX */
virCgroupPtr cgroup; virCgroupPtr cgroup;
/* Atomic inc/dec only */
size_t nactive; size_t nactive;
/* Immutable pointers. Caller must provide locking */
virStateInhibitCallback inhibitCallback; virStateInhibitCallback inhibitCallback;
void *inhibitOpaque; void *inhibitOpaque;
/* Immutable pointer, self-locking APIs */
virDomainObjListPtr domains; virDomainObjListPtr domains;
/* Lazy-load on first use. Unsafe. XXX */
char *qemuImgBinary; char *qemuImgBinary;
/* Immutable pointer, lockless APIs. Pointless abstraction */
ebtablesContext *ebtables; ebtablesContext *ebtables;
/* Require lock while using. Unsafe. XXX */
virCapsPtr caps; virCapsPtr caps;
/* Immutable pointer, self-locking APIs */
qemuCapsCachePtr capsCache; qemuCapsCachePtr capsCache;
/* Immutable pointer, self-locking APIs */
virDomainEventStatePtr domainEventState; virDomainEventStatePtr domainEventState;
/* Immutable pointer. Unsafe APIs. XXX */
virSecurityManagerPtr securityManager; virSecurityManagerPtr securityManager;
/* Immutable pointers. Requires locks to be held before
* calling APIs. activePciHostdevs must be locked before
* inactivePciHostdevs */
virPCIDeviceListPtr activePciHostdevs; virPCIDeviceListPtr activePciHostdevs;
virPCIDeviceListPtr inactivePciHostdevs; virPCIDeviceListPtr inactivePciHostdevs;
virUSBDeviceListPtr activeUsbHostdevs; virUSBDeviceListPtr activeUsbHostdevs;
/* Immutable pointer. Unsafe APIs. XXX */
virHashTablePtr sharedDisks; virHashTablePtr sharedDisks;
/* Immutable pointer, self-locking APIs */
virPortAllocatorPtr remotePorts; virPortAllocatorPtr remotePorts;
/* Immutable pointer, lockless APIs*/
virSysinfoDefPtr hostsysinfo; virSysinfoDefPtr hostsysinfo;
/* Immutable pointer. XXX check safety */
virLockManagerPluginPtr lockManager; virLockManagerPluginPtr lockManager;
/* Immutable pointer. Unsafe APIs. XXX */
virHashTablePtr closeCallbacks; virHashTablePtr closeCallbacks;
}; };