Commit Graph

31 Commits

Author SHA1 Message Date
Thomas Bertschinger
9a9af6e9e6 create common entry point for Rust commands
The bcachefs sub-commands that are implemented in Rust (completions,
list, and mount) had separate entrypoints and thus had some differences
in behavior.

This introduces a common entry point for the Rust sub-commands. This
reduces duplicate boilerplate code like parsing argv and setting up
logging, and will facilitate converting more sub-commands to Rust in
the future.

An immediate benefit is that this fixes an issue with `bcachefs list`
not reporting errors:

before:

$ bcachefs list /dev/typo
$ echo $?
0

after:

$ bcachefs list /dev/typo
ERROR - bcachefs_rust::cmd_list: Fatal error: "No such file or directory"
$ echo $?
1

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-07 21:38:31 -05:00
Kent Overstreet
a751fe3a3c cmd_reset_counters
Add a subcommand for resetting superblock counters - for automated tests

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-04 19:56:14 -05:00
Kent Overstreet
119d26bb10 delete dead code
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-16 17:54:06 -05:00
Zhai Can
1d1fe7b0b6
add command to generate Rust-part CLI completions 2023-11-10 21:20:01 +08:00
Linus Heckemann
0de1fb41b7 cmd_mount: don't return 0 on mount failure
Signed-off-by: Linus Heckemann <git@sphalerite.org>
2023-08-10 11:01:24 -04:00
Kent Overstreet
7a66cf70c5 cmd_fs_usage: Implement --help
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-06-10 20:59:22 -04:00
Kent Overstreet
ea1b618203 cmd_list.rs: Finish list modes, delete cmd_list.c
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-03-06 04:13:45 -05:00
Kent Overstreet
e0e06d95f8 Rust: Start of cmd_list rewrite
This is a _very_ preliminary rewrite of the cmd_list tool in rust, which
is intended to be a testing ground for a safe interface in Rust to the
core btree interface. This adds rust wrappers for:

bch_fs:		provides bch2_fs_open(), bch2_fs_stop
btree_trans:	provides bch2_trans_init(), bch2_trans_exit()
btree_iter:	provides peek, peek_and_restart, advance
bch_errcode:	implements Display (wraps bch2_err_str())
bpos:		implements Ord (wraps bpos_cmp())
bkey_s_c:	implements Display (wraps bch2_bkey_val_to_text())

and other assorted types.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-02-27 21:45:42 -05:00
Kent Overstreet
f2ab6e552d More rust improvements
- passing of arguments from c -> rust code now works correctly
 - 'bcachefs mount' now handles being passed a device or devices

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-02-21 14:39:43 -05:00
Kent Overstreet
28f703cc25 Rust now integrated into bcachefs binary
Rust is now required for building the bcachefs tool, and rust code is
now fully integrated with the C codebase - meaning it is possible to
call back and forth.

The mount helper is now a subcommand, 'mount.bcachefs' is now a small
shell wrapper that invokes 'bcachefs mount'.

This will make it easier to start rewriting other subcommands in rust,
and eventually the whole command line interface.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-02-21 01:03:08 -05:00
Kent Overstreet
e142c4ca01 New subcommand: set-option
This is for setting superblock options on existing filesystems, either
online or offline.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-05-26 16:37:13 -04:00
Kent Overstreet
58867de5bd New tool for killing btree nodes on a filesystem
To be used by error injection tests.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-04-07 19:25:50 -04:00
Brett Holman
9a649545a3 Add more specific subcommand usage messages
The device, data, fs, and subvolume subcommands currently print out a
generic usage message. Make these more specific.

Signed-off-by: Brett Holman <bholman.devel@gmail.com>
2021-11-01 08:12:35 -06:00
Kent Overstreet
d214908864 Subvolume commands 2021-09-26 19:50:47 -04:00
Kent Overstreet
cc92b0f5a2 New data job command
This adds a new subcommand, bcachefs data job, that gives more direct
access to the data job/ioctl functionality, and hooks up the new rewrite
old nodes data job.
2021-03-16 21:46:21 -04:00
Kent Overstreet
41bec63b26 Add a subcommand for resizing the journal
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-11-17 10:52:39 -05:00
Kent Overstreet
2dbedd962b Add a command for dumping contents of journal 2020-03-25 16:23:29 -04:00
Kent Overstreet
bc45c28470 fuse 2019-10-18 16:23:39 -04:00
Kent Overstreet
94cafcb8e5 New setattr command 2018-12-19 18:27:57 -05:00
Tim Schlueter
a5d94ce0a8 Added 'version' command to print when the bcachefs tool was built 2018-05-26 14:32:30 -07:00
Kent Overstreet
ff86d47221 Update bcachefs sources to 0906b1fb49 bcachefs: fixes for 32 bit/big endian machines 2018-05-17 02:36:19 -04:00
Kent Overstreet
7875b82630 New data rereplicate command 2018-02-08 15:33:43 -05:00
Kent Overstreet
aca9f96dcc Resizing 2017-12-28 02:55:08 -05:00
Kent Overstreet
30caf69540 Add bcachefs fs usage 2017-12-23 00:51:19 -05:00
Kent Overstreet
097fd2a5e6 Add commands for changing and removing passphrase 2017-11-08 16:06:37 -09:00
Kent Overstreet
d252e12acc Refactoring for device specific commands 2017-03-12 06:53:43 -08:00
Kent Overstreet
ac1b32acb4 cmd_device_fail
Add a comamnd for setting a device as failed, update bcache sources
2017-03-09 09:14:11 -09:00
Kent Overstreet
a17f7bcec7 cmd_migrate 2017-03-09 09:14:11 -09:00
Kent Overstreet
a5b5eba7f7 New on disk format - encryption 2017-02-28 03:05:38 -09:00
Kent Overstreet
d230eaea61 Add a command to dump filesystem metadata 2017-02-06 23:43:16 -09:00
Kent Overstreet
5933f9478c update bcache code, fsck improvements 2017-02-06 20:45:37 -09:00