* [PATCH 0/2] befs: Add FS_IOC_GETFSLABEL / FS_IOC_SETFSLABEL ioctls @ 2026-02-12 23:13 Ethan Ferguson 2026-02-12 23:13 ` [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl Ethan Ferguson 2026-02-12 23:13 ` [PATCH 2/2] befs: Add FS_IOC_SETFSLABEL ioctl Ethan Ferguson 0 siblings, 2 replies; 6+ messages in thread From: Ethan Ferguson @ 2026-02-12 23:13 UTC (permalink / raw) To: luisbg, salah.triki; +Cc: linux-fsdevel, linux-kernel, Ethan Ferguson Add the ability to read / write to the befs filesystem label through the FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL ioctls. Ethan Ferguson (2): befs: Add FS_IOC_GETFSLABEL ioctl befs: Add FS_IOC_SETFSLABEL ioctl fs/befs/befs.h | 1 + fs/befs/linuxvfs.c | 110 +++++++++++++++++++++++++++++++++++++++------ fs/befs/super.c | 1 + 3 files changed, 99 insertions(+), 13 deletions(-) base-commit: 541c43310e85dbf35368b43b720c6724bc8ad8ec -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl 2026-02-12 23:13 [PATCH 0/2] befs: Add FS_IOC_GETFSLABEL / FS_IOC_SETFSLABEL ioctls Ethan Ferguson @ 2026-02-12 23:13 ` Ethan Ferguson 2026-02-13 5:51 ` kernel test robot 2026-02-13 8:17 ` kernel test robot 2026-02-12 23:13 ` [PATCH 2/2] befs: Add FS_IOC_SETFSLABEL ioctl Ethan Ferguson 1 sibling, 2 replies; 6+ messages in thread From: Ethan Ferguson @ 2026-02-12 23:13 UTC (permalink / raw) To: luisbg, salah.triki; +Cc: linux-fsdevel, linux-kernel, Ethan Ferguson Add the FS_IOC_GETFSLABEL ioctl to the befs filesystem. Signed-off-by: Ethan Ferguson <ethan.ferguson@zetier.com> --- fs/befs/befs.h | 1 + fs/befs/linuxvfs.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ fs/befs/super.c | 1 + 3 files changed, 48 insertions(+) diff --git a/fs/befs/befs.h b/fs/befs/befs.h index 7cd47245694d..e4e2e9f4e307 100644 --- a/fs/befs/befs.h +++ b/fs/befs/befs.h @@ -30,6 +30,7 @@ struct befs_mount_options { }; struct befs_sb_info { + char name[B_OS_NAME_LENGTH]; u32 magic1; u32 block_size; u32 block_shift; diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index d7c5d9270387..4850295e5fe0 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -64,6 +64,15 @@ static struct dentry *befs_fh_to_parent(struct super_block *sb, struct fid *fid, int fh_len, int fh_type); static struct dentry *befs_get_parent(struct dentry *child); static void befs_free_fc(struct fs_context *fc); +static int befs_ioctl_get_volume_label(struct super_block *sb, + char __user *arg); +static long befs_generic_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg); +#ifdef CONFIG_COMPAT +static long befs_generic_compat_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg); +#endif + static const struct super_operations befs_sops = { .alloc_inode = befs_alloc_inode, /* allocate a new inode */ @@ -81,6 +90,10 @@ static const struct file_operations befs_dir_operations = { .iterate_shared = befs_readdir, .llseek = generic_file_llseek, .setlease = generic_setlease, + .unlocked_ioctl = befs_generic_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = befs_generic_compat_ioctl, +#endif }; static const struct inode_operations befs_dir_inode_operations = { @@ -940,6 +953,39 @@ befs_statfs(struct dentry *dentry, struct kstatfs *buf) return 0; } +static int befs_ioctl_get_volume_label(struct super_block *sb, char __user *arg) +{ + struct befs_sb_info *sbi = BEFS_SB(sb); + + if (copy_to_user(arg, sbi->name, B_OS_NAME_LENGTH)) + return -EFAULT; + + return 0; +} + +static long befs_generic_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg) +{ + struct inode *inode = file_inode(filp); + char __user *user = (char __user *)arg; + + switch (cmd) { + case FS_IOC_GETFSLABEL: + return befs_ioctl_get_volume_label(inode->i_sb, user); + default: + return -ENOTTY; + } +} + +#ifdef CONFIG_COMPAT +static long befs_generic_compat_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg) + +{ + return befs_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int befs_get_tree(struct fs_context *fc) { return get_tree_bdev(fc, befs_fill_super); diff --git a/fs/befs/super.c b/fs/befs/super.c index 7c50025c99d8..e6a13b497ac1 100644 --- a/fs/befs/super.c +++ b/fs/befs/super.c @@ -28,6 +28,7 @@ befs_load_sb(struct super_block *sb, befs_super_block *disk_sb) else if (disk_sb->fs_byte_order == BEFS_BYTEORDER_NATIVE_BE) befs_sb->byte_order = BEFS_BYTESEX_BE; + memcpy(befs_sb->name, disk_sb->name, B_OS_NAME_LENGTH); befs_sb->magic1 = fs32_to_cpu(sb, disk_sb->magic1); befs_sb->magic2 = fs32_to_cpu(sb, disk_sb->magic2); befs_sb->magic3 = fs32_to_cpu(sb, disk_sb->magic3); -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl 2026-02-12 23:13 ` [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl Ethan Ferguson @ 2026-02-13 5:51 ` kernel test robot 2026-02-13 8:17 ` kernel test robot 1 sibling, 0 replies; 6+ messages in thread From: kernel test robot @ 2026-02-13 5:51 UTC (permalink / raw) To: Ethan Ferguson, luisbg, salah.triki Cc: oe-kbuild-all, linux-fsdevel, linux-kernel, Ethan Ferguson Hi Ethan, kernel test robot noticed the following build errors: [auto build test ERROR on 541c43310e85dbf35368b43b720c6724bc8ad8ec] url: https://github.com/intel-lab-lkp/linux/commits/Ethan-Ferguson/befs-Add-FS_IOC_GETFSLABEL-ioctl/20260213-071516 base: 541c43310e85dbf35368b43b720c6724bc8ad8ec patch link: https://lore.kernel.org/r/20260212231339.644714-2-ethan.ferguson%40zetier.com patch subject: [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl config: sparc-randconfig-002-20260213 (https://download.01.org/0day-ci/archive/20260213/202602131301.1CCwgtrL-lkp@intel.com/config) compiler: sparc64-linux-gcc (GCC) 13.4.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260213/202602131301.1CCwgtrL-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202602131301.1CCwgtrL-lkp@intel.com/ All errors (new ones prefixed by >>): fs/befs/linuxvfs.c: In function 'befs_generic_compat_ioctl': >> fs/befs/linuxvfs.c:985:61: error: implicit declaration of function 'compat_ptr' [-Werror=implicit-function-declaration] 985 | return befs_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); | ^~~~~~~~~~ cc1: some warnings being treated as errors vim +/compat_ptr +985 fs/befs/linuxvfs.c 979 980 #ifdef CONFIG_COMPAT 981 static long befs_generic_compat_ioctl(struct file *filp, unsigned int cmd, 982 unsigned long arg) 983 984 { > 985 return befs_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); 986 } 987 #endif 988 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl 2026-02-12 23:13 ` [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl Ethan Ferguson 2026-02-13 5:51 ` kernel test robot @ 2026-02-13 8:17 ` kernel test robot 1 sibling, 0 replies; 6+ messages in thread From: kernel test robot @ 2026-02-13 8:17 UTC (permalink / raw) To: Ethan Ferguson, luisbg, salah.triki Cc: llvm, oe-kbuild-all, linux-fsdevel, linux-kernel, Ethan Ferguson Hi Ethan, kernel test robot noticed the following build errors: [auto build test ERROR on 541c43310e85dbf35368b43b720c6724bc8ad8ec] url: https://github.com/intel-lab-lkp/linux/commits/Ethan-Ferguson/befs-Add-FS_IOC_GETFSLABEL-ioctl/20260213-071516 base: 541c43310e85dbf35368b43b720c6724bc8ad8ec patch link: https://lore.kernel.org/r/20260212231339.644714-2-ethan.ferguson%40zetier.com patch subject: [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl config: sparc64-allmodconfig (https://download.01.org/0day-ci/archive/20260213/202602131600.jVbNpmdD-lkp@intel.com/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 9b8addffa70cee5b2acc5454712d9cf78ce45710) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260213/202602131600.jVbNpmdD-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202602131600.jVbNpmdD-lkp@intel.com/ All errors (new ones prefixed by >>): >> fs/befs/linuxvfs.c:985:54: error: call to undeclared function 'compat_ptr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 985 | return befs_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); | ^ 1 error generated. vim +/compat_ptr +985 fs/befs/linuxvfs.c 979 980 #ifdef CONFIG_COMPAT 981 static long befs_generic_compat_ioctl(struct file *filp, unsigned int cmd, 982 unsigned long arg) 983 984 { > 985 return befs_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); 986 } 987 #endif 988 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] befs: Add FS_IOC_SETFSLABEL ioctl 2026-02-12 23:13 [PATCH 0/2] befs: Add FS_IOC_GETFSLABEL / FS_IOC_SETFSLABEL ioctls Ethan Ferguson 2026-02-12 23:13 ` [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl Ethan Ferguson @ 2026-02-12 23:13 ` Ethan Ferguson 1 sibling, 0 replies; 6+ messages in thread From: Ethan Ferguson @ 2026-02-12 23:13 UTC (permalink / raw) To: luisbg, salah.triki; +Cc: linux-fsdevel, linux-kernel, Ethan Ferguson Add the FS_IOC_SETFSLABEL ioctl to the befs filesystem. Signed-off-by: Ethan Ferguson <ethan.ferguson@zetier.com> --- fs/befs/linuxvfs.c | 64 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 4850295e5fe0..4425ae5b6ed0 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -753,6 +753,23 @@ static int befs_show_options(struct seq_file *m, struct dentry *root) return 0; } +static befs_super_block *befs_get_disk_sb(struct super_block *sb, + struct buffer_head *bh) +{ + const off_t x86_sb_off = 512; + befs_super_block *ret = (befs_super_block *) bh->b_data; + + if ((ret->magic1 == BEFS_SUPER_MAGIC1_LE) || + (ret->magic1 == BEFS_SUPER_MAGIC1_BE)) { + befs_debug(sb, "Using PPC superblock location"); + } else { + befs_debug(sb, "Using x86 superblock location"); + ret = (befs_super_block *) ((void *) bh->b_data + x86_sb_off); + } + + return ret; +} + /* This function has the responsibiltiy of getting the * filesystem ready for unmounting. * Basically, we free everything that we allocated in @@ -761,9 +778,21 @@ static int befs_show_options(struct seq_file *m, struct dentry *root) static void befs_put_super(struct super_block *sb) { - kfree(BEFS_SB(sb)->mount_opts.iocharset); - BEFS_SB(sb)->mount_opts.iocharset = NULL; - unload_nls(BEFS_SB(sb)->nls); + struct befs_sb_info *befs_sb = BEFS_SB(sb); + struct buffer_head *bh = NULL; + befs_super_block *disk_sb; + + bh = sb_bread(sb, 0); + if (bh) { + disk_sb = befs_get_disk_sb(sb, bh); + memcpy(disk_sb->name, befs_sb->name, B_OS_NAME_LENGTH); + mark_buffer_dirty(bh); + brelse(bh); + } + + kfree(befs_sb->mount_opts.iocharset); + befs_sb->mount_opts.iocharset = NULL; + unload_nls(befs_sb->nls); kfree(sb->s_fs_info); sb->s_fs_info = NULL; } @@ -798,7 +827,6 @@ befs_fill_super(struct super_block *sb, struct fs_context *fc) struct inode *root; long ret = -EINVAL; const unsigned long sb_block = 0; - const off_t x86_sb_off = 512; int blocksize; struct befs_mount_options *parsed_opts = fc->fs_private; int silent = fc->sb_flags & SB_SILENT; @@ -842,15 +870,7 @@ befs_fill_super(struct super_block *sb, struct fs_context *fc) } /* account for offset of super block on x86 */ - disk_sb = (befs_super_block *) bh->b_data; - if ((disk_sb->magic1 == BEFS_SUPER_MAGIC1_LE) || - (disk_sb->magic1 == BEFS_SUPER_MAGIC1_BE)) { - befs_debug(sb, "Using PPC superblock location"); - } else { - befs_debug(sb, "Using x86 superblock location"); - disk_sb = - (befs_super_block *) ((void *) bh->b_data + x86_sb_off); - } + disk_sb = befs_get_disk_sb(sb, bh); if ((befs_load_sb(sb, disk_sb) != BEFS_OK) || (befs_check_sb(sb) != BEFS_OK)) @@ -963,6 +983,22 @@ static int befs_ioctl_get_volume_label(struct super_block *sb, char __user *arg) return 0; } +static int befs_ioctl_set_volume_label(struct super_block *sb, char __user *arg) +{ + struct befs_sb_info *sbi = BEFS_SB(sb); + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + + if (sb_rdonly(sb)) + return -EROFS; + + if (copy_from_user(sbi->name, arg, B_OS_NAME_LENGTH)) + return -EFAULT; + + return 0; +} + static long befs_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { @@ -972,6 +1008,8 @@ static long befs_generic_ioctl(struct file *filp, unsigned int cmd, switch (cmd) { case FS_IOC_GETFSLABEL: return befs_ioctl_get_volume_label(inode->i_sb, user); + case FS_IOC_SETFSLABEL: + return befs_ioctl_set_volume_label(inode->i_sb, user); default: return -ENOTTY; } -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/2] befs: Add FS_IOC_GETFSLABEL / FS_IOC_SETFSLABEL ioctls @ 2026-02-16 18:38 Ethan Ferguson 2026-02-16 18:38 ` [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl Ethan Ferguson 0 siblings, 1 reply; 6+ messages in thread From: Ethan Ferguson @ 2026-02-16 18:38 UTC (permalink / raw) To: luisbg, salah.triki; +Cc: linux-fsdevel, linux-kernel, Ethan Ferguson Add the ability to read / write to the befs filesystem label through the FS_IOC_GETFSLABEL and FS_IOC_SETFSLABEL ioctls. v2: Added an include for <linux/compat.h> for x86-32 compat ioctls Ethan Ferguson (2): befs: Add FS_IOC_GETFSLABEL ioctl befs: Add FS_IOC_SETFSLABEL ioctl fs/befs/befs.h | 1 + fs/befs/linuxvfs.c | 111 +++++++++++++++++++++++++++++++++++++++------ fs/befs/super.c | 1 + 3 files changed, 100 insertions(+), 13 deletions(-) base-commit: 541c43310e85dbf35368b43b720c6724bc8ad8ec -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl 2026-02-16 18:38 [PATCH 0/2] befs: Add FS_IOC_GETFSLABEL / FS_IOC_SETFSLABEL ioctls Ethan Ferguson @ 2026-02-16 18:38 ` Ethan Ferguson 0 siblings, 0 replies; 6+ messages in thread From: Ethan Ferguson @ 2026-02-16 18:38 UTC (permalink / raw) To: luisbg, salah.triki; +Cc: linux-fsdevel, linux-kernel, Ethan Ferguson Add the FS_IOC_GETFSLABEL ioctl to the befs filesystem. Signed-off-by: Ethan Ferguson <ethan.ferguson@zetier.com> --- fs/befs/befs.h | 1 + fs/befs/linuxvfs.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++ fs/befs/super.c | 1 + 3 files changed, 49 insertions(+) diff --git a/fs/befs/befs.h b/fs/befs/befs.h index 7cd47245694d..e4e2e9f4e307 100644 --- a/fs/befs/befs.h +++ b/fs/befs/befs.h @@ -30,6 +30,7 @@ struct befs_mount_options { }; struct befs_sb_info { + char name[B_OS_NAME_LENGTH]; u32 magic1; u32 block_size; u32 block_shift; diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index d7c5d9270387..942d247a6cae 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -25,6 +25,7 @@ #include <linux/exportfs.h> #include <linux/seq_file.h> #include <linux/blkdev.h> +#include <linux/compat.h> #include "befs.h" #include "btree.h" @@ -64,6 +65,15 @@ static struct dentry *befs_fh_to_parent(struct super_block *sb, struct fid *fid, int fh_len, int fh_type); static struct dentry *befs_get_parent(struct dentry *child); static void befs_free_fc(struct fs_context *fc); +static int befs_ioctl_get_volume_label(struct super_block *sb, + char __user *arg); +static long befs_generic_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg); +#ifdef CONFIG_COMPAT +static long befs_generic_compat_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg); +#endif + static const struct super_operations befs_sops = { .alloc_inode = befs_alloc_inode, /* allocate a new inode */ @@ -81,6 +91,10 @@ static const struct file_operations befs_dir_operations = { .iterate_shared = befs_readdir, .llseek = generic_file_llseek, .setlease = generic_setlease, + .unlocked_ioctl = befs_generic_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = befs_generic_compat_ioctl, +#endif }; static const struct inode_operations befs_dir_inode_operations = { @@ -940,6 +954,39 @@ befs_statfs(struct dentry *dentry, struct kstatfs *buf) return 0; } +static int befs_ioctl_get_volume_label(struct super_block *sb, char __user *arg) +{ + struct befs_sb_info *sbi = BEFS_SB(sb); + + if (copy_to_user(arg, sbi->name, B_OS_NAME_LENGTH)) + return -EFAULT; + + return 0; +} + +static long befs_generic_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg) +{ + struct inode *inode = file_inode(filp); + char __user *user = (char __user *)arg; + + switch (cmd) { + case FS_IOC_GETFSLABEL: + return befs_ioctl_get_volume_label(inode->i_sb, user); + default: + return -ENOTTY; + } +} + +#ifdef CONFIG_COMPAT +static long befs_generic_compat_ioctl(struct file *filp, unsigned int cmd, + unsigned long arg) + +{ + return befs_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static int befs_get_tree(struct fs_context *fc) { return get_tree_bdev(fc, befs_fill_super); diff --git a/fs/befs/super.c b/fs/befs/super.c index 7c50025c99d8..e6a13b497ac1 100644 --- a/fs/befs/super.c +++ b/fs/befs/super.c @@ -28,6 +28,7 @@ befs_load_sb(struct super_block *sb, befs_super_block *disk_sb) else if (disk_sb->fs_byte_order == BEFS_BYTEORDER_NATIVE_BE) befs_sb->byte_order = BEFS_BYTESEX_BE; + memcpy(befs_sb->name, disk_sb->name, B_OS_NAME_LENGTH); befs_sb->magic1 = fs32_to_cpu(sb, disk_sb->magic1); befs_sb->magic2 = fs32_to_cpu(sb, disk_sb->magic2); befs_sb->magic3 = fs32_to_cpu(sb, disk_sb->magic3); -- 2.43.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-16 18:41 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-02-12 23:13 [PATCH 0/2] befs: Add FS_IOC_GETFSLABEL / FS_IOC_SETFSLABEL ioctls Ethan Ferguson 2026-02-12 23:13 ` [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl Ethan Ferguson 2026-02-13 5:51 ` kernel test robot 2026-02-13 8:17 ` kernel test robot 2026-02-12 23:13 ` [PATCH 2/2] befs: Add FS_IOC_SETFSLABEL ioctl Ethan Ferguson 2026-02-16 18:38 [PATCH 0/2] befs: Add FS_IOC_GETFSLABEL / FS_IOC_SETFSLABEL ioctls Ethan Ferguson 2026-02-16 18:38 ` [PATCH 1/2] befs: Add FS_IOC_GETFSLABEL ioctl Ethan Ferguson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®