[PATCH 1/2] MTD: pass driver methods through partition wrappers on unpartitioned devices
Artem Bityutskiy
dedekind1 at gmail.com
Thu Dec 22 08:05:49 EST 2011
On Tue, 2011-12-20 at 10:42 -0800, Mike Dunn wrote:
> + /*
> + * For unpartitioned devices, create a single "partition" that
> + * spans the entire device, so that driver methods go through
> + * partition wrappers in all cases.
> + */
> + struct mtd_partition single_part = {
> + .name = (char *)mtd->name,
> + .offset = 0,
> + .size = mtd->size,
> + .mask_flags = 0,
> + .ecclayout = mtd->ecclayout,
> + };
> + err = add_mtd_partitions(mtd, &single_part, 1);
> }
There is a problem with this approach :-(
Look at the 'mtd_blkpg_ioctl()' function which is used to re-partition
MTD device from user-space. It is a bit strange, but we use block device
for re-partition in order to not invent new ioctls.
This function has this code:
/* Only master mtd device must be used to add partitions */
if (mtd_is_partition(mtd))
return -EINVAL;
and your patch will brake re-partitioning.
So I guess we should go back to your first patch where you just change
the ->read() / ->read_oob() interface.
Or:
1. Rework whole MTD interface from ->read()/->write()/etc (pointers to
functions) to mtd_read(mtd, ...)/mtd_write(mtd, ...)/etc.
2. In the new functions you may do the stuff you do at patch 2.
For me the second approach is more plausible.
--
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20111222/aa6ed69f/attachment.sig>
More information about the linux-mtd
mailing list