Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1464856

Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope

From zijun_hu <zijun_hu@zoho.com>
Newsgroups linux.kernel
Subject Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope
Date 2016-08-18 02:20 +0200
Message-ID <s7jdT-ht-3@gated-at.bofh.it> (permalink)
References <s6G2R-7Xd-3@gated-at.bofh.it> <s6Hii-c3-29@gated-at.bofh.it> <s7cP8-469-35@gated-at.bofh.it> <s7iUx-8lb-3@gated-at.bofh.it> <s7jdT-ht-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
#
# ==========================================================================

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] bitops.h: move out get_count_order[_long]() from  __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-16 08:30 +0200
  Re: [PATCH 1/1] bitops.h: move out get_count_order[_long]() from  __KERNEL__ scope Stephen Rothwell <sfr@canb.auug.org.au> - 2016-08-16 09:00 +0200
    Re: [PATCH 1/1] bitops.h: move out get_count_order[_long]() from  __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-16 09:30 +0200
  [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from  __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-16 09:50 +0200
    Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-17 19:30 +0200
      Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-18 02:00 +0200
        Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-18 02:20 +0200
          Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-18 02:30 +0200
            Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope zijun_hu <zijun_hu@zoho.com> - 2016-08-18 03:00 +0200
        Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]()  from __KERNEL__ scope Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-18 03:10 +0200

csiph-web