cmdline: prefix cmdline numeric enum
PATCH 1/1 cmdline: prefix cmdline numeric enum
The values in an enum are really global names and not specific to the enum in question. This can lead to namespace conflicts in applications if a common value is visible.
The DPDK cmdline API has an enum for numeric type values with names line UINT32 which could be used or defined in a user application. Change these to be prefixed with the enum name like other places in DPDK.
Lots of lines changed with no change in actual code generated.
--- app/test-cmdline/commands.c | 2 +- app/test-pmd/bpf_cmd.c | 8 +- app/test-pmd/cmdline.c | 656 +++++++++--------- app/test-pmd/cmdline_mtr.c | 84 +-- app/test-pmd/cmdline_tm.c | 172 ++--- app/test/test_cmdline_num.c | 48 +- doc/guides/rel_notes/release_19_11.rst | 3 + examples/ethtool/ethtool-app/ethapp.c | 18 +- examples/ipsec-secgw/parser.c | 2 +- examples/qos_sched/cmdline.c | 46 +- examples/quota_watermark/qwctl/commands.c | 2 +- .../guest_cli/vm_power_cli_guest.c | 2 +- examples/vm_power_manager/vm_power_cli.c | 8 +- lib/librte_cmdline/cmdline_parse_num.c | 40 +- lib/librte_cmdline/cmdline_parse_num.h | 16 +- 15 files changed, 555 insertions(+), 552 deletions(-)
app/test-cmdline/commands.c +1 -1
@@ -191,7 +191,7 @@ cmd_num_parsed(void *parsed_result, }cmdline_parse_token_num_t cmd_num_tok = - TOKEN_NUM_INITIALIZER(struct cmd_num_result, num, UINT32); + TOKEN_NUM_INITIALIZER(struct cmd_num_result, num, CMDLINE_UINT32);cmdline_parse_inst_t cmd_num = { .f = cmd_num_parsed,/* function to call */
app/test-pmd/bpf_cmd.c +4 -4
@@ -124,9 +124,9 @@ cmdline_parse_token_string_t cmd_load_bpf_dir = TOKEN_STRING_INITIALIZER(struct cmd_bpf_ld_result, dir, "rx#tx");cmdline_parse_token_num_t cmd_load_bpf_port = - TOKEN_NUM_INITIALIZER(struct cmd_bpf_ld_result, port, UINT8); + TOKEN_NUM_INITIALIZER(struct cmd_bpf_ld_result, port, CMDLINE_UINT8);cmdline_parse_token_num_t cmd_load_bpf_queue = - TOKEN_NUM_INITIALIZER(struct cmd_bpf_ld_result, queue, UINT16); + TOKEN_NUM_INITIALIZER(struct cmd_bpf_ld_result, queue, CMDLINE_UINT16);cmdline_parse_token_string_t cmd_load_bpf_flags = TOKEN_STRING_INITIALIZER(struct cmd_bpf_ld_result, flags,NULL );
@@ -180,9 +180,9 @@ cmdline_parse_token_string_t cmd_unload_bpf_dir = TOKEN_STRING_INITIALIZER(struct cmd_bpf_unld_result, dir, "rx#tx");cmdline_parse_token_num_t cmd_unload_bpf_port = - TOKEN_NUM_INITIALIZER(struct cmd_bpf_unld_result, port, UINT8); + TOKEN_NUM_INITIALIZER(struct cmd_bpf_unld_result, port, CMDLINE_UINT8);cmdline_parse_token_num_t cmd_unload_bpf_queue = - TOKEN_NUM_INITIALIZER(struct cmd_bpf_unld_result, queue, UINT16); + TOKEN_NUM_INITIALIZER(struct cmd_bpf_unld_result, queue, CMDLINE_UINT16);cmdline_parse_inst_t cmd_operate_bpf_unld_parse = { .f = cmd_operate_bpf_unld_parsed,
app/test-pmd/cmdline.c +328 -328
2,303 lines not on this page · raw message
app/test-pmd/cmdline_mtr.c +42 -42
242 lines not on this page · raw message
app/test-pmd/cmdline_tm.c +86 -86
425 lines not on this page · raw message
app/test/test_cmdline_num.c +24 -24
48 lines not on this page · raw message
examples/qos_sched/cmdline.c +23 -23
46 lines not on this page · raw message
examples/quota_watermark/qwctl/commands.c +1 -1
Lines of this file are not shown. View the raw message.
examples/vm_power_manager/guest_cli/vm_power_cli_guest.c +1 -1
Lines of this file are not shown. View the raw message.
examples/vm_power_manager/vm_power_cli.c +4 -4
Lines of this file are not shown. View the raw message.
lib/librte_cmdline/cmdline_parse_num.c +20 -20
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.20.1
Part of the diff is not shown here. View the raw message.
Quoted 9 lines · Stephen Hemminger
The values in an enum are really global names and not specific to the enum in question. This can lead to namespace conflicts in applications if a common value is visible.
The DPDK cmdline API has an enum for numeric type values with names line UINT32 which could be used or defined in a user application. Change these to be prefixed with the enum name like other places in DPDK.
Quoted 5 lines
Lots of lines changed with no change in actual code generated.
Signed-off-by Stephen Hemminger <[email protected]>---
Duplicate of this patch from 6 months ago?
http://patches.dpdk.org/patch/52644/
/Bruce
Quoted 13 lines · On Fri, 25 Oct 2019 11:55:41 +0100 Bruce Richardson…
Quoted 12 lines · Stephen Hemminger
The values in an enum are really global names and not specific to the enum in question. This can lead to namespace conflicts in applications if a common value is visible.
The DPDK cmdline API has an enum for numeric type values with names line UINT32 which could be used or defined in a user application. Change these to be prefixed with the enum name like other places in DPDK.
Lots of lines changed with no change in actual code generated.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Stephen Hemminger <[email protected]>---
Duplicate of this patch from 6 months ago?
http://patches.dpdk.org/patch/52644//Bruce
Yes. one of them should go in.
Checkpatch spits out lots of noise because existing code does not conform to style.