[PATCH v2 09/13] fs: include cdevname in struct stat

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Dec 15 03:25:40 PST 2025



On 12/9/25 1:51 PM, Sascha Hauer wrote:
> 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>

Reviewed-by: Ahmad Fatoum <a.fatoum 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 9e2c95c6352cc63400f997bb8de53af44f4741cf..9022287dff2f4959f64eac76c544634b3978d238 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;
>  };
>  
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list