Re: [libgpiod][PATCH v2 1/3] bindings: rust: fix soundness of line_info modeling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29-09-23, 15:18, Erik Schilling wrote:
> diff --git a/bindings/rust/libgpiod/src/chip.rs b/bindings/rust/libgpiod/src/chip.rs
> index 81e1be6..9ef8f22 100644
> --- a/bindings/rust/libgpiod/src/chip.rs
> +++ b/bindings/rust/libgpiod/src/chip.rs
> @@ -107,7 +107,9 @@ impl Chip {
>              ));
>          }
>  
> -        line::Info::new(info)
> +        // SAFETY: We verified that the pointer is valid. We own the pointer and
> +        // no longer use it after converting it into a Info instance.
> +        Ok(unsafe { line::Info::from_raw_owned(info) })

Hmm, I was expecting the naming to be simplified in this version here.

Now:

Info::from_raw_owned()
InfoRef::from_raw_non_owning()

What I am suggesting:

Info::from_raw()
InfoRef::from_raw()

Or maybe just `new()` routines for both ?

I think structure names tell us enough about ownership here and we don't need to
add it to functions.

-- 
viresh



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux