|
|
Log in / Subscribe / Register

O_REGULAR flag support for open

From:  Dorjoy Chowdhury <dorjoychy111-AT-gmail.com>
To:  linux-fsdevel-AT-vger.kernel.org
Subject:  [PATCH 0/2] O_REGULAR flag support for open
Date:  Sun, 25 Jan 2026 20:14:04 +0600
Message-ID:  <20260125141518.59493-1-dorjoychy111@gmail.com>
Cc:  linux-kernel-AT-vger.kernel.org, viro-AT-zeniv.linux.org.uk, brauner-AT-kernel.org, jack-AT-suse.cz, jlayton-AT-kernel.org, chuck.lever-AT-oracle.com, alex.aring-AT-gmail.com, arnd-AT-arndb.de
Archive-link:  Article

Hi,

I came upon this "Ability to only open regular files" uapi feature suggestion
from https://uapi-group.org/kernel-features/#ability-to-only-o...
and thought it would be something I could do as a first patch and get to
know the kernel code a bit better.

I am not quite sure if the semantics that I baked into the code for this
O_REGULAR flag's behavior when combined with other flags like O_CREAT look
good and if there are other places that need the checks. I can fixup my
patch according to suggestions for improvement. I did some happy path testing
and the O_REGULAR flag seems to work as intended.

Thanks.

Regards,
Dorjoy

Dorjoy Chowdhury (2):
  open: new O_REGULAR flag support
  kselftest/openat2: test for O_REGULAR flag

 fs/fcntl.c                                    |  2 +-
 fs/namei.c                                    |  6 +++
 fs/open.c                                     |  4 +-
 include/linux/fcntl.h                         |  2 +-
 include/uapi/asm-generic/errno-base.h         |  1 +
 include/uapi/asm-generic/fcntl.h              |  4 ++
 .../testing/selftests/openat2/openat2_test.c  | 37 ++++++++++++++++++-
 7 files changed, 52 insertions(+), 4 deletions(-)

-- 
2.52.0




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds