[dpdk-dev] [RFC v3 4/6] eal: add a helper for reading string from sysfs

Xia, Chenbo chenbo.xia at intel.com
Tue Jun 8 07:48:09 CEST 2021


Hi Stephen,

> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Tuesday, June 1, 2021 1:39 PM
> To: Xia, Chenbo <chenbo.xia at intel.com>
> Cc: dev at dpdk.org; thomas at monjalon.net; Liang, Cunming
> <cunming.liang at intel.com>; Wu, Jingjing <jingjing.wu at intel.com>; Burakov,
> Anatoly <anatoly.burakov at intel.com>; Yigit, Ferruh <ferruh.yigit at intel.com>;
> mdr at ashroe.eu; nhorman at tuxdriver.com; Richardson, Bruce
> <bruce.richardson at intel.com>; david.marchand at redhat.com; Ananyev, Konstantin
> <konstantin.ananyev at intel.com>; Tiwei Bie <tiwei.bie at intel.com>
> Subject: Re: [RFC v3 4/6] eal: add a helper for reading string from sysfs
> 
> On Tue,  1 Jun 2021 11:06:42 +0800
> Chenbo Xia <chenbo.xia at intel.com> wrote:
> 
> >
> > +int
> > +rte_eal_parse_sysfs_str(const char *filename, char *buf, unsigned long sz)
> > +{
> > +	FILE *f;
> > +
> > +	f = fopen(filename, "r");
> > +	if (f == NULL) {
> > +		RTE_LOG(ERR, EAL, "%s(): cannot open sysfs file %s\n",
> > +			__func__, filename);
> 
> Helpful to decode errno.
> 		RTE_LOG(ERR, EAL, "%s(): cannot open sysfs file %s:%s\n",
> 			__func__, filename, strerror(errno));

Yes. Will fix.

Thanks,
Chenbo



More information about the dev mailing list