lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080524200523.GB2308@cs181133002.pp.htv.fi>
Date:	Sat, 24 May 2008 23:05:24 +0300
From:	Adrian Bunk <bunk@...nel.org>
To:	Sam Ravnborg <sam@...nborg.org>
Cc:	linux-kbuild <linux-kbuild@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Roman Zippel <zippel@...ux-m68k.org>,
	Jeremy Fitzhardinge <jeremy@...p.org>
Subject: Re: [RFC PATCH] kconfig: introduce KCONFIG_* symbols for .c files

On Sat, May 24, 2008 at 09:25:40PM +0200, Sam Ravnborg wrote:
> We have many places in the kernel that looks like
> the following:
> 
> #ifdef CONFIG_FOO
> 	...
> #endif
> 
> Which has the disadvantage that the code denoted '...'
> are not even built if CONFIG_FOO is not selected in
> the current configuration.
> 
> We know that gcc do simple code-elimination for
> conditionals which is always true/false and
> thus the above code could be turned into:
> 
> 	if (CONFIG_FOO)
> 		...
> 
> One line smaller and we follow the normal flow in the program.
> The code is always build but we do not waste space as gcc will
> do proper code-elimination for us.
> 
> Today this is not possible because kconfig will only
> define CONFIG_FOO if selected and FOO is not a module.
> 
> The following patch implement a new set of defines in
> the KCONFIG_* namespace.
> 
> For a tristate symbol the following are defined:
> 
> FOO not selected: 
> #define KCONFIG_FOO        0
> #define KCONFIG_FOO_MODULE 0
> 
> FOO is built-in ('y')
> #define KCONFIG_FOO        1
> #define KCONFIG_FOO_MODULE 0
> 
> FOO is a module ('m'):
> #define KCONFIG_FOO        1
> #define KCONFIG_FOO_MODULE 1
> 
> In other words KCONFIG_FOO will say if the
> symbol is selected and KCONFIG_FOO_MODULE
> will say if it is a module.

If you really want to be able to transform all #if's in .c files to 
if()'s you also have to offer a variant of our MODULE #define.

> With the above included we can now do:
> 
> 	if (KCONFIG_FOO)
> 		...
> 
> This is not a replacement for the CONFIG_*
> defines but a pleasant supplement.
> Using KCONFIG_FOO will also give us a nice
> error message the day that FOO is no longer part
> of the configuration.
>...

Also an error message if if the varible is not currently available on 
this architecture (e.g. KCONFIG_ISA on ia64).

Not an unsolvable problem, but something that has to be taken care of.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ