erofs: Add support for FS_IOC_GETFSLABEL
PATCH v5 1/1 erofs: Add support for FS_IOC_GETFSLABEL
From: Bo Liui (OpenAnolis) <[email protected]>
Add support for reading to the erofs volume label from the FS_IOC_GETFSLABEL ioctls.
Signed-off-by Bo Liu (OpenAnolis) <[email protected]>
Reviewed-by Gao Xiang <[email protected]>
---
v1: https://lore.kernel.org/linux-erofs/[email protected]/
v2: https://lore.kernel.org/linux-erofs/[email protected]/
v3: https://lore.kernel.org/linux-erofs/[email protected]/
v4: https://lore.kernel.org/linux-erofs/[email protected]/
change since v4:
- fix 0day build errors.
fs/erofs/data.c | 4 ++++ fs/erofs/dir.c | 4 ++++ fs/erofs/inode.c | 41 +++++++++++++++++++++++++++++++++++++---- fs/erofs/internal.h | 6 ++++++ fs/erofs/super.c | 8 ++++++++ 5 files changed, 59 insertions(+), 4 deletions(-)
fs/erofs/data.c +4 -0
@@ -475,6 +475,10 @@ static loff_t erofs_file_llseek(struct file *file, loff_t offset, int whence)const struct file_operations erofs_file_fops = { .llseek = erofs_file_llseek, .read_iter = erofs_file_read_iter, + .unlocked_ioctl = erofs_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = erofs_compat_ioctl, +#endif .mmap_prepare = erofs_file_mmap_prepare, .get_unmapped_area = thp_get_unmapped_area, .splice_read = filemap_splice_read,
fs/erofs/dir.c +4 -0
@@ -123,4 +123,8 @@ const struct file_operations erofs_dir_fops = { .llseek = generic_file_llseek, .read = generic_read_dir, .iterate_shared = erofs_readdir, + .unlocked_ioctl = erofs_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = erofs_compat_ioctl, +#endif };
fs/erofs/inode.c +37 -4
59 lines not on this page · raw message
fs/erofs/internal.h +6 -0
@@ -166,6 +166,8 @@ struct erofs_sb_info {struct erofs_domain *domain;char *fsid;char *domain_id; + +char *volume_name; };#define EROFS_SB (sb) ((struct erofs_sb_info *)(sb)->s_fs_info)
@@ -535,6 +537,10 @@ static inline struct bio *erofs_fscache_bio_alloc(struct erofs_map_dev *mdev) {static inline void erofs_fscache_submit_bio (struct bio *bio) {}#endif +long erofs_ioctl (struct file *filp,unsigned int cmd,unsigned long arg); +long erofs_compat_ioctl (struct file *filp,unsigned int cmd, +unsigned long arg); +#define EFSCORRUPTED EUCLEAN/* Filesystem is corrupted */ #endif /* __EROFS_INTERNAL_H */
fs/erofs/super.c +8 -0
@@ -343,6 +343,13 @@ static int erofs_read_superblock(struct super_block *sb) sbi->fixed_nsec =le32_to_cpu (dsb->fixed_nsec);super_set_uuid (sb, (void *)dsb->uuid,sizeof (dsb->uuid)); +if (dsb->volume_name[0 ]) { + sbi->volume_name =kstrndup (dsb->volume_name, +sizeof (dsb->volume_name),GFP_KERNEL ); +if (!sbi->volume_name) +return -ENOMEM ; + } +/* parse on-disk compression configurations */ ret =z_erofs_parse_cfgs (sb, dsb);if (ret <0 )
@@ -822,6 +829,7 @@ static void erofs_sb_free(struct erofs_sb_info *sbi)kfree (sbi->domain_id);if (sbi->dif0.file)fput (sbi->dif0.file); +kfree (sbi->volume_name);kfree (sbi); }
Signature · 1 line
2.31.1