From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f68.google.com ([74.125.83.68]:34583 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751746AbeBZS1Y (ORCPT ); Mon, 26 Feb 2018 13:27:24 -0500 Received: by mail-pg0-f68.google.com with SMTP id m19so6505734pgn.1 for ; Mon, 26 Feb 2018 10:27:24 -0800 (PST) Subject: Re: [PATCH iproute2-next v3 8/8] iplink: Reduce number of arguments to iplink_parse() To: Serhey Popovych , Stephen Hemminger Cc: netdev@vger.kernel.org References: <1519304526-18848-1-git-send-email-serhe.popovych@gmail.com> <1519304526-18848-9-git-send-email-serhe.popovych@gmail.com> <20180226100638.789a770d@xeon-e3> From: David Ahern Message-ID: <4df74e2b-7248-1b48-3b2b-0ca2b10ea7de@gmail.com> Date: Mon, 26 Feb 2018 11:27:22 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On 2/26/18 11:20 AM, Serhey Popovych wrote: > Stephen Hemminger wrote: >> On Thu, 22 Feb 2018 15:02:06 +0200 >> Serhey Popovych wrote: >> >>> +struct iplink_parse_args { >>> + const char *dev; >>> + const char *name; >>> + const char *type; >>> + >>> + /* This definitely must be the last one and initialized >>> + * by the caller of iplink_parse() that will initialize rest. >>> + */ >>> + struct iplink_req *req; >>> +}; >>> + >> >> No control block please. > Accepted. > >> If you have too many arguments, then that means you need to do >> some refactoring. > > So using structure as single argument to a function isn't an option? > >> > > As I mentioned before, iplink_parse should not be used by vxcan or veth as they only want a subset of the parsing. Once you take those users out, iplink_parse becomes local to iplink.c with a single user. In which case I suspect the compiler will always inline the function so no refactoring on the number of arguments is needed.