direct-io.hg

changeset 7259:62d815160f01

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@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Oct 07 16:49:29 2005 +0100 (2005-10-07)
parents c45c3d6b1a60
children 1b4ad6eb6968
files .hgignore linux-2.6-xen-sparse/arch/ia64/Makefile linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c linux-2.6-xen-sparse/include/asm-xen/xenbus.h linux-2.6-xen-sparse/mkbuildtree tools/xenstore/speedtest.c tools/xenstore/xenstored_core.c tools/xenstore/xenstored_core.h tools/xenstore/xs.c tools/xenstore/xs.h tools/xenstore/xs_crashme.c tools/xenstore/xs_lib.h xen/include/public/io/xs_wire.h
line diff
     1.1 --- a/.hgignore	Fri Oct 07 15:52:43 2005 +0100
     1.2 +++ b/.hgignore	Fri Oct 07 16:49:29 2005 +0100
     1.3 @@ -155,7 +155,7 @@
     1.4  ^tools/xenstore/xenstore-read$
     1.5  ^tools/xenstore/xenstore-rm$
     1.6  ^tools/xenstore/xenstore-write$
     1.7 -^tools/xenstore/xs_dom0_test$
     1.8 +^tools/xenstore/xs_crashme$
     1.9  ^tools/xenstore/xs_random$
    1.10  ^tools/xenstore/xs_stress$
    1.11  ^tools/xenstore/xs_tdb_dump$
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/Makefile	Fri Oct 07 15:52:43 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/Makefile	Fri Oct 07 16:49:29 2005 +0100
     2.3 @@ -88,7 +88,6 @@ archclean:
     2.4  
     2.5  CLEAN_FILES += include/asm-ia64/.offsets.h.stamp vmlinux.gz bootloader
     2.6  #CLEAN_FILES += include/asm-xen/xen-public include/asm-ia64/xen/asm-xsi-offsets.h
     2.7 -#CLEAN_FILES += include/asm-xen/linux-public/xenstored.h
     2.8  #CLEAN_FILES += include/asm-xen/linux-public include/asm-xen/asm-ia64/hypervisor.h
     2.9  
    2.10  MRPROPER_FILES += include/asm-ia64/offsets.h
    2.11 @@ -119,9 +118,6 @@ include/asm-ia64/.offsets.h.stamp:
    2.12  #	[ -e include/asm-xen/linux-public ] \
    2.13  #	 || ln -s $(XEN_PATH)/linux-2.6-xen-sparse/include/asm-xen/linux-public \
    2.14  		include/asm-xen/linux-public
    2.15 -	[ -e include/asm-xen/linux-public/xenstored.h ] \
    2.16 -	 || ln -s $(XEN_PATH)/tools/xenstore/xenstored.h \
    2.17 -		include/asm-xen/linux-public/xenstored.h
    2.18  	[ -e include/asm-xen/asm-ia64/hypervisor.h ] \
    2.19  	 || ln -s $(XEN_PATH)/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/hypervisor.h \
    2.20  		include/asm-xen/asm-ia64/hypervisor.h
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Fri Oct 07 15:52:43 2005 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Fri Oct 07 16:49:29 2005 +0100
     3.3 @@ -44,7 +44,6 @@
     3.4  #include <asm-xen/xenbus.h>
     3.5  #include <asm-xen/xen_proc.h>
     3.6  #include <asm/hypervisor.h>
     3.7 -#include <asm-xen/linux-public/xenstored.h>
     3.8  
     3.9  struct xenbus_dev_data {
    3.10  	/* Are there bytes left to be read in this message? */
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Fri Oct 07 15:52:43 2005 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Fri Oct 07 16:49:29 2005 +0100
     4.3 @@ -38,7 +38,6 @@
     4.4  #include <linux/fcntl.h>
     4.5  #include <linux/kthread.h>
     4.6  #include <asm-xen/xenbus.h>
     4.7 -#include <asm-xen/linux-public/xenstored.h>
     4.8  #include "xenbus_comms.h"
     4.9  
    4.10  #define streq(a, b) (strcmp((a), (b)) == 0)
     5.1 --- a/linux-2.6-xen-sparse/include/asm-xen/xenbus.h	Fri Oct 07 15:52:43 2005 +0100
     5.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/xenbus.h	Fri Oct 07 16:49:29 2005 +0100
     5.3 @@ -33,9 +33,7 @@
     5.4  #include <linux/device.h>
     5.5  #include <linux/notifier.h>
     5.6  #include <asm/semaphore.h>
     5.7 -
     5.8 -/* FIXME there's got to be a better way to get at the XS_WATCH macros */
     5.9 -#include <asm-xen/linux-public/xenstored.h>
    5.10 +#include <asm-xen/xen-public/io/xs_wire.h>
    5.11  
    5.12  /* A xenbus device. */
    5.13  struct xenbus_device {
     6.1 --- a/linux-2.6-xen-sparse/mkbuildtree	Fri Oct 07 15:52:43 2005 +0100
     6.2 +++ b/linux-2.6-xen-sparse/mkbuildtree	Fri Oct 07 16:49:29 2005 +0100
     6.3 @@ -113,9 +113,6 @@ mkdir  ${AD}/include/asm-xen/xen-public
     6.4  cd     ${AD}/include/asm-xen/xen-public
     6.5  relative_lndir ../../../${RS}/../xen/include/public
     6.6  
     6.7 -cd ${AD}/include/asm-xen/linux-public
     6.8 -ln -sf ../../../${RS}/../tools/xenstore/xenstored.h
     6.9 -
    6.10  # Arch-specific post-processing
    6.11  cd ${AD}
    6.12  if [ -x arch/${LINUX_ARCH}/xen-mkbuildtree-post ]; then
     7.1 --- a/tools/xenstore/speedtest.c	Fri Oct 07 15:52:43 2005 +0100
     7.2 +++ b/tools/xenstore/speedtest.c	Fri Oct 07 16:49:29 2005 +0100
     7.3 @@ -98,7 +98,7 @@ int main(int argc, char *argv[])
     7.4  
     7.5  		if (i % print == 0)
     7.6  			write(1, ".", 1);
     7.7 -		if (!xs_transaction_start(h, "/")) {
     7.8 +		if (!xs_transaction_start(h)) {
     7.9  			kill_daemon(pid);
    7.10  			barf_perror("Starting transaction");
    7.11  		}
     8.1 --- a/tools/xenstore/xenstored.h	Fri Oct 07 15:52:43 2005 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,97 +0,0 @@
     8.4 -/*
     8.5 - * Simple prototyle Xen Store Daemon providing simple tree-like database.
     8.6 - * Copyright (C) 2005 Rusty Russell IBM Corporation
     8.7 - *
     8.8 - * This file may be distributed separately from the Linux kernel, or
     8.9 - * incorporated into other software packages, subject to the following license:
    8.10 - * 
    8.11 - * Permission is hereby granted, free of charge, to any person obtaining a copy
    8.12 - * of this source file (the "Software"), to deal in the Software without
    8.13 - * restriction, including without limitation the rights to use, copy, modify,
    8.14 - * merge, publish, distribute, sublicense, and/or sell copies of the Software,
    8.15 - * and to permit persons to whom the Software is furnished to do so, subject to
    8.16 - * the following conditions:
    8.17 - * 
    8.18 - * The above copyright notice and this permission notice shall be included in
    8.19 - * all copies or substantial portions of the Software.
    8.20 - * 
    8.21 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    8.22 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    8.23 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    8.24 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    8.25 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    8.26 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
    8.27 - * IN THE SOFTWARE.
    8.28 - */
    8.29 -
    8.30 -#ifndef _XENSTORED_H
    8.31 -#define _XENSTORED_H
    8.32 -
    8.33 -enum xsd_sockmsg_type
    8.34 -{
    8.35 -	XS_DEBUG,
    8.36 -	XS_SHUTDOWN,
    8.37 -	XS_DIRECTORY,
    8.38 -	XS_READ,
    8.39 -	XS_GET_PERMS,
    8.40 -	XS_WATCH,
    8.41 -	XS_WATCH_ACK,
    8.42 -	XS_UNWATCH,
    8.43 -	XS_TRANSACTION_START,
    8.44 -	XS_TRANSACTION_END,
    8.45 -	XS_OP_READ_ONLY = XS_TRANSACTION_END,
    8.46 -	XS_INTRODUCE,
    8.47 -	XS_RELEASE,
    8.48 -	XS_GET_DOMAIN_PATH,
    8.49 -	XS_WRITE,
    8.50 -	XS_MKDIR,
    8.51 -	XS_RM,
    8.52 -	XS_SET_PERMS,
    8.53 -	XS_WATCH_EVENT,
    8.54 -	XS_ERROR,
    8.55 -};
    8.56 -
    8.57 -#define XS_WRITE_NONE "NONE"
    8.58 -#define XS_WRITE_CREATE "CREATE"
    8.59 -#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
    8.60 -
    8.61 -/* We hand errors as strings, for portability. */
    8.62 -struct xsd_errors
    8.63 -{
    8.64 -	int errnum;
    8.65 -	const char *errstring;
    8.66 -};
    8.67 -#define XSD_ERROR(x) { x, #x }
    8.68 -static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
    8.69 -	XSD_ERROR(EINVAL),
    8.70 -	XSD_ERROR(EACCES),
    8.71 -	XSD_ERROR(EEXIST),
    8.72 -	XSD_ERROR(EISDIR),
    8.73 -	XSD_ERROR(ENOENT),
    8.74 -	XSD_ERROR(ENOMEM),
    8.75 -	XSD_ERROR(ENOSPC),
    8.76 -	XSD_ERROR(EIO),
    8.77 -	XSD_ERROR(ENOTEMPTY),
    8.78 -	XSD_ERROR(ENOSYS),
    8.79 -	XSD_ERROR(EROFS),
    8.80 -	XSD_ERROR(EBUSY),
    8.81 -	XSD_ERROR(EAGAIN),
    8.82 -	XSD_ERROR(EISCONN),
    8.83 -};
    8.84 -struct xsd_sockmsg
    8.85 -{
    8.86 -	u32 type;
    8.87 -	u32 len; 		/* Length of data following this. */
    8.88 -
    8.89 -	/* Generally followed by nul-terminated string(s). */
    8.90 -};
    8.91 -
    8.92 -/* FIXME we shouldn't have to declare this in two places, what's the right
    8.93 -   way to share things between xenstored.h and xs.h? */
    8.94 -enum xs_watch_type
    8.95 -{
    8.96 -	XS_WATCH_PATH = 0,
    8.97 -	XS_WATCH_TOKEN,
    8.98 -};
    8.99 -
   8.100 -#endif /* _XENSTORED_H */
     9.1 --- a/tools/xenstore/xenstored_core.c	Fri Oct 07 15:52:43 2005 +0100
     9.2 +++ b/tools/xenstore/xenstored_core.c	Fri Oct 07 16:49:29 2005 +0100
     9.3 @@ -44,7 +44,6 @@
     9.4  #include "list.h"
     9.5  #include "talloc.h"
     9.6  #include "xs_lib.h"
     9.7 -#include "xenstored.h"
     9.8  #include "xenstored_core.h"
     9.9  #include "xenstored_watch.h"
    9.10  #include "xenstored_transaction.h"
    10.1 --- a/tools/xenstore/xenstored_core.h	Fri Oct 07 15:52:43 2005 +0100
    10.2 +++ b/tools/xenstore/xenstored_core.h	Fri Oct 07 16:49:29 2005 +0100
    10.3 @@ -26,7 +26,6 @@
    10.4  #include <stdint.h>
    10.5  #include <errno.h>
    10.6  #include "xs_lib.h"
    10.7 -#include "xenstored.h"
    10.8  #include "list.h"
    10.9  #include "tdb.h"
   10.10  
    11.1 --- a/tools/xenstore/xs.c	Fri Oct 07 15:52:43 2005 +0100
    11.2 +++ b/tools/xenstore/xs.c	Fri Oct 07 16:49:29 2005 +0100
    11.3 @@ -33,8 +33,6 @@
    11.4  #include <errno.h>
    11.5  #include <sys/ioctl.h>
    11.6  #include "xs.h"
    11.7 -#include "xenstored.h"
    11.8 -#include "xs_lib.h"
    11.9  #include "utils.h"
   11.10  
   11.11  struct xs_handle
    12.1 --- a/tools/xenstore/xs.h	Fri Oct 07 15:52:43 2005 +0100
    12.2 +++ b/tools/xenstore/xs.h	Fri Oct 07 16:49:29 2005 +0100
    12.3 @@ -20,18 +20,10 @@
    12.4  #ifndef _XS_H
    12.5  #define _XS_H
    12.6  
    12.7 -#include "xs_lib.h"
    12.8 +#include <xs_lib.h>
    12.9  
   12.10  struct xs_handle;
   12.11  
   12.12 -/* FIXME we shouldn't have to declare this in two places, what's the right
   12.13 -   way to share things between xenstored.h and xs.h? */
   12.14 -enum xs_watch_type
   12.15 -{
   12.16 -	XS_WATCH_PATH = 0,
   12.17 -	XS_WATCH_TOKEN,
   12.18 -};
   12.19 -
   12.20  /* On failure, these routines set errno. */
   12.21  
   12.22  /* Connect to the xs daemon.
    13.1 --- a/tools/xenstore/xs_crashme.c	Fri Oct 07 15:52:43 2005 +0100
    13.2 +++ b/tools/xenstore/xs_crashme.c	Fri Oct 07 16:49:29 2005 +0100
    13.3 @@ -24,7 +24,6 @@
    13.4  #include "xs.h"
    13.5  #include "talloc.h"
    13.6  #include <errno.h>
    13.7 -#include "xenstored.h"
    13.8  
    13.9  #define XSTEST
   13.10  #define RAND_FREQ 128 		/* One char in 32 is corrupted. */
   13.11 @@ -231,20 +230,6 @@ static char *random_path(void)
   13.12  	return ret;
   13.13  }
   13.14  
   13.15 -static int random_flags(int *state)
   13.16 -{
   13.17 -	switch (get_randomness(state) % 4) {
   13.18 -	case 0:
   13.19 -		return 0;
   13.20 -	case 1:
   13.21 -		return O_CREAT;
   13.22 -	case 2:
   13.23 -		return O_CREAT|O_EXCL;
   13.24 -	default:
   13.25 -		return get_randomness(state);
   13.26 -	}
   13.27 -}
   13.28 -
   13.29  /* Do the next operation, return the results. */
   13.30  static void do_next_op(struct xs_handle *h, bool verbose)
   13.31  {
   13.32 @@ -315,7 +300,7 @@ static void do_next_op(struct xs_handle 
   13.33  	case 7: {
   13.34  		if (verbose)
   13.35  			printf("START %s\n", name);
   13.36 -		xs_transaction_start(h, name);
   13.37 +		xs_transaction_start(h);
   13.38  		break;
   13.39  	}
   13.40  	case 8: {
    14.1 --- a/tools/xenstore/xs_lib.h	Fri Oct 07 15:52:43 2005 +0100
    14.2 +++ b/tools/xenstore/xs_lib.h	Fri Oct 07 16:49:29 2005 +0100
    14.3 @@ -23,6 +23,8 @@
    14.4  #include <stdbool.h>
    14.5  #include <limits.h>
    14.6  #include <xenctrl.h>
    14.7 +#include <errno.h>
    14.8 +#include <xen/io/xs_wire.h>
    14.9  
   14.10  /* Bitmask of permissions. */
   14.11  enum xs_perm_type {
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/xen/include/public/io/xs_wire.h	Fri Oct 07 16:49:29 2005 +0100
    15.3 @@ -0,0 +1,96 @@
    15.4 +/*
    15.5 + * Details of the "wire" protocol between Xen Store Daemon and client
    15.6 + * library or guest kernel.
    15.7 + * Copyright (C) 2005 Rusty Russell IBM Corporation
    15.8 + *
    15.9 + * This file may be distributed separately from the Linux kernel, or
   15.10 + * incorporated into other software packages, subject to the following license:
   15.11 + * 
   15.12 + * Permission is hereby granted, free of charge, to any person obtaining a copy
   15.13 + * of this source file (the "Software"), to deal in the Software without
   15.14 + * restriction, including without limitation the rights to use, copy, modify,
   15.15 + * merge, publish, distribute, sublicense, and/or sell copies of the Software,
   15.16 + * and to permit persons to whom the Software is furnished to do so, subject to
   15.17 + * the following conditions:
   15.18 + * 
   15.19 + * The above copyright notice and this permission notice shall be included in
   15.20 + * all copies or substantial portions of the Software.
   15.21 + * 
   15.22 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   15.23 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   15.24 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   15.25 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   15.26 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   15.27 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
   15.28 + * IN THE SOFTWARE.
   15.29 + */
   15.30 +
   15.31 +#ifndef _XS_WIRE_H
   15.32 +#define _XS_WIRE_H
   15.33 +
   15.34 +enum xsd_sockmsg_type
   15.35 +{
   15.36 +	XS_DEBUG,
   15.37 +	XS_SHUTDOWN,
   15.38 +	XS_DIRECTORY,
   15.39 +	XS_READ,
   15.40 +	XS_GET_PERMS,
   15.41 +	XS_WATCH,
   15.42 +	XS_WATCH_ACK,
   15.43 +	XS_UNWATCH,
   15.44 +	XS_TRANSACTION_START,
   15.45 +	XS_TRANSACTION_END,
   15.46 +	XS_OP_READ_ONLY = XS_TRANSACTION_END,
   15.47 +	XS_INTRODUCE,
   15.48 +	XS_RELEASE,
   15.49 +	XS_GET_DOMAIN_PATH,
   15.50 +	XS_WRITE,
   15.51 +	XS_MKDIR,
   15.52 +	XS_RM,
   15.53 +	XS_SET_PERMS,
   15.54 +	XS_WATCH_EVENT,
   15.55 +	XS_ERROR,
   15.56 +};
   15.57 +
   15.58 +#define XS_WRITE_NONE "NONE"
   15.59 +#define XS_WRITE_CREATE "CREATE"
   15.60 +#define XS_WRITE_CREATE_EXCL "CREATE|EXCL"
   15.61 +
   15.62 +/* We hand errors as strings, for portability. */
   15.63 +struct xsd_errors
   15.64 +{
   15.65 +	int errnum;
   15.66 +	const char *errstring;
   15.67 +};
   15.68 +#define XSD_ERROR(x) { x, #x }
   15.69 +static struct xsd_errors xsd_errors[] __attribute__((unused)) = {
   15.70 +	XSD_ERROR(EINVAL),
   15.71 +	XSD_ERROR(EACCES),
   15.72 +	XSD_ERROR(EEXIST),
   15.73 +	XSD_ERROR(EISDIR),
   15.74 +	XSD_ERROR(ENOENT),
   15.75 +	XSD_ERROR(ENOMEM),
   15.76 +	XSD_ERROR(ENOSPC),
   15.77 +	XSD_ERROR(EIO),
   15.78 +	XSD_ERROR(ENOTEMPTY),
   15.79 +	XSD_ERROR(ENOSYS),
   15.80 +	XSD_ERROR(EROFS),
   15.81 +	XSD_ERROR(EBUSY),
   15.82 +	XSD_ERROR(EAGAIN),
   15.83 +	XSD_ERROR(EISCONN),
   15.84 +};
   15.85 +struct xsd_sockmsg
   15.86 +{
   15.87 +	u32 type;
   15.88 +	u32 len; 		/* Length of data following this. */
   15.89 +
   15.90 +	/* Generally followed by nul-terminated string(s). */
   15.91 +};
   15.92 +
   15.93 +enum xs_watch_type
   15.94 +{
   15.95 +	XS_WATCH_PATH = 0,
   15.96 +	XS_WATCH_TOKEN,
   15.97 +};
   15.98 +
   15.99 +#endif /* _XS_WIRE_H */