[PATCH 1/2] MTD: pass driver methods through partition wrappers on unpartitioned devices

Mike Dunn mikedunn at newsguy.com
Thu Dec 22 18:28:32 EST 2011


On 12/22/2011 05:05 AM, Artem Bityutskiy wrote:
> 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.


Sorry, missed that too.  So many perils...

Thanks,
Mike




More information about the linux-mtd mailing list