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

Function cdx_get_kernel_driver_by_path

dpdk/drivers/bus/cdx/cdx.c:112–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112static int
113cdx_get_kernel_driver_by_path(const char *filename, char *driver_name,
114 size_t len)
115{
116 int count;
117 char path[PATH_MAX];
118 char *name;
119
120 if (!filename || !driver_name)
121 return -1;
122
123 count = readlink(filename, path, PATH_MAX);
124 if (count >= PATH_MAX)
125 return -1;
126
127 /* For device does not have a driver */
128 if (count < 0)
129 return 1;
130
131 path[count] = '\0';
132
133 name = strrchr(path, '/');
134 if (name) {
135 strlcpy(driver_name, name + 1, len);
136 return 0;
137 }
138
139 return -1;
140}
141
142int rte_cdx_map_device(struct rte_cdx_device *dev)
143{

Callers 1

cdx_scan_oneFunction · 0.85

Calls 2

strrchrFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected