Commit Graph

21 Commits

Author SHA1 Message Date
Kent Overstreet
d27d4cf7f0 Fix 'fuse' feature conditional compilation
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-10-05 22:49:27 -04:00
Jubilee Young
a1122aced2 Remove byteorder dep
This requires something other than literally zero code to replace, but
is another opportunity to deny packagers the fun of experimenting with
replacing crate versions with incompatible patched crate versions.
2024-09-03 00:31:33 -07:00
Jubilee Young
1a5b11db3f bch_bindgen: Remove memoffset dep
A trivial replacement allowed by std stabilizing it in rust 1.77.
Less crate dependencies means less odd decisions by packagers.
2024-09-03 00:14:30 -07:00
Kent Overstreet
b422b19f63 Update bcachefs sources to 22fa8fc32e6a bcachefs: rcu_pending now works in userspace 2024-08-23 19:34:30 -04:00
Reed Riley
481a50f0a9 version bump to v1.11.1 2024-08-22 16:26:18 -05:00
Kent Overstreet
495a54c03b Revert "build: rm package.version from Cargo.toml"
This reverts commit 48c51020e5.

Deleting the version from Cargo.toml broke the MSRV build with cargo
1.7.0.
2024-08-09 04:08:08 -04:00
Thomas Mühlbacher
09cde4869d feat(logging): switch to custom file:line format
This mostly tries to be similar to the default `env_logger` format but
instead of using the more vague target in the log message, we instead
put the file name and line number in the log.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-07-21 01:16:28 +02:00
Thomas Mühlbacher
48c51020e5 build: rm package.version from Cargo.toml
This sets the version, that can be read at build time using the
environment variable `CARGO_PKG_VERSION`, to the default
value (`0.0.0`).

Setting `package.version` in the Cargo manifest is mandatory for
publishing to crates.io. We're not publishing the crate currently, and
there isn't an obvious case for doing so in the future that comes to
mind.

Our sources are not using the version from cargo currently. `clap` and
some other dependencies may use them by default but still we don't use
that version in any outputs. Therefore, we should be fine without it.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-07-21 01:16:28 +02:00
Kent Overstreet
60ff4f2f3c bump version to 1.9.5
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-18 20:48:14 -04:00
Lauri Tirkkonen
7ebd67e63a mount: replace rpassword with rustix::termios
because rpassword unconditionally open()s /dev/tty, it fails with ENXIO
on the console without workarounds like busybox's cttyhack. in contrast,
bcachefs unlock works fine on console, so change the passphrase prompt
logic in mount to be closer to what it is in unlock.

Signed-off-by: Lauri Tirkkonen <lauri@hacktheplanet.fi>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-14 21:49:58 -04:00
Thomas Bertschinger
9e12dd06b9 include debuginfo in bcachefs binary by default
The debuginfo is used by the "bcachefs debug" and "bcachefs list_bkeys"
commands.

Rust 1.77 [1] changed Cargo's release profile to strip debuginfo by default,
but we always want it included.

[1] https://github.com/rust-lang/cargo/pull/13257

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-14 16:20:17 -04:00
Thomas Mühlbacher
df09682869 feat: use env_logger
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-28 21:29:20 +02:00
Kent Overstreet
277ba6d4ac v1.9.1
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-19 14:48:31 -04:00
Kent Overstreet
dd275b1c5f Update version to 1.9.0
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-19 09:05:50 -04:00
Thomas Mühlbacher
22495e0d31 feat: rewrite key.rs
- 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-30 22:26:06 +02:00
Thomas Mühlbacher
21b1111b59 refactor: reduce UnlockPolicy boilerplate
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-30 22:26:06 +02:00
Alexander Fougner
a95a25dc1d Replace atty with stdlib
is_terminal() is part of rust 1.70 std, no need for isatty

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2024-02-07 21:27:35 +01:00
Thomas Bertschinger
7717a439cf use upstream bindgen; fix packed and aligned types
bcachefs-tools has been using a patched bindgen to work around a
limitation of rustc that prevents compiling structs with
both #[repr(packed(N)] and #[repr(align(N)] attributes. The patch:
e8168ceda507 "codegen: Don't generate conflicting packed() and align()
representation hints." discards the "align" attribute in cases where
bindgen produces a type with both.

This may be correct for some types, but it turns out that for each
bcachefs type with this problem, keeping the "align" attribute and
discarding the "packed" attribute generates a type with the same ABI as
the original C type.

This can be tested automatically by running:
$ cargo test --manifest-path bch_bindgen/Cargo.toml
in the bcachefs-tools tree.

There has been pressure recently to start using upstream bindgen; both
externally, from distribution maintainers who want to build
bcachefs-tools with standard dependencies, and internally, in order to
enable using Rust for bcachefs in-kernel.

This patch updates bcachefs-tools to use upstream bindgen. It works
around the rustc limitation with a post-processing step in the bindgen
build that adjusts the attributes to include "#[repr(C, align(N))]" and
exclude #[repr(packed(N)] only for the 4 types that need it. It also
updates bch_bindgen to format the code with prettyplease so that this
will work even in environments with rustfmt installed.

Some types that had been manually implemented in
bch_bindgen/src/bcachefs.rs are now automatically generated by bindgen,
so that they will be covered by the ABI compatibility testing mentioned
above.

I intentionally targeted the post-processing to the exact 4 types with
the issue currently, so that any changes to bcachefs that result in this
issue appearing for a new type will require manual intervention. I
figured any such changes should require careful consideration.

Ideally, bindgen can be updated to handle situations where "align(N)"
is needed and "packed(N)" can be safely discarded. If a patch for this
is accepted into bindgen, the post-processing hack can be removed.

I update the minimum Rust version to 1.70 as this is needed to build
recent versions of some dependencies.

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-23 13:08:12 -05:00
Kent Overstreet
5e224596cf Remove gag usage
Possibly-fixes: https://github.com/koverstreet/bcachefs-tools/issues/217
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-20 22:32:00 -05:00
Faidon Liambotis
06ff8b55b7 rust: bump rpassword to v7.x
Including a tiny API change.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-16 16:30:10 -05:00
Thomas Bertschinger
f5baaf48e3 move Rust sources to top level, C sources into c_src
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>
2024-01-16 01:47:05 -05:00