Re: [RFC][PATCH] Mark AT_* path flags as deprecated and add missing RESOLVE_ flags

From: Christian Brauner
Date: Fri Mar 06 2020 - 09:10:35 EST


On Sat, Mar 07, 2020 at 12:41:16AM +1100, Aleksa Sarai wrote:
> On 2020-03-05, David Howells <dhowells@xxxxxxxxxx> wrote:
> > Do we want to do this? Or should we duplicate the RESOLVE_* flags to AT_*
> > flags so that existing *at() syscalls can make use of them?
> >
> > David
> > ---
> > commit 448731bf3b29f2b1f7c969d7efe1f0673ae13b5e
> > Author: David Howells <dhowells@xxxxxxxxxx>
> > Date: Thu Mar 5 17:40:02 2020 +0000
> >
> > Mark AT_* flags as deprecated and add missing RESOLVE_ flags
> >
> > It has been suggested that new path-using system calls should use RESOLVE_*
> > flags instead of AT_* flags, but the RESOLVE_* flag functions are not a
> > superset of the AT_* flag functions. So formalise this by:
> >
> > (1) In linux/fcntl.h, add a comment noting that the AT_* flags are
> > deprecated for new system calls and that RESOLVE_* flags should be
> > used instead.
>
> I wouldn't say it that way -- the RESOLVE_* flags should be used by
> syscalls *where it makes sense to change the path resolution rules*. If
> it makes more sense for them to have their own flag set, they should
> arguably make a separate one (like renameat2 did -- though renameat2 can
> never take AT_EMPTY_PATH because it isn't sufficiently extensible).

Yeah, we should clearly state that they are not a replacement for
_all_ the AT_* flags. I think it makes sense to think of RESOLVE_* flags
as a superset of the path-resolution portions of AT_* flags.

Maybe in openat2.h:

/*
* Flags available to syscalls wanting to modify how paths are resolved.
* RESOLVE_* flags are intended to as a superset of those AT_* flags
* concerned with path resolution. All syscalls modifying their path
* resolution behavior are expected to use RESOLVE_* flags.
*/

Something like this (Native speaker can probably do this way nicer.)?