Received: by 10.223.176.5 with SMTP id f5csp2837499wra; Mon, 5 Feb 2018 10:41:40 -0800 (PST) X-Google-Smtp-Source: AH8x224jzyKxey+jCHiXwTn6iNZMvN23W6KAqhgolFk0j+4ThfZQhLfTnX4ighi0mGxKNaVsfpWf X-Received: by 10.101.92.77 with SMTP id v13mr3879537pgr.341.1517856100490; Mon, 05 Feb 2018 10:41:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517856100; cv=none; d=google.com; s=arc-20160816; b=aMm+4vlfLcCYbytu3XdnWwcXX6Fd+y9mKWDyzv/TI4LHPllqkILc383+UXJSzQB/Fx BL43GzeVCIUXYXv5F8eYLV1LW3OKwwzT0Dt2OfOLpu7Tz5AJ65DrLSA9s64VIV/49J/B ASLgoe/+ccdg5hQJXikzAVcit0XyRkJuT+wYu384E4VMZzAtxL9e4gBiEKZuyJnqY/sO l+8Ov7VqVoUaf3Cb1C84QkLRwqmBYA+4K6ubFDbXbplFswJd5rbciVDPzvjZX+dNJr3r 9TIgi4JwQL1R+TtwEQcoU48tts1yaE9z4B4wP8XsRyvd1hz39EY55EwNxNc7Ml7XWG/T NysQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9xyyhXtQ4zufEcmZXK4vuDXVJySqg4HXIrr0fTPFz24=; b=hb9yAwXn0voqf6Qibmbw5Whu4VZzQ2wOzflpXWIa5Eml0tSCecq16bp2bg9OZjI9X9 +gmf9Kkg6az8UG4wKbdTEgW1+Wyzolbg0Fmiyx0LGuTiNyC75+kQ7NKYPcsyBgt93vtN b/iDeWrOe7iiXvO0WQo1346ACN6x3qbbNQBtgvElVLDVxwYNiJMOkfnetgF6o4cpX0Lr lFjYqNMk4AXWYKg3R7jp+gKa2dgdvZ97aEGCdZYCxAMlI1KthIZzJ35nQy5lVbGjxaqP RJ99y6OmRxbybI7IWaZUYYl/zfTV2uza9oioXBCBMkOxSO80FpddAuJgXlPAzwhwcUTX NURQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15si95358pgt.312.2018.02.05.10.41.26; Mon, 05 Feb 2018 10:41:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753854AbeBESjn (ORCPT + 99 others); Mon, 5 Feb 2018 13:39:43 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54262 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753925AbeBES0m (ORCPT ); Mon, 5 Feb 2018 13:26:42 -0500 Received: from localhost (unknown [104.132.1.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2BA27D67; Mon, 5 Feb 2018 18:26:29 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Weinberger , Greg Hackmann , Bernie Innocenti , Lorenzo Colitti Subject: [PATCH 3.18 03/36] um: Stop abusing __KERNEL__ Date: Mon, 5 Feb 2018 10:23:31 -0800 Message-Id: <20180205182351.919749957@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180205182351.774761393@linuxfoundation.org> References: <20180205182351.774761393@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Richard Weinberger commit 298e20ba8c197e8d429a6c8671550c41c7919033 upstream. Currently UML is abusing __KERNEL__ to distinguish between kernel and host code (os-Linux). It is better to use a custom define such that existing users of __KERNEL__ don't get confused. Signed-off-by: Richard Weinberger Cc: Greg Hackmann Cc: Bernie Innocenti Cc: Lorenzo Colitti Signed-off-by: Greg Kroah-Hartman --- arch/um/Makefile | 7 ++++--- arch/um/drivers/mconsole.h | 2 +- arch/um/include/shared/init.h | 4 ++-- arch/um/include/shared/user.h | 2 +- arch/x86/um/shared/sysdep/tls.h | 6 +++--- 5 files changed, 11 insertions(+), 10 deletions(-) --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -68,9 +68,10 @@ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) - KBUILD_AFLAGS += $(ARCH_INCLUDE) -USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\ - $(patsubst -I%,,$(KBUILD_CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \ - $(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 -idirafter include +USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \ + $(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \ + -D_FILE_OFFSET_BITS=64 -idirafter include \ + -D__KERNEL__ -D__UM_HOST__ #This will adjust *FLAGS accordingly to the platform. include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) --- a/arch/um/drivers/mconsole.h +++ b/arch/um/drivers/mconsole.h @@ -7,7 +7,7 @@ #ifndef __MCONSOLE_H__ #define __MCONSOLE_H__ -#ifndef __KERNEL__ +#ifdef __UM_HOST__ #include #define u32 uint32_t #endif --- a/arch/um/include/shared/init.h +++ b/arch/um/include/shared/init.h @@ -40,7 +40,7 @@ typedef int (*initcall_t)(void); typedef void (*exitcall_t)(void); -#ifndef __KERNEL__ +#ifdef __UM_HOST__ #ifndef __section # define __section(S) __attribute__ ((__section__(#S))) #endif @@ -131,7 +131,7 @@ extern struct uml_param __uml_setup_star #define __uml_postsetup_call __used __section(.uml.postsetup.init) #define __uml_exit_call __used __section(.uml.exitcall.exit) -#ifndef __KERNEL__ +#ifdef __UM_HOST__ #define __define_initcall(level,fn) \ static initcall_t __initcall_##fn __used \ --- a/arch/um/include/shared/user.h +++ b/arch/um/include/shared/user.h @@ -17,7 +17,7 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) /* This is to get size_t */ -#ifdef __KERNEL__ +#ifndef __UM_HOST__ #include #else #include --- a/arch/x86/um/shared/sysdep/tls.h +++ b/arch/x86/um/shared/sysdep/tls.h @@ -1,7 +1,7 @@ #ifndef _SYSDEP_TLS_H #define _SYSDEP_TLS_H -# ifndef __KERNEL__ +#ifdef __UM_HOST__ /* Change name to avoid conflicts with the original one from , which * may be named user_desc (but in 2.4 and in header matching its API was named @@ -22,11 +22,11 @@ typedef struct um_dup_user_desc { #endif } user_desc_t; -# else /* __KERNEL__ */ +#else /* __UM_HOST__ */ typedef struct user_desc user_desc_t; -# endif /* __KERNEL__ */ +#endif /* __UM_HOST__ */ extern int os_set_thread_area(user_desc_t *info, int pid); extern int os_get_thread_area(user_desc_t *info, int pid);