On Wed, Jul 17, 2013 at 03:04:21PM +0200, Michal Privoznik wrote:
Annotate the fields in virLXCDriverPtr to indicate the locking
rules for their use
---
src/lxc/lxc_conf.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h
index f9a3e53..831e3e5 100644
--- a/src/lxc/lxc_conf.h
+++ b/src/lxc/lxc_conf.h
@@ -67,29 +67,43 @@ struct _virLXCDriverConfig {
struct _virLXCDriver {
virMutex lock;
+ /* Require lock to get reference on 'config',
+ * then lockless thereafter */
virLXCDriverConfigPtr config;
+ /* Require lock while using. Unsafe. XXX */
virCapsPtr caps;
+ /* Immutable pointer. Unsafe APIs XXX */
virCgroupPtr cgroup;
Oh this field is completely unused & should have been deleted a
while back. Please just kill as a separate patch.
+ /* Immutable pointer, Immutable object */
virDomainXMLOptionPtr xmlopt;
+ /* Immutable pointer, lockless APIs*/
virSysinfoDefPtr hostsysinfo;
+ /* Atomic inc/dec only */
unsigned int nactive;
+ /* Immutable pointers. Caller must provide locking */
virStateInhibitCallback inhibitCallback;
void *inhibitOpaque;
+ /* Immutable pointer, self-locking APIs */
virDomainObjListPtr domains;
+ /* Immutable pointer. Requires lock to be held before
+ * calling APIs. */
virUSBDeviceListPtr activeUsbHostdevs;
+ /* Immutable pointer, self-locking APIs */
virDomainEventStatePtr domainEventState;
+ /* Immutable pointer. self-locking APIs */
virSecurityManagerPtr securityManager;
+ /* Immutable pointer. Unsafe APIs. XXX */
virHashTablePtr autodestroy;
};
ACK, all makes sense.
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|