From: Nick Alcock Date: Sat, 15 Aug 2015 11:18:14 +0000 (+0100) Subject: kallsyms: de-ifdef kallmodsyms X-Git-Tag: v4.1.12-92~284^2~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=eef978d1b999894e00967de349100fc5e54ec671;p=users%2Fjedix%2Flinux-maple.git kallsyms: de-ifdef kallmodsyms 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 Acked-by: Santosh Shilimkar Orabug: 21539840 --- diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index d76c562b8b9cd..a7389c5f7dca8 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -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) {