[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH v3] nandwrite: implement -n (read/write without ecc)
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2016-01-02 0:33:21
Message-ID: CAK1hOcPDrNpMua9LwVgL_YO=SRKHJcbu2FsOdMt8AUeH+TSqwQ () mail ! gmail ! com
[Download RAW message or body]

Applied, thanks!

On Sat, Dec 19, 2015 at 9:34 PM, Aaro Koskinen <aaro.koskinen@iki.fi> wrote:
> Implement -n (read/write without ecc).
> 
> Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> ---
> 
> v3: Use xioctl() instead of open coding it.
> 
> v2: http://marc.info/?t=144763280800001&r=1&w=2
> 
> The first version was bogus, opt bits were messed up.
> 
> v1: http://marc.info/?l=busybox&m=144763034328791&w=2
> 
> miscutils/nandwrite.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c
> index 247fc72..c95cbb2 100644
> --- a/miscutils/nandwrite.c
> +++ b/miscutils/nandwrite.c
> @@ -29,16 +29,18 @@
> //kbuild:lib-$(CONFIG_NANDDUMP) += nandwrite.o
> 
> //usage:#define nandwrite_trivial_usage
> -//usage:       "[-p] [-s ADDR] MTD_DEVICE [FILE]"
> +//usage:       "[-np] [-s ADDR] MTD_DEVICE [FILE]"
> //usage:#define nandwrite_full_usage "\n\n"
> //usage:       "Write to MTD_DEVICE\n"
> +//usage:     "\n       -n      Write without ecc"
> //usage:     "\n       -p      Pad to page size"
> //usage:     "\n       -s ADDR Start address"
> 
> //usage:#define nanddump_trivial_usage
> -//usage:       "[-o]" IF_LONG_OPTS(" [--bb=padbad|skipbad]") " [-s ADDR] [-l LEN] \
> [-f FILE] MTD_DEVICE" +//usage:       "[-no]" IF_LONG_OPTS(" \
> [--bb=padbad|skipbad]") " [-s ADDR] [-l LEN] [-f FILE] MTD_DEVICE" //usage:#define \
>                 nanddump_full_usage "\n\n"
> //usage:       "Dump MTD_DEVICE\n"
> +//usage:     "\n       -n      Read without ecc"
> //usage:     "\n       -o      Dump oob data"
> //usage:     "\n       -s ADDR Start address"
> //usage:     "\n       -l LEN  Length"
> @@ -57,10 +59,11 @@
> 
> #define OPT_p  (1 << 0) /* nandwrite only */
> #define OPT_o  (1 << 0) /* nanddump only */
> -#define OPT_s  (1 << 1)
> -#define OPT_f  (1 << 2)
> -#define OPT_l  (1 << 3)
> -#define OPT_bb (1 << 4) /* must be the last one in the list */
> +#define OPT_n  (1 << 1)
> +#define OPT_s  (1 << 2)
> +#define OPT_f  (1 << 3)
> +#define OPT_l  (1 << 4)
> +#define OPT_bb (1 << 5) /* must be the last one in the list */
> 
> #define BB_PADBAD (1 << 0)
> #define BB_SKIPBAD (1 << 1)
> @@ -125,10 +128,10 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
> applet_long_options =
> "bb\0" Required_argument "\xff"; /* no short equivalent */
> #endif
> -               opts = getopt32(argv, "os:f:l:", &opt_s, &opt_f, &opt_l, &opt_bb);
> +               opts = getopt32(argv, "ons:f:l:", &opt_s, &opt_f, &opt_l, &opt_bb);
> } else { /* nandwrite */
> opt_complementary = "-1:?2";
> -               opts = getopt32(argv, "ps:", &opt_s);
> +               opts = getopt32(argv, "pns:", &opt_s);
> }
> argv += optind;
> 
> @@ -144,6 +147,9 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
> fd = xopen(argv[0], IS_NANDWRITE ? O_RDWR : O_RDONLY);
> xioctl(fd, MEMGETINFO, &meminfo);
> 
> +       if (opts & OPT_n)
> +               xioctl(fd, MTDFILEMODE, (void *)MTD_FILE_MODE_RAW);
> +
> mtdoffset = xstrtou(opt_s, 0);
> if (IS_NANDDUMP && (opts & OPT_l)) {
> unsigned length = xstrtou(opt_l, 0);
> --
> 2.4.0
> 
> _______________________________________________
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic