Rusty,
Any chance that module-init-tools-0.9.3 can be modified to stop looping
when it detected it has repeated scanning the same module again?
I'm still having problem loading ide as a module under 2.5.51
Thanks,
Jeff
[ [email protected] ]
---------- Forwarded message ----------
Date: Wed, 11 Dec 2002 15:07:33 +0800 (SGT)
From: Jeff Chua <[email protected]>
To: Adam J. Richter <[email protected]>
Cc: [email protected], <[email protected]>
Subject: Re: 2.5.51 ide module problem
On Tue, 10 Dec 2002, Adam J. Richter wrote:
> >depmod will ecounter "Segmentation fault" if the ide.ko and ide-io.ps
> >modules are in /lib/modules/2.5.51/kernel
>
> I think the new depmod recurses infinitely when it encounters
> circular dependencies. It eventually segfaults and leaves a huge
> modules.dep file from the infinite loop. If you look at the final
> huge line in that file, you can see where the loop occurred.
>
> depmod has no need to do any recursion, since it only needs
> to determine the immediate dependencies of each module. However,
> noticing such loops and printing them out would be a handy feature.
>
> I use IDE as a module, but I had to change the Makefile to
> build a big ide-mod.o from most of the core objects rather than
> allowing each one to be its own module. I believe I posted IDE
> modularization patches at least once a couple of months ago, but it
> seems to have fallen between the cracks. I could repost it if need
> be
Yes, please, send me your patch. I hope this patch works for
module-init-tools-0.9.3
>, although I have not yet booted 2.5.51.
I had same problem with pre 2.5.51. With 2.5.51, kernel now boot and I'm
able to get login prompt using ramdisk. Only catch is I've to specify
root=/dev/ram0 instead of /dev/ram for it to boot.
Thanks,
Jeff.
>
> Also note that I have not used the in kernel-based module
> loader recently, as I have been patching my kernels to use the user
> level module code. I am planning to try the kernel-base module loader
> in 2.5.51 once I fix other problems it has finding the root device
> under devfs. So, it's remotely possible that you may also see module
> problems that I've missed.
>
> Adam J. Richter __ ______________ 575 Oroville Road
> [email protected] \ / Milpitas, California 95035
> +1 408 309-6081 | g g d r a s i l United States of America
> "Free Software For The Rest Of Us."
>
In message <[email protected]> you
write:
>
> Rusty,
>
> Any chance that module-init-tools-0.9.3 can be modified to stop looping
> when it detected it has repeated scanning the same module again?
I didn't see this report before, so it's the first I've heard of it.
> > I think the new depmod recurses infinitely when it encounters
> > circular dependencies. It eventually segfaults and leaves a huge
> > modules.dep file from the infinite loop. If you look at the final
> > huge line in that file, you can see where the loop occurred.
> >
> > depmod has no need to do any recursion, since it only needs
> > to determine the immediate dependencies of each module. However,
> > noticing such loops and printing them out would be a handy feature.
Actually, depmod should print out every dependency, so that modprobe
doesn't have to do the recursion check.
But yes, circular dependencies will screw it.
> >depmod will ecounter "Segmentation fault" if the ide.ko and ide-io.ps
> >modules are in /lib/modules/2.5.51/kernel
I'll test, and release a fix.
Thanks for the (indirect) bug report!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
In message <[email protected]> you
write:
>
> Rusty,
>
> Any chance that module-init-tools-0.9.3 can be modified to stop looping
> when it detected it has repeated scanning the same module again?
>
> I'm still having problem loading ide as a module under 2.5.51
And you will continue to. There really is a loop, which means neither
module can be loaded (ide_dump_status is in ide.ko, and ide-io.ko wants
it, however ide.ko uses lots of things in ide-io.ko). However, this
patch will stop depmod from crashing.
Ask the IDE people,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Only in module-init-tools-current/: .deps
diff -ur module-init-tools-0.9.3/ChangeLog module-init-tools-current/ChangeLog
--- module-init-tools-0.9.3/ChangeLog 2002-12-10 17:42:36.000000000 +1100
+++ module-init-tools-current/ChangeLog 2002-12-12 20:43:40.000000000 +1100
@@ -1,3 +1,6 @@
+0.9.4 Version
+o Implement primitive loop detection.
+
0.9.3 Version
o Fix modprobe -r ordering (tried to remove backwards) (Jim Radford's report)
o David Brownell's extra rmmod options (modified)
diff -ur module-init-tools-0.9.3/depmod.c module-init-tools-current/depmod.c
--- module-init-tools-0.9.3/depmod.c 2002-12-09 11:14:37.000000000 +1100
+++ module-init-tools-current/depmod.c 2002-12-12 20:37:30.000000000 +1100
@@ -291,30 +291,70 @@
return next;
}
-static void write_dep(struct module *mod, unsigned int skipchars, FILE *out)
+static char *basename(char *name)
+{
+ char *base = strrchr(name, '/');
+ if (base) return base + 1;
+ return name;
+}
+
+static void report_loop(struct module *start)
+{
+ struct module *i;
+ warn("Loop detected: %s ", start->pathname);
+
+ for (i = start->next_dep; i != start; i = i->next_dep)
+ fprintf(stderr, "needs %s ", basename(i->pathname));
+ fprintf(stderr, "which needs %s again!\n", basename(start->pathname));
+}
+
+/* Only want to report head loops, since we usually are doing all
+ modules anyway. */
+static void write_dep(struct module *start,
+ struct module *mod, unsigned int skipchars, FILE *out)
{
unsigned int i;
+ /* Already done this one? */
+ if (mod->next_dep) {
+ if (mod == start)
+ report_loop(start);
+ return;
+ }
+
for (i = 0; i < mod->num_deps; i++) {
fprintf(out, " %s", mod->deps[i]->pathname + skipchars);
- write_dep(mod->deps[i], skipchars, out);
+ mod->next_dep = mod->deps[i];
+ write_dep(start, mod->deps[i], skipchars, out);
}
}
-/* FIXME: Don't write same dep twice: order and loop detect. --RR */
+/* Unset the duplicate detection pointers. */
+/* FIXME: Order n^2 is bad. tsort them and do something sensible when
+ loops detected. --RR */
+static void clear_deps(struct module *modules)
+{
+ struct module *i;
+
+ for (i = modules; i; i = i->next)
+ i->next_dep = NULL;
+}
+
static void output_deps(struct module *modules,
unsigned int skipchars,
- FILE *out)
+ FILE *out,
+ int verbose)
{
struct module *i;
for (i = modules; i; i = i->next)
- i->ops->calculate_deps(i);
+ i->ops->calculate_deps(i, verbose);
/* Now dump them out. */
for (i = modules; i; i = i->next) {
fprintf(out, "%s:", i->pathname + skipchars);
- write_dep(i, skipchars, out);
+ clear_deps(modules);
+ write_dep(i, i, skipchars, out);
fprintf(out, "\n");
}
}
@@ -361,7 +401,7 @@
int main(int argc, char *argv[])
{
- int opt, all = 0;
+ int opt, all = 0, verbose = 0;
unsigned int skipchars = 0;
FILE *depout = NULL, *pciout, *usbout, *ccwout;
char *basedir = "/lib/modules", *dirname, *version;
@@ -384,8 +424,10 @@
case 'e':
/* FIXME: Implement these together */
break;
- case 'u':
case 'v':
+ verbose = 1;
+ break;
+ case 'u':
case 'q':
/* Ignored. */
break;
@@ -467,7 +509,7 @@
list = grab_dir(dirname, list);
}
- output_deps(list, skipchars, depout);
+ output_deps(list, skipchars, depout, verbose);
output_pci_table(list, pciout);
output_usb_table(list, usbout);
output_ccw_table(list, ccwout);
diff -ur module-init-tools-0.9.3/depmod.h module-init-tools-current/depmod.h
--- module-init-tools-0.9.3/depmod.h 2002-12-09 11:14:37.000000000 +1100
+++ module-init-tools-current/depmod.h 2002-12-12 20:13:13.000000000 +1100
@@ -27,6 +27,9 @@
unsigned int num_deps;
struct module **deps;
+ /* Set if we're doing a dependency now (duplicate detection) */
+ struct module *next_dep;
+
/* Tables extracted from module by ops->fetch_tables(). */
/* FIXME: Do other tables too --RR */
unsigned int pci_size;
diff -ur module-init-tools-0.9.3/moduleops.c module-init-tools-current/moduleops.c
--- module-init-tools-0.9.3/moduleops.c 2002-12-09 11:14:37.000000000 +1100
+++ module-init-tools-current/moduleops.c 2002-12-12 19:55:47.000000000 +1100
@@ -44,7 +44,7 @@
}
/* Calculate the dependencies for this module */
-static void calculate_deps32(struct module *module)
+static void calculate_deps32(struct module *module, int verbose)
{
unsigned int i;
unsigned long size;
@@ -72,9 +72,13 @@
continue;
owner = find_symbol(name);
- if (owner)
+ if (owner) {
+ if (verbose)
+ printf("%s needs \"%s\": %s\n",
+ module->pathname, name,
+ owner->pathname);
add_dep(module, owner);
- else
+ } else
unknown_symbol(module, name);
}
}
@@ -164,7 +168,7 @@
}
/* Calculate the dependencies for this module */
-static void calculate_deps64(struct module *module)
+static void calculate_deps64(struct module *module, int verbose)
{
unsigned int i;
unsigned long size;
diff -ur module-init-tools-0.9.3/moduleops.h module-init-tools-current/moduleops.h
--- module-init-tools-0.9.3/moduleops.h 2002-11-27 20:45:07.000000000 +1100
+++ module-init-tools-current/moduleops.h 2002-12-12 19:52:33.000000000 +1100
@@ -17,7 +17,7 @@
struct module_ops
{
void (*load_symbols)(struct module *module);
- void (*calculate_deps)(struct module *module);
+ void (*calculate_deps)(struct module *module, int verbose);
void (*fetch_tables)(struct module *module);
};
On Thu, 2002-12-12 at 09:48, Rusty Russell wrote:
> And you will continue to. There really is a loop, which means neither
> module can be loaded (ide_dump_status is in ide.ko, and ide-io.ko wants
> it, however ide.ko uses lots of things in ide-io.ko). However, this
> patch will stop depmod from crashing.
>
> Ask the IDE people,
The module changes basically left me unable to do any further 2.5.5x
work at an acceptable rate. My time is now allocated to other projects
until January. At that point hopefully the module stuff will be usable
again, parameters will work etc and I can go back to work on 2.5.
Rusty is right that the ide stuff has dependancy loops right now. His
new module stuff shouldn't have crashed but the fundamental work to be
done is in the IDE layer. There are also some locking problems to
address before modular IDE becomes useful.
Alan
In message <[email protected]> you write:
> The module changes basically left me unable to do any further 2.5.5x
> work at an acceptable rate. My time is now allocated to other projects
> until January. At that point hopefully the module stuff will be usable
> again, parameters will work etc and I can go back to work on 2.5.
That's disappointing. However, I can completely relate to your
frustration with the lack of module parameters. Linus are you
listening? 8) Hopefully he's back today and will take patches, and
then I can look forward to some bug reports from you...
The patches I have queued for Linus are:
1) Param support
2) /lib/modules directory structure & depmod reversion
3) module's init calls request_module loop fix (bttv and parport do
this in some configs).
> Rusty is right that the ide stuff has dependancy loops right now. His
> new module stuff shouldn't have crashed but the fundamental work to be
> done is in the IDE layer. There are also some locking problems to
> address before modular IDE becomes useful.
Also, my stress_modules script gave the following warning then oops
from ide-cd on 2.5.51 SMP x86 (IDE is built-in):
Dec 12 11:05:36 mingo kernel: Badness in kobject_register at lib/kobject.c:113
Dec 12 11:05:37 mingo kernel: Call Trace:
Dec 12 11:05:37 mingo kernel: [<d0968fec>] ide_cdrom_driver+0x4c/0xd4 [ide_cd]
Dec 12 11:05:37 mingo kernel: [<c01a5745>] kobject_register+0x39/0x50
Dec 12 11:05:37 mingo kernel: [<c01b2352>] bus_add_driver+0x7a/0xc8
Dec 12 11:05:37 mingo kernel: [<d0969010>] ide_cdrom_driver+0x70/0xd4 [ide_cd]
Dec 12 11:05:37 mingo kernel: [<d0969000>] ide_cdrom_driver+0x60/0xd4 [ide_cd]
Dec 12 11:05:37 mingo kernel: [<d0968fa0>] ide_cdrom_driver+0x0/0xd4 [ide_cd]
Dec 12 11:05:37 mingo kernel: [<d0968fec>] ide_cdrom_driver+0x4c/0xd4 [ide_cd]
Dec 12 11:05:37 mingo kernel: [<c01dc239>] ata_attach+0xfd/0x2d0
Dec 12 11:05:37 mingo kernel: [<d0969010>] ide_cdrom_driver+0x70/0xd4 [ide_cd]
Dec 12 11:05:37 mingo kernel: [<c01b2776>] driver_register+0x3e/0x44
Dec 12 11:05:37 mingo kernel: [<d0968fec>] ide_cdrom_driver+0x4c/0xd4 [ide_cd]
Dec 12 11:05:37 mingo kernel: [<c01dd305>] ide_register_driver+0x1c9/0x1d4
Dec 12 11:05:37 mingo kernel: [<d0968fec>] ide_cdrom_driver+0x4c/0xd4 [ide_cd]
Dec 12 11:05:37 mingo kernel: [<d096618a>] ide_cdrom_init+0xa/0x10 [ide_cd]
Dec 12 11:05:37 mingo kernel: [<d0968fa0>] ide_cdrom_driver+0x0/0xd4 [ide_cd]
Dec 12 11:05:37 mingo kernel: [<c01307a3>] sys_init_module+0x183/0x210
Dec 12 11:05:37 mingo kernel: [<c0108f73>] syscall_call+0x7/0xb
Dec 12 11:05:44 mingo kernel: Unable to handle kernel paging request at virtual address d0969024
Dec 12 11:05:44 mingo kernel: printing eip:
Dec 12 11:05:44 mingo kernel: c01a56c5
Dec 12 11:05:44 mingo kernel: *pde = 0ff09067
Dec 12 11:05:44 mingo kernel: *pte = 00000000
Dec 12 11:05:44 mingo kernel: Oops: 0002
Dec 12 11:05:44 mingo kernel: CPU: 1
Dec 12 11:05:44 mingo kernel: EIP: 0060:[<c01a56c5>] Not tainted
Dec 12 11:05:44 mingo kernel: EFLAGS: 00010246
Dec 12 11:05:44 mingo kernel: EIP is at kobject_add+0x85/0xcc
Dec 12 11:05:44 mingo kernel: eax: d08fd024 ebx: c02c4fe8 ecx: d0969024 edx: c02c4fe0
Dec 12 11:05:44 mingo kernel: esi: d08fd010 edi: c02c4fb8 ebp: 00000000 esp: ccf67f38
Dec 12 11:05:44 mingo kernel: ds: 0068 es: 0068 ss: 0068
Dec 12 11:05:44 mingo kernel: Process modprobe (pid: 2977, threadinfo=ccf66000 task=ccfb2d20)
Dec 12 11:05:44 mingo kernel: Stack: d08fd010 d08fcdf4 d08fd020 d08fcfec c01a5721 d08fd010 d08fd010 c02c4f60
Dec 12 11:05:44 mingo kernel: c01b2352 d08fd010 d08fd000 d08fcfa0 ccf67fa0 d08fcfec c01dc239 d08fd010
Dec 12 11:05:44 mingo kernel: c02c4f94 c01b2776 d08fcfec c036dc94 c01dd305 d08fcfec d083f000 c0291534
Dec 12 11:05:44 mingo kernel: Call Trace:
Dec 12 11:05:44 mingo kernel: [<d08fd010>] ide_cdrom_driver+0x70/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<d08fcdf4>] sense_data_texts+0x263c/0x2728 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<d08fd020>] ide_cdrom_driver+0x80/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<d08fcfec>] ide_cdrom_driver+0x4c/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<c01a5721>] kobject_register+0x15/0x50
Dec 12 11:05:44 mingo kernel: [<d08fd010>] ide_cdrom_driver+0x70/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<d08fd010>] ide_cdrom_driver+0x70/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<c01b2352>] bus_add_driver+0x7a/0xc8
Dec 12 11:05:44 mingo kernel: [<d08fd010>] ide_cdrom_driver+0x70/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<d08fd000>] ide_cdrom_driver+0x60/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<d08fcfa0>] ide_cdrom_driver+0x0/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<d08fcfec>] ide_cdrom_driver+0x4c/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<c01dc239>] ata_attach+0xfd/0x2d0
Dec 12 11:05:44 mingo kernel: [<d08fd010>] ide_cdrom_driver+0x70/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<c01b2776>] driver_register+0x3e/0x44
Dec 12 11:05:44 mingo kernel: [<d08fcfec>] ide_cdrom_driver+0x4c/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<c01dd305>] ide_register_driver+0x1c9/0x1d4
Dec 12 11:05:44 mingo kernel: [<d08fcfec>] ide_cdrom_driver+0x4c/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<d08fa18a>] ide_cdrom_init+0xa/0x10 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<d08fcfa0>] ide_cdrom_driver+0x0/0xd4 [ide_cd]
Dec 12 11:05:44 mingo kernel: [<c01307a3>] sys_init_module+0x183/0x210
Dec 12 11:05:44 mingo kernel: [<c0108f73>] syscall_call+0x7/0xb
Dec 12 11:05:44 mingo kernel:
Dec 12 11:05:44 mingo kernel: Code: 89 01 57 e8 3b 01 00 00 89 46 1c 83 c4 04 89 d8 ba ff ff 00
Hope that helps!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
On Fri, 2002-12-13 at 01:35, Rusty Russell wrote:
> Also, my stress_modules script gave the following warning then oops
> from ide-cd on 2.5.51 SMP x86 (IDE is built-in):
Yes. This mysteriously stsrted happening. I don't know if its now
trapping a long standing IDE bug or its of the other changes people did
to IDE to make it actually follow the devices model properly. I've got a
slightly similar looking 2.4 bug to chase down which makes me suspect
the former.
On Thu, 12 Dec 2002, Rusty Russell wrote:
> > I'm still having problem loading ide as a module under 2.5.51
>
> And you will continue to. There really is a loop, which means neither
> module can be loaded (ide_dump_status is in ide.ko, and ide-io.ko wants
> it, however ide.ko uses lots of things in ide-io.ko). However, this
> patch will stop depmod from crashing.
Rusty,
I tried the patch and this one printed out the "loop detected" messages,
but still crashed.
# ./depmod -a -e -F /v6/rootdsk-g25/lib/modules/2.5.51/System.map -b /v6/rootdsk-g25/lib/modules 2.5.51
WARNING: Loop detected:
/v6/rootdsk-g25/lib/modules/2.5.51/kernel/ide-io.ko needs ide-taskfile.ko
needs ide-iops.ko needs ide.ko which needs ide-io.ko again!
WARNING: Loop detected:
/v6/rootdsk-g25/lib/modules/2.5.51/kernel/ide-io.ko needs ide-taskfile.ko
which needs ide-io.ko again!
WARNING: Loop detected:
/v6/rootdsk-g25/lib/modules/2.5.51/kernel/ide-iops.ko needs ide.ko which
needs ide-iops.ko again!
WARNING: Loop detected:
/v6/rootdsk-g25/lib/modules/2.5.51/kernel/ide-iops.ko needs ide.ko needs
ide-io.ko needs ide-taskfile.ko which needs ide-iops.ko again!
WARNING: Loop detected:
/v6/rootdsk-g25/lib/modules/2.5.51/kernel/ide-iops.ko needs ide.ko needs
ide-io.ko which needs ide-iops.ko again!
WARNING: Loop detected:
/v6/rootdsk-g25/lib/modules/2.5.51/kernel/ide-taskfile.ko needs
ide-iops.ko needs ide.ko needs ide-io.ko which needs ide-taskfile.ko
again!
WARNING: Loop detected:
/v6/rootdsk-g25/lib/modules/2.5.51/kernel/ide-taskfile.ko needs
ide-iops.ko needs ide.ko which needs ide-taskfile.ko again!
WARNING: Loop detected: /v6/rootdsk-g25/lib/modules/2.5.51/kernel/ide.ko
needs ide-iops.ko which needs ide.ko again!
WARNING: Loop detected: /v6/rootdsk-g25/lib/modules/2.5.51/kernel/ide.ko
needs ide-io.ko needs ide-taskfile.ko which needs ide.ko again!
WARNING: Loop detected: /v6/rootdsk-g25/lib/modules/2.5.51/kernel/ide.ko
needs ide-io.ko which needs ide.ko again!
Segmentation fault
>
> Ask the IDE people,
> Rusty.
> --
> Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
>
> Only in module-init-tools-current/: .deps
> diff -ur module-init-tools-0.9.3/ChangeLog module-init-tools-current/ChangeLog
> --- module-init-tools-0.9.3/ChangeLog 2002-12-10 17:42:36.000000000 +1100
> +++ module-init-tools-current/ChangeLog 2002-12-12 20:43:40.000000000 +1100
> @@ -1,3 +1,6 @@
> +0.9.4 Version
> +o Implement primitive loop detection.
> +
> 0.9.3 Version
> o Fix modprobe -r ordering (tried to remove backwards) (Jim Radford's report)
> o David Brownell's extra rmmod options (modified)
> diff -ur module-init-tools-0.9.3/depmod.c module-init-tools-current/depmod.c
> --- module-init-tools-0.9.3/depmod.c 2002-12-09 11:14:37.000000000 +1100
> +++ module-init-tools-current/depmod.c 2002-12-12 20:37:30.000000000 +1100
> @@ -291,30 +291,70 @@
> return next;
> }
>
> -static void write_dep(struct module *mod, unsigned int skipchars, FILE *out)
> +static char *basename(char *name)
> +{
> + char *base = strrchr(name, '/');
> + if (base) return base + 1;
> + return name;
> +}
> +
> +static void report_loop(struct module *start)
> +{
> + struct module *i;
> + warn("Loop detected: %s ", start->pathname);
> +
> + for (i = start->next_dep; i != start; i = i->next_dep)
> + fprintf(stderr, "needs %s ", basename(i->pathname));
> + fprintf(stderr, "which needs %s again!\n", basename(start->pathname));
> +}
> +
> +/* Only want to report head loops, since we usually are doing all
> + modules anyway. */
> +static void write_dep(struct module *start,
> + struct module *mod, unsigned int skipchars, FILE *out)
> {
> unsigned int i;
>
> + /* Already done this one? */
> + if (mod->next_dep) {
> + if (mod == start)
> + report_loop(start);
> + return;
> + }
> +
> for (i = 0; i < mod->num_deps; i++) {
> fprintf(out, " %s", mod->deps[i]->pathname + skipchars);
> - write_dep(mod->deps[i], skipchars, out);
> + mod->next_dep = mod->deps[i];
> + write_dep(start, mod->deps[i], skipchars, out);
> }
> }
>
> -/* FIXME: Don't write same dep twice: order and loop detect. --RR */
> +/* Unset the duplicate detection pointers. */
> +/* FIXME: Order n^2 is bad. tsort them and do something sensible when
> + loops detected. --RR */
> +static void clear_deps(struct module *modules)
> +{
> + struct module *i;
> +
> + for (i = modules; i; i = i->next)
> + i->next_dep = NULL;
> +}
> +
> static void output_deps(struct module *modules,
> unsigned int skipchars,
> - FILE *out)
> + FILE *out,
> + int verbose)
> {
> struct module *i;
>
> for (i = modules; i; i = i->next)
> - i->ops->calculate_deps(i);
> + i->ops->calculate_deps(i, verbose);
>
> /* Now dump them out. */
> for (i = modules; i; i = i->next) {
> fprintf(out, "%s:", i->pathname + skipchars);
> - write_dep(i, skipchars, out);
> + clear_deps(modules);
> + write_dep(i, i, skipchars, out);
> fprintf(out, "\n");
> }
> }
> @@ -361,7 +401,7 @@
>
> int main(int argc, char *argv[])
> {
> - int opt, all = 0;
> + int opt, all = 0, verbose = 0;
> unsigned int skipchars = 0;
> FILE *depout = NULL, *pciout, *usbout, *ccwout;
> char *basedir = "/lib/modules", *dirname, *version;
> @@ -384,8 +424,10 @@
> case 'e':
> /* FIXME: Implement these together */
> break;
> - case 'u':
> case 'v':
> + verbose = 1;
> + break;
> + case 'u':
> case 'q':
> /* Ignored. */
> break;
> @@ -467,7 +509,7 @@
> list = grab_dir(dirname, list);
> }
>
> - output_deps(list, skipchars, depout);
> + output_deps(list, skipchars, depout, verbose);
> output_pci_table(list, pciout);
> output_usb_table(list, usbout);
> output_ccw_table(list, ccwout);
> diff -ur module-init-tools-0.9.3/depmod.h module-init-tools-current/depmod.h
> --- module-init-tools-0.9.3/depmod.h 2002-12-09 11:14:37.000000000 +1100
> +++ module-init-tools-current/depmod.h 2002-12-12 20:13:13.000000000 +1100
> @@ -27,6 +27,9 @@
> unsigned int num_deps;
> struct module **deps;
>
> + /* Set if we're doing a dependency now (duplicate detection) */
> + struct module *next_dep;
> +
> /* Tables extracted from module by ops->fetch_tables(). */
> /* FIXME: Do other tables too --RR */
> unsigned int pci_size;
> diff -ur module-init-tools-0.9.3/moduleops.c module-init-tools-current/moduleops.c
> --- module-init-tools-0.9.3/moduleops.c 2002-12-09 11:14:37.000000000 +1100
> +++ module-init-tools-current/moduleops.c 2002-12-12 19:55:47.000000000 +1100
> @@ -44,7 +44,7 @@
> }
>
> /* Calculate the dependencies for this module */
> -static void calculate_deps32(struct module *module)
> +static void calculate_deps32(struct module *module, int verbose)
> {
> unsigned int i;
> unsigned long size;
> @@ -72,9 +72,13 @@
> continue;
>
> owner = find_symbol(name);
> - if (owner)
> + if (owner) {
> + if (verbose)
> + printf("%s needs \"%s\": %s\n",
> + module->pathname, name,
> + owner->pathname);
> add_dep(module, owner);
> - else
> + } else
> unknown_symbol(module, name);
> }
> }
> @@ -164,7 +168,7 @@
> }
>
> /* Calculate the dependencies for this module */
> -static void calculate_deps64(struct module *module)
> +static void calculate_deps64(struct module *module, int verbose)
> {
> unsigned int i;
> unsigned long size;
> diff -ur module-init-tools-0.9.3/moduleops.h module-init-tools-current/moduleops.h
> --- module-init-tools-0.9.3/moduleops.h 2002-11-27 20:45:07.000000000 +1100
> +++ module-init-tools-current/moduleops.h 2002-12-12 19:52:33.000000000 +1100
> @@ -17,7 +17,7 @@
> struct module_ops
> {
> void (*load_symbols)(struct module *module);
> - void (*calculate_deps)(struct module *module);
> + void (*calculate_deps)(struct module *module, int verbose);
> void (*fetch_tables)(struct module *module);
> };
>
>