Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp686283ybl; Wed, 28 Aug 2019 03:57:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRL0R8EnOEEKl1gj7yrYuEawQum1W088ryE9VOqiDFiC2lOjSu7g5t3q7NRqzvXnhJmLVt X-Received: by 2002:a63:8ac2:: with SMTP id y185mr2951720pgd.11.1566989864232; Wed, 28 Aug 2019 03:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566989864; cv=none; d=google.com; s=arc-20160816; b=sOOHVD+4gqeYbGC79cQk6VZYHsw4+ujooqWVuyGU/Gy+V0xMSgTc0jqZ49rLnuXt64 g1vYX8ciHVk2cEfRe2Q4ERS2Mz0DHzEp305DoCK4UfJNdYigN12h2xcFWT+MtNuVOWly 0sfYNmj7SYL+HKQoaUOmLqy18nJoaRAcrfXwXwVFcD+aGp/7P42pjGcjjg9+EDhOJ2WF h4Dvryc5ebrhfCGN+wnh+5rR5wX0X9STm1cmftJccHtKgkQ9sZmGe7fO1RgABqw65R7M KgqJjO+jBn7G+/emMTsCxt9CvXy0DcSBjYvsYrdtpAbXorx/49IPIxgYmhRX5PTqZUkV HRXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Vx9t5xjLzwxSs68UQHUay9ecnGA4GXfJUCmBL33YCMk=; b=mxJH4W+IKiNFEMOqO3MlyUNUKgrLqREAdt+iBdHBIb2WuLcLdEQN8mT9VVxkUkxGQP Wen6YBhtHzXzSfs4v4IP0ENnAdwE0tfTPOghkJSlz+WfsMA3eSoBLAP/fYHqrA9PULaW xTIIEgRFYSdJSQpj93kGlS936Od6TFERvyAaxSzvKBY3/8RE56vJtt+kqDdCCBuYjM8E Q4dTcc1wxqo5C1K0mD2ZnYRDM/Is+02/v+zBFRCG9cFTRZLbNsR8A+1b+tzfzK+0nJjQ iXUZ9MsLmXZYXLUwRoiqv6JbTlBNwtHzOj6P2stbKxppr6n2UWdgBCwUGWJh3/A2HaoB PJdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NVdwLJqM; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f37si1915452pgm.145.2019.08.28.03.57.26; Wed, 28 Aug 2019 03:57:44 -0700 (PDT) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=NVdwLJqM; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726450AbfH1K4f (ORCPT + 99 others); Wed, 28 Aug 2019 06:56:35 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36902 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbfH1K4e (ORCPT ); Wed, 28 Aug 2019 06:56:34 -0400 Received: by mail-wr1-f68.google.com with SMTP id z11so2023931wrt.4 for ; Wed, 28 Aug 2019 03:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Vx9t5xjLzwxSs68UQHUay9ecnGA4GXfJUCmBL33YCMk=; b=NVdwLJqMFK27Egi+W5DT/3XO+B227WKx3M16ICzoXvtv3NVx+kYKIWtAq4ZidBcYR/ 6IGwVIoAcsDgTwvd+pwztc4kqW7mf2sSDts/mC7aobOdzcsHuc/F1dpU/BpqoiE9ML/s cDjmOLbsoCc6teLG/5wl/NGS2xAgrdjgeDYEI91IhxSHXf76R4GeGYbxSFH+75iaJUfe wT8+75/RkSk5caZV3qv54/qXQy42Kzg3eZmIM2FCd4NoNwrSMF71P581+GSac3L9QeRC S3Wx1vvGVwqa0gtVdM4obwVJsgIHz4ohf44ieueSHJ/wOuQxb45CsaAbBU1sGHgIo0nm DTqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Vx9t5xjLzwxSs68UQHUay9ecnGA4GXfJUCmBL33YCMk=; b=PiIWSE/DFcCHoUhbguRUeHikqY2s9vHGlte4wuNr3J++rtSfR3gv9lGygx1sMxh5Y/ yPOBRlvfjShCbOxcuda5Geya1RQTBov1cPvlexE9Dv2C2GUgq4Cf5S8hytoSQPR+3ymc AlzrDxNNlkZ7gilx4mDa7TfaArj7OFGKgVLN15SQZ1jAQBsF66tQHGWyiPNnVvb3O8gR rjeLlBKOdKDjdBe/ao+f3JSOg5s2I72ZVzjDmFasgN1KpzfL5Xk4JIttZOCzxG5h1NYw sMOsGzMpUYeP3/eyvvuzPjoqV/2z89rbG7ey6CzM5xyRGKSiJiWktFSVPPG5Hm2DX8Wo eukA== X-Gm-Message-State: APjAAAVGsAihp3re0bl0LkEjb1x4IHouu1wvNtJ9O+9iHPBNH/Fmt850 wBNwBY6CV9U6P9lTYC36Nl0Nkg== X-Received: by 2002:adf:ce81:: with SMTP id r1mr3959629wrn.114.1566989791786; Wed, 28 Aug 2019 03:56:31 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:e8f7:125b:61e9:733d]) by smtp.gmail.com with ESMTPSA id f6sm4573707wrh.30.2019.08.28.03.56.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 03:56:31 -0700 (PDT) Date: Wed, 28 Aug 2019 11:56:27 +0100 From: Matthias Maennich To: Jessica Yu Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, arnd@arndb.de, geert@linux-m68k.org, gregkh@linuxfoundation.org, hpa@zytor.com, joel@joelfernandes.org, kstewart@linuxfoundation.org, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-modules@vger.kernel.org, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, lucas.de.marchi@gmail.com, maco@android.com, maco@google.com, michal.lkml@markovi.net, mingo@redhat.com, oneukum@suse.com, pombredanne@nexb.com, sam@ravnborg.org, sspatil@google.com, stern@rowland.harvard.edu, tglx@linutronix.de, usb-storage@lists.one-eyed-alien.net, x86@kernel.org, yamada.masahiro@socionext.com, Michael Ellerman , Ingo Molnar , Ard Biesheuvel Subject: Re: [PATCH v3 06/11] export: allow definition default namespaces in Makefiles or sources Message-ID: <20190828105627.GA41539@google.com> References: <20190813121733.52480-1-maennich@google.com> <20190821114955.12788-1-maennich@google.com> <20190821114955.12788-7-maennich@google.com> <20190828104951.GC25048@linux-8ccs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190828104951.GC25048@linux-8ccs> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 28, 2019 at 12:49:51PM +0200, Jessica Yu wrote: >+++ Matthias Maennich [21/08/19 12:49 +0100]: >>To avoid excessive usage of EXPORT_SYMBOL_NS(sym, MY_NAMESPACE), where >>MY_NAMESPACE will always be the namespace we are exporting to, allow >>exporting all definitions of EXPORT_SYMBOL() and friends by defining >>DEFAULT_SYMBOL_NAMESPACE. >> >>For example, to export all symbols defined in usb-common into the >>namespace USB_COMMON, add a line like this to drivers/usb/common/Makefile: >> >> ccflags-y += -DDEFAULT_SYMBOL_NAMESPACE=USB_COMMON >> >>That is equivalent to changing all EXPORT_SYMBOL(sym) definitions to >>EXPORT_SYMBOL_NS(sym, USB_COMMON). Subsequently all symbol namespaces >>functionality will apply. >> >>Another way of making use of this feature is to define the namespace >>within source or header files similar to how TRACE_SYSTEM defines are >>used: >> #undef DEFAULT_SYMBOL_NAMESPACE >> #define DEFAULT_SYMBOL_NAMESPACE USB_COMMON >> >>Please note that, as opposed to TRACE_SYSTEM, DEFAULT_SYMBOL_NAMESPACE >>has to be defined before including include/linux/export.h. >> >>If DEFAULT_SYMBOL_NAMESPACE is defined, a symbol can still be exported >>to another namespace by using EXPORT_SYMBOL_NS() and friends with >>explicitly specifying the namespace. > >This changelog provides a good summary of how to use >DEFAULT_SYMBOL_NAMESPACE, I wonder if we should explicitly document >its proper usage somewhere? (along with EXPORT_SYMBOL_NS*) >The EXPORT_SYMBOL API is briefly documented in >Documentation/kernel-hacking/hacking.rst - it might be slightly dated, >but perhaps it'd fit there best? I will add documentation along with the commits. Not only for the macros, but in general to describe the feature. >>Suggested-by: Arnd Bergmann >>Reviewed-by: Martijn Coenen >>Reviewed-by: Greg Kroah-Hartman >>Signed-off-by: Matthias Maennich >>--- >>include/linux/export.h | 6 ++++++ >>1 file changed, 6 insertions(+) >> >>diff --git a/include/linux/export.h b/include/linux/export.h >>index 8e12e05444d1..1fb243abdbc4 100644 >>--- a/include/linux/export.h >>+++ b/include/linux/export.h >>@@ -166,6 +166,12 @@ struct kernel_symbol { >>#define __EXPORT_SYMBOL ___EXPORT_SYMBOL >>#endif >> >>+#ifdef DEFAULT_SYMBOL_NAMESPACE >>+#undef __EXPORT_SYMBOL >>+#define __EXPORT_SYMBOL(sym, sec) \ >>+ __EXPORT_SYMBOL_NS(sym, sec, DEFAULT_SYMBOL_NAMESPACE) >>+#endif >>+ >>#define EXPORT_SYMBOL(sym) __EXPORT_SYMBOL(sym, "") >>#define EXPORT_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_gpl") >>#define EXPORT_SYMBOL_GPL_FUTURE(sym) __EXPORT_SYMBOL(sym, "_gpl_future") >>-- >>2.23.0.rc1.153.gdeed80330f-goog >>