[PATCH MTD-UTILS 5/5] ubiattach: introduce max_beb_per1024 in UBI_IOCATT
Shmulik Ladkani
shmulik.ladkani at gmail.com
Wed Aug 22 07:47:51 EDT 2012
Hi Artem,
On Wed, 22 Aug 2012 14:33:17 +0300 Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> > 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.
But the ioctl might return -EINVAL due to any of the *other*
ubi_attach_req fields being invalid.
So you can't really determine whether max_beb_per1024 is supported.
> > The first approach is more complex but probably cleaner. The second is
> > easier to implement.
>
> I guess I prefer the second option, though. What do you think?
I would go with first, due to my slight tendency to over-design
things ;-)
It is cleaner, however bloatier too...
I'll try to think if there's an easy alternative.
Regards,
Shmulik
More information about the linux-mtd
mailing list