rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Bertschinger <tahbertschinger@gmail.com>
To: rust-for-linux@vger.kernel.org, linux-bcachefs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	kent.overstreet@linux.dev, bfoster@redhat.com, ojeda@kernel.org,
	alex.gaynor@gmail.com, wedsonaf@gmail.com, masahiroy@kernel.org
Cc: Thomas Bertschinger <tahbertschinger@gmail.com>
Subject: [PATCH RFC 0/3] bcachefs: add framework for internal Rust code
Date: Tue,  6 Feb 2024 22:55:58 -0700	[thread overview]
Message-ID: <20240207055558.611606-1-tahbertschinger@gmail.com> (raw)

This series adds support for Rust code into bcachefs. This only enables
using Rust internally within bcachefs; there are no public Rust APIs
added. Rust support is hidden behind a new config option,
CONFIG_BCACHEFS_RUST. It is optional and bcachefs can still be built
with full functionality without rust.

I wasn't sure if this needed to be an RFC based on the current status
of accepting Rust code outside of the rust/ tree, so I designated it as
such to be safe. However, Kent plans to merge rust+bcachefs code in the
6.9 merge window, so I hope at least the first 2 patches in this series,
the ones that actually enable Rust for bcachefs, can be accepted.

#1 is a prerequisite in KBuild. In order to call bindgen commands in the
fs/bcachefs tree, the bindgen commands need to be defined in the
top-level scripts/Makefile.build along with the rustc commands, instead
of in rust/Makefile. This is the only patch outside of fs/bcachefs/ in
this series.

#2 creates the framework to use rust-bindgen in fs/bcachefs and
introduces the new config option to enable this. This patch does not
actually generate any Rust bindings; it just lays the foundation for
future patches to create bindings.

#3 demonstrates the new Rust functionality by implementing the module
entry and exit functions for bcachefs in Rust. The current C entry
and exit are retained so that bcachefs can still be built without Rust.
Given Kent's goal to use Rust more in bcachefs, the C functions will
presumably be dropped in the future.


Thomas Bertschinger (3):
  kbuild: rust: move bindgen commands to top-level
  bcachefs: create framework for Rust bindings
  bcachefs: introduce Rust module implementation

 fs/bcachefs/.gitignore                 |  3 ++
 fs/bcachefs/Kconfig                    |  6 +++
 fs/bcachefs/Makefile                   | 12 +++++
 fs/bcachefs/bcachefs.h                 |  5 ++
 fs/bcachefs/bcachefs_module.rs         | 66 ++++++++++++++++++++++++
 fs/bcachefs/bindgen_parameters         | 16 ++++++
 fs/bcachefs/bindings/bindings_helper.h |  7 +++
 fs/bcachefs/bindings/mod.rs            |  5 ++
 fs/bcachefs/super.c                    | 31 +++++++++--
 rust/Makefile                          | 67 ------------------------
 scripts/Makefile.build                 | 71 ++++++++++++++++++++++++++
 11 files changed, 219 insertions(+), 70 deletions(-)
 create mode 100644 fs/bcachefs/.gitignore
 create mode 100644 fs/bcachefs/bcachefs_module.rs
 create mode 100644 fs/bcachefs/bindgen_parameters
 create mode 100644 fs/bcachefs/bindings/bindings_helper.h
 create mode 100644 fs/bcachefs/bindings/mod.rs

-- 
2.43.0


             reply	other threads:[~2024-02-07  5:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07  5:55 Thomas Bertschinger [this message]
2024-02-07 11:06 ` [PATCH RFC 0/3] bcachefs: add framework for internal Rust code Miguel Ojeda
2024-02-07 20:57   ` Kent Overstreet
2024-02-07 21:33     ` Trevor Gross
2024-02-07 22:39     ` Darrick J. Wong
2024-02-08  4:19       ` Trevor Gross
2024-02-08  1:14   ` 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=20240207055558.611606-1-tahbertschinger@gmail.com \
    --to=tahbertschinger@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=bfoster@redhat.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).