[PATCH v3] libmtd: add helper funcs for getting regioninfo and locked info

Mike Frysinger vapier at gentoo.org
Wed Jun 8 14:10:27 EDT 2011


On Wed, Jun 8, 2011 at 07:47, Artem Bityutskiy wrote:
> On Tue, 2011-06-07 at 11:52 -0400, Mike Frysinger wrote:
>> This extends the libmtd with the helper functions:
>>       mtd_regioninfo: interface to MEMGETREGIONINFO
>>       mtd_islocked: interface to MEMISLOCKED
>>
>> Users of these functions will follow shortly ...
>>
>> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
>> ---
>> v3
>>       - add a "islocked_supported" field to handle older kernels nicely
>
> Umm, I meant a user-visible flag, so that the user could check it and
> not even try to print the map.

there is an option to not print the map ... "-M --map".  not sure what
you mean other than that.

> There does not seem to be much point having this flag otherewise
> - we can just call the ioctl, and return
> error if it fails, without printing any error message.

built-in optimization.  no point in doing the ioctl() over and over if
you know it's going to fail.

although thinking about it a bit more, i think the optimization is
incorrect.  it binds the status to the libmtd_t handle which is
per-library, not per-mtd.  so using it on different mtd devices would
result in misbehavior.
-mike



More information about the linux-mtd mailing list