[PATCH 4/8] mtd-utils: Add flash stress test Utility
Boris Brezillon
boris.brezillon at free-electrons.com
Tue Apr 26 01:18:50 PDT 2016
On Tue, 26 Apr 2016 00:13:25 +0200
Richard Weinberger <richard at nod.at> wrote:
> diff --git a/misc-utils/flash_stress.c b/misc-utils/flash_stress.c
> new file mode 100644
> index 0000000..2dd2da1
> --- /dev/null
> +++ b/misc-utils/flash_stress.c
[...]
> +static void process_options(int argc, char **argv)
> +{
> + int i;
> +
> + for (i=1; i<argc; ++i) {
> + if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
> + usage(EXIT_SUCCESS);
> + } else if (!strcmp(argv[i], "--keep") || !strcmp(argv[i], "-k")) {
> + if (flags & KEEP_CONTENTS)
> + goto failmulti;
> + flags |= KEEP_CONTENTS;
> + } else if (!strcmp(argv[i], "--seed") || !strcmp(argv[i], "-s")) {
> + if (flags & SEED_SET)
> + goto failmulti;
> + srand(read_num(i, i+1, argc, argv));
> + flags |= SEED_SET;
> + } else if (!strcmp(argv[i], "--count") || !strcmp(argv[i], "-c")) {
> + if (flags & COUNT_CHANGED)
> + goto failmulti;
> + count = read_num(i, i+1, argc, argv);
> + if (count <= 0)
> + goto failarg;
> + ++i;
> + flags |= COUNT_CHANGED;
> + } else {
> + if (mtddev)
> + usage(EXIT_FAILURE);
> + mtddev = argv[i];
> + }
> + }
Please use getopt_long(). I guess this applies to all your patches, so
I'll stop mentioning it.
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
More information about the linux-mtd
mailing list