diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2009-01-21 18:11:14 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2009-01-21 18:11:14 +0000 |
commit | e52d74e53614cd4f1b26a30b0c5e0cef4c082968 (patch) | |
tree | 83fbbaa22110ae63a77b8529faffccf6a66c8209 /src/xen_unified.h | |
parent | 20921cc28409b67774b59c8ed64dd52336950d87 (diff) | |
download | libvirt-e52d74e53614cd4f1b26a30b0c5e0cef4c082968.tar.gz |
Make xen driver threadsafe
Diffstat (limited to 'src/xen_unified.h')
-rw-r--r-- | src/xen_unified.h | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/xen_unified.h b/src/xen_unified.h index e949156fac..569c7babc8 100644 --- a/src/xen_unified.h +++ b/src/xen_unified.h @@ -131,6 +131,12 @@ typedef xenUnifiedDomainInfoList *xenUnifiedDomainInfoListPtr; * low-level drivers access parts of this structure. */ struct _xenUnifiedPrivate { + virMutex lock; + + /* These initial vars are initialized in Open method + * and readonly thereafter, so can be used without + * holding the lock + */ virCapsPtr caps; int handle; /* Xen hypervisor handle */ @@ -144,25 +150,36 @@ struct _xenUnifiedPrivate { struct sockaddr_un addr_un; /* the unix address */ struct sockaddr_in addr_in; /* the inet address */ - struct xs_handle *xshandle; /* handle to talk to the xenstore */ - - int proxy; /* fd of proxy. */ - /* Keep track of the drivers which opened. We keep a yes/no flag * here for each driver, corresponding to the array drivers in * xen_unified.c. */ int opened[XEN_UNIFIED_NR_DRIVERS]; + + /* + * Everything from this point onwards must be protected + * by the lock when used + */ + + struct xs_handle *xshandle; /* handle to talk to the xenstore */ + + int proxy; /* fd of proxy. */ + + /* A list of xenstore watches */ xenStoreWatchListPtr xsWatchList; int xsWatch; /* A list of active domain name/uuids */ xenUnifiedDomainInfoListPtr activeDomainList; + /* NUMA topology info cache */ + int nbNodeCells; + int nbNodeCpus; /* An list of callbacks */ virDomainEventCallbackListPtr domainEventCallbacks; + int domainEventDispatching; /* Location of config files, either /etc * or /var/lib/xen */ @@ -188,9 +205,6 @@ struct _xenUnifiedPrivate { typedef struct _xenUnifiedPrivate *xenUnifiedPrivatePtr; - -int xenNbCells(virConnectPtr conn); -int xenNbCpus(virConnectPtr conn); char *xenDomainUsedCpus(virDomainPtr dom); void xenUnifiedDomainInfoListFree(xenUnifiedDomainInfoListPtr info); @@ -204,4 +218,12 @@ void xenUnifiedDomainEventDispatch (xenUnifiedPrivatePtr priv, virDomainEventPtr event); unsigned long xenUnifiedVersion(void); +#ifndef PROXY +void xenUnifiedLock(xenUnifiedPrivatePtr priv); +void xenUnifiedUnlock(xenUnifiedPrivatePtr priv); +#else +#define xenUnifiedLock(p) do {} while(0) +#define xenUnifiedUnlock(p) do {} while(0) +#endif + #endif /* __VIR_XEN_UNIFIED_H__ */ |