]> git.droids-corp.org - dpdk.git/commit
cmdline: add function to verify valid commands
authorBruce Richardson <bruce.richardson@intel.com>
Fri, 10 Jun 2022 14:24:05 +0000 (15:24 +0100)
committerDavid Marchand <david.marchand@redhat.com>
Mon, 13 Jun 2022 08:26:39 +0000 (10:26 +0200)
commit758d92795b1c4794f04b463c18bb29d82ea46283
treef4c378cd61a4fcfcc0754a15ace820f19ecfa6c2
parent1ab4156e7d57858fca1db448ac7a0792e1d527b6
cmdline: add function to verify valid commands

The cmdline library cmdline_parse() function parses a command and
executes the action automatically too. The cmdline_valid_buffer function
also uses this function to validate commands, meaning that there is no
function to validate a command as ok without executing it.

To fix this omission, we extract the body of cmdline_parse into a new
static inline function with an extra parameter to indicate whether the
action should be performed or not. Then we create two wrappers around
that - a replacement for the existing cmdline_parse function where the
extra parameter is "true" to execute the command, and a new function
"cmdline_parse_check" which passes the parameter as "false" to perform
cmdline validation only.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Weiyuan Li <weiyuanx.li@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
lib/cmdline/cmdline_parse.c
lib/cmdline/cmdline_parse.h
lib/cmdline/version.map