From owner-svn-src-head@FreeBSD.ORG Tue Dec 11 04:12:15 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5ADCCD70; Tue, 11 Dec 2012 04:12:15 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx08.syd.optusnet.com.au (fallbackmx08.syd.optusnet.com.au [211.29.132.10]) by mx1.freebsd.org (Postfix) with ESMTP id D6B1E8FC13; Tue, 11 Dec 2012 04:12:14 +0000 (UTC) Received: from mail36.syd.optusnet.com.au (mail36.syd.optusnet.com.au [211.29.133.76]) by fallbackmx08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qBB46jDC007867; Tue, 11 Dec 2012 15:06:45 +1100 Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail36.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qBB46XOC013141 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Dec 2012 15:06:35 +1100 Date: Tue, 11 Dec 2012 15:06:33 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Niclas Zeising Subject: Re: svn commit: r243960 - in head/sys: amd64/include i386/include x86/include In-Reply-To: <50C67C29.4070408@freebsd.org> Message-ID: <20121211144118.L959@besplex.bde.org> References: <201212062233.qB6MXWpP046167@svn.freebsd.org> <50C66E2E.5040302@freebsd.org> <50C67129.6090704@intel.com> <50C672D0.9090908@freebsd.org> <50C6764E.4040804@intel.com> <50C67C29.4070408@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=fev1UDsF c=1 sm=1 a=5qa8e7V8SQ0A:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=2DPJxBlv9iIA:10 a=FPw1pQDZFgkkUDttQVMA:9 a=CjuIK1q_8ugA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@FreeBSD.org, Jim Harris , Carl Delsey , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2012 04:12:15 -0000 On Tue, 11 Dec 2012, Niclas Zeising wrote: > On 12/11/12 00:54, Carl Delsey wrote: >> On 12/10/12 16:40, Niclas Zeising wrote: >>> ... >>> libpciaccess uses bus_space_[read,write]_[1,2,4], which are defined in >>> x86/bus.h. It does not use the quad functions. >>> Regards! >> Ok. In that case I won't ifdef out the functions themselves, just the >> KASSERT in case libpciaccess expands in the future to 8 byte accesses >> :-) I had another related change in the works. I'll add this change in. > > Sounds good to me, thank you very much! > Don't forget to ifdef the include o as well as the KASSERTs. Including it at all is namespace pollution. It is a bug for any kernel .c file to not include always and early in its includes, because other includes may have KASSERT()s in them. Not all includes that uses KASSERT() have the namespace pollution, so adding it to some just breaks detection of the bug in some cases. The folowing headers in have the pollution: libkern.h, mbuf.h, pmckern.h, refcount.h. refcount.h only has the pollution if _KERNEL is defined. It handles the problem of polluting userland (though I think userland should be rewarded by syntax errors if it uses refcount.h or machine/bus.h) by supplying a dummy KASSERT() for the !_KERNEL case. The following headers in use KASSERT(): buf.h, eventhandler.h, lock.h, mbuf.h, mount.h, mutex.h, osd.h, proc.h, random.h, refcount.h. Most of them are missing the pollution. The pollution in libkern.h is circular: libkern.h includes systm.h, and systm.h includes libkern.h. systm.h's include of libkern.h and of many other headers like machine/atomic.h and machine/cpufunc.h is standard pollution -- direct includes of these are style bugs, and not including systm.h always and early is a bug because it may break more than KASSERT() (other headers may also use inlines in libkern.h etc.). The circular pollution in libkern.h is used because most files in libkern don't include systm.h directly; they mostly only include libkern.h directly. This and other pollution in mbuf.h is especially disgusting since mbuf.h is one of few headers that I managed to finish the #include de-pollution of in FreeBSD-3 or 2. Bruce