const char *path;
const char *relpath; /* path relative to '$ROOT/lib/modules/$VER/' */
char *uncrelpath; /* same as relpath but ending in .ko */
+ struct kmod_list *info_list;
struct array deps; /* struct symbol */
size_t baselen; /* points to start of basename/filename */
size_t modnamelen;
DBG("free %p kmod=%p, path=%s\n", mod, mod->kmod, mod->path);
array_free_array(&mod->deps);
kmod_module_unref(mod->kmod);
+ kmod_module_info_free_list(mod->info_list);
free(mod->uncrelpath);
free(mod);
}
return hash_find(depmod->symbols, name);
}
-static int depmod_load_symbols(struct depmod *depmod)
+static int depmod_load_symbols_and_info(struct depmod *depmod)
{
- const struct mod **itr, **itr_end;
+ struct mod **itr, **itr_end;
DBG("load symbols (%zd modules)\n", depmod->modules.count);
- itr = (const struct mod **)depmod->modules.array;
+ itr = (struct mod **)depmod->modules.array;
itr_end = itr + depmod->modules.count;
for (; itr < itr_end; itr++) {
- const struct mod *mod = *itr;
+ struct mod *mod = *itr;
struct kmod_list *l, *list = NULL;
int err = kmod_module_get_symbols(mod->kmod, &list);
if (err < 0) {
else
ERR("failed to load symbols from %s: %s\n",
mod->path, strerror(-err));
- continue;
+ goto load_info;
}
kmod_list_foreach(l, list) {
const char *name = kmod_module_symbol_get_symbol(l);
depmod_symbol_add(depmod, name, crc, mod);
}
kmod_module_symbols_free_list(list);
+
+load_info:
+ kmod_module_get_info(mod->kmod, &mod->info_list);
}
DBG("loaded symbols (%zd modules, %zd symbols)\n",
{
int err;
- err = depmod_load_symbols(depmod);
+ err = depmod_load_symbols_and_info(depmod);
if (err < 0)
return err;
for (i = 0; i < depmod->modules.count; i++) {
const struct mod *mod = depmod->modules.array[i];
- struct kmod_list *l, *list = NULL;
- int r = kmod_module_get_info(mod->kmod, &list);
- if (r < 0 || list == NULL)
- continue;
- kmod_list_foreach(l, list) {
+ struct kmod_list *l;
+
+ kmod_list_foreach(l, mod->info_list) {
const char *key = kmod_module_info_get_key(l);
const char *value = kmod_module_info_get_value(l);
fprintf(out, "alias %s %s\n",
value, kmod_module_get_name(mod->kmod));
}
- kmod_module_info_free_list(list);
}
return 0;
for (i = 0; i < depmod->modules.count; i++) {
const struct mod *mod = depmod->modules.array[i];
- struct kmod_list *l, *list = NULL;
- int r = kmod_module_get_info(mod->kmod, &list);
- if (r < 0 || list == NULL)
- continue;
- kmod_list_foreach(l, list) {
+ struct kmod_list *l;
+
+ kmod_list_foreach(l, mod->info_list) {
const char *key = kmod_module_info_get_key(l);
const char *value = kmod_module_info_get_value(l);
const char *modname, *alias;
WRN("duplicate module alias:\n%s %s\n",
alias, modname);
}
- kmod_module_info_free_list(list);
}
index_write(idx, out);
for (i = 0; i < depmod->modules.count; i++) {
const struct mod *mod = depmod->modules.array[i];
- struct kmod_list *l, *list = NULL;
- int r = kmod_module_get_info(mod->kmod, &list);
- if (r < 0 || list == NULL)
- continue;
- kmod_list_foreach(l, list) {
+ struct kmod_list *l;
+
+ kmod_list_foreach(l, mod->info_list) {
const char *key = kmod_module_info_get_key(l);
const char *value = kmod_module_info_get_value(l);
fprintf(out, "softdep %s %s\n",
kmod_module_get_name(mod->kmod), value);
}
- kmod_module_info_free_list(list);
}
return 0;
for (i = 0; i < depmod->modules.count; i++) {
const struct mod *mod = depmod->modules.array[i];
- struct kmod_list *l, *list = NULL;
+ struct kmod_list *l;
const char *devname = NULL;
char type = '\0';
unsigned int major = 0, minor = 0;
- int r;
- r = kmod_module_get_info(mod->kmod, &list);
- if (r < 0 || list == NULL)
- continue;
-
- kmod_list_foreach(l, list) {
+ kmod_list_foreach(l, mod->info_list) {
const char *key = kmod_module_info_get_key(l);
const char *value = kmod_module_info_get_value(l);
unsigned int maj, min;
break;
}
}
- kmod_module_info_free_list(list);
}
return 0;