lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH5fLggUvcERo2+xwSkFcv-ds++4sy+Q5JoxCCjrx-R41KfDiA@mail.gmail.com>
Date: Fri, 31 Jan 2025 12:36:22 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Daniel Sedlak <daniel@...lak.dev>
Cc: Daniel Almeida <daniel.almeida@...labora.com>, ojeda@...nel.org, alex.gaynor@...il.com, 
	boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.mco, 
	benno.lossin@...ton.me, a.hindborg@...nel.org, tmgross@...ch.edu, 
	gregkh@...uxfoundation.org, rafael@...nel.org, dakr@...nel.org, 
	boris.brezillon@...labora.com, robh@...nel.org, 
	rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 3/3] rust: platform: allow ioremap of platform resources

On Fri, Jan 31, 2025 at 11:19 AM Daniel Sedlak <daniel@...lak.dev> wrote:
>
> Hi,
>
> On 1/30/25 11:05 PM, Daniel Almeida wrote:
> > +
> > +    /// Same as [`Self::ioremap_resource`] but with exclusive access to the underlying
> > +    /// region.
> > +    pub fn ioremap_resource_exclusive(
> > +        &self,
> > +        resource: &Resource,
> > +    ) -> Result<Devres<ExclusiveIoMem<0>>> {
> > +        self.ioremap_resource_exclusive_sized::<0>(resource)
> > +    }
> > +
> > +    /// Returns the resource at `index`, if any.
> > +    pub fn resource(&self, index: u32) -> Option<&Resource> {
>
> Maybe we could utilize the Index [1] trait to make the API more rust~ish?
> Or at least name it `resource_by_index` to keep consistency with
> `resource_by_name`?
>
> Link: https://doc.rust-lang.org/core/ops/trait.Index.html [1]

Using the index trait would result in syntax like device[7] to get the
resource at index 7. I think that would be unclear because it's not
obvious that devices should behave like an array of resources.

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ