ia64/xen-unstable

changeset 7356:26599c5d298d

merge
author kaf24@firebug.cl.cam.ac.uk
date Wed Oct 12 13:06:35 2005 +0100 (2005-10-12)
parents 68e754d7e1cb ffbee4415bf7
children 97648825856b
files
line diff
     1.1 --- a/tools/python/xen/util/auxbin.py	Wed Oct 12 13:03:10 2005 +0100
     1.2 +++ b/tools/python/xen/util/auxbin.py	Wed Oct 12 13:06:35 2005 +0100
     1.3 @@ -19,6 +19,10 @@
     1.4  LIB_BIN_32 = "/usr/lib/xen/bin"
     1.5  LIB_BIN_64 = "/usr/lib64/xen/bin"
     1.6  
     1.7 +## The architectures on which the LIB_BIN_64 directory is used.  This
     1.8 +# deliberately excludes ia64.
     1.9 +LIB_64_ARCHS = [ 'x86_64', 'ppc64', 's390x', 'sparc64']
    1.10 +
    1.11  
    1.12  import os
    1.13  import os.path
    1.14 @@ -38,7 +42,7 @@ def pathTo(exe):
    1.15  
    1.16  def path():
    1.17      machine = os.uname()[4]
    1.18 -    if machine.find('64') != -1 and os.path.exists(LIB_BIN_64):
    1.19 +    if machine in LIB_64_ARCHS and os.path.exists(LIB_BIN_64):
    1.20          return LIB_BIN_64
    1.21      else:
    1.22          return LIB_BIN_32
     2.1 --- a/tools/xenstore/xenstore_client.c	Wed Oct 12 13:03:10 2005 +0100
     2.2 +++ b/tools/xenstore/xenstore_client.c	Wed Oct 12 13:06:35 2005 +0100
     2.3 @@ -4,6 +4,7 @@
     2.4   * this archive for more details.
     2.5   *
     2.6   * Copyright (C) 2005 by Christian Limpach
     2.7 + * Copyright (C) 2005 XenSource Ltd.
     2.8   *
     2.9   */
    2.10  
    2.11 @@ -28,16 +29,71 @@ usage(const char *progname)
    2.12  #endif
    2.13  }
    2.14  
    2.15 +
    2.16 +static int
    2.17 +perform(int optind, int argc, char **argv, struct xs_handle *xsh,
    2.18 +        struct xs_transaction_handle *xth, int prefix)
    2.19 +{
    2.20 +    while (optind < argc) {
    2.21 +#if defined(CLIENT_read)
    2.22 +	char *val = xs_read(xsh, xth, argv[optind], NULL);
    2.23 +	if (val == NULL) {
    2.24 +	    warnx("couldn't read path %s", argv[optind]);
    2.25 +	    return 1;
    2.26 +	}
    2.27 +	if (prefix)
    2.28 +	    printf("%s: ", argv[optind]);
    2.29 +	printf("%s\n", val);
    2.30 +	free(val);
    2.31 +	optind++;
    2.32 +#elif defined(CLIENT_write)
    2.33 +	if (!xs_write(xsh, xth, argv[optind], argv[optind + 1],
    2.34 +                      strlen(argv[optind + 1]))) {
    2.35 +	    warnx("could not write path %s", argv[optind]);
    2.36 +	    return 1;
    2.37 +	}
    2.38 +	optind += 2;
    2.39 +#elif defined(CLIENT_rm)
    2.40 +	if (!xs_rm(xsh, xth, argv[optind])) {
    2.41 +	    warnx("could not remove path %s", argv[optind]);
    2.42 +	    return 1;
    2.43 +	}
    2.44 +	optind++;
    2.45 +#elif defined(CLIENT_exists)
    2.46 +	char *val = xs_read(xsh, xth, argv[optind], NULL);
    2.47 +	if (val == NULL) {
    2.48 +	    return 1;
    2.49 +	}
    2.50 +	free(val);
    2.51 +	optind++;
    2.52 +#elif defined(CLIENT_list)
    2.53 +	unsigned int i, num;
    2.54 +	char **list = xs_directory(xsh, xth, argv[optind], &num);
    2.55 +	if (list == NULL) {
    2.56 +	    warnx("could not list path %s", argv[optind]);
    2.57 +	    return 1;
    2.58 +	}
    2.59 +	for (i = 0; i < num; i++) {
    2.60 +	    if (prefix)
    2.61 +		printf("%s/", argv[optind]);
    2.62 +	    printf("%s\n", list[i]);
    2.63 +	}
    2.64 +	free(list);
    2.65 +	optind++;
    2.66 +#endif
    2.67 +    }
    2.68 +
    2.69 +    return 0;
    2.70 +}
    2.71 +
    2.72 +
    2.73  int
    2.74  main(int argc, char **argv)
    2.75  {
    2.76      struct xs_handle *xsh;
    2.77      struct xs_transaction_handle *xth;
    2.78 -    bool success;
    2.79      int ret = 0, socket = 0;
    2.80 -#if defined(CLIENT_read) || defined(CLIENT_list)
    2.81      int prefix = 0;
    2.82 -#endif
    2.83  
    2.84      while (1) {
    2.85  	int c, index = 0;
    2.86 @@ -93,65 +149,9 @@ main(int argc, char **argv)
    2.87      if (xth == NULL)
    2.88  	errx(1, "couldn't start transaction");
    2.89  
    2.90 -    while (optind < argc) {
    2.91 -#if defined(CLIENT_read)
    2.92 -	char *val = xs_read(xsh, xth, argv[optind], NULL);
    2.93 -	if (val == NULL) {
    2.94 -	    warnx("couldn't read path %s", argv[optind]);
    2.95 -	    ret = 1;
    2.96 -	    goto out;
    2.97 -	}
    2.98 -	if (prefix)
    2.99 -	    printf("%s: ", argv[optind]);
   2.100 -	printf("%s\n", val);
   2.101 -	free(val);
   2.102 -	optind++;
   2.103 -#elif defined(CLIENT_write)
   2.104 -	success = xs_write(xsh, xth, argv[optind], argv[optind + 1],
   2.105 -			   strlen(argv[optind + 1]));
   2.106 -	if (!success) {
   2.107 -	    warnx("could not write path %s", argv[optind]);
   2.108 -	    ret = 1;
   2.109 -	    goto out;
   2.110 -	}
   2.111 -	optind += 2;
   2.112 -#elif defined(CLIENT_rm)
   2.113 -	success = xs_rm(xsh, xth, argv[optind]);
   2.114 -	if (!success) {
   2.115 -	    warnx("could not remove path %s", argv[optind]);
   2.116 -	    ret = 1;
   2.117 -	    goto out;
   2.118 -	}
   2.119 -	optind++;
   2.120 -#elif defined(CLIENT_exists)
   2.121 -	char *val = xs_read(xsh, xth, argv[optind], NULL);
   2.122 -	if (val == NULL) {
   2.123 -	    ret = 1;
   2.124 -	    goto out;
   2.125 -	}
   2.126 -	free(val);
   2.127 -	optind++;
   2.128 -#elif defined(CLIENT_list)
   2.129 -	unsigned int i, num;
   2.130 -	char **list = xs_directory(xsh, xth, argv[optind], &num);
   2.131 -	if (list == NULL) {
   2.132 -	    warnx("could not list path %s", argv[optind]);
   2.133 -	    ret = 1;
   2.134 -	    goto out;
   2.135 -	}
   2.136 -	for (i = 0; i < num; i++) {
   2.137 -	    if (prefix)
   2.138 -		printf("%s/", argv[optind]);
   2.139 -	    printf("%s\n", list[i]);
   2.140 -	}
   2.141 -	free(list);
   2.142 -	optind++;
   2.143 -#endif
   2.144 -    }
   2.145 +    ret = perform(optind, argc, argv, xsh, xth, prefix);
   2.146  
   2.147 - out:
   2.148 -    success = xs_transaction_end(xsh, xth, ret ? true : false);
   2.149 -    if (!success) {
   2.150 +    if (!xs_transaction_end(xsh, xth, ret)) {
   2.151  	if (ret == 0 && errno == EAGAIN)
   2.152  	    goto again;
   2.153  	errx(1, "couldn't end transaction");