[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211153423.4160836-1-aliceryhl@google.com>
Date: Mon, 11 Dec 2023 15:34:23 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: benno.lossin@...ton.me
Cc: a.hindborg@...sung.com, alex.gaynor@...il.com,
aliceryhl@...gle.com, arve@...roid.com, bjorn3_gh@...tonmail.com,
boqun.feng@...il.com, brauner@...nel.org, cmllamas@...gle.com,
dan.j.williams@...el.com, dxu@...uu.xyz, gary@...yguo.net,
gregkh@...uxfoundation.org, joel@...lfernandes.org,
keescook@...omium.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, maco@...roid.com, ojeda@...nel.org,
peterz@...radead.org, rust-for-linux@...r.kernel.org,
surenb@...gle.com, tglx@...utronix.de, tkjos@...roid.com,
viro@...iv.linux.org.uk, wedsonaf@...il.com, willy@...radead.org
Subject: Re: [PATCH v2 1/7] rust: file: add Rust abstraction for `struct file`
Benno Lossin <benno.lossin@...ton.me> wrutes:
> > + // SAFETY: `fget` either returns null or a valid pointer to a file, and we checked for null
> > + // above.
>
> Since now both the Rust and C functions are called `fget`, I think you
> should refer to `bindings::fget`.
> [...]
> > + unsafe fn dec_ref(obj: ptr::NonNull<Self>) {
> > + // SAFETY: The safety requirements guarantee that the refcount is nonzero.
> > + unsafe { bindings::fput(obj.cast().as_ptr()) }
>
> The comment should also justify the cast.
I'll make both changes.
Alice
Powered by blists - more mailing lists