On Mon, 2025-05-19 at 14:37 +0000, Johannes Thumshirn wrote: > [You don't often get email from johannes.thumshirn@xxxxxxx. Learn why this is important at > https://aka.ms/LearnAboutSenderIdentification ;] > > On 19.05.25 15:12, Joakim Tjernlund wrote: > > This enables mounting, like JFFS2, MTD devices by "label": > > mount -t squashfs mtd:appfs /tmp > > where mtd:appfs comes from: > > # > cat /proc/mtd > > dev: size erasesize name > > ... > > mtd22: 00750000 00010000 "appfs" > > > > Signed-off-by: Joakim Tjernlund <joakim.tjernlund@xxxxxxxxxxxx> > > --- > > fs/super.c | 26 ++++++++++++++++++++++++++ > > 1 file changed, 26 insertions(+) > > > > diff --git a/fs/super.c b/fs/super.c > > index 97a17f9d9023..8c3aa2f05b42 100644 > > --- a/fs/super.c > > +++ b/fs/super.c > > @@ -37,6 +37,7 @@ > > #include <linux/user_namespace.h> > > #include <linux/fs_context.h> > > #include <uapi/linux/mount.h> > > +#include <linux/mtd/mtd.h> > > #include "internal.h" > > > > static int thaw_super_locked(struct super_block *sb, enum freeze_holder who); > > @@ -1595,6 +1596,30 @@ int setup_bdev_super(struct super_block *sb, int sb_flags, > > } > > EXPORT_SYMBOL_GPL(setup_bdev_super); > > > > +void translate_mtd_name(void) > > How can that work doesn't it need the fs_context? Dooh ... > > > +{ > > +#ifdef CONFIG_MTD_BLOCK > > + if (!strncmp(fc->source, "mtd:", 4)) { > > + struct mtd_info *mtd; > > + char *blk_source; > > + > > + /* mount by MTD device name */ > > + pr_debug("Block SB: name \"%s\"\n", fc->source); > > + > > + mtd = get_mtd_device_nm(fc->source + 4); > > + if (IS_ERR(mtd)) > > + return -EINVAL; > > + blk_source = kmalloc(20, GFP_KERNEL); > > + if (!blk_source) > > + return -ENOMEM; > > + sprintf(blk_source, "/dev/mtdblock%d", mtd->index); > > + kfree(fc->source); > > + fc->source = blk_source; > > + pr_debug("MTD device:%s found\n", fc->source); > > + } > > +#endif > > +} > > + > > /** > > * get_tree_bdev_flags - Get a superblock based on a single block device > > * @fc: The filesystem context holding the parameters > > @@ -1612,6 +1637,7 @@ int get_tree_bdev_flags(struct fs_context *fc, > > if (!fc->source) > > return invalf(fc, "No source specified"); > > > > + translate_mtd_name(); > > error = lookup_bdev(fc->source, &dev); > > if (error) { > > if (!(flags & GET_TREE_BDEV_QUIET_LOOKUP))