Messages in this thread | ![/](/images/icornerl.gif) | | Date | Mon, 11 Dec 2023 15:34:23 +0000 | Subject | Re: [PATCH v2 1/7] rust: file: add Rust abstraction for `struct file` | From | Alice Ryhl <> |
| |
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
| ![\](/images/icornerr.gif) |