Messages in this thread Patch in this message | | | Subject | [PATCH] Suspend2 Merge: Get module list. | From | Nigel Cunningham <> | Date | Thu, 16 Sep 2004 21:06:12 +1000 |
| |
Hi again.
This patch adds support for getting a list of currently loaded modules. It's used in displaying debugging info:
> Please include the following information in bug reports: > - SWSUSP core : 2.0.0.107 > - Kernel Version : 2.4.27 > - Version spec. : 2.0.1 > - Compiler vers. : 3.3 > - Modules loaded : ppp_mppe ppp_deflate zlib_inflate zlib_deflate > bsd_comp ltmodem_cs ds i82365 pcmcia_core maestro3 ac97_codec > soundcore ftdi_sio visor usbserial printer usb-uhci usbcore Mvnetd > Mvnet Mvnetint Mvw Mvmouse Mvkbd Mvgic Mvdsp Mserial Mmpip Mmerge > mki-adapter i830 agpgart parport_pc lp parport ide-cd cdrom floppy > ipt_LOG ipt_state ipt_MASQUERADE iptable_nat ip_conntrack > ipt_multiport ipt_REJECT iptable_filter ip_tables ppp_async > ppp_generic slhc af_packet omnibook battery button eepro100 mii rtc > unix suspend_swap suspend_block_io suspend_lzf suspend_bootsplash > suspend_text suspend_core > - Attempt number : 1 > - Parameters : 0 2816 0 0 0 128 > - Limits : 161664 pages RAM. Initial boot: 156425. > - Overall expected compression percentage: 0. > - LZF Compressor enabled. > Compressed 340914176 bytes into 187258858 (45 percent compression). > - Swapwriter active. > Swap available for image: 172688 pages. > - Debugging compiled in. > - Preemptive kernel. > - I/O speed: Write 28 MB/s, Read 49 MB/s. > [root@laptop current-2.6.9-rc2-patches]#
(I'm using 2.4 because there's no 2.6 pcmcia_cs ltmodem driver yet :>).
Regards,
Nigel
diff -ruN linux-2.6.9-rc1/kernel/module.c software-suspend-linux-2.6.9-rc1-rev3/kernel/module.c --- linux-2.6.9-rc1/kernel/module.c 2004-09-07 21:59:00.000000000 +1000 +++ software-suspend-linux-2.6.9-rc1-rev3/kernel/module.c 2004-09-09 19:36:24.000000000 +1000 @@ -2146,6 +2146,33 @@ printk("\n"); } +#define MODLIST_SIZE 4096 + +void print_module_list(void) +{ + static char modlist[MODLIST_SIZE]; + struct module *mod; + int pos = 0; + + list_for_each_entry(mod, &modules, list) + if (mod->name) + pos += snprintf(modlist+pos, MODLIST_SIZE-pos-1, + "%s ", mod->name); + printk("%s\n",modlist); +} + +int print_module_list_to_buffer(char * buffer, int size) +{ + struct module *mod; + int pos = 0; + + list_for_each_entry(mod, &modules, list) + if (mod->name) + pos += snprintf(buffer+pos, size-pos-1, + "%s ", mod->name); + return pos; +} + #ifdef CONFIG_MODVERSIONS /* Generate the signature for struct module here, too, for modversions. */ void struct_module(struct module *mod) { return; } @@ -2157,3 +2184,6 @@ return subsystem_register(&module_subsys); } __initcall(modules_init); + +/* For Suspend2 */ +EXPORT_SYMBOL(print_module_list_to_buffer); -- Nigel Cunningham Pastoral Worker Christian Reformed Church of Tuggeranong PO Box 1004, Tuggeranong, ACT 2901
Many today claim to be tolerant. True tolerance, however, can cope with others being intolerant.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |