summaryrefslogtreecommitdiff
path: root/src/bcachefs.rs
AgeCommit message (Collapse)Author
2025-06-20cmd_image_createKent Overstreet
Add a tool for creating small image files. Data is written out in a reproducible order, sequentially from the start of the device. Metadata is initially written to a temporary device, then after writing out data, the metadata we want to keep (alloc info is left out by default) is migrated to the real device. Then, the image file is trimmed to minimum size and the temporary metadata device dropped. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-06-20cmd_strip_allocKent Overstreet
Add a command for stripping allocation info for a filesystem. This is primarily to test codepaths used by the new image creation tool. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-17cmd_recover_super: 'bcachefs recover-super'Kent Overstreet
New tool for scanning for backup superblocks, to recover when the primary superblock + sb layout have been overwritten. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-10-12cmd_mount: Change error message on -EBUSY to match util-linuxKent Overstreet
This causes xfstests generic/741 to pass Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-10-05Fix 'fuse' feature conditional compilationKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-30fix: don't try to convert C command returns to u8Thomas Mühlbacher
Fixes Rust panics if some C command (like fsck) returns a value bigger than 255. The process exit code will be mangled but what can we do, it's less confusing than a panic (that unfortunately doesn't print the return value). Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-07-20Rename option commandsKent Overstreet
set-option -> set-fs-option setattr -> set-file-option Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-29feat: use `ExitCode` over `std::process:exit()`Thomas Mühlbacher
Should provide us with better outputs on process failure, also makes unwinding better and is generally recommended over `exit()`. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-28feat: use env_loggerThomas Mühlbacher
Instead of the custom logger impl, which limits the features we can easily provide for users. This introduces the `BCACHEFS_LOG` environment variable for setting the log verbosity. Setting `BCACHEFS_LOG=trace`, e.g. in a test environment, will yield all log messages. Also I think it's reasonable to print INFO level logs by default. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-31refactor: casting-related `clippy::pedantic` fixesThomas Mühlbacher
Prefer using `ptr::addr_of!()` and `pointer::cast()` instead of raw `as` where clippy complains and other type casting lints. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-31refactor: treat harmless `clippy::pedantic` lintsThomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-26Format with rustfmtKent Overstreet
Note that we're using struct/enum align options, which require nightly. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-04-30remove redundant "cmd_" prefix from functions in "commands"Thomas Bertschinger
It is more idiomatic to use `commands::mount` than `commands::cmd_mount`. No functionality changes intended by this patch. Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-03-13Avoid casting away const when processing C command argsWesley Moore
2024-02-06kill dependency on char signednessKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-27feat(rust/commands): introduce Rust-driven `subvolume` sub-CLIRyan Lahfa
This makes use of `BcachefsHandle` to introduce an elegant Rust driven CLI for subvolumes. Signed-off-by: Ryan Lahfa <bcachefs@lahfa.xyz>
2024-01-27feat(rust/wrappers): init `BcachefsHandle`Ryan Lahfa
We propose a simple low-level wrapper which can perform various subvolume-related operations as an example for the API surface. This will be used in an upcoming commit to migrate the subvolume CLI fully to Rust. The API design is the following: - `BcachefsHandle` is meant as a low level handle to carry around whenever you need a filesystem handle to send ioctl to. - it possess type-safe operations Type safe operations are handled by having type safe wrappers for ioctl commands *and* their payloads. We assume that all ioctl payloads only use *one* argument, this can easily be changed if needed. When the handle goes out of scope, we automatically close it à la C++ RAII. Signed-off-by: Ryan Lahfa <bcachefs@lahfa.xyz>
2024-01-16move Rust sources to top level, C sources into c_srcThomas Bertschinger
This moves the Rust sources out of rust_src/ and into the top level. Running the bcachefs executable out of the development tree is now: $ ./target/release/bcachefs command or $ cargo run --profile release -- command instead of "./bcachefs command". Building and installing is still: $ make && make install Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>