diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-23 18:16:15 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-23 18:16:15 -0500 |
commit | 8c9dddb00ae85b7c7bceeac0e66dfceae2d81839 (patch) | |
tree | 1f27a90554c9e946b71e7f5320133360e5147499 | |
parent | 8b2a893c6bb61870bb86fcd33b866b70e9c94f2b (diff) |
getattr skeletongetattr
-rw-r--r-- | cmd_attr.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -1,4 +1,5 @@ #include <dirent.h> +#include <getopt.h> #include <stdio.h> #include <sys/ioctl.h> #include <sys/stat.h> @@ -112,3 +113,38 @@ int cmd_setattr(int argc, char *argv[]) return 0; } + +static void getattr_usage(void) +{ + puts("bcachefs getattr - get attributes on files in a bcachefs filesystem\n" + "Usage: bcachefs getattr <files>\n" + "\n" + "Options:\n" + " -h, --help Display this help and exit\n" + "Report bugs to <linux-bcachefs@vger.kernel.org>"); +} + +int cmd_getattr(int argc, char *argv[]) +{ + static const struct option longopts[] = { + { "help", no_argument, NULL, 'h' }, + { NULL } + }; + int opt; + + while ((opt = getopt_long(argc, argv, "h", + longopts, NULL)) != -1) + switch (opt) { + case 'h': + getattr_usage(); + exit(EXIT_SUCCESS); + default: + getattr_usage(); + exit(EXIT_FAILURE); + } + args_shift(optind); + + //for (i = 1; i < argc; i++) + // do_setattr(argv[i], opts); + return 0; +} |