archive mirror
 help / color / mirror / Atom feed
From: Thomas Bertschinger <>
Cc: Thomas Bertschinger <>
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: <> (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/ 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/         | 66 ++++++++++++++++++++++++
 fs/bcachefs/bindgen_parameters         | 16 ++++++
 fs/bcachefs/bindings/bindings_helper.h |  7 +++
 fs/bcachefs/bindings/            |  5 ++
 fs/bcachefs/super.c                    | 31 +++++++++--
 rust/Makefile                          | 67 ------------------------
 scripts/                 | 71 ++++++++++++++++++++++++++
 11 files changed, 219 insertions(+), 70 deletions(-)
 create mode 100644 fs/bcachefs/.gitignore
 create mode 100644 fs/bcachefs/
 create mode 100644 fs/bcachefs/bindgen_parameters
 create mode 100644 fs/bcachefs/bindings/bindings_helper.h
 create mode 100644 fs/bcachefs/bindings/


             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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \

* 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).