[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Rationalise xenstore header files a little. xenstored.h,



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 62d815160f01020359ef78705c5ce13614f766b2
# Parent  c45c3d6b1a601689a43c4ec5fb141bb70bace6b8
Rationalise xenstore header files a little. xenstored.h,
which defines aspects of the 'wire' protocol between
xs daemon and clients in user and kernel land, is now
xs_wire.h and moved to xen's public/io directory. From there
it is more easily accessible by kernels.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r c45c3d6b1a60 -r 62d815160f01 .hgignore
--- a/.hgignore Fri Oct  7 14:52:43 2005
+++ b/.hgignore Fri Oct  7 15:49:29 2005
@@ -155,7 +155,7 @@
 ^tools/xenstore/xenstore-read$
 ^tools/xenstore/xenstore-rm$
 ^tools/xenstore/xenstore-write$
-^tools/xenstore/xs_dom0_test$
+^tools/xenstore/xs_crashme$
 ^tools/xenstore/xs_random$
 ^tools/xenstore/xs_stress$
 ^tools/xenstore/xs_tdb_dump$
diff -r c45c3d6b1a60 -r 62d815160f01 linux-2.6-xen-sparse/arch/ia64/Makefile
--- a/linux-2.6-xen-sparse/arch/ia64/Makefile   Fri Oct  7 14:52:43 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/Makefile   Fri Oct  7 15:49:29 2005
@@ -88,7 +88,6 @@
 
 CLEAN_FILES += include/asm-ia64/.offsets.h.stamp vmlinux.gz bootloader
 #CLEAN_FILES += include/asm-xen/xen-public 
include/asm-ia64/xen/asm-xsi-offsets.h
-#CLEAN_FILES += include/asm-xen/linux-public/xenstored.h
 #CLEAN_FILES += include/asm-xen/linux-public 
include/asm-xen/asm-ia64/hypervisor.h
 
 MRPROPER_FILES += include/asm-ia64/offsets.h
@@ -119,9 +118,6 @@
 #      [ -e include/asm-xen/linux-public ] \
 #       || ln -s $(XEN_PATH)/linux-2.6-xen-sparse/include/asm-xen/linux-public 
\
                include/asm-xen/linux-public
-       [ -e include/asm-xen/linux-public/xenstored.h ] \
-        || ln -s $(XEN_PATH)/tools/xenstore/xenstored.h \
-               include/asm-xen/linux-public/xenstored.h
        [ -e include/asm-xen/asm-ia64/hypervisor.h ] \
         || ln -s 
$(XEN_PATH)/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/hypervisor.h \
                include/asm-xen/asm-ia64/hypervisor.h
diff -r c45c3d6b1a60 -r 62d815160f01 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Fri Oct  7 
14:52:43 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Fri Oct  7 
15:49:29 2005
@@ -44,7 +44,6 @@
 #include <asm-xen/xenbus.h>
 #include <asm-xen/xen_proc.h>
 #include <asm/hypervisor.h>
-#include <asm-xen/linux-public/xenstored.h>
 
 struct xenbus_dev_data {
        /* Are there bytes left to be read in this message? */
diff -r c45c3d6b1a60 -r 62d815160f01 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Fri Oct  7 
14:52:43 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Fri Oct  7 
15:49:29 2005
@@ -38,7 +38,6 @@
 #include <linux/fcntl.h>
 #include <linux/kthread.h>
 #include <asm-xen/xenbus.h>
-#include <asm-xen/linux-public/xenstored.h>
 #include "xenbus_comms.h"
 
 #define streq(a, b) (strcmp((a), (b)) == 0)
diff -r c45c3d6b1a60 -r 62d815160f01 
linux-2.6-xen-sparse/include/asm-xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h     Fri Oct  7 14:52:43 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h     Fri Oct  7 15:49:29 2005
@@ -33,9 +33,7 @@
 #include <linux/device.h>
 #include <linux/notifier.h>
 #include <asm/semaphore.h>
-
-/* FIXME there's got to be a better way to get at the XS_WATCH macros */
-#include <asm-xen/linux-public/xenstored.h>
+#include <asm-xen/xen-public/io/xs_wire.h>
 
 /* A xenbus device. */
 struct xenbus_device {
diff -r c45c3d6b1a60 -r 62d815160f01 linux-2.6-xen-sparse/mkbuildtree
--- a/linux-2.6-xen-sparse/mkbuildtree  Fri Oct  7 14:52:43 2005
+++ b/linux-2.6-xen-sparse/mkbuildtree  Fri Oct  7 15:49:29 2005
@@ -113,9 +113,6 @@
 cd     ${AD}/include/asm-xen/xen-public
 relative_lndir ../../../${RS}/../xen/include/public
 
-cd ${AD}/include/asm-xen/linux-public
-ln -sf ../../../${RS}/../tools/xenstore/xenstored.h
-
 # Arch-specific post-processing
 cd ${AD}
 if [ -x arch/${LINUX_ARCH}/xen-mkbuildtree-post ]; then
diff -r c45c3d6b1a60 -r 62d815160f01 tools/xenstore/speedtest.c
--- a/tools/xenstore/speedtest.c        Fri Oct  7 14:52:43 2005
+++ b/tools/xenstore/speedtest.c        Fri Oct  7 15:49:29 2005
@@ -98,7 +98,7 @@
 
                if (i % print == 0)
                        write(1, ".", 1);
-               if (!xs_transaction_start(h, "/")) {
+               if (!xs_transaction_start(h)) {
                        kill_daemon(pid);
                        barf_perror("Starting transaction");
                }
diff -r c45c3d6b1a60 -r 62d815160f01 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Fri Oct  7 14:52:43 2005
+++ b/tools/xenstore/xenstored_core.c   Fri Oct  7 15:49:29 2005
@@ -44,7 +44,6 @@
 #include "list.h"
 #include "talloc.h"
 #include "xs_lib.h"
-#include "xenstored.h"
 #include "xenstored_core.h"
 #include "xenstored_watch.h"
 #include "xenstored_transaction.h"
diff -r c45c3d6b1a60 -r 62d815160f01 tools/xenstore/xenstored_core.h
--- a/tools/xenstore/xenstored_core.h   Fri Oct  7 14:52:43 2005
+++ b/tools/xenstore/xenstored_core.h   Fri Oct  7 15:49:29 2005
@@ -26,7 +26,6 @@
 #include <stdint.h>
 #include <errno.h>
 #include "xs_lib.h"
-#include "xenstored.h"
 #include "list.h"
 #include "tdb.h"
 
diff -r c45c3d6b1a60 -r 62d815160f01 tools/xenstore/xs.c
--- a/tools/xenstore/xs.c       Fri Oct  7 14:52:43 2005
+++ b/tools/xenstore/xs.c       Fri Oct  7 15:49:29 2005
@@ -33,8 +33,6 @@
 #include <errno.h>
 #include <sys/ioctl.h>
 #include "xs.h"
-#include "xenstored.h"
-#include "xs_lib.h"
 #include "utils.h"
 
 struct xs_handle
diff -r c45c3d6b1a60 -r 62d815160f01 tools/xenstore/xs.h
--- a/tools/xenstore/xs.h       Fri Oct  7 14:52:43 2005
+++ b/tools/xenstore/xs.h       Fri Oct  7 15:49:29 2005
@@ -20,17 +20,9 @@
 #ifndef _XS_H
 #define _XS_H
 
-#include "xs_lib.h"
+#include <xs_lib.h>
 
 struct xs_handle;
-
-/* FIXME we shouldn't have to declare this in two places, what's the right
-   way to share things between xenstored.h and xs.h? */
-enum xs_watch_type
-{
-       XS_WATCH_PATH = 0,
-       XS_WATCH_TOKEN,
-};
 
 /* On failure, these routines set errno. */
 
diff -r c45c3d6b1a60 -r 62d815160f01 tools/xenstore/xs_crashme.c
--- a/tools/xenstore/xs_crashme.c       Fri Oct  7 14:52:43 2005
+++ b/tools/xenstore/xs_crashme.c       Fri Oct  7 15:49:29 2005
@@ -24,7 +24,6 @@
 #include "xs.h"
 #include "talloc.h"
 #include <errno.h>
-#include "xenstored.h"
 
 #define XSTEST
 #define RAND_FREQ 128          /* One char in 32 is corrupted. */
@@ -231,20 +230,6 @@
        return ret;
 }
 
-static int random_flags(int *state)
-{
-       switch (get_randomness(state) % 4) {
-       case 0:
-               return 0;
-       case 1:
-               return O_CREAT;
-       case 2:
-               return O_CREAT|O_EXCL;
-       default:
-               return get_randomness(state);
-       }
-}
-
 /* Do the next operation, return the results. */
 static void do_next_op(struct xs_handle *h, bool verbose)
 {
@@ -315,7 +300,7 @@
        case 7: {
                if (verbose)
                        printf("START %s\n", name);
-               xs_transaction_start(h, name);
+               xs_transaction_start(h);
                break;
        }
        case 8: {
diff -r c45c3d6b1a60 -r 62d815160f01 tools/xenstore/xs_lib.h
--- a/tools/xenstore/xs_lib.h   Fri Oct  7 14:52:43 2005
+++ b/tools/xenstore/xs_lib.h   Fri Oct  7 15:49:29 2005
@@ -23,6 +23,8 @@
 #include <stdbool.h>
 #include <limits.h>
 #include <xenctrl.h>
+#include <errno.h>
+#include <xen/io/xs_wire.h>
 
 /* Bitmask of permissions. */
 enum xs_perm_type {
diff -r c45c3d6b1a60 -r 62d815160f01 xen/include/public/io/xs_wire.h
--- /dev/null   Fri Oct  7 14:52:43 2005
+++ b/xen/include/public/io/xs_wire.h   Fri Oct  7 15:49:29 2005
@@ -0,0 +1,96 @@
+/*
+ * Details of the "wire" protocol between Xen Store Daemon and client
+ * library or guest kernel.
+ * Copyright (C) 2005 Rusty Russell IBM Corporation
+ *
+ * This file may be distributed separately from the Linux kernel, or
+ * incorporated into other software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef _XS_WIRE_H
+#define _XS_WIRE_H
+
+enum xsd_sockmsg_type
+{
+       XS_DEBUG,
+       XS_SHUTDOWN,
+       XS_DIRECTORY,
+       XS_READ,
+       XS_GET_PERMS,
+       XS_WATCH,
+       XS_WATCH_ACK,
+       XS_UNWATCH,
+       XS_TRANSACTION_START,
+       XS_TRANSACTION_END,
+       XS_OP_READ_ONLY = XS_TRANSACTION_END,
+       XS_INTRODUCE,
+       XS_RELEASE,
+       XS_GET_DOMAIN_PATH,
+       XS_WRITE,
+       XS_MKDIR,
+       XS_RM,
+       XS_SET_PERMS,
+       XS_WATCH_EVENT,
+       XS_ERROR,
+};
+
+#define XS_WRITE_NONE "NONE"
+#define XS_WRITE_CREATE "CREATE"
+#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
+
+/* We hand errors as strings, for portability. */
+struct xsd_errors
+{
+       int errnum;
+       const char *errstring;
+};
+#define XSD_ERROR(x) { x, #x }
+static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
+       XSD_ERROR(EINVAL),
+       XSD_ERROR(EACCES),
+       XSD_ERROR(EEXIST),
+       XSD_ERROR(EISDIR),
+       XSD_ERROR(ENOENT),
+       XSD_ERROR(ENOMEM),
+       XSD_ERROR(ENOSPC),
+       XSD_ERROR(EIO),
+       XSD_ERROR(ENOTEMPTY),
+       XSD_ERROR(ENOSYS),
+       XSD_ERROR(EROFS),
+       XSD_ERROR(EBUSY),
+       XSD_ERROR(EAGAIN),
+       XSD_ERROR(EISCONN),
+};
+struct xsd_sockmsg
+{
+       u32 type;
+       u32 len;                /* Length of data following this. */
+
+       /* Generally followed by nul-terminated string(s). */
+};
+
+enum xs_watch_type
+{
+       XS_WATCH_PATH = 0,
+       XS_WATCH_TOKEN,
+};
+
+#endif /* _XS_WIRE_H */
diff -r c45c3d6b1a60 -r 62d815160f01 tools/xenstore/xenstored.h
--- a/tools/xenstore/xenstored.h        Fri Oct  7 14:52:43 2005
+++ /dev/null   Fri Oct  7 15:49:29 2005
@@ -1,97 +0,0 @@
-/*
- * Simple prototyle Xen Store Daemon providing simple tree-like database.
- * Copyright (C) 2005 Rusty Russell IBM Corporation
- *
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this source file (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy, modify,
- * merge, publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef _XENSTORED_H
-#define _XENSTORED_H
-
-enum xsd_sockmsg_type
-{
-       XS_DEBUG,
-       XS_SHUTDOWN,
-       XS_DIRECTORY,
-       XS_READ,
-       XS_GET_PERMS,
-       XS_WATCH,
-       XS_WATCH_ACK,
-       XS_UNWATCH,
-       XS_TRANSACTION_START,
-       XS_TRANSACTION_END,
-       XS_OP_READ_ONLY = XS_TRANSACTION_END,
-       XS_INTRODUCE,
-       XS_RELEASE,
-       XS_GET_DOMAIN_PATH,
-       XS_WRITE,
-       XS_MKDIR,
-       XS_RM,
-       XS_SET_PERMS,
-       XS_WATCH_EVENT,
-       XS_ERROR,
-};
-
-#define XS_WRITE_NONE "NONE"
-#define XS_WRITE_CREATE "CREATE"
-#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
-
-/* We hand errors as strings, for portability. */
-struct xsd_errors
-{
-       int errnum;
-       const char *errstring;
-};
-#define XSD_ERROR(x) { x, #x }
-static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
-       XSD_ERROR(EINVAL),
-       XSD_ERROR(EACCES),
-       XSD_ERROR(EEXIST),
-       XSD_ERROR(EISDIR),
-       XSD_ERROR(ENOENT),
-       XSD_ERROR(ENOMEM),
-       XSD_ERROR(ENOSPC),
-       XSD_ERROR(EIO),
-       XSD_ERROR(ENOTEMPTY),
-       XSD_ERROR(ENOSYS),
-       XSD_ERROR(EROFS),
-       XSD_ERROR(EBUSY),
-       XSD_ERROR(EAGAIN),
-       XSD_ERROR(EISCONN),
-};
-struct xsd_sockmsg
-{
-       u32 type;
-       u32 len;                /* Length of data following this. */
-
-       /* Generally followed by nul-terminated string(s). */
-};
-
-/* FIXME we shouldn't have to declare this in two places, what's the right
-   way to share things between xenstored.h and xs.h? */
-enum xs_watch_type
-{
-       XS_WATCH_PATH = 0,
-       XS_WATCH_TOKEN,
-};
-
-#endif /* _XENSTORED_H */

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.