Re: [PATCH v2] block: support mtd:<name> syntax for block devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16.05.25 09:50, Joakim Tjernlund wrote:
> +#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
>   	error = lookup_bdev(fc->source, &dev);
>   	if (error) {
>   		if (!(flags & GET_TREE_BDEV_QUIET_LOOKUP))

Can you please at least encapsulate the check in a function, so it 
doesn't look that much like a layering violation? That way we don't need 
the #ifdef in get_tree_bdev_flags() as well (and can save a layer of 
indentation).




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux