"\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"
#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");
}
{
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);
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 (!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