From: Dean Roehrich Date: Fri, 7 Mar 2003 15:19:18 +0000 (+0000) Subject: allow dmapi test tools get/set_dmattr to take handle or pathname X-Git-Tag: v1.1.0~1006 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bcbe9ee230f8c833497631be40e63f56cc4f923f;p=users%2Fhch%2Fxfstests-dev.git allow dmapi test tools get/set_dmattr to take handle or pathname allow pathname or handle --- diff --git a/dmapi/src/suite1/cmd/get_dmattr.c b/dmapi/src/suite1/cmd/get_dmattr.c index 039e6c387..a03180da2 100644 --- a/dmapi/src/suite1/cmd/get_dmattr.c +++ b/dmapi/src/suite1/cmd/get_dmattr.c @@ -40,7 +40,7 @@ Test program used to test the DMAPI function dm_get_dmattr(). The command line is: - get_dmattr [-b buflen] [-s sid] [-t token] pathname attr + get_dmattr [-b buflen] [-s sid] [-t token] {pathname|handle} attr where pathname is the name of a file, buflen is the size of the buffer to use in the call, attr is the name of the DMAPI attribute, and sid is the session ID @@ -61,7 +61,7 @@ static void usage(void) { fprintf(stderr, "usage:\t%s [-b buflen] [-s sid] [-t token] " - "pathname attr\n", Progname); + "{pathname|handle} attr\n", Progname); exit(1); } @@ -73,7 +73,7 @@ main( { dm_sessid_t sid = DM_NO_SESSION; dm_token_t token = DM_NO_TOKEN; - char *pathname; + char *object; dm_attrname_t *attrnamep; void *bufp; size_t buflen = 10000; @@ -108,7 +108,7 @@ main( } if (optind + 2 != argc) usage(); - pathname = argv[optind++]; + object = argv[optind++]; attrnamep = (dm_attrname_t *)argv[optind]; if (dm_init_service(&name) == -1) { @@ -120,9 +120,8 @@ main( /* Get the file's handle. */ - if (dm_path_to_handle(pathname, &hanp, &hlen)) { - fprintf(stderr, "can't get handle for file %s, %s\n", - pathname, strerror(errno)); + if (opaque_to_handle(object, &hanp, &hlen)) { + fprintf(stderr, "can't get handle for %s\n", object); exit(1); } diff --git a/dmapi/src/suite1/cmd/set_dmattr.c b/dmapi/src/suite1/cmd/set_dmattr.c index ec39db633..ff271db94 100644 --- a/dmapi/src/suite1/cmd/set_dmattr.c +++ b/dmapi/src/suite1/cmd/set_dmattr.c @@ -41,7 +41,7 @@ Test program used to test the DMAPI function dm_set_dmattr(). The command line is: - set_dmattr [-b buflen] [-s sid] [-u] pathname attr value + set_dmattr [-b buflen] [-s sid] [-u] {pathname|handle} attr value where pathname is the name of a file, buflen is the size of the buffer to use in the call, attr is the name of the DMAPI attribute, -u is selected if @@ -62,8 +62,8 @@ char *Progname; static void usage(void) { - fprintf(stderr, "usage:\t%s [-b buflen] [-s sid] [-u] pathname " - "attr value\n", Progname); + fprintf(stderr, "usage:\t%s [-b buflen] [-s sid] [-u] " + "{pathname|handle} attr value\n", Progname); exit(1); } @@ -74,7 +74,7 @@ main( char **argv) { dm_sessid_t sid = DM_NO_SESSION; - char *pathname; + char *object; dm_attrname_t *attrnamep; char *bufp; size_t buflen; @@ -111,7 +111,7 @@ main( } if (optind + 3 != argc) usage(); - pathname = argv[optind++]; + object = argv[optind++]; attrnamep = (dm_attrname_t *)argv[optind++]; bufp = argv[optind]; if (!bflag) @@ -126,9 +126,8 @@ main( /* Get the file's handle. */ - if (dm_path_to_handle(pathname, &hanp, &hlen)) { - fprintf(stderr, "can't get handle for file %s, %s\n", - pathname, strerror(errno)); + if (opaque_to_handle(object, &hanp, &hlen)) { + fprintf(stderr, "can't get handle for %s\n", object); exit(1); }