[Concept,06/23] linux: Add namei.h with pathname lookup flags

Message ID 20260119061529.3383191-7-sjg@u-boot.org
State New
Headers
Series Reduce ext4_uboot.h by moving definitions to linux headers |

Commit Message

Simon Glass Jan. 19, 2026, 6:15 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Create linux/namei.h with LOOKUP_* flags for pathname resolution
operations used by filesystem code.

Update ext4_uboot.h to use linux/namei.h instead of duplicating
the LOOKUP_FOLLOW definition.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 fs/ext4l/ext4_uboot.h |  4 ++--
 include/linux/namei.h | 26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/namei.h
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 35d1c8125df..0b1778ad0a6 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -1254,8 +1254,8 @@  void ext4_unregister_li_request(struct super_block *sb);
 
 /* Timer and timing stubs are in linux/jiffies.h */
 
-/* Path lookup flags */
-#define LOOKUP_FOLLOW			0x0001
+/* Path lookup flags - use linux/namei.h */
+#include <linux/namei.h>
 
 /* I/O priority classes */
 #define IOPRIO_CLASS_BE			2
diff --git a/include/linux/namei.h b/include/linux/namei.h
new file mode 100644
index 00000000000..7b66fb242d6
--- /dev/null
+++ b/include/linux/namei.h
@@ -0,0 +1,26 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Pathname lookup definitions for U-Boot
+ *
+ * Based on Linux namei.h - pathname resolution flags.
+ */
+#ifndef _LINUX_NAMEI_H
+#define _LINUX_NAMEI_H
+
+/* Pathname lookup flags */
+#define LOOKUP_FOLLOW		0x0001	/* Follow links at end */
+#define LOOKUP_DIRECTORY	0x0002	/* Require a directory */
+#define LOOKUP_AUTOMOUNT	0x0004	/* Force terminal automount */
+#define LOOKUP_EMPTY		0x0008	/* Accept empty path */
+#define LOOKUP_DOWN		0x0020	/* Follow mounts at start */
+#define LOOKUP_MOUNTPOINT	0x0040	/* Follow mounts at end */
+#define LOOKUP_REVAL		0x0080	/* Revalidate cache */
+#define LOOKUP_RCU		0x0100	/* RCU mode */
+#define LOOKUP_CACHED		0x0200	/* Cached lookup only */
+#define LOOKUP_PARENT		0x0400	/* Looking up parent */
+#define LOOKUP_OPEN		0x10000	/* Opening file */
+#define LOOKUP_CREATE		0x20000	/* Creating file */
+#define LOOKUP_EXCL		0x40000	/* Exclusive create */
+#define LOOKUP_RENAME_TARGET	0x80000	/* Rename target */
+
+#endif /* _LINUX_NAMEI_H */