]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kallsyms: de-ifdef kallmodsyms
authorNick Alcock <nick.alcock@oracle.com>
Sat, 15 Aug 2015 11:18:14 +0000 (12:18 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 4 Sep 2015 21:39:59 +0000 (22:39 +0100)
CONFIG_KALLMODSYMS is a bit ugly because of the burden of ifdefs.  It's
hard to remove them from scripts/kallsyms.c, but kernel/kallsyms.c doesn't
need any, since even when CONFIG_KALLMODSYMS is on it does not pull in any
extra build dependencies in and of itself: it just needs to arrange to not
create the kallmodsyms /proc node when the config option is turned off.
This will have the effect of disabling /proc/kallmodsyms when
CONFIG_KALLMODSYMS=n, without cluttering up the code with so many
ifdefs. (We still need one to populate the node in the first place.)

We also reverse the code motion we did earlier to make the other ifdefs
easier to insert.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Orabug: 21539840

kernel/kallsyms.c

index d76c562b8b9cd1ec8a77163e67da5433721d9d4b..a7389c5f7dca88c91613619786f0333bd27c1c70 100644 (file)
@@ -596,6 +596,11 @@ static int s_show(struct seq_file *m, void *p)
        return s_show_internal(m, p, 0);
 }
 
+static int s_mod_show(struct seq_file *m, void *p)
+{
+       return s_show_internal(m, p, 1);
+}
+
 static const struct seq_operations kallsyms_op = {
        .start = s_start,
        .next = s_next,
@@ -603,19 +608,12 @@ static const struct seq_operations kallsyms_op = {
        .show = s_show
 };
 
-#ifdef CONFIG_KALLMODSYMS
-static int s_mod_show(struct seq_file *m, void *p)
-{
-       return s_show_internal(m, p, 1);
-}
-
 static const struct seq_operations kallmodsyms_op = {
        .start = s_start,
        .next = s_next,
        .stop = s_stop,
        .show = s_mod_show
 };
-#endif
 
 static int kallsyms_open_internal(struct inode *inode, struct file *file,
        const struct seq_operations *ops)
@@ -639,12 +637,10 @@ static int kallsyms_open(struct inode *inode, struct file *file)
        return kallsyms_open_internal(inode, file, &kallsyms_op);
 }
 
-#ifdef CONFIG_KALLMODSYMS
 static int kallmodsyms_open(struct inode *inode, struct file *file)
 {
        return kallsyms_open_internal(inode, file, &kallmodsyms_op);
 }
-#endif
 
 #ifdef CONFIG_KGDB_KDB
 const char *kdb_walk_kallsyms(loff_t *pos)
@@ -673,14 +669,12 @@ static const struct file_operations kallsyms_operations = {
        .release = seq_release_private,
 };
 
-#ifdef CONFIG_KALLMODSYMS
 static const struct file_operations kallmodsyms_operations = {
        .open = kallmodsyms_open,
        .read = seq_read,
        .llseek = seq_lseek,
        .release = seq_release_private,
 };
-#endif
 
 static int __init kallsyms_init(void)
 {