Message ID | 9a23b6698bd8f223f7789149e8196712d5d624ae.1608746691.git.me@pmachata.org |
---|---|
State | Superseded |
Headers | show |
Series | dcb: Support APP, DCBX objects | expand |
On 12/23/20 11:25 AM, Petr Machata wrote: > diff --git a/dcb/dcb.c b/dcb/dcb.c > index a59b63ac9159..e6cda7337924 100644 > --- a/dcb/dcb.c > +++ b/dcb/dcb.c > @@ -467,7 +467,8 @@ static void dcb_help(void) > " dcb [ -f | --force ] { -b | --batch } filename [ -N | --Netns ] netnsname\n" > "where OBJECT := { buffer | ets | maxrate | pfc }\n" > " OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n" > - " | -p | --pretty | -s | --statistics | -v | --verbose]\n"); > + " | -n | --no-nice-names | -p | --pretty\n" iproute2 commands really should have a consistent user interface. Unfortunately -N and -n are inconsistent with the newer commands like devlink. dcb has not been released yet so time to fix this. devlink is the only one using the horribly named 'no-nice-names', and we should avoid propagating that to dcb. At a minimum it should be 'numeric' which is consistent with the others. My preference is also to have dcb follow ip and tc (vs ss) with '-n' to mean -netns and -N' to mean numeric.
David Ahern <dsahern@gmail.com> writes: > On 12/23/20 11:25 AM, Petr Machata wrote: >> diff --git a/dcb/dcb.c b/dcb/dcb.c >> index a59b63ac9159..e6cda7337924 100644 >> --- a/dcb/dcb.c >> +++ b/dcb/dcb.c >> @@ -467,7 +467,8 @@ static void dcb_help(void) >> " dcb [ -f | --force ] { -b | --batch } filename [ -N | --Netns ] netnsname\n" >> "where OBJECT := { buffer | ets | maxrate | pfc }\n" >> " OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n" >> - " | -p | --pretty | -s | --statistics | -v | --verbose]\n"); >> + " | -n | --no-nice-names | -p | --pretty\n" > > > iproute2 commands really should have a consistent user interface. > Unfortunately -N and -n are inconsistent with the newer commands like > devlink. dcb has not been released yet so time to fix this. > > devlink is the only one using the horribly named 'no-nice-names', and we > should avoid propagating that to dcb. At a minimum it should be > 'numeric' which is consistent with the others. > > My preference is also to have dcb follow ip and tc (vs ss) with '-n' to > mean -netns and -N' to mean numeric. Agreed on all counts.
diff --git a/dcb/dcb.c b/dcb/dcb.c index a59b63ac9159..e6cda7337924 100644 --- a/dcb/dcb.c +++ b/dcb/dcb.c @@ -467,7 +467,8 @@ static void dcb_help(void) " dcb [ -f | --force ] { -b | --batch } filename [ -N | --Netns ] netnsname\n" "where OBJECT := { buffer | ets | maxrate | pfc }\n" " OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n" - " | -p | --pretty | -s | --statistics | -v | --verbose]\n"); + " | -n | --no-nice-names | -p | --pretty\n" + " | -s | --statistics | -v | --verbose]\n"); } static int dcb_cmd(struct dcb *dcb, int argc, char **argv) @@ -509,6 +510,7 @@ int main(int argc, char **argv) { "batch", required_argument, NULL, 'b' }, { "iec", no_argument, NULL, 'i' }, { "json", no_argument, NULL, 'j' }, + { "no-nice-names", no_argument, NULL, 'n' }, { "pretty", no_argument, NULL, 'p' }, { "statistics", no_argument, NULL, 's' }, { "Netns", required_argument, NULL, 'N' }, @@ -528,7 +530,7 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - while ((opt = getopt_long(argc, argv, "b:fhijpsvN:V", + while ((opt = getopt_long(argc, argv, "b:fhijnpsvN:V", long_options, NULL)) >= 0) { switch (opt) { @@ -545,6 +547,9 @@ int main(int argc, char **argv) case 'j': dcb->json_output = true; break; + case 'n': + dcb->no_nice_names = true; + break; case 'p': pretty = true; break; diff --git a/dcb/dcb.h b/dcb/dcb.h index 8c7327a43588..f1d089257867 100644 --- a/dcb/dcb.h +++ b/dcb/dcb.h @@ -14,6 +14,7 @@ struct dcb { bool json_output; bool stats; bool use_iec; + bool no_nice_names; }; int dcb_parse_mapping(const char *what_key, __u32 key, __u32 max_key, diff --git a/man/man8/dcb.8 b/man/man8/dcb.8 index 5964f25d386d..46c7a31410b7 100644 --- a/man/man8/dcb.8 +++ b/man/man8/dcb.8 @@ -52,6 +52,11 @@ the 1000-based ones (K, M, B). .BR "\-j" , " --json" Generate JSON output. +.TP +.BR "\-n" , " --no-nice-names" +If the subtool in question translates numbers to symbolic names in some way, +suppress this translation. + .TP .BR "\-p" , " --pretty" When combined with -j generate a pretty JSON output.
Some DSCP values can be translated to symbolic names. That may not be always desirable. Introduce a command-line option similar to other tools, -n or --no-nice-names, to suppress this translation. Signed-off-by: Petr Machata <me@pmachata.org> --- dcb/dcb.c | 9 +++++++-- dcb/dcb.h | 1 + man/man8/dcb.8 | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-)