On Sat, 23 Apr 2005 02:28:15 +0400 Michael Tokarev <[EMAIL PROTECTED]> wrote:
> 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. Thanks for that info. I don't do much 'M=path' building. > 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. Yes, ISTM that the best solution would be to always use a 'relative path', but how to get it... > 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). Why do you conclude that? It seems to me like using KBUILD_BASENAME (or KBUILD_MODNAME) should be usable, even for a driver built in-kernel, e.g., usblp: gcc -Wp,-MD,drivers/usb/class/.usblp.o.d -nostdinc -isystem /usr/lib64/gcc-lib/amd64-mandrake-linux-gnu/3.3.2/include -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -Os -fomit-frame-pointer -march=k8 -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -Wno-sign-compare -fno-asynchronous-unwind-tables -funit-at-a-time -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -DKBUILD_BASENAME=usblp -DKBUILD_MODNAME=usblp -c -o drivers/usb/class/usblp.o drivers/usb/class/usblp.c (Yes, that still does not handle your other case of a driver built from multiple source files.) -- ~Randy ------------------------------------------------------- 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