-
- cmd = xasprintf ("tsort > %s/modules", dir);
- if (verbose >= 2) fprintf (stderr, "%s\n", cmd);
- FILE *pp = popen (cmd, "w");
- if (pp == NULL)
- error (EXIT_FAILURE, errno, "tsort: failed to create modules list");
-
- DIR *dr = opendir (dir);
- if (dr == NULL)
- error (EXIT_FAILURE, errno, "opendir: %s", dir);
-
- struct dirent *d;
- while ((errno = 0, d = readdir (dr)) != NULL) {
- size_t n = strlen (d->d_name);
- if (n >= 3 &&
- d->d_name[n-3] == '.' &&
- d->d_name[n-2] == 'k' &&
- d->d_name[n-1] == 'o') {
- const char *dep = get_module_dep (d->d_name);
- if (dep)
- /* Reversed so that tsort will print the final list in the
- * order that it has to be loaded.
- */
- fprintf (pp, "%s %s\n", dep, d->d_name);
+ add_module ("");
+ for (int i = 0; kmods[i] != NULL; ++i) {
+ for (struct module *m = modules; m; m = m->next) {
+ char *n = strrchr (m->name, '/');
+ if (n)
+ n += 1;