helper function to build devargs, caller should free the memory */
| 123 | |
| 124 | /* helper function to build devargs, caller should free the memory */ |
| 125 | static int |
| 126 | build_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 | |
| 149 | int |
| 150 | rte_eal_hotplug_add(const char *busname, const char *devname, |
no test coverage detected