From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com ([209.85.215.68]:37593 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750762AbeBZSic (ORCPT ); Mon, 26 Feb 2018 13:38:32 -0500 Received: by mail-lf0-f68.google.com with SMTP id y19so23713063lfd.4 for ; Mon, 26 Feb 2018 10:38:32 -0800 (PST) Subject: Re: [PATCH iproute2-next v3 8/8] iplink: Reduce number of arguments to iplink_parse() To: David Ahern , 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> <4df74e2b-7248-1b48-3b2b-0ca2b10ea7de@gmail.com> From: Serhey Popovych Message-ID: <0834a77a-4b9c-d132-990b-f0afb92768fb@gmail.com> Date: Mon, 26 Feb 2018 20:38:22 +0200 MIME-Version: 1.0 In-Reply-To: <4df74e2b-7248-1b48-3b2b-0ca2b10ea7de@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aqaBsyUaH1GeQVJeG0lwAc1yI9XIWDxVA" Sender: netdev-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --aqaBsyUaH1GeQVJeG0lwAc1yI9XIWDxVA Content-Type: multipart/mixed; boundary="aOnMp1xOSJ9lWDgZVqOdEcEmjLK4an7s1"; protected-headers="v1" From: Serhey Popovych To: David Ahern , Stephen Hemminger Cc: netdev@vger.kernel.org Message-ID: <0834a77a-4b9c-d132-990b-f0afb92768fb@gmail.com> Subject: Re: [PATCH iproute2-next v3 8/8] iplink: Reduce number of arguments to iplink_parse() 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> <4df74e2b-7248-1b48-3b2b-0ca2b10ea7de@gmail.com> In-Reply-To: <4df74e2b-7248-1b48-3b2b-0ca2b10ea7de@gmail.com> --aOnMp1xOSJ9lWDgZVqOdEcEmjLK4an7s1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable David Ahern wrote: > 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? >> >>> >> >> >=20 > 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 whic= h > case I suspect the compiler will always inline the function so no > refactoring on the number of arguments is needed. >=20 I will implement cut down function to parse vxcan and veth peer device parameters and reuse it in iplink_parse() to avoid code duplications. But my final goal not to refactor on number of arguments to parse, that's side product of this series, I want to take @name, @dev and other parameters for later use. In ->parse_opt() modules @name, @dev and others are not available easily. It seems only way to get them is to parse supplied netlink buffer. --aOnMp1xOSJ9lWDgZVqOdEcEmjLK4an7s1-- --aqaBsyUaH1GeQVJeG0lwAc1yI9XIWDxVA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJalFQlAAoJEBTawMmQ61bBtS4H/jMVgjH6k6KmanjIP1qXYmcO uO3BU1ZpLgwh1v5pCqusOel6pMA8NchlkQVZorsiB1j9RT8jm1nJ8IyhK7VI4Zyh gajvrGuSd2EYRmHCAkMNQq6qJZ/QaJd3+IWhW5W3vwhpLVonmgKhpzTcCkwij4pp lKZeooom/fmsTxV996CA8k/sVdEQoEjRfRex6B7dEZkAZC0pmgtu7VAohBhzurLF uSfrGavYceZn+N5tba2GsrLs5vR6e+i/wY8eSlWGkqYq17vMU2MJ3kZJEOy7Ek3M 0JmswOLvFmKQYcef4YWA6R5PcnAVbVS3e0xDwgFb/712QK5Mt5NnR9mz8fuqGms= =GbJh -----END PGP SIGNATURE----- --aqaBsyUaH1GeQVJeG0lwAc1yI9XIWDxVA--