[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xenstore-chmod: handle arbitrary number of perms rather than MAX_PERMS constant
# HG changeset patch # User Chunyan Liu <cyliu@xxxxxxxx> # Date 1354025618 0 # Node ID 48a02f60bf1e4be1f376a848fb6800e4caf333b6 # Parent 16bf7f3069a77c8a15b785cfdb5f2f634661d7fc xenstore-chmod: handle arbitrary number of perms rather than MAX_PERMS constant Constant MAX_PERMS 16 is too small to use in some occasions, e.g. if there are more than 16 domU(s) on one hypervisor (it's easy to achieve) and one wants to do xenstore-chmod PATH to all domU(s). So, remove MAX_PERMS limitation and make it as arbitrary number of perms. Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- diff -r 16bf7f3069a7 -r 48a02f60bf1e tools/xenstore/xenstore_client.c --- a/tools/xenstore/xenstore_client.c Mon Nov 26 17:20:39 2012 +0100 +++ b/tools/xenstore/xenstore_client.c Tue Nov 27 14:13:38 2012 +0000 @@ -25,7 +25,6 @@ #define PATH_SEP '/' #define MAX_PATH_LEN 256 -#define MAX_PERMS 16 enum mode { MODE_unknown, @@ -407,44 +406,41 @@ perform(enum mode mode, int optind, int output("%s\n", list[i]); } free(list); - optind++; - break; - } - case MODE_ls: { - do_ls(xsh, argv[optind], 0, prefix); - optind++; - break; + optind++; + break; + } + case MODE_ls: { + do_ls(xsh, argv[optind], 0, prefix); + optind++; + break; } case MODE_chmod: { - struct xs_permissions perms[MAX_PERMS]; - int nperms = 0; /* save path pointer: */ char *path = argv[optind++]; - for (; argv[optind]; optind++, nperms++) + int nperms = argc - optind; + struct xs_permissions perms[nperms]; + int i; + for (i = 0; argv[optind]; optind++, i++) { - if (MAX_PERMS <= nperms) - errx(1, "Too many permissions specified. " - "Maximum per invocation is %d.", MAX_PERMS); - - perms[nperms].id = atoi(argv[optind]+1); + perms[i].id = atoi(argv[optind]+1); switch (argv[optind][0]) { case 'n': - perms[nperms].perms = XS_PERM_NONE; + perms[i].perms = XS_PERM_NONE; break; case 'r': - perms[nperms].perms = XS_PERM_READ; + perms[i].perms = XS_PERM_READ; break; case 'w': - perms[nperms].perms = XS_PERM_WRITE; + perms[i].perms = XS_PERM_WRITE; break; case 'b': - perms[nperms].perms = XS_PERM_READ | XS_PERM_WRITE; + perms[i].perms = XS_PERM_READ | XS_PERM_WRITE; break; default: errx(1, "Invalid permission specification: '%c'", - argv[optind][0]); + argv[optind][0]); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |