[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0ba55ab9-eae7-d50f-1b45-c6714e094b03@zoho.com>
Date: Thu, 18 Aug 2016 08:10:19 +0800
From: zijun_hu <zijun_hu@...o.com>
To: Al Viro <viro@...IV.linux.org.uk>
Cc: Stephen Rothwell <sfr@...b.auug.org.au>,
Andrew Morton <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()
from __KERNEL__ scope
On 2016/8/18 7:59, Al Viro wrote:
> On Thu, Aug 18, 2016 at 07:51:19AM +0800, zijun_hu wrote:
>>> What the hell is anything without __KERNEL__ doing with linux/bitops.h in
>>> the first place? IOW, why do we have those ifdefs at all?
>>>
>>
>> __KERNEL__ is used to indicate the relevant sections within kernel
>> headers can't be exported to or used by user space
>
> ITYM "used to be used". These days it's "everything outside of */uapi/*.h
> can't be exported"...
>
i conclude one purpose of __KERNEL__ from the following kernel files
scripts/headers_install.sh:
echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]"
echo
echo "Prepares kernel header files for use by user space, by removing"
echo "all compiler.h definitions and #includes, removing any"
echo "#ifdef __KERNEL__ sections, and putting __underscores__ around"
echo "asm/inline/volatile keywords."
echo
......
scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed"
Documentation/kbuild/makefiles.txt:
The kernel includes a set of headers that is exported to userspace.
Many headers can be exported as-is but other headers require a
minimal pre-processing before they are ready for user-space.
The pre-processing does:
- drop kernel-specific annotations
- drop include of compiler.h
- drop all sections that are kernel internal (guarded by ifdef __KERNEL__)
scripts/Makefile.headersinst:
# ==========================================================================
# Installing headers
#
# header-y - list files to be installed. They are preprocessed
# to remove __KERNEL__ section of the file
# genhdr-y - Same as header-y but in a generated/ directory
#
# ==========================================================================
Powered by blists - more mailing lists