From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v2 2/3] bus/pci: expose sysfs parsing API Date: Wed, 21 Mar 2018 21:44:48 +0100 Message-ID: <63424504.iVi4kYAKMf@xps> References: <20180309230809.63361-3-xiao.w.wang@intel.com> <20180321132108.52464-1-xiao.w.wang@intel.com> <20180321132108.52464-3-xiao.w.wang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, maxime.coquelin@redhat.com, yliu@fridaylinux.org, zhihong.wang@intel.com, tiwei.bie@intel.com, junjie.j.chen@intel.com, rosen.xu@intel.com, dan.daly@intel.com, cunming.liang@intel.com, anatoly.burakov@intel.com, gaetan.rivet@6wind.com To: Xiao Wang Return-path: Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 38529AAC2 for ; Wed, 21 Mar 2018 21:45:06 +0100 (CET) In-Reply-To: <20180321132108.52464-3-xiao.w.wang@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 21/03/2018 14:21, Xiao Wang: > Some existing sysfs parsing functions are helpful for the later vDPA > driver, this patch make them global and expose them to shared lib. > > Signed-off-by: Xiao Wang > --- > /* parse driver */ > snprintf(filename, sizeof(filename), "%s/driver", dirname); > - ret = pci_get_kernel_driver_by_path(filename, driver); > + ret = rte_pci_device_kdriver_name(addr, driver); I guess the snprintf above becomes useless. > + * @param dri_name > + * Output buffer pointer. Parameter name and comment can be improved here: "kdrv_name" would be more meaningful. As a comment, "Output buffer for kernel driver name" > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice > + * > + * Parse the "resource" sysfs file. > + * > + * @param filename > + * The PCI resource file path. > + * @dev > + * Pointer of rte_pci_device object, into which the parse result is recorded. > + * @return > + * 0 on success, -1 on error, 1 on no driver found. > + */ > +int __rte_experimental > +rte_pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev); This is a Linux specific API. Maybe remove "sysfs" and replace "filename" by "resource"?