public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* af_unix.c, KBUILD_MODNAME and unix
@ 2005-03-20 13:45 Magnus Damm
  2005-03-20 13:52 ` Russell King
  0 siblings, 1 reply; 6+ messages in thread
From: Magnus Damm @ 2005-03-20 13:45 UTC (permalink / raw)
  To: linux-kernel

Hello All,

af_unix.c is currenty built with KBUILD_MODNAME=unix. This seems to
work rather well today, but if someone actually tries to use
KBUILD_MODNAME then they will end up with a preprocessor surprise:
KBUILD_MODNAME -> unix -> 1, because "unix" is defined to 1.

With other words, if someone adds module_param(foo,...) code to
af_unix.c and compiles the code as built in then they will have to use
"1.foo" to set the variable instead of "unix.foo" as expected.

Solution? #undef unix?

I came across this when trying to autogenerate parameter documentation...

/ magnus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: af_unix.c, KBUILD_MODNAME and unix
  2005-03-20 13:45 af_unix.c, KBUILD_MODNAME and unix Magnus Damm
@ 2005-03-20 13:52 ` Russell King
  2005-03-20 14:01   ` Jan Engelhardt
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King @ 2005-03-20 13:52 UTC (permalink / raw)
  To: Magnus Damm; +Cc: linux-kernel

On Sun, Mar 20, 2005 at 02:45:36PM +0100, Magnus Damm wrote:
> Hello All,
> 
> af_unix.c is currenty built with KBUILD_MODNAME=unix. This seems to
> work rather well today, but if someone actually tries to use
> KBUILD_MODNAME then they will end up with a preprocessor surprise:
> KBUILD_MODNAME -> unix -> 1, because "unix" is defined to 1.
> 
> With other words, if someone adds module_param(foo,...) code to
> af_unix.c and compiles the code as built in then they will have to use
> "1.foo" to set the variable instead of "unix.foo" as expected.
> 
> Solution? #undef unix?

or maybe -Uunix ?

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: af_unix.c, KBUILD_MODNAME and unix
  2005-03-20 13:52 ` Russell King
@ 2005-03-20 14:01   ` Jan Engelhardt
  2005-03-20 15:52     ` Magnus Damm
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2005-03-20 14:01 UTC (permalink / raw)
  To: Russell King; +Cc: Magnus Damm, linux-kernel

>> Hello All,
>> 
>> af_unix.c is currenty built with KBUILD_MODNAME=unix. This seems to
>> Solution? #undef unix?
>
>or maybe -Uunix ?

Why is not KBUILD_MODNAME=af_unix ?



Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: af_unix.c, KBUILD_MODNAME and unix
  2005-03-20 14:01   ` Jan Engelhardt
@ 2005-03-20 15:52     ` Magnus Damm
  2005-03-20 21:51       ` Jan Engelhardt
  0 siblings, 1 reply; 6+ messages in thread
From: Magnus Damm @ 2005-03-20 15:52 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Russell King, linux-kernel

> >> af_unix.c is currenty built with KBUILD_MODNAME=unix. This seems to
> >> Solution? #undef unix?
> >
> >or maybe -Uunix ?
> 
> Why is not KBUILD_MODNAME=af_unix ?

The exact solution does not matter that much to me, and I'm afraid I
do not know how changing KBUILD_MODNAME affects the rest of the
codebase. So basically - someone else should decide... but who?

/ magnus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: af_unix.c, KBUILD_MODNAME and unix
       [not found] <fa.jj4t62d.1j5ccif@ifi.uio.no>
@ 2005-03-20 20:21 ` Bodo Eggert
  0 siblings, 0 replies; 6+ messages in thread
From: Bodo Eggert @ 2005-03-20 20:21 UTC (permalink / raw)
  To: Magnus Damm, linux-kernel

Magnus Damm <magnus.damm@gmail.com> wrote:

> Solution? #undef unix?

#define unix unix?

provided nobody uses unix numerically.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: af_unix.c, KBUILD_MODNAME and unix
  2005-03-20 15:52     ` Magnus Damm
@ 2005-03-20 21:51       ` Jan Engelhardt
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2005-03-20 21:51 UTC (permalink / raw)
  To: Magnus Damm; +Cc: Russell King, linux-kernel

>> Why is not KBUILD_MODNAME=af_unix ?
>
>The exact solution does not matter that much to me, and I'm afraid I
>do not know how changing KBUILD_MODNAME affects the rest of the
>codebase. So basically - someone else should decide... but who?

KBUILD_MODNAME is "not used", which means you can use it for anything that 
like. You can undef it, redefine, thwap it all over and whatnot.
It's a generosity from /usr/bin/make generally providing the module with its 
own name.




Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-03-20 21:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-20 13:45 af_unix.c, KBUILD_MODNAME and unix Magnus Damm
2005-03-20 13:52 ` Russell King
2005-03-20 14:01   ` Jan Engelhardt
2005-03-20 15:52     ` Magnus Damm
2005-03-20 21:51       ` Jan Engelhardt
     [not found] <fa.jj4t62d.1j5ccif@ifi.uio.no>
2005-03-20 20:21 ` Bodo Eggert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox