ia64/xen-unstable

changeset 8554:f226284e5c1a

Share the same name for xenbus transaction type between user and kernel

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Wed Jan 11 11:46:32 2006 +0000 (2006-01-11)
parents a248738166b1
children e629bb62c63e
files tools/python/xen/lowlevel/xs/xs.c tools/xenstore/xenstore_client.c tools/xenstore/xs.c tools/xenstore/xs.h tools/xenstore/xs_test.c
line diff
     1.1 --- a/tools/python/xen/lowlevel/xs/xs.c	Wed Jan 11 11:34:05 2006 +0100
     1.2 +++ b/tools/python/xen/lowlevel/xs/xs.c	Wed Jan 11 11:46:32 2006 +0000
     1.3 @@ -66,7 +66,7 @@ static PyObject *none(bool result);
     1.4  
     1.5  static int parse_transaction_path(XsHandle *self, PyObject *args,
     1.6                                    struct xs_handle **xh,
     1.7 -                                  xs_transaction_handle *th,
     1.8 +                                  xs_transaction_t *th,
     1.9                                    char **path);
    1.10  
    1.11  
    1.12 @@ -83,7 +83,7 @@ static int parse_transaction_path(XsHand
    1.13  static PyObject *xspy_read(XsHandle *self, PyObject *args)
    1.14  {
    1.15      struct xs_handle *xh;
    1.16 -    xs_transaction_handle th;
    1.17 +    xs_transaction_t th;
    1.18      char *path;
    1.19  
    1.20      char *xsval;
    1.21 @@ -120,7 +120,7 @@ static PyObject *xspy_write(XsHandle *se
    1.22  {
    1.23      static char *arg_spec = "sss#";
    1.24      struct xs_handle *xh = xshandle(self);
    1.25 -    xs_transaction_handle th;
    1.26 +    xs_transaction_t th;
    1.27      char *thstr;
    1.28      char *path;
    1.29      char *data;
    1.30 @@ -132,7 +132,7 @@ static PyObject *xspy_write(XsHandle *se
    1.31      if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path, &data, &data_n))
    1.32          return NULL;
    1.33  
    1.34 -    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
    1.35 +    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
    1.36  
    1.37      Py_BEGIN_ALLOW_THREADS
    1.38      result = xs_write(xh, th, path, data, data_n);
    1.39 @@ -155,7 +155,7 @@ static PyObject *xspy_write(XsHandle *se
    1.40  static PyObject *xspy_ls(XsHandle *self, PyObject *args)
    1.41  {
    1.42      struct xs_handle *xh;
    1.43 -    xs_transaction_handle th;
    1.44 +    xs_transaction_t th;
    1.45      char *path;
    1.46  
    1.47      char **xsval;
    1.48 @@ -193,7 +193,7 @@ static PyObject *xspy_ls(XsHandle *self,
    1.49  static PyObject *xspy_mkdir(XsHandle *self, PyObject *args)
    1.50  {
    1.51      struct xs_handle *xh;
    1.52 -    xs_transaction_handle th;
    1.53 +    xs_transaction_t th;
    1.54      char *path;
    1.55  
    1.56      bool result;
    1.57 @@ -221,7 +221,7 @@ static PyObject *xspy_mkdir(XsHandle *se
    1.58  static PyObject *xspy_rm(XsHandle *self, PyObject *args)
    1.59  {
    1.60      struct xs_handle *xh;
    1.61 -    xs_transaction_handle th;
    1.62 +    xs_transaction_t th;
    1.63      char *path;
    1.64  
    1.65      bool result;
    1.66 @@ -256,7 +256,7 @@ static PyObject *xspy_get_permissions(Xs
    1.67      unsigned int perms_n = 0;
    1.68      int i;
    1.69  
    1.70 -    xs_transaction_handle th;
    1.71 +    xs_transaction_t th;
    1.72      char *thstr;
    1.73  
    1.74      if (!xh)
    1.75 @@ -264,7 +264,7 @@ static PyObject *xspy_get_permissions(Xs
    1.76      if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path))
    1.77          return NULL;
    1.78  
    1.79 -    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
    1.80 +    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
    1.81  
    1.82      Py_BEGIN_ALLOW_THREADS
    1.83      perms = xs_get_permissions(xh, th, path, &perms_n);
    1.84 @@ -312,7 +312,7 @@ static PyObject *xspy_set_permissions(Xs
    1.85      int xsperms_n;
    1.86      PyObject *tuple0 = NULL;
    1.87  
    1.88 -    xs_transaction_handle th;
    1.89 +    xs_transaction_t th;
    1.90      char *thstr;
    1.91  
    1.92      if (!xh)
    1.93 @@ -320,7 +320,7 @@ static PyObject *xspy_set_permissions(Xs
    1.94      if (!PyArg_ParseTuple(args, "ssO", &thstr, &path, &perms))
    1.95          goto exit;
    1.96  
    1.97 -    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
    1.98 +    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
    1.99  
   1.100      if (!PyList_Check(perms)) {
   1.101          PyErr_SetString(PyExc_RuntimeError, "perms must be a list");
   1.102 @@ -509,7 +509,7 @@ static PyObject *xspy_unwatch(XsHandle *
   1.103  static PyObject *xspy_transaction_start(XsHandle *self)
   1.104  {
   1.105      struct xs_handle *xh = xshandle(self);
   1.106 -    xs_transaction_handle th;
   1.107 +    xs_transaction_t th;
   1.108      char thstr[MAX_STRLEN(unsigned long) + 1];
   1.109  
   1.110      if (!xh)
   1.111 @@ -547,7 +547,7 @@ static PyObject *xspy_transaction_end(Xs
   1.112      struct xs_handle *xh = xshandle(self);
   1.113      bool result;
   1.114  
   1.115 -    xs_transaction_handle th;
   1.116 +    xs_transaction_t th;
   1.117      char *thstr;
   1.118  
   1.119      if (!xh)
   1.120 @@ -556,7 +556,7 @@ static PyObject *xspy_transaction_end(Xs
   1.121                                       &thstr, &abort))
   1.122          return NULL;
   1.123  
   1.124 -    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
   1.125 +    th = (xs_transaction_t)strtoul(thstr, NULL, 16);
   1.126  
   1.127      Py_BEGIN_ALLOW_THREADS
   1.128      result = xs_transaction_end(xh, th, abort);
   1.129 @@ -727,7 +727,7 @@ static void remove_watch(XsHandle *self,
   1.130   */
   1.131  static int parse_transaction_path(XsHandle *self, PyObject *args,
   1.132                                    struct xs_handle **xh,
   1.133 -                                  xs_transaction_handle *th,
   1.134 +                                  xs_transaction_t *th,
   1.135                                    char **path)
   1.136  {
   1.137      char *thstr;
   1.138 @@ -740,7 +740,7 @@ static int parse_transaction_path(XsHand
   1.139      if (!PyArg_ParseTuple(args, "ss", &thstr, path))
   1.140          return 0;
   1.141  
   1.142 -    *th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
   1.143 +    *th = (xs_transaction_t)strtoul(thstr, NULL, 16);
   1.144  
   1.145      return 1;
   1.146  }
     2.1 --- a/tools/xenstore/xenstore_client.c	Wed Jan 11 11:34:05 2006 +0100
     2.2 +++ b/tools/xenstore/xenstore_client.c	Wed Jan 11 11:46:32 2006 +0000
     2.3 @@ -66,7 +66,7 @@ usage(const char *progname)
     2.4  
     2.5  #if defined(CLIENT_rm)
     2.6  static int
     2.7 -do_rm(char *path, struct xs_handle *xsh, xs_transaction_handle xth)
     2.8 +do_rm(char *path, struct xs_handle *xsh, xs_transaction_t xth)
     2.9  {
    2.10      if (xs_rm(xsh, xth, path)) {
    2.11          return 0;
    2.12 @@ -81,7 +81,7 @@ do_rm(char *path, struct xs_handle *xsh,
    2.13  
    2.14  static int
    2.15  perform(int optind, int argc, char **argv, struct xs_handle *xsh,
    2.16 -        xs_transaction_handle xth, int prefix, int tidy)
    2.17 +        xs_transaction_t xth, int prefix, int tidy)
    2.18  {
    2.19      while (optind < argc) {
    2.20  #if defined(CLIENT_read)
    2.21 @@ -179,7 +179,7 @@ int
    2.22  main(int argc, char **argv)
    2.23  {
    2.24      struct xs_handle *xsh;
    2.25 -    xs_transaction_handle xth;
    2.26 +    xs_transaction_t xth;
    2.27      int ret = 0, socket = 0;
    2.28      int prefix = 0;
    2.29      int tidy = 0;
     3.1 --- a/tools/xenstore/xs.c	Wed Jan 11 11:34:05 2006 +0100
     3.2 +++ b/tools/xenstore/xs.c	Wed Jan 11 11:46:32 2006 +0000
     3.3 @@ -292,7 +292,7 @@ static void *read_reply(
     3.4  }
     3.5  
     3.6  /* Send message to xs, get malloc'ed reply.  NULL and set errno on error. */
     3.7 -static void *xs_talkv(struct xs_handle *h, xs_transaction_handle t,
     3.8 +static void *xs_talkv(struct xs_handle *h, xs_transaction_t t,
     3.9  		      enum xsd_sockmsg_type type,
    3.10  		      const struct iovec *iovec,
    3.11  		      unsigned int num_vecs,
    3.12 @@ -368,7 +368,7 @@ static void free_no_errno(void *p)
    3.13  }
    3.14  
    3.15  /* Simplified version of xs_talkv: single message. */
    3.16 -static void *xs_single(struct xs_handle *h, xs_transaction_handle t,
    3.17 +static void *xs_single(struct xs_handle *h, xs_transaction_t t,
    3.18  		       enum xsd_sockmsg_type type,
    3.19  		       const char *string,
    3.20  		       unsigned int *len)
    3.21 @@ -388,7 +388,7 @@ static bool xs_bool(char *reply)
    3.22  	return true;
    3.23  }
    3.24  
    3.25 -char **xs_directory(struct xs_handle *h, xs_transaction_handle t,
    3.26 +char **xs_directory(struct xs_handle *h, xs_transaction_t t,
    3.27  		    const char *path, unsigned int *num)
    3.28  {
    3.29  	char *strings, *p, **ret;
    3.30 @@ -420,7 +420,7 @@ char **xs_directory(struct xs_handle *h,
    3.31   * Returns a malloced value: call free() on it after use.
    3.32   * len indicates length in bytes, not including the nul.
    3.33   */
    3.34 -void *xs_read(struct xs_handle *h, xs_transaction_handle t,
    3.35 +void *xs_read(struct xs_handle *h, xs_transaction_t t,
    3.36  	      const char *path, unsigned int *len)
    3.37  {
    3.38  	return xs_single(h, t, XS_READ, path, len);
    3.39 @@ -429,7 +429,7 @@ void *xs_read(struct xs_handle *h, xs_tr
    3.40  /* Write the value of a single file.
    3.41   * Returns false on failure.
    3.42   */
    3.43 -bool xs_write(struct xs_handle *h, xs_transaction_handle t,
    3.44 +bool xs_write(struct xs_handle *h, xs_transaction_t t,
    3.45  	      const char *path, const void *data, unsigned int len)
    3.46  {
    3.47  	struct iovec iovec[2];
    3.48 @@ -446,7 +446,7 @@ bool xs_write(struct xs_handle *h, xs_tr
    3.49  /* Create a new directory.
    3.50   * Returns false on failure, or success if it already exists.
    3.51   */
    3.52 -bool xs_mkdir(struct xs_handle *h, xs_transaction_handle t,
    3.53 +bool xs_mkdir(struct xs_handle *h, xs_transaction_t t,
    3.54  	      const char *path)
    3.55  {
    3.56  	return xs_bool(xs_single(h, t, XS_MKDIR, path, NULL));
    3.57 @@ -455,7 +455,7 @@ bool xs_mkdir(struct xs_handle *h, xs_tr
    3.58  /* Destroy a file or directory (directories must be empty).
    3.59   * Returns false on failure, or success if it doesn't exist.
    3.60   */
    3.61 -bool xs_rm(struct xs_handle *h, xs_transaction_handle t,
    3.62 +bool xs_rm(struct xs_handle *h, xs_transaction_t t,
    3.63  	   const char *path)
    3.64  {
    3.65  	return xs_bool(xs_single(h, t, XS_RM, path, NULL));
    3.66 @@ -465,7 +465,7 @@ bool xs_rm(struct xs_handle *h, xs_trans
    3.67   * Returns malloced array, or NULL: call free() after use.
    3.68   */
    3.69  struct xs_permissions *xs_get_permissions(struct xs_handle *h,
    3.70 -					  xs_transaction_handle t,
    3.71 +					  xs_transaction_t t,
    3.72  					  const char *path, unsigned int *num)
    3.73  {
    3.74  	char *strings;
    3.75 @@ -499,7 +499,7 @@ struct xs_permissions *xs_get_permission
    3.76   * Returns false on failure.
    3.77   */
    3.78  bool xs_set_permissions(struct xs_handle *h,
    3.79 -			xs_transaction_handle t,
    3.80 +			xs_transaction_t t,
    3.81  			const char *path,
    3.82  			struct xs_permissions *perms,
    3.83  			unsigned int num_perms)
    3.84 @@ -636,7 +636,7 @@ bool xs_unwatch(struct xs_handle *h, con
    3.85   * You can only have one transaction at any time.
    3.86   * Returns NULL on failure.
    3.87   */
    3.88 -xs_transaction_handle xs_transaction_start(struct xs_handle *h)
    3.89 +xs_transaction_t xs_transaction_start(struct xs_handle *h)
    3.90  {
    3.91  	char *id_str;
    3.92  	unsigned long id;
    3.93 @@ -648,7 +648,7 @@ xs_transaction_handle xs_transaction_sta
    3.94  	id = strtoul(id_str, NULL, 0);
    3.95  	free(id_str);
    3.96  
    3.97 -	return (xs_transaction_handle)id;
    3.98 +	return (xs_transaction_t)id;
    3.99  }
   3.100  
   3.101  /* End a transaction.
   3.102 @@ -656,7 +656,7 @@ xs_transaction_handle xs_transaction_sta
   3.103   * Returns false on failure, which indicates an error: transactions will
   3.104   * not fail spuriously.
   3.105   */
   3.106 -bool xs_transaction_end(struct xs_handle *h, xs_transaction_handle t,
   3.107 +bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
   3.108  			bool abort)
   3.109  {
   3.110  	char abortstr[2];
     4.1 --- a/tools/xenstore/xs.h	Wed Jan 11 11:34:05 2006 +0100
     4.2 +++ b/tools/xenstore/xs.h	Wed Jan 11 11:46:32 2006 +0000
     4.3 @@ -25,8 +25,8 @@
     4.4  #define XBT_NULL NULL
     4.5  
     4.6  struct xs_handle;
     4.7 -struct xs_transaction_handle;
     4.8 -typedef struct xs_transaction_handle * xs_transaction_handle;
     4.9 +struct xs_transaction_t;
    4.10 +typedef struct xs_transaction_t * xs_transaction_t;
    4.11  
    4.12  /* On failure, these routines set errno. */
    4.13  
    4.14 @@ -48,45 +48,45 @@ void xs_daemon_close(struct xs_handle *)
    4.15   * Returns a malloced array: call free() on it after use.
    4.16   * Num indicates size.
    4.17   */
    4.18 -char **xs_directory(struct xs_handle *h, xs_transaction_handle t,
    4.19 +char **xs_directory(struct xs_handle *h, xs_transaction_t t,
    4.20  		    const char *path, unsigned int *num);
    4.21  
    4.22  /* Get the value of a single file, nul terminated.
    4.23   * Returns a malloced value: call free() on it after use.
    4.24   * len indicates length in bytes, not including terminator.
    4.25   */
    4.26 -void *xs_read(struct xs_handle *h, xs_transaction_handle t,
    4.27 +void *xs_read(struct xs_handle *h, xs_transaction_t t,
    4.28  	      const char *path, unsigned int *len);
    4.29  
    4.30  /* Write the value of a single file.
    4.31   * Returns false on failure.
    4.32   */
    4.33 -bool xs_write(struct xs_handle *h, xs_transaction_handle t,
    4.34 +bool xs_write(struct xs_handle *h, xs_transaction_t t,
    4.35  	      const char *path, const void *data, unsigned int len);
    4.36  
    4.37  /* Create a new directory.
    4.38   * Returns false on failure, or success if it already exists.
    4.39   */
    4.40 -bool xs_mkdir(struct xs_handle *h, xs_transaction_handle t,
    4.41 +bool xs_mkdir(struct xs_handle *h, xs_transaction_t t,
    4.42  	      const char *path);
    4.43  
    4.44  /* Destroy a file or directory (and children).
    4.45   * Returns false on failure, or if it doesn't exist.
    4.46   */
    4.47 -bool xs_rm(struct xs_handle *h, xs_transaction_handle t,
    4.48 +bool xs_rm(struct xs_handle *h, xs_transaction_t t,
    4.49  	   const char *path);
    4.50  
    4.51  /* Get permissions of node (first element is owner, first perms is "other").
    4.52   * Returns malloced array, or NULL: call free() after use.
    4.53   */
    4.54  struct xs_permissions *xs_get_permissions(struct xs_handle *h,
    4.55 -					  xs_transaction_handle t,
    4.56 +					  xs_transaction_t t,
    4.57  					  const char *path, unsigned int *num);
    4.58  
    4.59  /* Set permissions of node (must be owner).
    4.60   * Returns false on failure.
    4.61   */
    4.62 -bool xs_set_permissions(struct xs_handle *h, xs_transaction_handle t,
    4.63 +bool xs_set_permissions(struct xs_handle *h, xs_transaction_t t,
    4.64  			const char *path, struct xs_permissions *perms,
    4.65  			unsigned int num_perms);
    4.66  
    4.67 @@ -116,14 +116,14 @@ bool xs_unwatch(struct xs_handle *h, con
    4.68   * You can only have one transaction at any time.
    4.69   * Returns NULL on failure.
    4.70   */
    4.71 -xs_transaction_handle xs_transaction_start(struct xs_handle *h);
    4.72 +xs_transaction_t xs_transaction_start(struct xs_handle *h);
    4.73  
    4.74  /* End a transaction.
    4.75   * If abandon is true, transaction is discarded instead of committed.
    4.76   * Returns false on failure: if errno == EAGAIN, you have to restart
    4.77   * transaction.
    4.78   */
    4.79 -bool xs_transaction_end(struct xs_handle *h, xs_transaction_handle t,
    4.80 +bool xs_transaction_end(struct xs_handle *h, xs_transaction_t t,
    4.81  			bool abort);
    4.82  
    4.83  /* Introduce a new domain.
     5.1 --- a/tools/xenstore/xs_test.c	Wed Jan 11 11:34:05 2006 +0100
     5.2 +++ b/tools/xenstore/xs_test.c	Wed Jan 11 11:46:32 2006 +0000
     5.3 @@ -43,7 +43,7 @@
     5.4  #define XSTEST
     5.5  
     5.6  static struct xs_handle *handles[10] = { NULL };
     5.7 -static xs_transaction_handle txh[10] = { XBT_NULL };
     5.8 +static xs_transaction_t txh[10] = { XBT_NULL };
     5.9  
    5.10  static unsigned int timeout_ms = 500;
    5.11  static bool timeout_suppressed = true;