[PATCH 09/10] mtd-utils: nanddump: type consistency
Mike Frysinger
vapier.adi at gmail.com
Tue Nov 9 19:00:43 EST 2010
On Tue, Nov 9, 2010 at 13:19, Brian Norris wrote:
> On 11/9/2010 1:51 AM, Mike Frysinger wrote:
>> On Wed, Nov 3, 2010 at 04:27, Brian Norris wrote:
>>> --- a/nandwrite.c
>>> +++ b/nandwrite.c
>>> @@ -262,7 +262,7 @@ int main(int argc, char * const argv[])
>>> long long blockstart = -1;
>>> struct mtd_dev_info mtd;
>>> struct mtd_oob_buf oob;
>>> - loff_t offs;
>>> + long long offs;
>>> int ret;
>>> int oobinfochanged = 0;
>>> struct nand_oobinfo old_oobinfo;
>>
>> i dont think this is quite right. "offs" is given to an ioctl which
>> takes __kernel_loff_t ... we shouldnt assume "long long" and
>> "__kernel_loff_t" are always the same.
>
> This problem is sort of a "which comes first" question for me: I put
> this patch before patch 10, where in patch 10, the ioctl in question is
> replaced with an entirely different call to "mtd_is_bad".
>
> In the new usage (patch 10), "mtd_is_bad" needs the eraseblock number as
> an int, so there's some arithmetic going on ("offs" divided by ebsize)
> that passes an int to "mtd_is_bad".
>
> I was just trying to unify the usage of different 64-bit data types, and
> after patch 10, there's no need to be using the "loff_t" type. However,
> if it makes more sense, I can rearrange patch 9 and 10 such that the
> type change comes after the ioctl is no longer called directly.
i'd leave the type unchanged when using the ioctl() and change it only
when moving to a different API
-mike
More information about the linux-mtd
mailing list