Konstantin Zhidkov <[EMAIL PROTECTED]> writes: > While reading such code one have to look at definition of > *each* function, because there's no other way to distinguish > between conditional and generic functions. Simple naming > convention can overcome this nightmare: cond__<name> > like this: cond__i8259_setup();
I don't oppose that kind of thing in principle. I simply don't get the need for it. If the function is done well it should be the same as if it became a noop just because of the configuration options selected. > Use of mirage functions have one big advantage -- incapsulation > of preprocessor directives. This reduces use of complex/nested > preprocessor directives, which sometimes are hard to predict. > Look at interrupts_on() in i386_subr.c: what will happen if > both I686 and APIC are undefined? This is what I mean. Nothing. Though admit that case is a little interesting. One of my challenges is I probably wrote half the hary code in LinuxBIOS so I intuitively understand it :) > There's also need to distinguish between configuration options > and configuration parameters. While option can only exist or > not exist, parameter can have any value, including zero, and > can also not exist. Currently, one have to add both option and > parameter to avoid use of #ifndef, for example: Hmm. Perhaps. The idiom I would use is in some default config file do: option NONEXISTENT_PORT 0x80 And then it could be overriddent elsewhere. Not that I am arguing that the current system is perfect. Just that it doesn't suck to bad :) > config: > # We have to slowdown io by output to nonexistent port. > # Port 0x80 isn't nonexistent in our system. > option CONFIG_LINUXBIOS_USE_CUSTOM_NONEXISTENT_PORT=1 > option CONFIG_LINUXBIOS_NONEXISTENT_PORT=0 > > changes to io.h: > #if ((CONFIG_LINUXBIOS_USE_CUSTOM_NONEXISTENT_PORT) == 1) > #define NONEXISTENT_PORT CONFIG_LINUXBIOS_NONEXISTENT_PORT > #else > #define NONEXISTENT_PORT 0x80 > #endif Eric
