mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fs: fix overlap of O_RWSIZE with new O_PATH/O_CHROOT flags
@ 2024-03-08 14:20 Ahmad Fatoum
  0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2024-03-08 14:20 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

O_PATH had the same value as O_RWSIZE_2, while O_CHROOT overlapped with
O_RWSIZE_4. Fix this by moving up the bits used for O_PATH and O_CHROOT.

This resolves the EINVAL reported when running md -w 0.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
This fixes a regression in next cause by:
  fs: implement O_PATH
  fs: implement O_CHROOT

@Sascha, could you apply the changes to each commit individually, so
there's no regression? Alternatively, I can resent these two commits
to replace what's in next.
---
 include/fcntl.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/fcntl.h b/include/fcntl.h
index 532a3a0f6b1e..a746471411b5 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -23,11 +23,6 @@
 #define O_APPEND	00002000
 #define O_DIRECTORY	00200000	/* must be a directory */
 #define O_NOFOLLOW	00400000	/* don't follow links */
-#define O_PATH		02000000	/* open as path */
-#define O_CHROOT	04000000	/* dirfd: stay within filesystem root */
-#define __O_TMPFILE	020000000
-
-#define O_TMPFILE       (__O_TMPFILE | O_DIRECTORY)
 
 /* barebox additional flags */
 #define O_RWSIZE_MASK	017000000
@@ -37,6 +32,12 @@
 #define O_RWSIZE_4	004000000
 #define O_RWSIZE_8	010000000
 
+#define __O_TMPFILE	020000000
+#define O_PATH		040000000	/* open as path */
+#define O_CHROOT	0100000000	/* dirfd: stay within filesystem root */
+
+#define O_TMPFILE       (__O_TMPFILE | O_DIRECTORY)
+
 int openat(int dirfd, const char *pathname, int flags);
 
 static inline int open(const char *pathname, int flags, ...)
-- 
2.39.2




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-08 14:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08 14:20 [PATCH] fs: fix overlap of O_RWSIZE with new O_PATH/O_CHROOT flags Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox