]> xenbits.xensource.com Git - xen.git/commitdiff
nstore: rename public xenstore headers
authorIan Campbell <ian.campbell@citrix.com>
Mon, 14 May 2012 16:15:36 +0000 (17:15 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 14 May 2012 16:15:36 +0000 (17:15 +0100)
The xenstore header xs.h is producing conflicts with other software[1].

xs is a too short identifier and does not matche the library. Renaming
the headers to xenstore.h and xenstore_lib.h is the easiest way to make
them easy recognizable and prevent furthe problems.

[1]: http://bugs.debian.org/668550

[ Also update QEMU_TAG, to bring in corresponding change to
qemu-xen-traditional. -iwj ]

Signed-off-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
--HG--
rename : tools/xenstore/xs.h => tools/xenstore/xenstore.h
rename : tools/xenstore/xs_lib.h => tools/xenstore/xenstore_lib.h

43 files changed:
Config.mk
Makefile
extras/mini-os/lib/sys.c
extras/mini-os/lib/xs.c
tools/Makefile
tools/blktap/drivers/blktapctrl.c
tools/blktap/lib/blktaplib.h
tools/blktap/lib/xenbus.c
tools/blktap/lib/xs_api.c
tools/console/client/main.c
tools/console/daemon/io.c
tools/console/daemon/utils.h
tools/libvchan/init.c
tools/libxl/libxl_internal.h
tools/misc/xen-lowmemd.c
tools/python/xen/lowlevel/checkpoint/checkpoint.c
tools/python/xen/lowlevel/checkpoint/checkpoint.h
tools/python/xen/lowlevel/checkpoint/libcheckpoint.c
tools/python/xen/lowlevel/xs/xs.c
tools/tests/mce-test/tools/xen-mceinj.c
tools/xcutils/xc_save.c
tools/xenbackendd/xenbackendd.c
tools/xenpaging/xenpaging.c
tools/xenpmd/xenpmd.c
tools/xenstat/libxenstat/src/xenstat_priv.h
tools/xenstore/COPYING
tools/xenstore/Makefile
tools/xenstore/compat/xs.h [new file with mode: 0644]
tools/xenstore/compat/xs_lib.h [new file with mode: 0644]
tools/xenstore/init-xenstore-domain.c
tools/xenstore/xenstore.h [new file with mode: 0644]
tools/xenstore/xenstore_client.c
tools/xenstore/xenstore_control.c
tools/xenstore/xenstore_lib.h [new file with mode: 0644]
tools/xenstore/xenstored_core.c
tools/xenstore/xenstored_core.h
tools/xenstore/xenstored_transaction.c
tools/xenstore/xenstored_watch.c
tools/xenstore/xs.c
tools/xenstore/xs.h [deleted file]
tools/xenstore/xs_lib.c
tools/xenstore/xs_lib.h [deleted file]
tools/xenstore/xs_tdb_dump.c

index 24883134d7cdef7d73cb18aa5b898a989bfe4adf..7d4e0a34a98dd3b58c03840b9a90c29a2a7e1da0 100644 (file)
--- a/Config.mk
+++ b/Config.mk
@@ -213,9 +213,9 @@ ETHERBOOT_NICS ?= rtl8139 8086100e
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= b7469189669c4de0a5161a869f443738d84539ec
-# Fri May 11 12:40:42 2012 +0100
-# passthrough: Intel GPU passthrough, fix OpRegion mapping
+QEMU_TAG ?= 7bde54662d45b0bbc2ee78c7a8bf2c97c6655445
+# Mon May 14 17:05:48 2012 +0100
+# xenstore: Use <xenstore.h>
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.
index 67f61821f3783535fe89b99270761c283a18e5ea..79ebe1caa25300a9a32edab2af3f90cc2b47100e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -241,6 +241,8 @@ uninstall:
        rm -rf $(D)$(BINDIR)/xenpvnetboot $(D)$(BINDIR)/qemu-*-xen
        rm -rf $(D)$(INCLUDEDIR)/xenctrl* $(D)$(INCLUDEDIR)/xenguest.h
        rm -rf $(D)$(INCLUDEDIR)/xs_lib.h $(D)$(INCLUDEDIR)/xs.h
+       rm -rf $(D)$(INCLUDEDIR)/xenstore-compat/xs_lib.h $(D)$(INCLUDEDIR)/xensotre-compat/xs.h
+       rm -rf $(D)$(INCLUDEDIR)/xenstore_lib.h $(D)$(INCLUDEDIR)/xenstore.h
        rm -rf $(D)$(INCLUDEDIR)/xen
        rm -rf $(D)$(INCLUDEDIR)/_libxl* $(D)$(INCLUDEDIR)/libxl*
        rm -rf $(D)$(INCLUDEDIR)/xenstat.h $(D)$(INCLUDEDIR)/xentoollog.h
index 5875797f48690a7d607f29e086ca0a330e76e1ec..a7d35d689ef142d0a01502b5439fb628b5a38b19 100644 (file)
@@ -28,7 +28,7 @@
 #include <blkfront.h>
 #include <fbfront.h>
 #include <xenbus.h>
-#include <xs.h>
+#include <xenstore.h>
 
 #include <sys/types.h>
 #include <sys/unistd.h>
index 6eced7034770876ec8f1d0a298537af083b4d7e4..a2a122098cce7d42647c328283af021787f83f27 100644 (file)
@@ -9,7 +9,7 @@
 #ifdef HAVE_LIBC
 #include <os.h>
 #include <lib.h>
-#include <xs.h>
+#include <xenstore.h>
 #include <xenbus.h>
 #include <stdlib.h>
 #include <unistd.h>
index a74df2f276f248df7e835229e542390b22d944a8..7b146785eb022630c088e3ff8df89707d86dcb21 100644 (file)
@@ -150,7 +150,8 @@ subdir-all-qemu-xen-dir subdir-install-qemu-xen-dir: qemu-xen-dir-find
                --source-path=$$source \
                --extra-cflags="-I$(XEN_ROOT)/tools/include \
                -I$(XEN_ROOT)/tools/libxc \
-               -I$(XEN_ROOT)/tools/xenstore" \
+               -I$(XEN_ROOT)/tools/xenstore \
+               -I$(XEN_ROOT)/tools/xenstore/compat" \
                --extra-ldflags="-L$(XEN_ROOT)/tools/libxc \
                -L$(XEN_ROOT)/tools/xenstore" \
                --bindir=$(LIBEXEC) \
index 445d2a08636a817b235dbe140b3b58021f3191f5..0a8b8800e8a0613cbca4de851fe6f86340b4900d 100644 (file)
@@ -47,7 +47,7 @@
 #include <sys/ioctl.h>
 #include <string.h>
 #include <unistd.h>
-#include <xs.h>
+#include <xenstore.h>
 #include <sys/time.h>
 #include <syslog.h>
 #ifdef MEMSHR
index 47dcdff05b1d4457767a2243e1547895b21425f8..a80e518361eaafa1b9f53e75418f2512a024f029 100644 (file)
@@ -38,7 +38,7 @@
 #include <xen/xen.h>
 #include <xen/io/blkif.h>
 #include <xen/io/ring.h>
-#include <xs.h>
+#include <xenstore.h>
 #include <sys/types.h>
 #include <unistd.h>
 
index 53db3c8b29c9e5fada7729ed94d23b23d5fa45f9..948eb026645a9ef5e09dabaef889590e9abca1d7 100644 (file)
@@ -41,7 +41,7 @@
 #include <err.h>
 #include <stdarg.h>
 #include <errno.h>
-#include <xs.h>
+#include <xenstore.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
index 93d1cb91600a399e92f023d2f6b9c86d80fed7ac..464843239e7a6c37adc2d96a6ce91d428d9bf861 100644 (file)
@@ -38,7 +38,7 @@
 #include <err.h>
 #include <stdarg.h>
 #include <errno.h>
-#include <xs.h>
+#include <xenstore.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
index df3636fc209cb22b58239012c912dd7cd48edaa0..523fc23ed5baf1718cf0b731c06268b96c7be67c 100644 (file)
@@ -39,7 +39,7 @@
 #include <sys/stropts.h>
 #endif
 
-#include "xs.h"
+#include <xenstore.h>
 #include "xenctrl.h"
 
 #define ESCAPE_CHARACTER 0x1d
index b6d41de99cf6e8190c42bb138aac9e6886015b73..f09d63a304bdf1cd1d51bb55baa44fc679cbc4b8 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "utils.h"
 #include "io.h"
-#include <xs.h>
+#include <xenstore.h>
 #include <xen/io/console.h>
 
 #include <stdlib.h>
index 6743e5fdf6e053914ae04b10ca7823891bd85a4d..8725dcdafa8b4eb2528775a6a623ee98004587cf 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include <xenctrl.h>
 
-#include "xs.h"
+#include <xenstore.h>
 
 void daemonize(const char *pidfile);
 bool xen_setup(void);
index acaddd5b041d7c4c0ed801d6ab3fd423d79e2625..0c7cff6c578be4b074065c592b5435e781688e81 100644 (file)
@@ -40,7 +40,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include <xs.h>
+#include <xenstore.h>
 #include <xen/sys/evtchn.h>
 #include <xen/sys/gntalloc.h>
 #include <xen/sys/gntdev.h>
index f71e76a55b5f67f0590a0295842f42de4f9f9acf..b2fe8bb1011fd38fe3242708222259b6b8bce5d9 100644 (file)
@@ -44,7 +44,7 @@
 #include <sys/wait.h>
 #include <sys/socket.h>
 
-#include <xs.h>
+#include <xenstore.h>
 #include <xenctrl.h>
 
 #include "xentoollog.h"
index 42098e4d6fa89a8d0bb5c69f22775bd0c2a7acfa..82ffd752e0198fa609ec5f46183e4a60163848f6 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <stdio.h>
 #include <xenctrl.h>
-#include <xs.h>
+#include <xenstore.h>
 #include <stdlib.h>
 #include <string.h>
 
index 917077818788f2eba9b4e2ce837caa21e89c8bfa..c5cdd83810e497ffa4f4fb4477dee73999407473 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <Python.h>
 
-#include <xs.h>
+#include <xenstore.h>
 #include <xenctrl.h>
 
 #include "checkpoint.h"
index 4b119bb38cbecc5fc86da0fb55d0dbfcd4ea6376..187d9d768c234a8da50b8ed02cf4e64f53dcbe45 100644 (file)
@@ -8,7 +8,7 @@
 #include <time.h>
 
 #include <xenguest.h>
-#include <xs.h>
+#include <xenstore.h>
 
 typedef enum {
     dt_unknown,
index 0fc433fcf907f5063dd484b51f63908b505bc531..01c0d47c126864bf4e52c08880973f7df06028db 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <xenctrl.h>
 #include <xenguest.h>
-#include <xs.h>
+#include <xenstore.h>
 
 #include "checkpoint.h"
 
index 76a00a42a24ca97786bc070da0650c1c2053bb7f..84e1711f6027919e1ededa2b281d50c5ceb163e8 100644 (file)
@@ -30,7 +30,7 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#include "xs.h"
+#include <xenstore.h>
 
 /** @file
  * Python interface to the Xen Store Daemon (xs).
index 4d72fe82ad5ca7f1c25ea6f6caa8be0866d777b4..b69c65dd8a7c2d619c6c8a6d3ab42144a74a6468 100644 (file)
@@ -38,7 +38,7 @@
 #include <sys/time.h>
 #include <xen/arch-x86/xen-mca.h>
 #include <xg_save_restore.h>
-#include <xs.h>
+#include <xenstore.h>
 
 #define MCi_type_CTL        0x0
 #define MCi_type_STATUS     0x1
index 252759ea95a36882bc1bf21c57e74374fee27a5b..26e2ac15141737bf42ae64f7bcfdd290cf7dbfff 100644 (file)
@@ -19,7 +19,7 @@
 #include <fcntl.h>
 #include <err.h>
 
-#include <xs.h>
+#include <xenstore.h>
 #include <xenctrl.h>
 #include <xenguest.h>
 
index a659baf6c0eeb51024d75d76d15dbe14292f92fc..6b5bb8e75d41ca0ca375974b01565480e8178ea1 100644 (file)
@@ -28,7 +28,7 @@
 #include <string.h>
 #include <syslog.h>
 
-#include <xs.h>
+#include <xenstore.h>
 
 #define DEVTYPE_UNKNOWN 0
 #define DEVTYPE_VIF 1
index 52dbdaa9f38cd9d65e089891f8b0f5a5d9809ad4..090e775d00aebeaeaec6c40b9b37421c334453af 100644 (file)
@@ -29,7 +29,7 @@
 #include <unistd.h>
 #include <poll.h>
 #include <xc_private.h>
-#include <xs.h>
+#include <xenstore.h>
 #include <getopt.h>
 
 #include "xc_bitops.h"
index 28de744ef01694ce22572cda7732998f2f37a746..5dffff828d48021e59e1e44248d881d261b561ac 100644 (file)
@@ -40,7 +40,7 @@
 #include <dirent.h>
 #include <unistd.h>
 #include <sys/stat.h>
-#include <xs.h>
+#include <xenstore.h>
 
 /* #define RUN_STANDALONE */
 #define RUN_IN_SIMULATE_MODE
index fdd70ed6e48aec61c362b6b0ba11e880ce51f070..8490e232c6d4e31e624992dc1164136fe390159b 100644 (file)
@@ -24,7 +24,7 @@
 #define XENSTAT_PRIV_H
 
 #include <sys/types.h>
-#include <xs.h>
+#include <xenstore.h>
 #include "xenstat.h"
 
 #include "xenctrl.h"
index c20f517203880498df73625ef12772f1e9325fbf..5a6237bb0b3eaa043d65aec0a0a6d478ca34ab30 100644 (file)
@@ -1,6 +1,6 @@
 This license (LGPL) applies to the xenstore library which interfaces
-with the xenstore daemon (as stated in xs.c, xs.h, xs_lib.c and
-xs_lib.h).  The remaining files in the directory are licensed as
+with the xenstore daemon (as stated in xs.c, xenstore.h, xs_lib.c and
+xenstore_lib.h).  The remaining files in the directory are licensed as
 stated in the comments (as of this writing, GPL, see ../../COPYING).
 
 
index e95790165c31fe32dc6b153048f2684dbf642911..4ded89225bc23fb4963dd6a64d9594cbb9199b1c 100644 (file)
@@ -109,6 +109,7 @@ install: all
        $(INSTALL_DIR) $(DESTDIR)$(BINDIR)
        $(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
        $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
+       $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xenstore-compat
        $(INSTALL_DIR) $(DESTDIR)/var/run/xenstored
        $(INSTALL_DIR) $(DESTDIR)/var/lib/xenstored
        $(INSTALL_PROG) xenstored $(DESTDIR)$(SBINDIR)
@@ -122,8 +123,12 @@ install: all
        ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenstore.so.$(MAJOR)
        ln -sf libxenstore.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenstore.so
        $(INSTALL_DATA) libxenstore.a $(DESTDIR)$(LIBDIR)
-       $(INSTALL_DATA) xs.h $(DESTDIR)$(INCLUDEDIR)
-       $(INSTALL_DATA) xs_lib.h $(DESTDIR)$(INCLUDEDIR)
+       $(INSTALL_DATA) xenstore.h $(DESTDIR)$(INCLUDEDIR)
+       $(INSTALL_DATA) xenstore_lib.h $(DESTDIR)$(INCLUDEDIR)
+       $(INSTALL_DATA) compat/xs.h $(DESTDIR)$(INCLUDEDIR)/xenstore-compat/xs.h
+       $(INSTALL_DATA) compat/xs_lib.h $(DESTDIR)$(INCLUDEDIR)/xenstore-compat/xs_lib.h
+       ln -sf xenstore-compat/xs.h  $(DESTDIR)$(INCLUDEDIR)/xs.h
+       ln -sf xenstore-compat/xs_lib.h $(DESTDIR)$(INCLUDEDIR)/xs_lib.h
 
 -include $(DEPS)
 
diff --git a/tools/xenstore/compat/xs.h b/tools/xenstore/compat/xs.h
new file mode 100644 (file)
index 0000000..99cf39b
--- /dev/null
@@ -0,0 +1,2 @@
+#warning xs.h is deprecated use xenstore.h instead
+#include <xenstore.h>
diff --git a/tools/xenstore/compat/xs_lib.h b/tools/xenstore/compat/xs_lib.h
new file mode 100644 (file)
index 0000000..ad81b54
--- /dev/null
@@ -0,0 +1,2 @@
+#warning xs_lib.h is deprecated use xenstore_lib.h instead
+#include <xenstore_lib.h>
index f3a4497bcce41b1df1f192917d3a57512d29c3db..18c075bebdcc5a4033d484373f09ce4087d8efe8 100644 (file)
@@ -7,7 +7,7 @@
 #include <sys/mman.h>
 #include <xenctrl.h>
 #include <xc_dom.h>
-#include <xs.h>
+#include <xenstore.h>
 #include <xen/sys/xenbus_dev.h>
 
 static uint32_t domid = -1;
diff --git a/tools/xenstore/xenstore.h b/tools/xenstore/xenstore.h
new file mode 100644 (file)
index 0000000..7259e49
--- /dev/null
@@ -0,0 +1,236 @@
+/* 
+    Xen Store Daemon providing simple tree-like database.
+    Copyright (C) 2005 Rusty Russell IBM Corporation
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef XENSTORE_H
+#define XENSTORE_H
+
+#include <xenstore_lib.h>
+
+#define XBT_NULL 0
+
+#define XS_OPEN_READONLY       1UL<<0
+#define XS_OPEN_SOCKETONLY      1UL<<1
+
+struct xs_handle;
+typedef uint32_t xs_transaction_t;
+
+/* IMPORTANT: For details on xenstore protocol limits, see
+ * docs/misc/xenstore.txt in the Xen public source repository, and use the
+ * XENSTORE_*_MAX limit macros defined in xen/io/xs_wire.h.
+ */
+
+/* On failure, these routines set errno. */
+
+/* Open a connection to the xs daemon.
+ * Attempts to make a connection over the socket interface, 
+ * and if it fails, then over the  xenbus interface.
+ * Mode 0 specifies read-write access, XS_OPEN_READONLY for
+ * read-only access.
+ * Returns a handle or NULL.
+ */
+struct xs_handle *xs_open(unsigned long flags);
+
+/* Close the connection to the xs daemon. */
+void xs_close(struct xs_handle *xsh);
+
+/* Connect to the xs daemon.
+ * Returns a handle or NULL.
+ * Deprecated, please use xs_open(0) instead
+ */
+struct xs_handle *xs_daemon_open(void);
+struct xs_handle *xs_domain_open(void);
+
+/* Connect to the xs daemon (readonly for non-root clients).
+ * Returns a handle or NULL.
+ * Deprecated, please use xs_open(XS_OPEN_READONLY) instead
+ */
+struct xs_handle *xs_daemon_open_readonly(void);
+
+/* Close the connection to the xs daemon.
+ * Deprecated, please use xs_close() instead
+ */
+void xs_daemon_close(struct xs_handle *);
+
+/* Throw away the connection to the xs daemon, for use after fork(). */
+void xs_daemon_destroy_postfork(struct xs_handle *);
+
+/* Get contents of a directory.
+ * Returns a malloced array: call free() on it after use.
+ * Num indicates size.
+ */
+char **xs_directory(struct xs_handle *h, xs_transaction_t t,
+                   const char *path, unsigned int *num);
+
+/* Get the value of a single file, nul terminated.
+ * Returns a malloced value: call free() on it after use.
+ * len indicates length in bytes, not including terminator.
+ */
+void *xs_read(struct xs_handle *h, xs_transaction_t t,
+             const char *path, unsigned int *len);
+
+/* Write the value of a single file.
+ * Returns false on failure.
+ */
+bool xs_write(struct xs_handle *h, xs_transaction_t t,
+             const char *path, const void *data, unsigned int len);
+
+/* Create a new directory.
+ * Returns false on failure, or success if it already exists.
+ */
+bool xs_mkdir(struct xs_handle *h, xs_transaction_t t,
+             const char *path);
+
+/* Destroy a file or directory (and children).
+ * Returns false on failure, or if it doesn't exist.
+ */
+bool xs_rm(struct xs_handle *h, xs_transaction_t t,
+          const char *path);
+
+/* Restrict a xenstore handle so that it acts as if it had the
+ * permissions of domain @domid.  The handle must currently be
+ * using domain 0's credentials.
+ *
+ * Returns false on failure, in which case the handle continues
+ * to use the old credentials, or true on success.
+ */
+bool xs_restrict(struct xs_handle *h, unsigned domid);
+
+/* Get permissions of node (first element is owner, first perms is "other").
+ * Returns malloced array, or NULL: call free() after use.
+ */
+struct xs_permissions *xs_get_permissions(struct xs_handle *h,
+                                         xs_transaction_t t,
+                                         const char *path, unsigned int *num);
+
+/* Set permissions of node (must be owner).
+ * Returns false on failure.
+ */
+bool xs_set_permissions(struct xs_handle *h, xs_transaction_t t,
+                       const char *path, struct xs_permissions *perms,
+                       unsigned int num_perms);
+
+/* Watch a node for changes (poll on fd to detect, or call read_watch()).
+ * When the node (or any child) changes, fd will become readable.
+ * Token is returned when watch is read, to allow matching.
+ * Returns false on failure.
+ */
+bool xs_watch(struct xs_handle *h, const char *path, const char *token);
+
+/* Return the FD to poll on to see if a watch has fired. */
+int xs_fileno(struct xs_handle *h);
+
+/* Check for node changes.  On success, returns a non-NULL pointer ret
+ * such that ret[0] and ret[1] are valid C strings, namely the
+ * triggering path (see docs/misc/xenstore.txt) and the token (from
+ * xs_watch).  On error return value is NULL setting errno.
+ * 
+ * Callers should, after xs_fileno has become readable, repeatedly
+ * call xs_check_watch until it returns NULL and sets errno to EAGAIN.
+ * (If the fd became readable, xs_check_watch is allowed to make it no
+ * longer show up as readable even if future calls to xs_check_watch
+ * will return more watch events.)
+ *
+ * After the caller is finished with the returned information it
+ * should be freed all in one go with free(ret).
+ */
+char **xs_check_watch(struct xs_handle *h);
+
+/* Find out what node change was on (will block if nothing pending).
+ * Returns array containing the path and token. Use XS_WATCH_* to access these
+ * elements. Call free() after use.
+ */
+char **xs_read_watch(struct xs_handle *h, unsigned int *num);
+
+/* Remove a watch on a node: implicitly acks any outstanding watch.
+ * Returns false on failure (no watch on that node).
+ */
+bool xs_unwatch(struct xs_handle *h, const char *path, const char *token);
+
+/* Start a transaction: changes by others will not be seen during this
+ * transaction, and changes will not be visible to others until end.
+ * Returns NULL on failure.
+ */
+xs_transaction_t xs_transaction_start(struct xs_handle *h);
+
+/* End a transaction.
+ * If abandon is true, transaction is discarded instead of committed.
+ * Returns false on failure: if errno == EAGAIN, you have to restart
+ * transaction.
+ */
+bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
+                       bool abort);
+
+/* Introduce a new domain.
+ * This tells the store daemon about a shared memory page, event channel and
+ * store path associated with a domain: the domain uses these to communicate.
+ */
+bool xs_introduce_domain(struct xs_handle *h,
+                        unsigned int domid,
+                        unsigned long mfn,
+                         unsigned int eventchn); 
+
+/* Set the target of a domain
+ * This tells the store daemon that a domain is targetting another one, so
+ * it should let it tinker with it.
+ */
+bool xs_set_target(struct xs_handle *h,
+                  unsigned int domid,
+                  unsigned int target);
+
+/* Resume a domain.
+ * Clear the shutdown flag for this domain in the store.
+ */
+bool xs_resume_domain(struct xs_handle *h, unsigned int domid);
+
+/* Release a domain.
+ * Tells the store domain to release the memory page to the domain.
+ */
+bool xs_release_domain(struct xs_handle *h, unsigned int domid);
+
+/* Query the home path of a domain.  Call free() after use.
+ */
+char *xs_get_domain_path(struct xs_handle *h, unsigned int domid);
+
+/* Returns true if child is either equal to parent, or a node underneath
+ * parent; or false otherwise.  Done by string comparison, so relative and
+ * absolute pathnames never in a parent/child relationship by this
+ * definition.  Cannot fail.
+ */
+bool xs_path_is_subpath(const char *parent, const char *child);
+
+/* Return whether the domain specified has been introduced to xenstored.
+ */
+bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid);
+
+/* Only useful for DEBUG versions */
+char *xs_debug_command(struct xs_handle *h, const char *cmd,
+                      void *data, unsigned int len);
+
+int xs_suspend_evtchn_port(int domid);
+#endif /* XENSTORE_H */
+
+/*
+ * Local variables:
+ *  c-file-style: "linux"
+ *  indent-tabs-mode: t
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */
index 94b82b99af820dcde1ea0837a05d754eddaf4fe6..37b1bc65e19ac046a670df9485a5d4cfa7d750bb 100644 (file)
@@ -18,7 +18,7 @@
 #include <string.h>
 #include <termios.h>
 #include <unistd.h>
-#include <xs.h>
+#include <xenstore.h>
 
 #include <sys/ioctl.h>
 
index 0be80261e4ab2ce3c3c1e756d3ac1ecde4f9a2cd..0a108df0aa2d21dbc0e85c3645f2a7fd0311ca00 100644 (file)
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "xs.h"
+#include "xenstore.h"
 
 
 int main(int argc, char **argv)
diff --git a/tools/xenstore/xenstore_lib.h b/tools/xenstore/xenstore_lib.h
new file mode 100644 (file)
index 0000000..5c2baf6
--- /dev/null
@@ -0,0 +1,85 @@
+/* 
+    Common routines between Xen store user library and daemon.
+    Copyright (C) 2005 Rusty Russell IBM Corporation
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef XENSTORE_LIB_H
+#define XENSTORE_LIB_H
+
+#include <stdbool.h>
+#include <limits.h>
+#include <errno.h>
+#include <stdint.h>
+#include <xen/io/xs_wire.h>
+
+/* Bitmask of permissions. */
+enum xs_perm_type {
+       XS_PERM_NONE = 0,
+       XS_PERM_READ = 1,
+       XS_PERM_WRITE = 2,
+       /* Internal use. */
+       XS_PERM_ENOENT_OK = 4,
+       XS_PERM_OWNER = 8,
+};
+
+struct xs_permissions
+{
+       unsigned int id;
+       enum xs_perm_type perms;
+};
+
+/* Each 10 bits takes ~ 3 digits, plus one, plus one for nul terminator. */
+#define MAX_STRLEN(x) ((sizeof(x) * CHAR_BIT + CHAR_BIT-1) / 10 * 3 + 2)
+
+/* Path for various daemon things: env vars can override. */
+const char *xs_daemon_rootdir(void);
+const char *xs_daemon_rundir(void);
+const char *xs_daemon_socket(void);
+const char *xs_daemon_socket_ro(void);
+const char *xs_domain_dev(void);
+const char *xs_daemon_tdb(void);
+
+/* Simple write function: loops for you. */
+bool xs_write_all(int fd, const void *data, unsigned int len);
+
+/* Convert strings to permissions.  False if a problem. */
+bool xs_strings_to_perms(struct xs_permissions *perms, unsigned int num,
+                        const char *strings);
+
+/* Convert permissions to a string (up to len MAX_STRLEN(unsigned int)+1). */
+bool xs_perm_to_string(const struct xs_permissions *perm,
+                       char *buffer, size_t buf_len);
+
+/* Given a string and a length, count how many strings (nul terms). */
+unsigned int xs_count_strings(const char *strings, unsigned int len);
+
+/* Sanitising (quoting) possibly-binary strings. */
+struct expanding_buffer {
+       char *buf;
+       int avail;
+};
+
+/* Ensure that given expanding buffer has at least min_avail characters. */
+char *expanding_buffer_ensure(struct expanding_buffer *, int min_avail);
+
+/* sanitise_value() may return NULL if malloc fails. */
+char *sanitise_value(struct expanding_buffer *, const char *val, unsigned len);
+
+/* *out_len_r on entry is ignored; out must be at least strlen(in)+1 bytes. */
+void unsanitise_value(char *out, unsigned *out_len_r, const char *in);
+
+#endif /* XENSTORE_LIB_H */
index a42f55291d3e35b02ebd9fb03b1e05f965e3e965..bd446453704ff97f9a24f028c26339618c4d270d 100644 (file)
@@ -44,7 +44,7 @@
 #include "utils.h"
 #include "list.h"
 #include "talloc.h"
-#include "xs_lib.h"
+#include "xenstore_lib.h"
 #include "xenstored_core.h"
 #include "xenstored_watch.h"
 #include "xenstored_transaction.h"
index 92c27ba92f2ba72edc964877cb146ad0fcc10e7a..492ca0d9a7f2a1ab4d78c97c3f25bdc52c563318 100644 (file)
@@ -27,7 +27,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <errno.h>
-#include "xs_lib.h"
+#include "xenstore_lib.h"
 #include "list.h"
 #include "tdb.h"
 
index 380c691bb2db999746201a9607d75fdf862a5e0d..50a32fbcba0648bae9e9ce0a04a1d4c471a11ac9 100644 (file)
@@ -33,7 +33,7 @@
 #include "xenstored_transaction.h"
 #include "xenstored_watch.h"
 #include "xenstored_domain.h"
-#include "xs_lib.h"
+#include "xenstore_lib.h"
 #include "utils.h"
 
 struct changed_node
index 65d4025239e0379e8f4e59907d6a4495fab7a217..2ac498ae7ffb4d77808b4b2d37669d8d7a75a063 100644 (file)
@@ -27,7 +27,7 @@
 #include "talloc.h"
 #include "list.h"
 #include "xenstored_watch.h"
-#include "xs_lib.h"
+#include "xenstore_lib.h"
 #include "utils.h"
 #include "xenstored_domain.h"
 
index 0a01675a787efae3444467df2c35bf367d74bbd8..f141066efc5e57acd657130787a0630c33f478cf 100644 (file)
@@ -32,7 +32,7 @@
 #include <signal.h>
 #include <stdint.h>
 #include <errno.h>
-#include "xs.h"
+#include "xenstore.h"
 #include "list.h"
 #include "utils.h"
 
diff --git a/tools/xenstore/xs.h b/tools/xenstore/xs.h
deleted file mode 100644 (file)
index 8d49e50..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-/* 
-    Xen Store Daemon providing simple tree-like database.
-    Copyright (C) 2005 Rusty Russell IBM Corporation
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-#ifndef _XS_H
-#define _XS_H
-
-#include <xs_lib.h>
-
-#define XBT_NULL 0
-
-#define XS_OPEN_READONLY       1UL<<0
-#define XS_OPEN_SOCKETONLY      1UL<<1
-
-struct xs_handle;
-typedef uint32_t xs_transaction_t;
-
-/* IMPORTANT: For details on xenstore protocol limits, see
- * docs/misc/xenstore.txt in the Xen public source repository, and use the
- * XENSTORE_*_MAX limit macros defined in xen/io/xs_wire.h.
- */
-
-/* On failure, these routines set errno. */
-
-/* Open a connection to the xs daemon.
- * Attempts to make a connection over the socket interface, 
- * and if it fails, then over the  xenbus interface.
- * Mode 0 specifies read-write access, XS_OPEN_READONLY for
- * read-only access.
- * Returns a handle or NULL.
- */
-struct xs_handle *xs_open(unsigned long flags);
-
-/* Close the connection to the xs daemon. */
-void xs_close(struct xs_handle *xsh);
-
-/* Connect to the xs daemon.
- * Returns a handle or NULL.
- * Deprecated, please use xs_open(0) instead
- */
-struct xs_handle *xs_daemon_open(void);
-struct xs_handle *xs_domain_open(void);
-
-/* Connect to the xs daemon (readonly for non-root clients).
- * Returns a handle or NULL.
- * Deprecated, please use xs_open(XS_OPEN_READONLY) instead
- */
-struct xs_handle *xs_daemon_open_readonly(void);
-
-/* Close the connection to the xs daemon.
- * Deprecated, please use xs_close() instead
- */
-void xs_daemon_close(struct xs_handle *);
-
-/* Throw away the connection to the xs daemon, for use after fork(). */
-void xs_daemon_destroy_postfork(struct xs_handle *);
-
-/* Get contents of a directory.
- * Returns a malloced array: call free() on it after use.
- * Num indicates size.
- */
-char **xs_directory(struct xs_handle *h, xs_transaction_t t,
-                   const char *path, unsigned int *num);
-
-/* Get the value of a single file, nul terminated.
- * Returns a malloced value: call free() on it after use.
- * len indicates length in bytes, not including terminator.
- */
-void *xs_read(struct xs_handle *h, xs_transaction_t t,
-             const char *path, unsigned int *len);
-
-/* Write the value of a single file.
- * Returns false on failure.
- */
-bool xs_write(struct xs_handle *h, xs_transaction_t t,
-             const char *path, const void *data, unsigned int len);
-
-/* Create a new directory.
- * Returns false on failure, or success if it already exists.
- */
-bool xs_mkdir(struct xs_handle *h, xs_transaction_t t,
-             const char *path);
-
-/* Destroy a file or directory (and children).
- * Returns false on failure, or if it doesn't exist.
- */
-bool xs_rm(struct xs_handle *h, xs_transaction_t t,
-          const char *path);
-
-/* Restrict a xenstore handle so that it acts as if it had the
- * permissions of domain @domid.  The handle must currently be
- * using domain 0's credentials.
- *
- * Returns false on failure, in which case the handle continues
- * to use the old credentials, or true on success.
- */
-bool xs_restrict(struct xs_handle *h, unsigned domid);
-
-/* Get permissions of node (first element is owner, first perms is "other").
- * Returns malloced array, or NULL: call free() after use.
- */
-struct xs_permissions *xs_get_permissions(struct xs_handle *h,
-                                         xs_transaction_t t,
-                                         const char *path, unsigned int *num);
-
-/* Set permissions of node (must be owner).
- * Returns false on failure.
- */
-bool xs_set_permissions(struct xs_handle *h, xs_transaction_t t,
-                       const char *path, struct xs_permissions *perms,
-                       unsigned int num_perms);
-
-/* Watch a node for changes (poll on fd to detect, or call read_watch()).
- * When the node (or any child) changes, fd will become readable.
- * Token is returned when watch is read, to allow matching.
- * Returns false on failure.
- */
-bool xs_watch(struct xs_handle *h, const char *path, const char *token);
-
-/* Return the FD to poll on to see if a watch has fired. */
-int xs_fileno(struct xs_handle *h);
-
-/* Check for node changes.  On success, returns a non-NULL pointer ret
- * such that ret[0] and ret[1] are valid C strings, namely the
- * triggering path (see docs/misc/xenstore.txt) and the token (from
- * xs_watch).  On error return value is NULL setting errno.
- * 
- * Callers should, after xs_fileno has become readable, repeatedly
- * call xs_check_watch until it returns NULL and sets errno to EAGAIN.
- * (If the fd became readable, xs_check_watch is allowed to make it no
- * longer show up as readable even if future calls to xs_check_watch
- * will return more watch events.)
- *
- * After the caller is finished with the returned information it
- * should be freed all in one go with free(ret).
- */
-char **xs_check_watch(struct xs_handle *h);
-
-/* Find out what node change was on (will block if nothing pending).
- * Returns array containing the path and token. Use XS_WATCH_* to access these
- * elements. Call free() after use.
- */
-char **xs_read_watch(struct xs_handle *h, unsigned int *num);
-
-/* Remove a watch on a node: implicitly acks any outstanding watch.
- * Returns false on failure (no watch on that node).
- */
-bool xs_unwatch(struct xs_handle *h, const char *path, const char *token);
-
-/* Start a transaction: changes by others will not be seen during this
- * transaction, and changes will not be visible to others until end.
- * Returns NULL on failure.
- */
-xs_transaction_t xs_transaction_start(struct xs_handle *h);
-
-/* End a transaction.
- * If abandon is true, transaction is discarded instead of committed.
- * Returns false on failure: if errno == EAGAIN, you have to restart
- * transaction.
- */
-bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
-                       bool abort);
-
-/* Introduce a new domain.
- * This tells the store daemon about a shared memory page, event channel and
- * store path associated with a domain: the domain uses these to communicate.
- */
-bool xs_introduce_domain(struct xs_handle *h,
-                        unsigned int domid,
-                        unsigned long mfn,
-                         unsigned int eventchn); 
-
-/* Set the target of a domain
- * This tells the store daemon that a domain is targetting another one, so
- * it should let it tinker with it.
- */
-bool xs_set_target(struct xs_handle *h,
-                  unsigned int domid,
-                  unsigned int target);
-
-/* Resume a domain.
- * Clear the shutdown flag for this domain in the store.
- */
-bool xs_resume_domain(struct xs_handle *h, unsigned int domid);
-
-/* Release a domain.
- * Tells the store domain to release the memory page to the domain.
- */
-bool xs_release_domain(struct xs_handle *h, unsigned int domid);
-
-/* Query the home path of a domain.  Call free() after use.
- */
-char *xs_get_domain_path(struct xs_handle *h, unsigned int domid);
-
-/* Returns true if child is either equal to parent, or a node underneath
- * parent; or false otherwise.  Done by string comparison, so relative and
- * absolute pathnames never in a parent/child relationship by this
- * definition.  Cannot fail.
- */
-bool xs_path_is_subpath(const char *parent, const char *child);
-
-/* Return whether the domain specified has been introduced to xenstored.
- */
-bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid);
-
-/* Only useful for DEBUG versions */
-char *xs_debug_command(struct xs_handle *h, const char *cmd,
-                      void *data, unsigned int len);
-
-int xs_suspend_evtchn_port(int domid);
-#endif /* _XS_H */
-
-/*
- * Local variables:
- *  c-file-style: "linux"
- *  indent-tabs-mode: t
- *  c-indent-level: 8
- *  c-basic-offset: 8
- *  tab-width: 8
- * End:
- */
index 03a9ee4393bb9d62d1f746b0505967ebc368c283..f7076cc62cf1fce57392cffc698615b55ee9244d 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <assert.h>
-#include "xs_lib.h"
+#include "xenstore_lib.h"
 
 /* Common routines for the Xen store daemon and client library. */
 
diff --git a/tools/xenstore/xs_lib.h b/tools/xenstore/xs_lib.h
deleted file mode 100644 (file)
index bea010d..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/* 
-    Common routines between Xen store user library and daemon.
-    Copyright (C) 2005 Rusty Russell IBM Corporation
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-#ifndef _XS_LIB_H
-#define _XS_LIB_H
-
-#include <stdbool.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdint.h>
-#include <xen/io/xs_wire.h>
-
-/* Bitmask of permissions. */
-enum xs_perm_type {
-       XS_PERM_NONE = 0,
-       XS_PERM_READ = 1,
-       XS_PERM_WRITE = 2,
-       /* Internal use. */
-       XS_PERM_ENOENT_OK = 4,
-       XS_PERM_OWNER = 8,
-};
-
-struct xs_permissions
-{
-       unsigned int id;
-       enum xs_perm_type perms;
-};
-
-/* Each 10 bits takes ~ 3 digits, plus one, plus one for nul terminator. */
-#define MAX_STRLEN(x) ((sizeof(x) * CHAR_BIT + CHAR_BIT-1) / 10 * 3 + 2)
-
-/* Path for various daemon things: env vars can override. */
-const char *xs_daemon_rootdir(void);
-const char *xs_daemon_rundir(void);
-const char *xs_daemon_socket(void);
-const char *xs_daemon_socket_ro(void);
-const char *xs_domain_dev(void);
-const char *xs_daemon_tdb(void);
-
-/* Simple write function: loops for you. */
-bool xs_write_all(int fd, const void *data, unsigned int len);
-
-/* Convert strings to permissions.  False if a problem. */
-bool xs_strings_to_perms(struct xs_permissions *perms, unsigned int num,
-                        const char *strings);
-
-/* Convert permissions to a string (up to len MAX_STRLEN(unsigned int)+1). */
-bool xs_perm_to_string(const struct xs_permissions *perm,
-                       char *buffer, size_t buf_len);
-
-/* Given a string and a length, count how many strings (nul terms). */
-unsigned int xs_count_strings(const char *strings, unsigned int len);
-
-/* Sanitising (quoting) possibly-binary strings. */
-struct expanding_buffer {
-       char *buf;
-       int avail;
-};
-
-/* Ensure that given expanding buffer has at least min_avail characters. */
-char *expanding_buffer_ensure(struct expanding_buffer *, int min_avail);
-
-/* sanitise_value() may return NULL if malloc fails. */
-char *sanitise_value(struct expanding_buffer *, const char *val, unsigned len);
-
-/* *out_len_r on entry is ignored; out must be at least strlen(in)+1 bytes. */
-void unsanitise_value(char *out, unsigned *out_len_r, const char *in);
-
-#endif /* _XS_LIB_H */
index d3c515418ca5c068ee713a2ba0b6b022de8e6500..7aa7158595c85b7ae6df17b8ea62f470c7125357 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
-#include "xs_lib.h"
+#include "xenstore_lib.h"
 #include "tdb.h"
 #include "talloc.h"
 #include "utils.h"