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

Function build_devargs

dpdk/lib/eal/common/eal_common_dev.c:125–147  ·  view source on GitHub ↗

helper function to build devargs, caller should free the memory */

Source from the content-addressed store, hash-verified

123
124/* helper function to build devargs, caller should free the memory */
125static int
126build_devargs(const char *busname, const char *devname,
127 const char *drvargs, char **devargs)
128{
129 int length;
130
131 length = snprintf(NULL, 0, "%s:%s,%s", busname, devname, drvargs);
132 if (length < 0)
133 return -EINVAL;
134
135 *devargs = malloc(length + 1);
136 if (*devargs == NULL)
137 return -ENOMEM;
138
139 length = snprintf(*devargs, length + 1, "%s:%s,%s",
140 busname, devname, drvargs);
141 if (length < 0) {
142 free(*devargs);
143 return -EINVAL;
144 }
145
146 return 0;
147}
148
149int
150rte_eal_hotplug_add(const char *busname, const char *devname,

Callers 2

rte_eal_hotplug_addFunction · 0.85
rte_dev_removeFunction · 0.85

Calls 3

snprintfFunction · 0.85
mallocFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected