char name[];
};
-static inline char *modname_normalize(const char *modname, char buf[NAME_MAX],
+inline char *modname_normalize(const char *modname, char buf[NAME_MAX],
size_t *len)
{
size_t s;
} while (0)
KMOD_EXPORT int kmod_module_new_from_lookup(struct kmod_ctx *ctx,
- const char *alias,
+ const char *given_alias,
struct kmod_list **list)
{
int err;
+ char alias[NAME_MAX];
if (ctx == NULL || alias == NULL)
return -ENOENT;
return -ENOSYS;
}
+ modname_normalize(given_alias, alias, NULL);
+
/* Aliases from config file override all the others */
err = kmod_lookup_alias_from_config(ctx, alias, list);
CHECK_ERR_AND_FINISH(err, fail, list, finish);
#include <stdbool.h>
#include <stdio.h>
#include <syslog.h>
+#include <limits.h>
#include "macro.h"
#include "libkmod.h"
/* libkmod-module.c */
+char *modname_normalize(const char *modname, char buf[NAME_MAX], size_t *len) __attribute__((nonnull(1, 2)));
int kmod_module_parse_depline(struct kmod_module *mod, char *line) __attribute__((nonnull(1, 2)));
/* libkmod-hash.c */
}
}
-KMOD_EXPORT int kmod_resolve_alias_options(struct kmod_ctx *ctx, const char *alias, char **options)
+KMOD_EXPORT int kmod_resolve_alias_options(struct kmod_ctx *ctx, const char *given_alias, char **options)
{
struct kmod_list *modules = NULL, *l;
+ char alias[NAME_MAX];
char *opts = NULL;
size_t optslen = 0;
int err;
if (ctx == NULL || options == NULL)
return -ENOENT;
+ modname_normalize(given_alias, alias, NULL);
+
err = kmod_module_new_from_lookup(ctx, alias, &modules);
if (err >= 0) {
kmod_list_foreach(l, modules) {