# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 26599c5d298d128d0317a66c93332e241058ba68
# Parent 68e754d7e1cb56ad6c732b1f896063f22850749c
# Parent ffbee4415bf72ad092741c215484e8d83245bd51
merge
diff -r 68e754d7e1cb -r 26599c5d298d tools/python/xen/util/auxbin.py
--- a/tools/python/xen/util/auxbin.py Wed Oct 12 12:03:10 2005
+++ b/tools/python/xen/util/auxbin.py Wed Oct 12 12:06:35 2005
@@ -19,6 +19,10 @@
LIB_BIN_32 = "/usr/lib/xen/bin"
LIB_BIN_64 = "/usr/lib64/xen/bin"
+## The architectures on which the LIB_BIN_64 directory is used. This
+# deliberately excludes ia64.
+LIB_64_ARCHS = [ 'x86_64', 'ppc64', 's390x', 'sparc64']
+
import os
import os.path
@@ -38,7 +42,7 @@
def path():
machine = os.uname()[4]
- if machine.find('64') != -1 and os.path.exists(LIB_BIN_64):
+ if machine in LIB_64_ARCHS and os.path.exists(LIB_BIN_64):
return LIB_BIN_64
else:
return LIB_BIN_32
diff -r 68e754d7e1cb -r 26599c5d298d tools/xenstore/xenstore_client.c
--- a/tools/xenstore/xenstore_client.c Wed Oct 12 12:03:10 2005
+++ b/tools/xenstore/xenstore_client.c Wed Oct 12 12:06:35 2005
@@ -4,6 +4,7 @@
* this archive for more details.
*
* Copyright (C) 2005 by Christian Limpach
+ * Copyright (C) 2005 XenSource Ltd.
*
*/
@@ -28,16 +29,71 @@
#endif
}
+
+static int
+perform(int optind, int argc, char **argv, struct xs_handle *xsh,
+ struct xs_transaction_handle *xth, int prefix)
+{
+ while (optind < argc) {
+#if defined(CLIENT_read)
+ char *val = xs_read(xsh, xth, argv[optind], NULL);
+ if (val == NULL) {
+ warnx("couldn't read path %s", argv[optind]);
+ return 1;
+ }
+ if (prefix)
+ printf("%s: ", argv[optind]);
+ printf("%s\n", val);
+ free(val);
+ optind++;
+#elif defined(CLIENT_write)
+ if (!xs_write(xsh, xth, argv[optind], argv[optind + 1],
+ strlen(argv[optind + 1]))) {
+ warnx("could not write path %s", argv[optind]);
+ return 1;
+ }
+ optind += 2;
+#elif defined(CLIENT_rm)
+ if (!xs_rm(xsh, xth, argv[optind])) {
+ warnx("could not remove path %s", argv[optind]);
+ return 1;
+ }
+ optind++;
+#elif defined(CLIENT_exists)
+ char *val = xs_read(xsh, xth, argv[optind], NULL);
+ if (val == NULL) {
+ return 1;
+ }
+ free(val);
+ optind++;
+#elif defined(CLIENT_list)
+ unsigned int i, num;
+ char **list = xs_directory(xsh, xth, argv[optind], &num);
+ if (list == NULL) {
+ warnx("could not list path %s", argv[optind]);
+ return 1;
+ }
+ for (i = 0; i < num; i++) {
+ if (prefix)
+ printf("%s/", argv[optind]);
+ printf("%s\n", list[i]);
+ }
+ free(list);
+ optind++;
+#endif
+ }
+
+ return 0;
+}
+
+
int
main(int argc, char **argv)
{
struct xs_handle *xsh;
struct xs_transaction_handle *xth;
- bool success;
int ret = 0, socket = 0;
-#if defined(CLIENT_read) || defined(CLIENT_list)
int prefix = 0;
-#endif
while (1) {
int c, index = 0;
@@ -93,65 +149,9 @@
if (xth == NULL)
errx(1, "couldn't start transaction");
- while (optind < argc) {
-#if defined(CLIENT_read)
- char *val = xs_read(xsh, xth, argv[optind], NULL);
- if (val == NULL) {
- warnx("couldn't read path %s", argv[optind]);
- ret = 1;
- goto out;
- }
- if (prefix)
- printf("%s: ", argv[optind]);
- printf("%s\n", val);
- free(val);
- optind++;
-#elif defined(CLIENT_write)
- success = xs_write(xsh, xth, argv[optind], argv[optind + 1],
- strlen(argv[optind + 1]));
- if (!success) {
- warnx("could not write path %s", argv[optind]);
- ret = 1;
- goto out;
- }
- optind += 2;
-#elif defined(CLIENT_rm)
- success = xs_rm(xsh, xth, argv[optind]);
- if (!success) {
- warnx("could not remove path %s", argv[optind]);
- ret = 1;
- goto out;
- }
- optind++;
-#elif defined(CLIENT_exists)
- char *val = xs_read(xsh, xth, argv[optind], NULL);
- if (val == NULL) {
- ret = 1;
- goto out;
- }
- free(val);
- optind++;
-#elif defined(CLIENT_list)
- unsigned int i, num;
- char **list = xs_directory(xsh, xth, argv[optind], &num);
- if (list == NULL) {
- warnx("could not list path %s", argv[optind]);
- ret = 1;
- goto out;
- }
- for (i = 0; i < num; i++) {
- if (prefix)
- printf("%s/", argv[optind]);
- printf("%s\n", list[i]);
- }
- free(list);
- optind++;
-#endif
- }
+ ret = perform(optind, argc, argv, xsh, xth, prefix);
- out:
- success = xs_transaction_end(xsh, xth, ret ? true : false);
- if (!success) {
+ if (!xs_transaction_end(xsh, xth, ret)) {
if (ret == 0 && errno == EAGAIN)
goto again;
errx(1, "couldn't end transaction");
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|