On Thu, 14 Nov 2019, Ondrej Mosnacek wrote:
On Mon, Nov 11, 2019 at 11:58 AM Arnd Bergmann arnd@arndb.de wrote:
I don't see that as a problem, we rarely put declarations inside of an #ifdef. The main effect that would have is forcing any file that includes linux/time.h to be rebuilt when selinux is turned on or off in the .config.
OK, but with this patch if someone tries to use the function elsewhere, the build will succeed if SELinux is enabled in the config, but fail if it isn't. Is that intended? I would suggest at least clearly documenting it above the declaration that the function isn't supposed to be used by new users and doing so will cause build to fail under CONFIG_SECURITY_SELINUX=n.
Come on. We have enough functions in the kernel which are only available under a certain config option and if you (ab)use them elsewhere then the build fails. So what?
The #ifdef documents the limited scope and intended use clearly. If something else really needs that function, then removing the #ifdef shouldn't be rocket science either.
Thanks,
tglx