[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 8 Aug 2019 10:49:48 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: "Daniel T. Lee" <danieltimlee@...il.com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...nel.org>,
netdev <netdev@...r.kernel.org>
Subject: Re: [v3,1/4] tools: bpftool: add net attach command to attach XDP
on interface
On Thu, 8 Aug 2019 07:15:22 +0900, Daniel T. Lee wrote:
> > > + return -EINVAL;
> > > + }
> > > +
> > > + NEXT_ARG();
> >
> > nit: the new line should be before NEXT_ARG(), IOV NEXT_ARG() belongs
> > to the code which consumed the argument
> >
>
> I'm not sure I'm following.
> Are you saying that, at here the newline shouldn't be necessary?
I mean this is better:
if (!is_prefix(*argv, "bla-bla"))
return -EINVAL;
NEXT_ARG();
if (!is_prefix(*argv, "bla-bla"))
return -EINVAL;
NEXT_ARG();
Than this:
if (!is_prefix(*argv, "bla-bla"))
return -EINVAL;
NEXT_ARG();
if (!is_prefix(*argv, "bla-bla"))
return -EINVAL;
NEXT_ARG();
Because the NEXT_ARG() "belongs" to the code that "consumed" the option.
So instead of this:
attach_type = parse_attach_type(*argv);
if (attach_type == max_net_attach_type) {
p_err("invalid net attach/detach type");
return -EINVAL;
}
NEXT_ARG();
progfd = prog_parse_fd(&argc, &argv);
if (progfd < 0)
return -EINVAL;
This seems more logical to me:
attach_type = parse_attach_type(*argv);
if (attach_type == max_net_attach_type) {
p_err("invalid net attach/detach type");
return -EINVAL;
}
NEXT_ARG();
progfd = prog_parse_fd(&argc, &argv);
if (progfd < 0)
return -EINVAL;
Powered by blists - more mailing lists