[dpdk-dev] [PATCH v5 2/2] eal/linux: Add support for handling built-in kernel modules
Stephen Hemminger
stephen at networkplumber.org
Wed Dec 9 17:38:58 CET 2015
On Wed, 9 Dec 2015 14:19:58 +0100
Kamil Rytarowski <Kamil.Rytarowski at caviumnetworks.com> wrote:
> + /* Check if there is sysfs mounted */
> + if (stat("/sys/module", &st) != 0) {
> + RTE_LOG(DEBUG, EAL, "sysfs is not mounted! error %i (%s)\n",
> + errno, strerror(errno));
> return -1;
> }
This check is redundant. Remove it.
If the later "/sys/module/foo" would fail if /sys/module was not present.
> - while (!feof(fd)) {
> - n = fscanf(fd, "%29s %*[^\n]", mod_name);
> - if ((n == 1) && !strcmp(mod_name, module_name)) {
> - ret = 1;
> - break;
> - }
> +
> + /* A module might be built-in, therefore try sysfs */
> + n = snprintf(sysfs_mod_name, PATH_MAX, "/sys/module/%s", module_name);
More information about the dev
mailing list