- /* We get a file here. If the file does not have ".ko" but an
- * intermittent dentry has, it's just their fault.
- */
- if (strrstr(modulename, ".ko") != NULL) {
- dep_lst_t *new = xzalloc(sizeof(dep_lst_t));
- new->name = xstrdup(modulename + G.moddir_base_len);
- new->next = G.lst;
- G.lst = new;
+ if (strrstr(fname, ".ko") == NULL)
+ return TRUE;
+
+ image = xmalloc_open_zipped_read_close(fname, &len);
+ info = xzalloc(sizeof(module_info));
+
+ info->next = *first;
+ *first = info;
+
+ info->dnext = info->dprev = info;
+ info->name = xstrdup(fname);
+ info->modname = filename2modname(fname, NULL);
+ for (ptr = image; ptr < image + len - 10; ptr++) {
+ if (strncmp(ptr, "depends=", 8) == 0) {
+ char *u;
+
+ ptr += 8;
+ for (u = ptr; *u; u++)
+ if (*u == '-')
+ *u = '_';
+ ptr += string_to_llist(ptr, &info->dependencies, ",");
+ } else if (ENABLE_FEATURE_MODUTILS_ALIAS &&
+ strncmp(ptr, "alias=", 6) == 0) {
+ llist_add_to(&info->aliases, xstrdup(ptr + 6));
+ ptr += strlen(ptr);
+ } else if (ENABLE_FEATURE_MODUTILS_SYMBOLS &&
+ strncmp(ptr, "__ksymtab_", 10) == 0) {
+ ptr += 10;
+ if (strncmp(ptr, "gpl", 3) == 0 ||
+ strcmp(ptr, "strings") == 0)
+ continue;
+ llist_add_to(&info->symbols, xstrdup(ptr));
+ ptr += strlen(ptr);
+ }