[PATCH v3] mtd-utils: Add mtdpart to add/delete partition

Nam Nguyen namnguyen at chromium.org
Tue Apr 14 11:24:23 PDT 2015


On Thu, Apr 2, 2015 at 2:15 PM, Brian Norris
<computersforpeace at gmail.com> wrote:
> This doesn't even compile...

This is an embarrassment. I'm so sorry it happened.

>
> 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.

Done in v4.

>
>> +
>> +             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...

Thanks for catching it. Version 4 fixed this.

Nam



More information about the linux-mtd mailing list