mkdir /var/log/ksymoops
Every time a module is loaded /proc/ksymsand /proc/modules is copied there.
-k /var/log/ksymoops/
-l /var/log/ksymoops/
dbg() macro
#if !defined(CONFIG_FOO_MODULE)
#define MY_NAME "foo_driver"
#else
#define MY_NAME THIS_MODULE->name
#endif
#define dbg(fmt, arg...) do {
if (debug)
printk(KERN_DEBUG "%s: "__FUNCTION__": "
fmt "\n" , MY_NAME , ## arg);
} while (0)
static int debug;
MODULE_PARM(debug, "i");
Using dbg()
dbg ("Added slot %d to the list",
slot->physical_number);
shows up as:
hotplug_pci: pci_hp_register: Added slot 2 to the list
dbg ("");
shows up as:
hotplug_pci: pci_hp_register:
Other printk() macros
#define err(fmt, arg...)
printk(KERN_ERR "%s: " fmt "\n" , MY_NAME , ## arg)
#define info(fmt, arg...)
printk(KERN_INFO "%s: " fmt "\n" , MY_NAME , ## arg)
#define warn(fmt, arg...)
printk(KERN_WARNING "%s: " fmt "\n" , MY_NAME , ## arg)
Comments