[PATCH MTD-UTILS 5/5] ubiattach: introduce max_beb_per1024 in UBI_IOCATT
Richard Genoud
richard.genoud at gmail.com
Wed Aug 22 07:35:21 EDT 2012
2012/8/22 Artem Bityutskiy <dedekind1 at gmail.com>:
> I see 2 ways.
>
> 1. Add a 'get device property' ioctl, similar to the 'set volume
> property' ioctl we have. And use this ioctl to query the current bad
> PEBs limit.
>
> 2. Just call the 'attach' ioctl with an insane max_beb_per1024 value
> (say, -1) first. If it succeeded, than the driver does not support
> max_beb_per1024 at all, and you may exit with a warning that you have
> attached it, but the max_beb_per1024 was ignored because the kernel is
> old.
>
> If it fails with -EINVAL, this means the kernel checked the value and
> the feature is supported, so you can call it for the second time with
> the right max_beb_per1024.
>
> The first approach is more complex but probably cleaner. The second is
> easier to implement.
>
> --
> Best Regards,
> Artem Bityutskiy
There's also a 3rd one with an uname system call, checking if kernel
>= 3.7, but that's not very elegant.
--
for me, ck means con kolivas and not calvin klein... does it mean I'm a geek ?
More information about the linux-mtd
mailing list