rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: "lossin@kernel.org" <lossin@kernel.org>,
	"miguel.ojeda.sandonis@gmail.com"
	<miguel.ojeda.sandonis@gmail.com>
Cc: "frank.li@vivo.com" <frank.li@vivo.com>,
	"glaubitz@physik.fu-berlin.de" <glaubitz@physik.fu-berlin.de>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"slava@dubeyko.com" <slava@dubeyko.com>,
	"rust-for-linux@vger.kernel.org" <rust-for-linux@vger.kernel.org>
Subject: RE: [RFC] Should we consider to re-write HFS/HFS+ in Rust?
Date: Thu, 19 Jun 2025 21:48:57 +0000	[thread overview]
Message-ID: <c212d2e1ca41fa0f2e4bc7c6d9fe0186ca5e839e.camel@ibm.com> (raw)
In-Reply-To: <CANiq72k5SensLERt3PkyDfDWiQsds_3GpS4nQqPPPMVSiWwSfg@mail.gmail.com>

On Thu, 2025-06-19 at 22:22 +0200, Miguel Ojeda wrote:
> On Thu, Jun 19, 2025 at 9:35 PM Benno Lossin <lossin@kernel.org> wrote:
> > 
> > There are some subsystems that go for a library approach: extract some
> > self-contained piece of functionality and move it to Rust code and then
> > call that from C. I personally don't really like this approach, as it
> > makes it hard to separate the safety boundary, create proper
> > abstractions & write idiomatic Rust code.
> 
> Yeah, that approach works best when the interface surface is
> small/simple enough relative to the functionality, e.g. the QR code
> case we have in the kernel already.
> 
> So there are some use cases of the approach (codecs have also been
> discussed as another one). But going, in the extreme, "function by
> function" replacing C with Rust and having two-way calls everywhere
> isn't good, and it isn't the goal.
> 
> Instead, we aim to write safe Rust APIs ("abstractions") and then
> ideally having pure Rust modules that take advantage of those.
> Sometimes you may want to keep certain pieces in C, but still use them
> from the Rust module until you cover those too eventually.
> 

Yeah, I completely agree. But I would like to implement the step-by-step
approach. At first, introduce a Rust "library" that will absorb a "duplicated"
functionality of HFS/HFS+. And C code of HFS/HFS+ will re-use the functionality
of Rust "library". Then, elaborate "abstractions" (probably, HFS/HFS+ metadata
primitives) and test it in Rust "library" by calling from C code. And, finally,
completely switch to Rust implementation.

> > One good path forward using the reference driver would be to first
> > create a read-only version. That was the plan that Wedson followed with
> > ext2 (and IIRC also ext4? I might misremember). It apparently makes the
> > initial implementation easier (I have no experience with filesystems)
> > and thus works better as a PoC.
> 
> Yeah, my understanding is that a read-only version would be easier.
> Performance is another axis too.
> 
> It would be nice to see eventually a 100% safe code Rust filesystem,
> even if read-only and "slow". That could already have use cases.
> 

Frankly speaking, I don't see how Read-Only version can be easier. :) Because,
even Read-Only version requires to operate by file system's metadata. And it's
around 80% - 90% of the whole file system driver functionality. From my point of
view, it is much easier to convert every metadata structure implementation step
by step into Rust.

Thanks,
Slava.


  reply	other threads:[~2025-06-19 21:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d5ea8adb198eb6b6d2f6accaf044b543631f7a72.camel@ibm.com>
2025-05-28 12:40 ` [RFC] Should we consider to re-write HFS/HFS+ in Rust? Yangtao Li
2025-05-28 16:16   ` Viacheslav Dubeyko
2025-06-19 19:33     ` Benno Lossin
2025-06-19 20:22       ` Miguel Ojeda
2025-06-19 21:48         ` Viacheslav Dubeyko [this message]
2025-06-19 22:00           ` Benno Lossin
2025-06-20  8:17           ` Miguel Ojeda
2025-06-20 18:10             ` Viacheslav Dubeyko
2025-06-20 19:27               ` Miguel Ojeda
2025-06-19 21:39       ` Viacheslav Dubeyko
2025-06-19 22:24         ` Benno Lossin
2025-06-20 17:46           ` Viacheslav Dubeyko
2025-06-20 18:11             ` Miguel Ojeda
2025-06-21 22:38               ` Viacheslav Dubeyko
2025-06-22  7:48                 ` Benno Lossin
2025-06-23 10:25                 ` Miguel Ojeda

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=c212d2e1ca41fa0f2e4bc7c6d9fe0186ca5e839e.camel@ibm.com \
    --to=slava.dubeyko@ibm.com \
    --cc=frank.li@vivo.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=slava@dubeyko.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).