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
| ||
|
Date: Sat, 24 May 2008 17:57:25 +0200 From: "Vegard Nossum" <vegard.nossum@...il.com> To: "Jeremy Fitzhardinge" <jeremy@...p.org> Cc: "Sam Ravnborg" <sam@...nborg.org>, "H. Peter Anvin" <hpa@...or.com>, "Steve French" <smfrench@...il.com>, lkml <linux-kernel@...r.kernel.org> Subject: Re: kernel coding style for if ... else which cross #ifdef On Sat, May 24, 2008 at 5:45 PM, Jeremy Fitzhardinge <jeremy@...p.org> wrote: > Sam Ravnborg wrote: >> >> We should actually do as you intially suggested and alwyas >> define CONFIG_FOO no matter if FOO is built-in or module. >> Because we do only want to distingush between the two in rare cases. >> >> But that is a separate patch and lets not do the same >> mistage with CFG_* >> > > I think pretty strongly that CFG_ and CONFIG_ should be exactly parallel. > If you want to change the meaning of CONFIG_X in the presence of modules, > then change CFG_X at the same time. Making them have different meanings > will just confuse anyone wanting to convert #ifdef CONFIG_ code into > if(CFG_) code. > >> I cooked up following patch - but I have not test-build a kernel yet. >> We may use CFG_* here and there and clash is not good. >> > > I have to say I'm not very keen on the CFG_* prefix. It doesn't have any > inherent meaning and just looks like a redundant abbreviation of CONFIG_; > something which actually expresses the notion that it's always a > compile-time constant would be better. Not that I have any particularly > good alternatives: CONST_? CCONST_? CONFIG_X_VAL? KCONFIG_? KONFIG_? > KCONST_? Don't know if this is really my place, but I could not agree more with your characterisation of the CFG_* prefix and I will make the following suggestion: Why not use all-lowercase config_* names? It seems elegant, and fits in with the notion that these are to be used not as macros, but as ordinary constants. (The only disadvantage I can see is that they will stand out less. But I don't know how great the disadvantage is.) You could even go further and make them real constants, something along the lines of: enum config_value { no, yes, mod }; static const enum config_value config_lockdep_support = yes; (I believe the "static const" will prevent emission of this symbol in the object file -- though I am not certain.) You can now also test for specific values, e.g. if (config_scsi_wait_scan == mod), in addition to simply testing the truth value. That concludes my suggestion. Vegard -- "The animistic metaphor of the bug that maliciously sneaked in while the programmer was not looking is intellectually dishonest as it disguises that the error is the programmer's own creation." -- E. W. Dijkstra, EWD1036 -- 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