From patchwork Mon Nov 9 02:49:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rusty Russell X-Patchwork-Id: 58650 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA92nQHH024856 for ; Mon, 9 Nov 2009 02:49:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751739AbZKICtT (ORCPT ); Sun, 8 Nov 2009 21:49:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752779AbZKICtT (ORCPT ); Sun, 8 Nov 2009 21:49:19 -0500 Received: from ozlabs.org ([203.10.76.45]:59745 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751739AbZKICtS convert rfc822-to-8bit (ORCPT ); Sun, 8 Nov 2009 21:49:18 -0500 Received: from vivaldi.localnet (unknown [150.101.102.135]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id 913C1B7079; Mon, 9 Nov 2009 13:49:23 +1100 (EST) From: Rusty Russell To: Alan Jenkins Subject: Re: [PATCH 10/10] module: fix is_exported() to return true for all types of exports Date: Mon, 9 Nov 2009 13:19:19 +1030 User-Agent: KMail/1.12.2 (Linux/2.6.31-14-generic; KDE/4.3.2; i686; ; ) Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org References: <4AF5DF9F.5020208@tuffmail.co.uk> <1257627841-15817-10-git-send-email-alan-jenkins@tuffmail.co.uk> In-Reply-To: <1257627841-15817-10-git-send-email-alan-jenkins@tuffmail.co.uk> MIME-Version: 1.0 Message-Id: <200911091319.20308.rusty@rustcorp.com.au> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org diff --git a/kernel/module.c b/kernel/module.c --- a/kernel/module.c +++ b/kernel/module.c @@ -194,30 +194,45 @@ extern const unsigned long __start___kcr static struct ksymtab ksymtab[EXPORT_TYPE_MAX]; +#ifdef CONFIG_MODVERSIONS +#define init_one_ksymtab(ksymt, start, stop, crc_start) \ + do { \ + struct ksymtab *ks = (ksymt); \ + ks->syms = (start); \ + ks->num_syms = (stop) - ks->syms; \ + ks->crcs = (crc_start); \ + } while (0) +#else +#define init_one_ksymtab(ksymt, start, stop, crc_start) \ + do { \ + struct ksymtab *ks = (ksymt); \ + ks->syms = (start); \ + ks->num_syms = (stop) - ks->syms; \ + } while (0) +#endif + static int __init init_ksymtab(void) { - ksymtab[EXPORT_TYPE_PLAIN] = (struct ksymtab) { - __start___ksymtab, __start___kcrctab, - __stop___ksymtab - __start___ksymtab, - }; - ksymtab[EXPORT_TYPE_GPL] = (struct ksymtab) { - __start___ksymtab_gpl, __start___kcrctab_gpl, - __stop___ksymtab_gpl - __start___ksymtab_gpl, - }; + init_one_ksymtab(&ksymtab[EXPORT_TYPE_PLAIN], + __start___ksymtab, __stop___ksymtab, + __start___kcrctab); + init_one_ksymtab(&ksymtab[EXPORT_TYPE_GPL], + __start___ksymtab_gpl, __stop___ksymtab_gpl, + __start___kcrctab_gpl); #ifdef CONFIG_UNUSED_EXPORTS - ksymtab[EXPORT_TYPE_UNUSED] = (struct ksymtab) { - __start___ksymtab_unused, __start___kcrctab_unused, - __stop___ksymtab_unused - __start___ksymtab_unused, - }; - ksymtab[EXPORT_TYPE_UNUSED_GPL] = (struct ksymtab) { - __start___ksymtab_unused_gpl, __start___kcrctab_unused_gpl, - __stop___ksymtab_unused_gpl - __start___ksymtab_unused_gpl, - }; + init_one_ksymtab(&ksymtab[EXPORT_TYPE_UNUSED], + __start___ksymtab_unused, + __stop___ksymtab_unused, + __start___kcrctab_unused); + init_one_ksymtab(&ksymtab[EXPORT_TYPE_UNUSED_GPL], + __start___ksymtab_unused_gpl, + __stop___ksymtab_unused_gpl, + __start___kcrctab_unused_gpl); #endif - ksymtab[EXPORT_TYPE_GPL_FUTURE] = (struct ksymtab) { - __start___ksymtab_gpl_future, __start___kcrctab_gpl_future, - __stop___ksymtab_gpl_future - __start___ksymtab_gpl_future, - }; + init_one_ksymtab(&ksymtab[EXPORT_TYPE_GPL_FUTURE], + __start___ksymtab_gpl_future, + __stop___ksymtab_gpl_future, + __start___kcrctab_gpl_future); return 0; }