Date: Wed, 17 Jan 2018 15:14:37 -0800 From: Gleb Smirnoff <glebius@FreeBSD.org> To: John Baldwin <jhb@freebsd.org> Cc: Julian Elischer <julian@freebsd.org>, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Colin Percival <cperciva@freebsd.org> Subject: Re: svn commit: r327447 - head/sys/sys Message-ID: <20180117231437.GQ8113@FreeBSD.org> In-Reply-To: <8492136.94UhKCrmBg@ralph.baldwin.cx> References: <201712312100.vBVL0L0a038783@repo.freebsd.org> <c6194248-8229-b46e-f9c6-0e96bcfeab5a@freebsd.org> <8492136.94UhKCrmBg@ralph.baldwin.cx>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 02, 2018 at 09:56:09AM -0800, John Baldwin wrote: J> > this is a recurring issue. Program that want to look into the J> > internals of files such as mount.h J> > and define _KERNEL to allow themselves to do so. It eventualy leads J> > to all sorts of confusion and pollution. J> > Maybe we should make a policy on how to do this. At $JOB I had to hack J> > it to define a J> > #ifdef _NOTREALLYKERNEL to split out parts we really wanted, but it J> > would be better to have specific ones for J> > various specific 'rule breakers'.. J> > e.g. J> > #if defined( _KERNEL ) || defined (WANT_TO_LOOK_AT_something) J> > J> > kdump seems ot do the right thing with: J> > J> > kdump/kdump.c:#define _WANT_KERNEL_ERRNO J> > errno.h:#if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO) J> J> The past few years we have been using _WANT_FOO when new things need to be J> exposed and that is our current pattern. However, that doesn't fix existing J> code for old things. As one who added a lot of _WANT_FOOs, I must admit that I don't consider that a final and clean solution. But this seems to be a lesser evil when dealing with old code that has multiple dependencies. New code needs to be written in a fashion that clearly separates kernel structures from user visible structures, so that no tricks with preprocessor are needed. -- Gleb Smirnoff
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180117231437.GQ8113>