[dpdk-dev] [PATCH v4 6/7] examples/vhost: enhance getopt_long usage

Maxime Coquelin maxime.coquelin at redhat.com
Tue Mar 23 12:19:07 CET 2021



On 2/4/21 8:34 AM, Ibtisam Tariq wrote:
> Instead of using getopt_long return value, strcmp was used to
> compare the input parameters with the struct option array. This
> patch get rid of all those strcmp by directly binding each longopt
> with an int enum. This is to improve readability and consistency in
> all examples.
> 
> Bugzilla ID: 238
> Cc: jiayu.hu at intel.com
> Cc: huawei.xie at intel.com
> 
> Reported-by: David Marchand <david.marchand at redhat.com>
> Signed-off-by: Ibtisam Tariq <ibtisam.tariq at emumba.com>
> ---
> v4:
> * Set indentation of preprocessor directives.
> * Add enums for OPT_BUILTIN_NET_DRIVER and OPT_CLIENT in getopt_long.
> 
> v3:
> * None.
> 
> v2:
> * Remove extra indentations.
> * Remove extra block brackets in switch statement.
> * Change enum names to start with OPT_ and remove KEYWORD from enum names.
> 
> v1:
> * enhance getopt_long usage.
> ---
>  examples/vhost/main.c | 288 +++++++++++++++++++++++-------------------
>  1 file changed, 155 insertions(+), 133 deletions(-)
> 


Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>

Thanks,
Maxime



More information about the dev mailing list