On Sun, Jan 14, 2024 at 10:24:49PM -0700, Thomas Bertschinger wrote: > 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
Nice work :) I think there's some more rearraging we could do - it'd be cleaner if we moved the C sources out of the top level directory, perhaps to c_src, and then moved everything in rust-src/ to the toplevel. Top level directory is getting a bit crowded, and then the new bcachefs binary won't be quite so out of the way; I frequently build and run without installing when I'm debugging.
