Ping ? On Mon, 2025-06-02 at 09:50 +0200, Joakim Tjernlund wrote: > This enables mounting, like JFFS2, MTD devices by "label": > mount -t squashfs mtd:appfs /tmp > and cmdline argument: > root=mtd:rootfs > > where mtd:appfs comes from: > # > cat /proc/mtd > dev: size erasesize name > ... > mtd22: 00750000 00010000 "appfs" > > Signed-off-by: Joakim Tjernlund <joakim.tjernlund@xxxxxxxxxxxx> > --- > > - kernel test bot found white space issues, fix these. > block/bdev.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/block/bdev.c b/block/bdev.c > index 889ec6e002d7..0e53ce99481b 100644 > --- a/block/bdev.c > +++ b/block/bdev.c > @@ -17,6 +17,7 @@ > #include <linux/module.h> > #include <linux/blkpg.h> > #include <linux/magic.h> > +#include <linux/mtd/mtd.h> > #include <linux/buffer_head.h> > #include <linux/swap.h> > #include <linux/writeback.h> > @@ -1075,9 +1076,23 @@ struct file *bdev_file_open_by_path(const char *path, blk_mode_t mode, > dev_t dev; > int error; > > - error = lookup_bdev(path, &dev); > - if (error) > - return ERR_PTR(error); > +#ifdef CONFIG_MTD_BLOCK > + if (!strncmp(path, "mtd:", 4)) { > + struct mtd_info *mtd; > + > + /* mount by MTD device name */ > + pr_debug("path name \"%s\"\n", path); > + mtd = get_mtd_device_nm(path + 4); > + if (IS_ERR(mtd)) > + return ERR_PTR(-EINVAL); > + dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index); > + } else > +#endif > + { > + error = lookup_bdev(path, &dev); > + if (error) > + return ERR_PTR(error); > + } > > file = bdev_file_open_by_dev(dev, mode, holder, hops); > if (!IS_ERR(file) && (mode & BLK_OPEN_WRITE)) {