[PATCH v3] mtd-utils: Add mtdpart to add/delete partition
Brian Norris
computersforpeace at gmail.com
Thu Apr 2 14:15:50 PDT 2015
This doesn't even compile...
On Wed, Mar 04, 2015 at 11:41:31AM -0800, Nam T. Nguyen wrote:
> Add a simple utility to exercise BLKPG ioctl.
>
> Signed-off-by: Nam T. Nguyen <namnguyen at chromium.org>
> ---
> Changes from v2:
>
> o Fix coding style
> o Remove cleanup code since we exit()ing anyway.
>
> Makefile | 2 +-
> mtdpart.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 188 insertions(+), 1 deletion(-)
> create mode 100644 mtdpart.c
>
...
> diff --git a/mtdpart.c b/mtdpart.c
> new file mode 100644
> index 0000000..b944f49
> --- /dev/null
> +++ b/mtdpart.c
> @@ -0,0 +1,187 @@
[...]
> + command = COMMAND_DEL;
> + } else if (strcmp(s_command, "add") == 0 && (argc - optind) == 3) {
> + part_name = argv[optind++];
> + const char *s_start = argv[optind++];
> + const char *s_length = argv[optind++];
The preferred style is to keep variable definitions before statements.
> +
> + if (strlen(part_name) >= BLKPG_DEVNAMELTH)
> + errmsg_die("Partition name (%s) should be less than %d characters"
^^ you're missing a comma on this line. I think that's the only compile
issue? But I'd expect you to compile and test what you're sending
first...
> + part_name, BLKPG_DEVNAMELTH);
> +
> + start_addr = simple_strtoll(s_start, &error);
> + if (start_addr < 0)
> + errmsg_die("Can't specify negative start offset: %lld",
> + start_addr);
> +
> + length = simple_strtoll(s_length, &error);
> + if (length < 0)
[snip]
Brian
More information about the linux-mtd
mailing list