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]
Date:	Thu, 12 Apr 2012 12:29:11 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Stephen Rothwell <sfr@...b.auug.org.au>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
	davem@...emloft.net, tony@...eyournoodle.com, mmarek@...e.cz,
	lacombar@...il.com
Subject: Re: [PATCH 0/5] RFC: strip 15,000 lines from a typical autoconf.h

On Wed, Apr 11, 2012 at 8:10 PM, Stephen Rothwell <sfr@...b.auug.org.au> wrote:
>
> Can we leave the CONFIG_ part in the caller, so they are still grepable, please?
>
> So:
>
>        #define config_enabled(x)       (__stringify(x)[0] == '1')

Sure. Except G+ came through, and we now have an even better hack for
this, that works entirely in the preprocessor.

That also means that you can use it for static initializers etc, so you can do

   int some_value = config_enabled(CONFIG_ENABLE_XYZ_BY_DEFAULT);

Paul, do you want to write the patch to change IS_ENABLED() to use this trick?

Trick courtesy of "comex ." on G+ (please do give him credit even if
he doesn't seem to use his real name):

  #define is_set(macro) is_set_(macro)
  #define macrotest_1 ,
  #define is_set_(value) is_set__(macrotest_##value)
  #define is_set__(comma) is_set___(comma 1, 0)
  #define is_set___(_, v, ...) v

and now "is_set(CONFIG_xyzzy)" works, and gives either 1 or 0 directly
in the preprocessor.

Obviously the names have to be changed here (let's not use
"macrotest_1" - make it something more internal), but the concept is
solid, and I would actually suggest having this as a generic "is this
macro set to 1" helper first, and then implement IS_ENABLED() in terms
of that.

My likee.

                       Linus
--
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