]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - bcachefs.c
fix list_journal for nochanges
[bcachefs-tools-debian] / bcachefs.c
index 495395b44091c6c08208c9c4f0b84feeb159ddaa..4efe29edaad25c0b3fb96865e0a5f4907b3f1d55 100644 (file)
@@ -33,18 +33,24 @@ static void usage(void)
             "Superblock commands:\n"
             "  format                   Format a new filesystem\n"
             "  show-super               Dump superblock information to stdout\n"
+            "  set-option               Set a filesystem option\n"
             "\n"
+#ifndef BCACHEFS_NO_RUST
+            "Mount:\n"
+            "  mount                    Mount a filesystem\n"
+            "\n"
+#endif
             "Repair:\n"
             "  fsck                     Check an existing filesystem for errors\n"
             "\n"
-            "Startup/shutdown, assembly of multi device filesystems:\n"
 #if 0
+            "Startup/shutdown, assembly of multi device filesystems:\n"
             "  assemble                 Assemble an existing multi device filesystem\n"
             "  incremental              Incrementally assemble an existing multi device filesystem\n"
             "  run                      Start a partially assembled filesystem\n"
             "  stop                     Stop a running filesystem\n"
-#endif
             "\n"
+#endif
             "Commands for managing a running filesystem:\n"
             "  fs usage                 Show disk usage\n"
             "\n"
@@ -59,9 +65,9 @@ static void usage(void)
             "  device resize-journal    Resize journal on a device\n"
             "\n"
             "Commands for managing subvolumes and snapshots:\n"
-            "  subvolume create     Create a new subvolume\n"
-            "  subvolume delete     Delete an existing subvolume\n"
-            "  subvolume snapshot   Create a snapshot\n"
+            "  subvolume create         Create a new subvolume\n"
+            "  subvolume delete         Delete an existing subvolume\n"
+            "  subvolume snapshot       Create a snapshot\n"
             "\n"
             "Commands for managing filesystem data:\n"
             "  data rereplicate         Rereplicate degraded data\n"
@@ -78,13 +84,22 @@ 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"
+#ifndef BCACHEFS_NO_RUST
             "  list                     List filesystem metadata in textual form\n"
+#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");
 }
 
@@ -105,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);
 
@@ -174,10 +191,28 @@ 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);
-       if (argc < 1) {
+       if (!cmd) {
                puts("missing command\n");
                goto usage;
        }
@@ -199,12 +234,8 @@ int main(int argc, char *argv[])
                return cmd_version(argc, argv);
        if (!strcmp(cmd, "show-super"))
                return cmd_show_super(argc, argv);
-
-       if (argc < 2) {
-               printf("%s: missing command\n", argv[0]);
-               usage();
-               exit(EXIT_FAILURE);
-       }
+       if (!strcmp(cmd, "set-option"))
+               return cmd_set_option(argc, argv);
 
 #if 0
        if (!strcmp(cmd, "assemble"))
@@ -231,13 +262,23 @@ int main(int argc, char *argv[])
 
        if (!strcmp(cmd, "dump"))
                return cmd_dump(argc, argv);
+#ifndef BCACHEFS_NO_RUST
        if (!strcmp(cmd, "list"))
                return cmd_list(argc, argv);
+#endif
        if (!strcmp(cmd, "list_journal"))
                return cmd_list_journal(argc, argv);
+       if (!strcmp(cmd, "kill_btree_node"))
+               return cmd_kill_btree_node(argc, argv);
 
        if (!strcmp(cmd, "setattr"))
                return cmd_setattr(argc, argv);
+#ifndef BCACHEFS_NO_RUST
+       if (!strcmp(cmd, "mount"))
+               return cmd_mount(argc, argv);
+    if (strstr(cmd, "completions"))
+        return cmd_completions(argc, argv);
+#endif
 
 #ifdef BCACHEFS_FUSE
        if (!strcmp(cmd, "fusemount"))