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

Function alloc_devargs

dpdk/drivers/bus/vdev/vdev.c:235–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235static struct rte_devargs *
236alloc_devargs(const char *name, const char *args)
237{
238 struct rte_devargs *devargs;
239 int ret;
240
241 devargs = calloc(1, sizeof(*devargs));
242 if (!devargs)
243 return NULL;
244
245 devargs->bus = &rte_vdev_bus;
246 if (args)
247 devargs->data = strdup(args);
248 else
249 devargs->data = strdup("");
250 if (devargs->data == NULL) {
251 free(devargs);
252 return NULL;
253 }
254 devargs->args = devargs->data;
255
256 ret = strlcpy(devargs->name, name, sizeof(devargs->name));
257 if (ret < 0 || ret >= (int)sizeof(devargs->name)) {
258 rte_devargs_reset(devargs);
259 free(devargs);
260 return NULL;
261 }
262
263 return devargs;
264}
265
266static int
267insert_vdev(const char *name, const char *args,

Callers 1

insert_vdevFunction · 0.85

Calls 5

callocFunction · 0.85
strdupFunction · 0.85
rte_devargs_resetFunction · 0.85
freeFunction · 0.50
strlcpyFunction · 0.50

Tested by

no test coverage detected