MCPcopy Create free account
hub / github.com/F-Stack/f-stack / read_sysfs_string

Function read_sysfs_string

dpdk/drivers/bus/platform/platform.c:221–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221static int
222read_sysfs_string(const char *path, char *buf, size_t size)
223{
224 FILE *f;
225 char *p;
226
227 f = fopen(path, "r");
228 if (f == NULL)
229 return -errno;
230
231 if (fgets(buf, size, f) == NULL) {
232 fclose(f);
233 return -ENODATA;
234 }
235
236 fclose(f);
237
238 p = strrchr(buf, '\n');
239 if (p != NULL)
240 *p = '\0';
241
242 return 0;
243}
244
245static char *
246of_resource_name(const char *dev_name, int index)

Callers 1

of_resource_nameFunction · 0.85

Calls 1

strrchrFunction · 0.85

Tested by

no test coverage detected