mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
allow dmapi test tools get/set_dmattr to take handle or pathname
allow pathname or handle
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
Test program used to test the DMAPI function dm_get_dmattr(). The
|
Test program used to test the DMAPI function dm_get_dmattr(). The
|
||||||
command line is:
|
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
|
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
|
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)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage:\t%s [-b buflen] [-s sid] [-t token] "
|
fprintf(stderr, "usage:\t%s [-b buflen] [-s sid] [-t token] "
|
||||||
"pathname attr\n", Progname);
|
"{pathname|handle} attr\n", Progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ main(
|
|||||||
{
|
{
|
||||||
dm_sessid_t sid = DM_NO_SESSION;
|
dm_sessid_t sid = DM_NO_SESSION;
|
||||||
dm_token_t token = DM_NO_TOKEN;
|
dm_token_t token = DM_NO_TOKEN;
|
||||||
char *pathname;
|
char *object;
|
||||||
dm_attrname_t *attrnamep;
|
dm_attrname_t *attrnamep;
|
||||||
void *bufp;
|
void *bufp;
|
||||||
size_t buflen = 10000;
|
size_t buflen = 10000;
|
||||||
@@ -108,7 +108,7 @@ main(
|
|||||||
}
|
}
|
||||||
if (optind + 2 != argc)
|
if (optind + 2 != argc)
|
||||||
usage();
|
usage();
|
||||||
pathname = argv[optind++];
|
object = argv[optind++];
|
||||||
attrnamep = (dm_attrname_t *)argv[optind];
|
attrnamep = (dm_attrname_t *)argv[optind];
|
||||||
|
|
||||||
if (dm_init_service(&name) == -1) {
|
if (dm_init_service(&name) == -1) {
|
||||||
@@ -120,9 +120,8 @@ main(
|
|||||||
|
|
||||||
/* Get the file's handle. */
|
/* Get the file's handle. */
|
||||||
|
|
||||||
if (dm_path_to_handle(pathname, &hanp, &hlen)) {
|
if (opaque_to_handle(object, &hanp, &hlen)) {
|
||||||
fprintf(stderr, "can't get handle for file %s, %s\n",
|
fprintf(stderr, "can't get handle for %s\n", object);
|
||||||
pathname, strerror(errno));
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
Test program used to test the DMAPI function dm_set_dmattr(). The
|
Test program used to test the DMAPI function dm_set_dmattr(). The
|
||||||
command line is:
|
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
|
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
|
in the call, attr is the name of the DMAPI attribute, -u is selected if
|
||||||
@@ -62,8 +62,8 @@ char *Progname;
|
|||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage:\t%s [-b buflen] [-s sid] [-u] pathname "
|
fprintf(stderr, "usage:\t%s [-b buflen] [-s sid] [-u] "
|
||||||
"attr value\n", Progname);
|
"{pathname|handle} attr value\n", Progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ main(
|
|||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
dm_sessid_t sid = DM_NO_SESSION;
|
dm_sessid_t sid = DM_NO_SESSION;
|
||||||
char *pathname;
|
char *object;
|
||||||
dm_attrname_t *attrnamep;
|
dm_attrname_t *attrnamep;
|
||||||
char *bufp;
|
char *bufp;
|
||||||
size_t buflen;
|
size_t buflen;
|
||||||
@@ -111,7 +111,7 @@ main(
|
|||||||
}
|
}
|
||||||
if (optind + 3 != argc)
|
if (optind + 3 != argc)
|
||||||
usage();
|
usage();
|
||||||
pathname = argv[optind++];
|
object = argv[optind++];
|
||||||
attrnamep = (dm_attrname_t *)argv[optind++];
|
attrnamep = (dm_attrname_t *)argv[optind++];
|
||||||
bufp = argv[optind];
|
bufp = argv[optind];
|
||||||
if (!bflag)
|
if (!bflag)
|
||||||
@@ -126,9 +126,8 @@ main(
|
|||||||
|
|
||||||
/* Get the file's handle. */
|
/* Get the file's handle. */
|
||||||
|
|
||||||
if (dm_path_to_handle(pathname, &hanp, &hlen)) {
|
if (opaque_to_handle(object, &hanp, &hlen)) {
|
||||||
fprintf(stderr, "can't get handle for file %s, %s\n",
|
fprintf(stderr, "can't get handle for %s\n", object);
|
||||||
pathname, strerror(errno));
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user