summaryrefslogtreecommitdiff
path: root/src/commands
AgeCommit message (Collapse)Author
5 daysmount: check if bcachefs module is loadedHEADmasterKent Overstreet
This lets us print out a more useful error. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-29Update bcachefs sources to 7f938192650f bcachefs: darray_find(), darray_find_p()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-29cmd_list: Don't run any fsck/upgradesKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-07list: Allow for lookups within a particular snapshotKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13Update bcachefs sources to 2f9361370129 bcachefs: Improve opts.degradedKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-27bcachefs-tools: make targets of subvolume create/delete requiredIntegral
Currently, when no targets are provided for "bcachefs subvolume create" or "bcachefs subvolume delete", it will exit silently with code 0. Make targets (arguments) required to solve this problem. This patch solves issue https://github.com/koverstreet/bcachefs/issues/766. Signed-off-by: Integral <integral@archlinuxcn.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-25mount: Parse bcachefs options, and pass them to mount helperKent Overstreet
This fixes the migrate test - we need to handle the sb=# option. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-21fix(key): replace c_str macro with `c""` literalThomas Mühlbacher
According to the MSRV in Cargo.toml, we can use this now. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-12-29Merge pull request #345 from Flowdalic/mount-print-errorkoverstreet
mount: print a helpful error message
2024-10-25Allow multiple targets for subvolume delete.Malte Schröder
Signed-off-by: Malte Schröder <malte.schroeder@tnxip.de> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-10-25mount: print a helpful error messageFlorian Schmaus
Just returning a failure exit status makes it hard to tell what the actual issue was. Instead, the mount command now also provides some textual output. See https://github.com/koverstreet/bcachefs-tools/issues/308 for an example where mount does not provide any helpful output, even with BCACHEFS_LOG=trace enabled. Signed-off-by: Florian Schmaus <flo@geekplace.eu>
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-09-29cmd_list: open with noxclKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-08-09mount: When mounting a single device, make sure we mount the device specifiedKent Overstreet
When mounting a multi device filesystem we have to scan for component devices from the UUID, but we don't want to scan if it's a single device filesystem; if the same filesystem is exposed via multiple device nodes (e.g. dm faulty testing), the scan can pick up the wrong node. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-26mount: Ask for password via systemd-ask-passwordSasha Finkelstein
This would allow to supply the password via the plymouth password input. If systemd-ask-password does not exist or fails to start, falls back to the old-style password request. Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
2024-07-22mount: Fix UAF in option string handlingKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-21refactor: fix clippy lintThomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-07-21style: nix fmtThomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-07-20mount: Fall back to read-only on -EROFSKent Overstreet
this is the mount helper's job, and since we're the mount helper... fixes: xfstests generic/050 Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-18mount: Close devices before doing mountKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-15logging: kill quiet optionv1.9.4Kent Overstreet
no logging by default, enabled with -v logging by default broke fstests 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: add `--quiet` cli argumentThomas Mühlbacher
To silence log outputs on the CLI. 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-06-26refactor: simplify branches for parsing devThomas Mühlbacher
Less repetition and no nested if/else. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26feat(mount): make unlock policy optional/explictThomas Mühlbacher
This changes the semantics of some arguments related to unlocking and slightly changes the unlocking logic. Also update help formatting/text. Instead of defaulting to `UnlockPolicy::Ask`, the argument becomes optional. That means if it is specified, the user really wants that specific policy. Similar to how `passphrase_file` also works. This also extends `UnlockPolicy` to override `isatty` detection. Fixes: #292 Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26refactor(mount): rename `opt` => `cli`Thomas Mühlbacher
The term option is already used for mount options and the `Option` type. In other modules it's just called `cli`, so let's do that here as well. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26refactor: rm function param only used for log msgThomas Mühlbacher
We lose that bit of info but it's weird to require a parameter simply because we want to use it for a log message. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-18fix(logger): log to stderrThomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-10fix(subvol): canonicalize requires path to existThomas Mühlbacher
Which is probably not the case when you want to create a subvolume in that path. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-09fix(subvol): make cmds work with relative pathsThomas Mühlbacher
`Path::parent()` returns `Some("")` for relative paths with a single component. The simplest fix is to just canonicalize the paths first. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-31Merge pull request #284 from tmuehlbacher/fix-result-evalkoverstreet
fix: evaluate KeyHandle Result
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: make `c_str!` simpler, add testThomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-31refactor: change some fn type sigs and simplifyThomas Mühlbacher
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-31fix: evaluate KeyHandle ResultThomas Mühlbacher
This one is sort of bad to have missed, ouch. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-31fix: keep compat with MSRVThomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-30feat: rewrite key.rsThomas Mühlbacher
- Introduce `KeyHandle` and `Passphrase` types - Refactor the functions into associated functions - Add `zeroizing` crate to handle passphrase memory safely Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-30refactor: rename function againThomas Mühlbacher
`bch2_sb_is_encrypted_and_locked()` simply does not check if the fs is locked. The name is misleading. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-30refactor: reduce `UnlockPolicy` boilerplateThomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-29mount: minor cleanupKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
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-05-26`check_for_key` before `ask_for_passphrase`Thomas Mühlbacher
let's always first check if there is already a key in the keyring available before we try to get the key from some more involved means. Fixes: #261 Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-22refactor: manually fix remaining clippy lintsThomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22refactor: `cargo clippy --fix`Thomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-09add "bkey-type" option to list commandThomas Bertschinger
Only bkeys of the specified type will be printed. Also, this reworks the error type in bch_bindgen to be able to represent other kinds of error than just "invalid btree id". Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-07mount: Make udev_bcachefs_info more idiomaticTony Asleson
Signed-off-by: Tony Asleson <tasleson@redhat.com>
2024-05-07Handle mount with FS with 1 deviceTony Asleson
If the user passes a single device node during the mount and we have no information for it in the udev db, we read up the super block. When we do this, if the FS only has 1 block device we will simply go ahead and do the mount instead of walking all the block devices and reading up super blocks looking for devices with a matching FS UUID. Signed-off-by: Tony Asleson <tasleson@redhat.com>
2024-05-07Add env. variable BCACHEFS_BLOCK_SCANTony Asleson
Introduce an env. variable for users that have a broken blkid which renders the udev db as incomplete. Only checks for the existence of the variable, not its value. Signed-off-by: Tony Asleson <tasleson@redhat.com>