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] [day] [month] [year] [list]
Message-ID: <20200701143733.GR25523@casper.infradead.org>
Date:   Wed, 1 Jul 2020 15:37:33 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     Christoph Hellwig <hch@...radead.org>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: alternative to xa_for_each?

On Wed, Jul 01, 2020 at 07:02:39AM +0100, Christoph Hellwig wrote:
> Hi Matthew,
> 
> I'm just reviewing a patch adding an xarray user, and I'm wondering
> if we could just replace xa_for_each with a loop on
> xa_find_after with a magic index to start from the beginning?  That
> would always seem like more readable code than the magic looping macro.

The problem is that there is no index we can use for that purpose.
xa_find_after(0) should return the entry at 1 (or higher).
xa_find_after(ULONG_MAX) should return NULL.  The xas_ version doesn't
have this problem because we can distinguish between "first time" and
"subsequent time" by values in the xa_state.

> And while we're at it:  is there an idiomatic way to get the entry with
> the highest index?

That's something I need to add.  I think I did it once but then the user
went away.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ