diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-09 21:29:10 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-09 21:29:10 +0100 |
commit | 25517fd2f2a26162a466a0933cb56c49373fbae7 (patch) | |
tree | cc33fda73a2b22c572c17966c690303c1e2ccaa2 /tools/xenstore/xenstore_client.c | |
parent | f2b39d8ae1082e6d2f364e5dab146d2396094cac (diff) | |
download | xen-25517fd2f2a26162a466a0933cb56c49373fbae7.tar.gz xen-25517fd2f2a26162a466a0933cb56c49373fbae7.tar.bz2 xen-25517fd2f2a26162a466a0933cb56c49373fbae7.zip |
Extend xenbus/xenstore client interface to include a transaction
handle on appropriate operations. Next step is to plug this
through to the store daemon and get rid of the nasty serialisation
mutex for 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 | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c index ef428f9acb..5370d43e99 100644 --- a/tools/xenstore/xenstore_client.c +++ b/tools/xenstore/xenstore_client.c @@ -32,6 +32,7 @@ int main(int argc, char **argv) { struct xs_handle *xsh; + struct xs_transaction_handle *xth; bool success; int ret = 0; #if defined(CLIENT_read) || defined(CLIENT_list) @@ -84,13 +85,13 @@ main(int argc, char **argv) #endif again: - success = xs_transaction_start(xsh); - if (!success) + xth = xs_transaction_start(xsh); + if (xth == NULL) errx(1, "couldn't start transaction"); while (optind < argc) { #if defined(CLIENT_read) - char *val = xs_read(xsh, argv[optind], NULL); + char *val = xs_read(xsh, xth, argv[optind], NULL); if (val == NULL) { warnx("couldn't read path %s", argv[optind]); ret = 1; @@ -102,7 +103,7 @@ main(int argc, char **argv) free(val); optind++; #elif defined(CLIENT_write) - success = xs_write(xsh, argv[optind], argv[optind + 1], + success = xs_write(xsh, xth, argv[optind], argv[optind + 1], strlen(argv[optind + 1])); if (!success) { warnx("could not write path %s", argv[optind]); @@ -111,7 +112,7 @@ main(int argc, char **argv) } optind += 2; #elif defined(CLIENT_rm) - success = xs_rm(xsh, argv[optind]); + success = xs_rm(xsh, xth, argv[optind]); if (!success) { warnx("could not remove path %s", argv[optind]); ret = 1; @@ -119,7 +120,7 @@ main(int argc, char **argv) } optind++; #elif defined(CLIENT_exists) - char *val = xs_read(xsh, argv[optind], NULL); + char *val = xs_read(xsh, xth, argv[optind], NULL); if (val == NULL) { ret = 1; goto out; @@ -128,7 +129,7 @@ main(int argc, char **argv) optind++; #elif defined(CLIENT_list) unsigned int i, num; - char **list = xs_directory(xsh, argv[optind], &num); + char **list = xs_directory(xsh, xth, argv[optind], &num); if (list == NULL) { warnx("could not list path %s", argv[optind]); ret = 1; @@ -145,7 +146,7 @@ main(int argc, char **argv) } out: - success = xs_transaction_end(xsh, ret ? true : false); + success = xs_transaction_end(xsh, xth, ret ? true : false); if (!success) { if (ret == 0 && errno == EAGAIN) goto again; |