[PATCH] nandwrite: new mtd-utils applet

Denys Vlasenko vda.linux at googlemail.com
Tue Aug 24 04:02:45 UTC 2010


On Monday 23 August 2010 06:54, Baruch Siach wrote:
> Hi Denys,
> 
> Thanks for your review. See my comments below.
> 
> > > +	/* TODO: switch to getopt32 once it supports strtou */
> > > +	while ((opt = getopt(argc, argv, "ps:")) != -1) {
> > 
> > Do use getopt32.
> 
> And how do I do the strtou conversion with getopt32?

Example from losetup:

int losetup_main(int argc UNUSED_PARAM, char **argv)
{
        unsigned opt;
...
        char *opt_o;
        unsigned long long offset = 0;
        enum {
                OPT_d = (1 << 0),
                OPT_o = (1 << 1),
                OPT_f = (1 << 2),
        };
...
        opt = getopt32(argv, "do:f", &opt_o);
        argv += optind;

        if (opt & OPT_o)
                offset = xatoull(opt_o);

IOW: it can be simply open-coded...


> > and btw, why mtdoffset is not off_t? MTDs can be larger than 4G, right?
> 
> This is how upstream nandwrite is implemented. Upstream also does not support 
> MTDs larger than 4GB (yet?), since it uses the 32bit limited MEMERASE ioctl.  
> I'm reluctant to extend the Busybox version of nandwrite beyond the 
> capabilities of upstream, because upstream might implement this in an 
> incompatible way in the future.  IMO we should wait for this support to appear 
> upstream first, and then catch up. What do you think?

Ok then.

-- 
vda


More information about the busybox mailing list