tc: f_u32 cleanup indentation and long lines

Several long lines and too long messages here.
This commit is contained in:
Stephen Hemminger 2016-06-08 16:45:26 -07:00
parent 5e5b3008d1
commit 622812052a
1 changed files with 21 additions and 17 deletions

View File

@ -30,16 +30,18 @@ extern int show_pretty;
static void explain(void) static void explain(void)
{ {
fprintf(stderr, "Usage: ... u32 [ match SELECTOR ... ] [ link HTID ] [ classid CLASSID ] [skip-hw | skip-sw]\n"); fprintf(stderr,
fprintf(stderr, " [ action ACTION_SPEC ] [ offset OFFSET_SPEC ]\n"); "Usage: ... u32 [ match SELECTOR ... ] [ link HTID ] [ classid CLASSID ]\n"
fprintf(stderr, " [ ht HTID ] [ hashkey HASHKEY_SPEC ]\n"); " [ action ACTION_SPEC ] [ offset OFFSET_SPEC ]\n"
fprintf(stderr, " [ sample SAMPLE ]\n"); " [ ht HTID ] [ hashkey HASHKEY_SPEC ]\n"
fprintf(stderr, "or u32 divisor DIVISOR\n"); " [ sample SAMPLE ] [skip-hw | skip-sw]\n"
fprintf(stderr, "\n"); "or u32 divisor DIVISOR\n"
fprintf(stderr, "Where: SELECTOR := SAMPLE SAMPLE ...\n"); "\n"
fprintf(stderr, " SAMPLE := { ip | ip6 | udp | tcp | icmp | u{32|16|8} | mark } SAMPLE_ARGS [divisor DIVISOR]\n"); "Where: SELECTOR := SAMPLE SAMPLE ...\n"
fprintf(stderr, " FILTERID := X:Y:Z\n"); " SAMPLE := { ip | ip6 | udp | tcp | icmp | u{32|16|8} | mark }\n"
fprintf(stderr, "\nNOTE: CLASSID is parsed at hexadecimal input.\n"); " SAMPLE_ARGS [ divisor DIVISOR ]\n"
" FILTERID := X:Y:Z\n"
"\nNOTE: CLASSID is parsed at hexadecimal input.\n");
} }
static int get_u32_handle(__u32 *handle, const char *str) static int get_u32_handle(__u32 *handle, const char *str)
@ -1192,9 +1194,10 @@ static int u32_parse_opt(struct filter_util *qu, char *handle,
sizeof(sel.sel) + sizeof(sel.sel) +
sel.sel.nkeys * sizeof(struct tc_u32_key)); sel.sel.nkeys * sizeof(struct tc_u32_key));
if (flags) { if (flags) {
if (!(flags ^ (TCA_CLS_FLAGS_SKIP_HW | TCA_CLS_FLAGS_SKIP_SW))) { if (!(flags ^ (TCA_CLS_FLAGS_SKIP_HW |
fprintf(stderr, "skip_hw and skip_sw are mutually " TCA_CLS_FLAGS_SKIP_SW))) {
"exclusive flags. Only one can be set\n"); fprintf(stderr,
"skip_hw and skip_sw are mutually exclusive\n");
return -1; return -1;
} }
addattr_l(n, MAX_MSG, TCA_U32_FLAGS, &flags, 4); addattr_l(n, MAX_MSG, TCA_U32_FLAGS, &flags, 4);
@ -1220,9 +1223,9 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
SPRINT_BUF(b1); SPRINT_BUF(b1);
fprintf(f, "fh %s ", sprint_u32_handle(handle, b1)); fprintf(f, "fh %s ", sprint_u32_handle(handle, b1));
} }
if (TC_U32_NODE(handle)) {
if (TC_U32_NODE(handle))
fprintf(f, "order %d ", TC_U32_NODE(handle)); fprintf(f, "order %d ", TC_U32_NODE(handle));
}
if (tb[TCA_U32_SEL]) { if (tb[TCA_U32_SEL]) {
if (RTA_PAYLOAD(tb[TCA_U32_SEL]) < sizeof(*sel)) if (RTA_PAYLOAD(tb[TCA_U32_SEL]) < sizeof(*sel))
@ -1325,14 +1328,15 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
fprintf(f, "\n"); fprintf(f, "\n");
tc_print_police(f, tb[TCA_U32_POLICE]); tc_print_police(f, tb[TCA_U32_POLICE]);
} }
if (tb[TCA_U32_INDEV]) { if (tb[TCA_U32_INDEV]) {
struct rtattr *idev = tb[TCA_U32_INDEV]; struct rtattr *idev = tb[TCA_U32_INDEV];
fprintf(f, "\n input dev %s\n", rta_getattr_str(idev)); fprintf(f, "\n input dev %s\n", rta_getattr_str(idev));
} }
if (tb[TCA_U32_ACT]) {
if (tb[TCA_U32_ACT])
tc_print_action(f, tb[TCA_U32_ACT]); tc_print_action(f, tb[TCA_U32_ACT]);
}
return 0; return 0;
} }