Randy.Dunlap wrote:
On Mon, 18 Apr 2005 11:15:50 -0500 Stephen Morgan wrote:

| Hello all,
| | I'm converting a USB driver for Linux 2.4.20-8 to 2.6.9-1.667 and have found
| that the __FILE__ macro is now giving me the full path of the driver source.
| In 2.4, I was just getting the file name. Like:
| | /home/me/path/yada/yada/minimum.c: minimum_init: Loading module
| | instead of:
| | minimum.c: minimum_init: Loading module
[]
I don't know if gcc changed in any way regarding __FILE__,
but in 2.6., a module should use KBUILD_MODNAME, which is
passed during module build like so (from "make V=1" output):

No, gcc didn't change. It is the difference between specifying M=stuff and not in kernel make commandline. With M=/path/to/dir, __FILE__ macro expands to the full path, wile w/o the M= stuff, it expands to the relative path -- ie, to the filename exactly as passed to the compiler command line.

And yes, it'd be very nice to fix this full pathname messages
in all the usb subsystem messages.  But I don't quite know how.

In include/linux/usb.h:

#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , 
## arg)
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , __FILE__ , ## 
arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , __FILE__ , 
## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , __FILE__ 
, ## arg)

This can't be changed to KBUILD_BASENAME, as it will change meaning
of the messages somewhat.  Maybe not a big deal really (i mean, when
there are multiple source files are used to build single module; or,
even, when the code is statically linked into kernel).

/mjt


------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to