linux-bcachefs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Overstreet <kent.overstreet@linux.dev>
To: TruongSinh Tran-Nguyen <i@truongsinh.pro>
Cc: linux-bcachefs@vger.kernel.org
Subject: Re: [PATCH] chore(format): rewrite `read_one_super` in Rust
Date: Fri, 28 Apr 2023 20:32:56 -0400	[thread overview]
Message-ID: <ZExluHAmghQHp/Fi@moria.home.lan> (raw)
In-Reply-To: <20230428192833.86943-1-i@truongsinh.pro>

On Fri, Apr 28, 2023 at 12:28:33PM -0700, TruongSinh Tran-Nguyen wrote:
> This rewrite tries to be as close to C code as possible, thus almost the whole
> block is in `unsafe {}`. After this commit is merge, there will be further
> refactoring to make it more Rust-idiomatic. There are several things to note:
> 
> 1. `read_one_super_result` return the result, with the Error formatting again
>   closely matches C's counter-part. In the future, we may no longer need
>   `return_code` inside the error.
> 2. There is only 1 `goto` statement, which can be easily rewritten into a loop
>   with conditional break
> 3. There are several functions and const defined as C macro that are redefined
>   as `fn_*` for functions and `BLK_.*`
> 4. This rewritten is aware for BCACHEFS_NO_RUST flag

 - libbcachefs/ is imported from the kernel repository, we don't make
   changes here in -tools, they have to be commited to that repository
   and imported so things stay in sync.
 - also, we don't yet have things figured out for building rust code
   kernel side; there shouldn't be anything too difficult there but we
   need to figure out build system integration. If you're feeling
   ambitious, you could start there...

      reply	other threads:[~2023-04-29  0:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 19:28 [PATCH] chore(format): rewrite `read_one_super` in Rust TruongSinh Tran-Nguyen
2023-04-29  0:32 ` Kent Overstreet [this message]

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=ZExluHAmghQHp/Fi@moria.home.lan \
    --to=kent.overstreet@linux.dev \
    --cc=i@truongsinh.pro \
    --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;
as well as URLs for NNTP newsgroup(s).