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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YS3laqvwXE9XoAD/@hovoldconsulting.com>
Date:   Tue, 31 Aug 2021 10:16:42 +0200
From:   Johan Hovold <johan@...nel.org>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     "Fabio M. De Francesco" <fmdefrancesco@...il.com>,
        Alex Elder <elder@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        greybus-dev@...ts.linaro.org, linux-staging@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4] staging: greybus: Convert uart.c from IDR to XArray

On Mon, Aug 30, 2021 at 02:31:35PM +0100, Matthew Wilcox wrote:
> On Mon, Aug 30, 2021 at 02:33:05PM +0200, Johan Hovold wrote:
> > On Mon, Aug 30, 2021 at 01:16:07PM +0100, Matthew Wilcox wrote:
> > > On Mon, Aug 30, 2021 at 01:52:48PM +0200, Johan Hovold wrote:
> > > > Whether the API is better is debatable. As I said, almost no drivers use
> > > > the new XArray interface, and perhaps partly because the new interface
> > > > isn't as intuitive as has been claimed (e.g. xa_load() instead of
> > > > ida_find()). And IDR/IDA isn't marked/documented as deprecated as far as
> > > > I know.

> > > Why do you think that idr_find() is more intuitive than xa_load()?
> > > The 'find' verb means that you search for something.  But it doesn't
> > > search for anything; it just returns the pointer at that index.
> > > 'find' should return the next non-NULL pointer at-or-above a given
> > > index.
> > 
> > We're looking up a minor number which may or may not exist. "Find" (or
> > "lookup" or "search") seems to describe this much better than "load"
> > (even if that may better reflect the implementation of XArray).
> 
> It's not the _implementation_ that it fits, it's the _idiom_.
> The implementation is a lookup in a trie.  The idiom of the XArray
> is that it's a sparse array, and so it's a load.

Ok, but it still stands out in the conversions since it is in no way
obvious that idr_find() should be replaced by xa_load() from just
looking at the diff. You need to look up the interface for that.

> > And no, I would not expect a find implementation to return the next
> > entry if the requested entry does not exist (and neither does idr_find()
> > or radix_tree_lookup()).
> 
> Oh dear.  You've been corrupted by the bad naming of the IDR functions
> ;-(

Heh. Don't flatter yourself. Just look up any text book on data
structures.

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ