[PATCH] block: cmdline-parser: perfect cmdline format checking
Joe Perches
joe at perches.com
Mon Nov 11 19:45:48 EST 2013
On Mon, 2013-11-11 at 15:34 -0800, Andrew Morton wrote:
> On Sat, 9 Nov 2013 11:45:14 +0000 Caizhiyong <caizhiyong at hisilicon.com> wrote:
[]
> > -perfect cmdline format checking, make the error information clear
> > for understand, make this lib fully equivalent to the old parser
> > in drivers/mtd/cmdlinepart.c
> >
> > ...
> >
> > +#define PARSER "cmdline-parser: "
> > ...
> > - pr_warn("cmdline partition size is invalid.");
> > + pr_warn(PARSER "partition '%s' size '0x%llx' too small.",
>
> You can use the standard pr_fmt() mechanism instead of this.
[]
> diff -puN block/cmdline-parser.c~mtd-cmdlinepart-use-cmdline-partition-parser-lib-fix block/cmdline-parser.c
[]
> @@ -21,10 +26,12 @@ static int parse_subpart(struct cmdline_
> if (*partdef == '-') {
> new_subpart->size = (sector_t)(~0ULL);
> partdef++;
> + lastpart = 1;
> } else {
> new_subpart->size = (sector_t)memparse(partdef, &partdef);
> if (new_subpart->size < (sector_t)PAGE_SIZE) {
> - pr_warn("cmdline partition size is invalid.");
> + pr_warn(PARSER "partition '%s' size '0x%llx' too small.",
> + partorg, new_subpart->size);
As well, please add terminating '\n' newlines to all the formats.
This helps avoid possible logging message interleaving.
More information about the linux-mtd
mailing list