lkml.org 
[lkml]   [2023]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 1/7] rust: file: add Rust abstraction for `struct file`
From
Benno Lossin <benno.lossin@proton.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

\
 
 \ /
  Last update: 2023-12-11 16:35    [W:0.087 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site