[PATCH 07/10] fs: include cdevname in struct stat

Sascha Hauer s.hauer at pengutronix.de
Thu Nov 27 01:19:29 PST 2025


In Linux struct stat contains the major/minor numbers of the underlying
device, consequently we put the cdev name into struct stat.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 fs/fs.c              | 1 +
 include/linux/stat.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index b96393e2301e2d8a622e319e0033953399b4e989..41cdaf5070798388aa989d16e7bf2ace081b4a2b 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1117,6 +1117,7 @@ static void stat_inode(struct inode *inode, struct stat *s)
 	s->st_mode = inode->i_mode;
 	s->st_uid = inode->i_uid;
 	s->st_gid = inode->i_gid;
+	s->st_cdevname = inode->cdevname;
 }
 
 int fstat(int fd, struct stat *s)
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 6ee05b52873f47e5d17a4387829187512be29ea8..84b6484a1f2149d1f2d770f0f11bf0ae0ef63744 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -55,6 +55,7 @@ struct stat {
 	unsigned short st_mode;
 	unsigned short st_uid;
 	unsigned short st_gid;
+	const char *st_cdevname; /* barebox specific */
 	loff_t  st_size;
 };
 

-- 
2.47.3




More information about the barebox mailing list