From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753533AbcHRAKw (ORCPT ); Wed, 17 Aug 2016 20:10:52 -0400 Received: from sender153-mail.zoho.com ([74.201.84.153]:21039 "EHLO sender153-mail.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753180AbcHRAKu (ORCPT ); Wed, 17 Aug 2016 20:10:50 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=subject:to:references:cc:from:message-id:date:user-agent:mime-version:in-reply-to:content-type; b=gSlJpEoABCOFpQk6f1mRHiqO6+48C3cmsTTOhCxHW+NwLQ6/jBQ3QP16lEqoPLQ+HGCHZ1YGLuZA WrWXkH/m33k0xCMINifjJyYfghJhdn37rlZ1gRYX7pefHVYKVfES Subject: Re: [RESEND PATCH 1/1] bitops.h: move out get_count_order[_long]() from __KERNEL__ scope To: Al Viro References: <57B2B238.3030709@zoho.com> <57B2C4CE.80303@zoho.com> <20160817172056.GE2356@ZenIV.linux.org.uk> <20160817235914.GJ2356@ZenIV.linux.org.uk> Cc: Stephen Rothwell , Andrew Morton , "linux-kernel@vger.kernel.org" From: zijun_hu Message-ID: <0ba55ab9-eae7-d50f-1b45-c6714e094b03@zoho.com> Date: Thu, 18 Aug 2016 08:10:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160817235914.GJ2356@ZenIV.linux.org.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 # # ==========================================================================