[Concept,02/23] linux: path: Add path_put and d_path stubs
Commit Message
From: Simon Glass <simon.glass@canonical.com>
Add path_put() macro and d_path() stub function to linux/path.h for
filesystem code that uses path operations.
Update linux/fs.h to include linux/path.h instead of duplicating
the struct path definition.
Update ext4_uboot.h to use linux/path.h instead of duplicating
these definitions.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/ext4_uboot.h | 12 +++---------
include/linux/fs.h | 7 ++-----
include/linux/path.h | 31 +++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+), 14 deletions(-)
@@ -928,13 +928,8 @@ void mapping_clear_folio_cache(struct address_space *mapping);
#define sb_start_pagefault(sb) do { (void)(sb); } while (0)
#define sb_end_pagefault(sb) do { (void)(sb); } while (0)
-/* d_path - get pathname - stub returns empty path */
-static inline char *d_path(const struct path *path, char *buf, int buflen)
-{
- if (buflen > 0)
- buf[0] = '\0';
- return buf;
-}
+/* d_path, path_put - use linux/path.h */
+#include <linux/path.h>
/* fscrypt_file_open is in ext4_fscrypt.h */
#define fsverity_file_open(i, f) ({ (void)(i); (void)(f); 0; })
@@ -1379,8 +1374,7 @@ int inode_generic_drop(struct inode *inode);
/* NFS export helpers are now in linux/exportfs.h */
-/* Path operations */
-#define path_put(p) do { } while (0)
+/* Path operations - path_put, d_path are in linux/path.h */
/* I/O priority - declaration for stub.c */
int IOPRIO_PRIO_VALUE(int class, int data);
@@ -51,11 +51,8 @@ struct vfsmount {
struct dentry *mnt_root;
};
-/* path - pathname components */
-struct path {
- struct vfsmount *mnt;
- struct dentry *dentry;
-};
+/* path - use linux/path.h */
+#include <linux/path.h>
/* Buffer operations are in buffer_head.h */
@@ -1,4 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Path definitions for U-Boot
+ *
+ * Based on Linux path.h - filesystem path operations.
+ */
#ifndef _LINUX_PATH_H
#define _LINUX_PATH_H
@@ -10,4 +15,30 @@ struct path {
struct dentry *dentry;
};
+/**
+ * path_put() - release a path reference
+ * @path: path to release
+ *
+ * U-Boot stub - no reference counting.
+ */
+#define path_put(path) do { (void)(path); } while (0)
+
+/**
+ * d_path() - get pathname from path structure
+ * @path: path to convert
+ * @buf: buffer for pathname
+ * @buflen: size of buffer
+ *
+ * U-Boot stub - returns empty string.
+ *
+ * Return: pointer to pathname in buffer
+ */
+static inline char *d_path(const struct path *path, char *buf, int buflen)
+{
+ (void)path;
+ if (buflen > 0)
+ buf[0] = '\0';
+ return buf;
+}
+
#endif /* _LINUX_PATH_H */