summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-12-23 18:16:15 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-12-23 18:16:15 -0500
commit8c9dddb00ae85b7c7bceeac0e66dfceae2d81839 (patch)
tree1f27a90554c9e946b71e7f5320133360e5147499
parent8b2a893c6bb61870bb86fcd33b866b70e9c94f2b (diff)
getattr skeletongetattr
-rw-r--r--cmd_attr.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/cmd_attr.c b/cmd_attr.c
index 9e7f5639..d3b20672 100644
--- a/cmd_attr.c
+++ b/cmd_attr.c
@@ -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;
+}