diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-10 15:38:01 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-10 15:38:01 +0100 |
commit | bddd41366dca057dfbd5204193931f78dbd686a6 (patch) | |
tree | 38f078024a96ca8510ad90ff137966878dd05197 /tools/xenstore/xenstore_client.c | |
parent | 5910d2c4608435ea13a95f2955496a0cdb8d97a9 (diff) | |
download | xen-bddd41366dca057dfbd5204193931f78dbd686a6.tar.gz xen-bddd41366dca057dfbd5204193931f78dbd686a6.tar.bz2 xen-bddd41366dca057dfbd5204193931f78dbd686a6.zip |
xenstored now supports multiple concurrent transactions per
connection, plus interleaving of transactional and
non-transactional accesses. A transaction identifier is added
to the xsd_sockmsg header structure (0 means 'not in context
of a transaction'). The user and kernel xs interfaces accept
a pointer to a transaction handle where appropriate --
currently this is directly cast to an integer identifier in
the client library / kernel driver, but will allow for keeping
extra dynamic client-side state in future if we need to.
The transaction mutex has now gone. It's replaced with a
read-write mutex, but this is only acquired for exclusive
access during suspend/resume, to ensure there are no in-progress
transactions.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/xenstore/xenstore_client.c')
-rw-r--r-- | tools/xenstore/xenstore_client.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c index 5370d43e99..5f69da53c9 100644 --- a/tools/xenstore/xenstore_client.c +++ b/tools/xenstore/xenstore_client.c @@ -34,15 +34,11 @@ main(int argc, char **argv) struct xs_handle *xsh; struct xs_transaction_handle *xth; bool success; - int ret = 0; + int ret = 0, socket = 0; #if defined(CLIENT_read) || defined(CLIENT_list) int prefix = 0; #endif - xsh = xs_domain_open(); - if (xsh == NULL) - err(1, "xs_domain_open"); - while (1) { int c, index = 0; static struct option long_options[] = { @@ -50,10 +46,11 @@ main(int argc, char **argv) #if defined(CLIENT_read) || defined(CLIENT_list) {"prefix", 0, 0, 'p'}, #endif + {"socket", 0, 0, 's'}, {0, 0, 0, 0} }; - c = getopt_long(argc, argv, "h" + c = getopt_long(argc, argv, "hs" #if defined(CLIENT_read) || defined(CLIENT_list) "p" #endif @@ -65,6 +62,9 @@ main(int argc, char **argv) case 'h': usage(argv[0]); /* NOTREACHED */ + case 's': + socket = 1; + break; #if defined(CLIENT_read) || defined(CLIENT_list) case 'p': prefix = 1; @@ -84,6 +84,10 @@ main(int argc, char **argv) } #endif + xsh = socket ? xs_daemon_open() : xs_domain_open(); + if (xsh == NULL) + err(1, socket ? "xs_daemon_open" : "xs_domain_open"); + again: xth = xs_transaction_start(xsh); if (xth == NULL) |