From: Hongbo Li Date: Mon, 26 Aug 2024 09:17:00 +0000 (+0800) Subject: ubifs: add support for FS_IOC_GETFSSYSFSPATH X-Git-Tag: microblaze-v6.16~483^2~18 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=39ba2b9ac6fd61c67c83b8fd2a3ec6b0bea89490;p=linux-2.6-microblaze.git ubifs: add support for FS_IOC_GETFSSYSFSPATH In commit ae8c51175730 ("fs: add FS_IOC_GETFSSYSFSPATH"), a new fs ioctl was introduced to standardize exporting data from sysfs across filesystems. The returned path will always be of the form "$FSTYP/$SYSFS_IDENTIFIER", where the sysfs identifier may be a UUID or a device name. The ubifs is a file system based on char device, and the common method to fill s_sysfs_name (super_set_sysfs_name_bdev) is unavialable. So in order to support FS_IOC_GETFSSYSFSPATH ioctl, we fill the s_sysfs_name with ubi_volume_info member which keeps the format defined in macro UBIFS_DFS_DIR_NAME by using super_set_sysfs_name_generic. That's for ubifs, it will output "ubifs/". ``` $ ./ioctl_getfssysfs_path /mnt/ubifs/testfile path: ubifs/ubi0_0 $ ls /sys/fs/ubifs/ubi0_0/ errors_crc errors_magic errors_node ``` Signed-off-by: Hongbo Li Reviewed-by: Zhihao Cheng Signed-off-by: Richard Weinberger --- diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 291583005dd1..cb26b8b27ef6 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -2249,6 +2249,8 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) } super_set_uuid(sb, c->uuid, sizeof(c->uuid)); + super_set_sysfs_name_generic(sb, UBIFS_DFS_DIR_NAME, + c->vi.ubi_num, c->vi.vol_id); mutex_unlock(&c->umount_mutex); return 0;