]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - bcachefs.c
fix list_journal for nochanges
[bcachefs-tools-debian] / bcachefs.c
index 8616d554a14894c5c20c236018ff96465e5cd1d9..4efe29edaad25c0b3fb96865e0a5f4907b3f1d55 100644 (file)
@@ -84,6 +84,7 @@ static void usage(void)
             "\n"
             "Commands for operating on files in a bcachefs filesystem:\n"
             "  setattr                  Set various per file attributes\n"
+            "\n"
             "Debug:\n"
             "These commands work on offline, unmounted filesystems\n"
             "  dump                     Dump filesystem metadata to a qcow2 image\n"
@@ -92,7 +93,13 @@ static void usage(void)
 #endif
             "  list_journal             List contents of journal\n"
             "\n"
+            "FUSE:\n"
+            "  fusemount                Mount a filesystem via FUSE\n"
+            "\n"
             "Miscellaneous:\n"
+#ifndef BCACHEFS_NO_RUST
+         "  completions              Generate shell completions\n"
+#endif
             "  version                  Display the version of the invoked bcachefs tool\n");
 }
 
@@ -113,8 +120,10 @@ static int fs_cmds(int argc, char *argv[])
 {
        char *cmd = pop_cmd(&argc, argv);
 
-       if (argc < 1)
-               return fs_usage();
+       if (argc < 1) {
+               usage();
+               exit(EXIT_FAILURE);
+       }
        if (!strcmp(cmd, "usage"))
                return cmd_fs_usage(argc, argv);
 
@@ -182,6 +191,24 @@ int main(int argc, char *argv[])
 
        full_cmd = argv[0];
 
+       /* Are we being called via a symlink? */
+
+       if (strstr(full_cmd, "mkfs"))
+               return cmd_format(argc, argv);
+
+       if (strstr(full_cmd, "fsck"))
+               return cmd_fsck(argc, argv);
+
+#ifdef BCACHEFS_FUSE
+       if (strstr(full_cmd, "mount.fuse"))
+               return cmd_fusemount(argc, argv);
+#endif
+
+#ifndef BCACHEFS_NO_RUST
+       if (strstr(full_cmd, "mount"))
+               return cmd_mount(argc, argv);
+#endif
+
        setvbuf(stdout, NULL, _IOLBF, 0);
 
        char *cmd = pop_cmd(&argc, argv);
@@ -247,10 +274,10 @@ int main(int argc, char *argv[])
        if (!strcmp(cmd, "setattr"))
                return cmd_setattr(argc, argv);
 #ifndef BCACHEFS_NO_RUST
-       if (!strcmp(cmd, "mount")) {
-               cmd_mount(argc, argv);
-               return 0;
-       }
+       if (!strcmp(cmd, "mount"))
+               return cmd_mount(argc, argv);
+    if (strstr(cmd, "completions"))
+        return cmd_completions(argc, argv);
 #endif
 
 #ifdef BCACHEFS_FUSE