Re: [PATCH v2 1/2] open: new O_REGULAR flag support

From: Jan Kara

Date: Mon Jan 26 2026 - 11:11:21 EST


On Mon 26-01-26 21:39:21, Dorjoy Chowdhury wrote:
> This flag indicates the path should be opened if it's a regular file.
> A relevant error code ENOTREGULAR(35) has been introduced. For example,
> if open is called on path /dev/null with O_REGULAR in the flag param,
> it will return -ENOTREGULAR.
>
> When used in combination with O_CREAT, either the regular file is
> created, or if the path already exists, it is opened if it's a regular
> file. Otherwise, -ENOTREGULAR is returned.
>
> -EINVAL is returned when O_REGULAR is combined with O_DIRECTORY (not
> part of O_TMPFILE) because it doesn't make sense to open a path that
> is both a directory and a regular file.
>
> Signed-off-by: Dorjoy Chowdhury <dorjoychy111@xxxxxxxxx>

The feature looks useful to me (but the justification with the danger of
being tricked into opening some device nodes would be nice to have here in
the changelog).

> diff --git a/arch/parisc/include/uapi/asm/fcntl.h b/arch/parisc/include/uapi/asm/fcntl.h
> index 03dee816cb13..efd763335ff7 100644
> --- a/arch/parisc/include/uapi/asm/fcntl.h
> +++ b/arch/parisc/include/uapi/asm/fcntl.h
> @@ -19,6 +19,7 @@
>
> #define O_PATH 020000000
> #define __O_TMPFILE 040000000
> +#define O_REGULAR 060000000

This looks wrong? O_REGULAR is overlapping with O_PATH and __O_TMPFILE???

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR