WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add xenstore-list and xenstore-exists clients

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add xenstore-list and xenstore-exists clients
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 12 Sep 2005 21:12:11 +0000
Delivery-date: Mon, 12 Sep 2005 21:10:52 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 282d5698ea40f40dc09871f0c92dc691b10b7269
# Parent  d22091179975853b0438c937aaea239d92b83832
Add xenstore-list and xenstore-exists clients
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r d22091179975 -r 282d5698ea40 tools/xenstore/Makefile
--- a/tools/xenstore/Makefile   Mon Sep 12 20:24:58 2005
+++ b/tools/xenstore/Makefile   Mon Sep 12 20:46:37 2005
@@ -25,7 +25,8 @@
 TESTFLAGS= -DTESTING
 TESTENV  = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
 
-CLIENTS := xenstore-read xenstore-rm xenstore-write
+CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm
+CLIENTS += xenstore-write
 CLIENTS_OBJS := $(patsubst xenstore-%,xenstore_%.o,$(CLIENTS))
 
 all: libxenstore.so xenstored $(CLIENTS)
diff -r d22091179975 -r 282d5698ea40 tools/xenstore/xenstore_client.c
--- a/tools/xenstore/xenstore_client.c  Mon Sep 12 20:24:58 2005
+++ b/tools/xenstore/xenstore_client.c  Mon Sep 12 20:46:37 2005
@@ -22,7 +22,7 @@
     errx(1, "Usage: %s [-h] [-p] key [...]", progname);
 #elif defined(CLIENT_write)
     errx(1, "Usage: %s [-h] key value [...]", progname);
-#elif defined(CLIENT_rm)
+#elif defined(CLIENT_rm) || defined(CLIENT_exists) || defined(CLIENT_list)
     errx(1, "Usage: %s [-h] key [...]", progname);
 #endif
 }
@@ -33,8 +33,7 @@
     struct xs_handle *xsh;
     bool success;
     int ret = 0;
-#if defined(CLIENT_read)
-    char *val;
+#if defined(CLIENT_read) || defined(CLIENT_list)
     int prefix = 0;
 #endif
 
@@ -46,14 +45,14 @@
        int c, index = 0;
        static struct option long_options[] = {
            {"help", 0, 0, 'h'},
-#if defined(CLIENT_read)
+#if defined(CLIENT_read) || defined(CLIENT_list)
            {"prefix", 0, 0, 'p'},
 #endif
            {0, 0, 0, 0}
        };
 
        c = getopt_long(argc, argv, "h"
-#if defined(CLIENT_read)
+#if defined(CLIENT_read) || defined(CLIENT_list)
                        "p"
 #endif
                        , long_options, &index);
@@ -64,7 +63,7 @@
        case 'h':
            usage(argv[0]);
            /* NOTREACHED */
-#if defined(CLIENT_read)
+#if defined(CLIENT_read) || defined(CLIENT_list)
        case 'p':
            prefix = 1;
            break;
@@ -90,7 +89,7 @@
 
     while (optind < argc) {
 #if defined(CLIENT_read)
-       val = xs_read(xsh, argv[optind], NULL);
+       char *val = xs_read(xsh, argv[optind], NULL);
        if (val == NULL) {
            warnx("couldn't read path %s", argv[optind]);
            ret = 1;
@@ -118,6 +117,29 @@
            goto out;
        }
        optind++;
+#elif defined(CLIENT_exists)
+       char *val = xs_read(xsh, argv[optind], NULL);
+       if (val == NULL) {
+           ret = 1;
+           goto out;
+       }
+       free(val);
+       optind++;
+#elif defined(CLIENT_list)
+       unsigned int i, num;
+       char **list = xs_directory(xsh, argv[optind], &num);
+       if (list == NULL) {
+           warnx("could not list path %s", argv[optind]);
+           ret = 1;
+           goto out;
+       }
+       for (i = 0; i < num; i++) {
+           if (prefix)
+               printf("%s/", argv[optind]);
+           printf("%s\n", list[i]);
+       }
+       free(list);
+       optind++;
 #endif
     }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add xenstore-list and xenstore-exists clients, Xen patchbot -unstable <=