From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 4281BE72 for ; Fri, 16 Oct 2015 14:57:32 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 16 Oct 2015 05:57:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,689,1437462000"; d="scan'208";a="582125958" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.208.62]) by FMSMGA003.fm.intel.com with SMTP; 16 Oct 2015 05:57:30 -0700 Received: by (sSMTP sendmail emulation); Fri, 16 Oct 2015 13:57:28 +0025 Date: Fri, 16 Oct 2015 13:57:28 +0100 From: Bruce Richardson To: Panu Matilainen Message-ID: <20151016125727.GB9980@bricha3-MOBL3> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 1/5] eal: refactor plugin list append from eal_parse_args() to a helper function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Oct 2015 12:57:32 -0000 On Fri, Oct 16, 2015 at 02:58:13PM +0300, Panu Matilainen wrote: > Signed-off-by: Panu Matilainen > --- > lib/librte_eal/linuxapp/eal/eal.c | 28 +++++++++++++++++++--------- > 1 file changed, 19 insertions(+), 9 deletions(-) > > diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c > index 33e1067..cc66d9f 100644 > --- a/lib/librte_eal/linuxapp/eal/eal.c > +++ b/lib/librte_eal/linuxapp/eal/eal.c > @@ -530,6 +530,24 @@ eal_log_level_parse(int argc, char **argv) > optind = 0; /* reset getopt lib */ > } > > +static int > +eal_plugin_add(const char *path) > +{ > + struct shared_driver *solib; > + > + solib = malloc(sizeof(*solib)); > + if (solib == NULL) { > + RTE_LOG(ERR, EAL, "malloc(solib) failed\n"); > + return -1; > + } > + memset(solib, 0, sizeof(*solib)); > + strncpy(solib->name, path, PATH_MAX-1); > + solib->name[PATH_MAX-1] = 0; I always prefer a one-line snprintf to the above two-line code. :-) /Bruce