Re: [PATCH 10/10] module: fix is_exported() to return true for all types of exports

From: Rusty Russell
Date: Sun Nov 08 2009 - 21:49:31 EST


On Sun, 8 Nov 2009 07:34:01 am Alan Jenkins wrote:
> /proc/kallsyms annotates module symbols as global (e.g. 'D' for a data
> symbol) or local (e.g. 'd'), depending on whether is_exported() returns
> true or false.

Thanks, I've applied the whole series.

Cheers,
Rusty.
PS. One fix so far:

Fix for CONFIG_MODVERSIONS=n:

kernel/module.c: In function âinit_ksymtabâ:
kernel/module.c:200: warning: initialization makes integer from pointer without a cast
kernel/module.c:201: warning: excess elements in struct initializer
kernel/module.c:201: warning: (near initialization for â(anonymous)â)

Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/