[PATCH] [MTD] mtd-utils: Use new 64-bit ioctls to access >4GiB devices
kpc.mtd at gmail.com
Wed Mar 18 16:40:54 EDT 2009
On Wed, Mar 18, 2009 at 5:06 AM, Josh Boyer <jwboyer at gmail.com> wrote:
> On Wed, Mar 18, 2009 at 08:50:08AM +0100, Ricard Wanderlof wrote:
>> Wouldn't it be an idea to support both the old and new calls for a while
>> (using compile time switching), in case someone wants to grab a newer
>> version of mtdtools but doesn't have a newer kernel for whatever reason?
> Yes, it would. In fact, it would be better to probably add a new
> --large-device (or similar) option to all the utilities so that
> they can use both with a runtime switch.
OK, new proposal:
In my original mtd-utils patch, I replaced each "32-bit" ioctl call
with the new "64-bit" equivalent.
Instead of replacing each "32-bit" ioctl with a "64-bit" ioctl,
replace it with a call to a wrapper function that decides which ioctl
to use. The wrapper functions will figure out whether the kernel
supports the new ABI, and cache the answer so that it only needs to do
The wrapper functions would always return the "64-bit" structures, and
translate the old structures to the new format if they had to call the
"32-bit" ioctl. This way, the utilities only need to deal with the
"64-bit" data structures, and do not need any backward compatibility
code of their own.
I can add this to libmtd, if that is an interface you would like to
standardize on. Or I can just make a new "ioctl.c" file and build it
into each utility.
More information about the linux-mtd