From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0061.outbound.protection.outlook.com [104.47.37.61]) by dpdk.org (Postfix) with ESMTP id 1FDCA2C15 for ; Mon, 4 Sep 2017 13:29:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Vjq35aMxH/kU3vbCpp7VlXZiuCT+bDBJQVjFCuGTH+0=; b=VjIEIz+INP3s8NM27AgaYusdhKjHu/KXrZrCGxvsX7pIF1bEJjXm9P+rTizoS01aqHmDAT1FtRIurOXcMpL/lgHzy6deBt2JRrGG2u/Xibz+kgIp31LeiGXoPI81fvh2uK0PaD8xqRuKTnt/VYhwbdbkR1ZHBVFYndBU1MMchxE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Guduri.Prathyusha@cavium.com; Received: from cavium.com (111.93.218.67) by SN1PR0701MB2110.namprd07.prod.outlook.com (10.163.133.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Mon, 4 Sep 2017 11:29:07 +0000 Date: Mon, 4 Sep 2017 16:58:44 +0530 From: Guduri Prathyusha To: Bruce Richardson Cc: dev@dpdk.org Message-ID: <20170904112842.GA11102@cavium.com> References: <1493275900-4728-1-git-send-email-gprathyusha@caviumnetworks.com> <20170904105843.GA15316@bricha3-MOBL3.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170904105843.GA15316@bricha3-MOBL3.ger.corp.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0101.INDPRD01.PROD.OUTLOOK.COM (10.174.56.145) To SN1PR0701MB2110.namprd07.prod.outlook.com (10.163.133.13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6f19dd68-1c3f-45e5-8e69-08d4f388282e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN1PR0701MB2110; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0701MB2110; 3:VSf1sLUdaITGcJ9TE+zy3gkSRumydO+GMD8J7H5vrqa0vag4IIhMdHx1vOIueBksNzZKBKvoHov3tQg5ZarlnT6pP/iumNC62QTOIdkmd6T0YWj+OLi7sY080wfvzBt8iQIQlWqIw8ljjly5SS4UjeOXwj4IxSReWINpyHYm1GMKv5An0UYwh6hL5mmUN4B5O38XkW6dsQ2RpxdWnaUjqOwD48tLU8WHKyt0qicLrl+NoHJK2F1Ngz7lQgU753iq; 25:fLQ6Rl+DIdeiTSsKhgEKvwE1usN7R0KYccDp2JoE8AuDl5O37arYy1hvnUGARBI0UXt3qFmJGE934sojINi/O6pu5GNTj3kEF114bM4JAg3o+vB/AqJ4ApPsD/7RbmobHGDURgItRL5B9LeRyA7NQq/Qrh1z/axDp1alg8oSLav5iPx7R1RcDGcCxwLehCzwl8hxne6C4Prk/W0E/Q+aEfPZSGYnj/QzbhAClUuGdDgKat8AMUDYOAmeSfxVsYZOX6QG+azl66dXTvT9jMfXH+phsRI4E7qiuqcAO2R7auIEs/VDVUioUmTI+kMI2JRmFBEOQuPxiVlR2n9juji94w==; 31:IxkSetDIbvOpL5rpZ6G96As0ARPBrrtfqaS0w78HRnBrucaCqLWvSu+ojkCmep9/G1IUvv9miPtqsP7+95bVnnRovWRHpQXvUYFLi++LFN2Se0+lRta7FYmdz4LREUZcQzD6KXP3o7u6dtW2pimuYcfiDQysEnNY7V1DUllDg/Z+UkCiK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test: UriScan:(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(3002001)(10201501046)(100000703101)(100105400095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123564025)(20161123558100)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN1PR0701MB2110; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN1PR0701MB2110; X-Forefront-PRVS: 0420213CCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(24454002)(189002)(69596002)(23726003)(47776003)(68736007)(6666003)(36756003)(2950100002)(1076002)(42882006)(6916009)(478600001)(6116002)(2906002)(189998001)(3846002)(229853002)(6506006)(21086003)(53936002)(50466002)(55016002)(9686003)(305945005)(6246003)(110136004)(5660300001)(106356001)(105586002)(42186005)(5009440100003)(83506001)(72206003)(33656002)(97736004)(4001350100001)(25786009)(7736002)(4326008)(8676002)(66066001)(81156014)(76176999)(54356999)(50986999)(81166006)(101416001)(8936002)(18370500001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0701MB2110; H:cavium.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0701MB2110; 23:6bmZc5lCjieKoF4vz8rTq6Dd3JDyj3b5AHO8E3A?= =?us-ascii?Q?tdyB7dT+WlM9M5u4lSdswaju2giage6+Ye7v7WPIjTePhsLui5Gq+qbD/0O0?= =?us-ascii?Q?o9duRtLtc7XXDGYZt+67rBf5ceiht8bBGPCFDy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k4dnlBPURGoeyHgmyhnMwygj6guLpU69auzawTToWnvk64eUhpiIPnYs8LtufE5Rjc/k0TDQMWNI6HvHOiZ9ywAJIXzwz2oCj8i2miOmaICbPFY9Fh8mb61y4JJDYcc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2017 11:29:07.1636 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0701MB2110 Subject: Re: [dpdk-dev] [PATCH] librte_cfgfile: add section num entries by index X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Sep 2017 11:29:10 -0000 On Mon, Sep 04, 2017 at 11:58:44AM +0100, Bruce Richardson wrote: > On Thu, Apr 27, 2017 at 12:21:40PM +0530, Guduri Prathyusha wrote: > > rte_cfgfile_section_num_entries_by_index() is added to get the number of > > entries of a section when multiple sections of the same name are > > present. > > > > Signed-off-by: Guduri Prathyusha > > Reviewed-by: Bruce Richardson > Acked-by: Bruce Richardson > > --- > > lib/librte_cfgfile/rte_cfgfile.c | 13 +++++++++++++ > > lib/librte_cfgfile/rte_cfgfile.h | 20 ++++++++++++++++++++ > > 2 files changed, 33 insertions(+) > > > > diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c > > index b54a523..2588093 100644 > > --- a/lib/librte_cfgfile/rte_cfgfile.c > > +++ b/lib/librte_cfgfile/rte_cfgfile.c > > @@ -408,7 +408,20 @@ int rte_cfgfile_close(struct rte_cfgfile *cfg) > > return s->num_entries; > > } > > > > +int > > +rte_cfgfile_section_num_entries_by_index(struct rte_cfgfile *cfg, > > + char *sectionname, int index) > > +{ > > + const struct rte_cfgfile_section *sect; > > + > > + if (index < 0 || index >= cfg->num_sections) > > + return -1; > > > > + sect = cfg->sections[index]; > > + snprintf(sectionname, CFG_NAME_LEN, "%s", sect->name); > > I don't like the fact that the section name is being overwritten here, > but the behaviour is consistent with that done by the other "by_index()" > functions, so it's probably better to keep this. > In future a change to consider would be remove the sectionname entirely > from the function arguments since it serves no purpose that I can see. > I agree that sectionname doesn't serve any purpose and can be removed. Thanks. > > + > > + return sect->num_entries; > > +} > > int > > rte_cfgfile_section_entries(struct rte_cfgfile *cfg, const char *sectionname, > > struct rte_cfgfile_entry *entries, int max_entries) > > diff --git a/lib/librte_cfgfile/rte_cfgfile.h b/lib/librte_cfgfile/rte_cfgfile.h > > index fa10d40..35dc419 100644 > > --- a/lib/librte_cfgfile/rte_cfgfile.h > > +++ b/lib/librte_cfgfile/rte_cfgfile.h > > @@ -184,6 +184,26 @@ int rte_cfgfile_section_num_entries(struct rte_cfgfile *cfg, > > const char *sectionname); > > > > /** > > +* Get number of entries in given config file section > > +* > > +* The index of a section is the same as the index of its name in the > > +* result of rte_cfgfile_sections. This API can be used when there are > > +* multiple sections with the same name. > > +* > > +* @param cfg > > +* Config file > > +* @param sectionname > > +* Section name > > +* @param index > > +* Section index > > +* @return > > +* Number of entries in section on success, -1 otherwise > > +*/ > > +int rte_cfgfile_section_num_entries_by_index(struct rte_cfgfile *cfg, > > + char *sectionname, > > + int index); > > + > > +/** > > * Get section entries as key-value pairs > > * > > * If multiple sections have the given name this function operates on the > > -- > > 1.7.9.5 > >