From: Thomas Bertschinger <tahbertschinger@gmail.com>
To: kent.overstreet@linux.dev, linux-bcachefs@vger.kernel.org,
bfoster@redhat.com
Cc: Thomas Bertschinger <tahbertschinger@gmail.com>
Subject: [PATCH TOOLS 0/2] convert main() from C to Rust
Date: Sun, 14 Jan 2024 22:24:49 -0700 [thread overview]
Message-ID: <20240115052451.145611-1-tahbertschinger@gmail.com> (raw)
This converts the top-level main() of the bcachefs command line tool
from C to Rust.
The first patch does all the work of implementing a new main(), updating
the build process, and making things look for the executable in its new
location which is now rust-src/target/release/bcachefs.
The second patch removes the Library crate from the Rust package. This
was needed previously to allow the C program to link in the Rust
functions, but that doesn't happen anymore.
It seems likely that a bcachefs-tools library will be needed in the
future; for example see this request [1] on GitHub. This library will
have a different external-focused API as opposed to the previous library
that provided an internal API for the bcachefs tool itself. Considering
Rust's structure of one library crate per package, removing the current
library makes room for that requested library.
I tried to update everything to account for the new location of the
bcachefs executable, but let me know if anyone sees something I missed.
I could not figure out how this is set for the Debian package so it's
possible I missed something there...
[1] https://github.com/koverstreet/bcachefs-tools/issues/188
Thomas Bertschinger (2):
convert main() from C to Rust
remove library from bcachefs-tools Rust package
Makefile | 21 +--
bcachefs.c | 127 +-----------------
cmds.h | 6 +-
rust-src/Cargo.lock | 2 +-
rust-src/Cargo.toml | 7 +-
rust-src/bch_bindgen/build.rs | 6 +
.../bch_bindgen/src/libbcachefs_wrapper.h | 2 +
rust-src/build.rs | 21 +++
rust-src/src/bcachefs.rs | 120 +++++++++++++++++
rust-src/src/cmd_main.rs | 34 -----
.../src/{ => commands}/cmd_completions.rs | 3 +-
rust-src/src/{ => commands}/cmd_list.rs | 3 +-
rust-src/src/{ => commands}/cmd_mount.rs | 11 +-
rust-src/src/{ => commands}/logger.rs | 0
rust-src/src/commands/mod.rs | 31 +++++
rust-src/src/lib.rs | 54 --------
tests/util.py | 2 +-
17 files changed, 214 insertions(+), 236 deletions(-)
create mode 100644 rust-src/build.rs
create mode 100644 rust-src/src/bcachefs.rs
delete mode 100644 rust-src/src/cmd_main.rs
rename rust-src/src/{ => commands}/cmd_completions.rs (84%)
rename rust-src/src/{ => commands}/cmd_list.rs (98%)
rename rust-src/src/{ => commands}/cmd_mount.rs (94%)
rename rust-src/src/{ => commands}/logger.rs (100%)
create mode 100644 rust-src/src/commands/mod.rs
delete mode 100644 rust-src/src/lib.rs
--
2.43.0
next reply other threads:[~2024-01-15 5:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-15 5:24 Thomas Bertschinger [this message]
2024-01-15 5:24 ` [PATCH TOOLS 1/2] convert main() from C to Rust Thomas Bertschinger
2024-01-15 5:24 ` [PATCH TOOLS 2/2] remove library from bcachefs-tools Rust package Thomas Bertschinger
2024-01-15 17:32 ` [PATCH TOOLS 0/2] convert main() from C to Rust Kent Overstreet
2024-01-15 17:55 ` Thomas Bertschinger
2024-01-15 18:45 ` Kent Overstreet
2024-01-15 19:10 ` Thomas Bertschinger
2024-01-15 19:22 ` Kent Overstreet
2024-01-19 19:05 ` Trevor Gross
2024-01-19 21:37 ` Kent Overstreet
2024-01-21 16:11 ` packed, aligned structs in bcachefs (was: Re: [PATCH TOOLS 0/2] convert main() from C to Rust) Thomas Bertschinger
2024-01-21 18:19 ` Kent Overstreet
2024-01-21 19:32 ` Thomas Bertschinger
2024-01-22 2:47 ` Thomas Bertschinger
2024-01-15 17:48 ` [PATCH TOOLS 0/2] convert main() from C to Rust Kent Overstreet
2024-01-15 17:57 ` Thomas Bertschinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240115052451.145611-1-tahbertschinger@gmail.com \
--to=tahbertschinger@gmail.com \
--cc=bfoster@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox