Commit b9667942 authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

kallsyms: Simplify update_iter_mod()

The logic in update_iter_mod() is overcomplicated and gets worse every
time another get_ksymbol_* function is added.

In preparation for adding another get_ksymbol_* function, simplify logic
in update_iter_mod().
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Tested-by: default avatar(ftrace changes only) Steven Rostedt (VMware) <rostedt@goodmis.org>
Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Link: http://lkml.kernel.org/r/1528289651-4113-2-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 99cbbe56
...@@ -506,27 +506,24 @@ static void reset_iter(struct kallsym_iter *iter, loff_t new_pos) ...@@ -506,27 +506,24 @@ static void reset_iter(struct kallsym_iter *iter, loff_t new_pos)
} }
} }
/*
* The end position (last + 1) of each additional kallsyms section is recorded
* in iter->pos_..._end as each section is added, and so can be used to
* determine which get_ksymbol_...() function to call next.
*/
static int update_iter_mod(struct kallsym_iter *iter, loff_t pos) static int update_iter_mod(struct kallsym_iter *iter, loff_t pos)
{ {
iter->pos = pos; iter->pos = pos;
if (iter->pos_ftrace_mod_end > 0 && if ((!iter->pos_mod_end || iter->pos_mod_end > pos) &&
iter->pos_ftrace_mod_end < iter->pos) get_ksymbol_mod(iter))
return get_ksymbol_bpf(iter); return 1;
if (iter->pos_mod_end > 0 && if ((!iter->pos_ftrace_mod_end || iter->pos_ftrace_mod_end > pos) &&
iter->pos_mod_end < iter->pos) { get_ksymbol_ftrace_mod(iter))
if (!get_ksymbol_ftrace_mod(iter))
return get_ksymbol_bpf(iter);
return 1; return 1;
}
if (!get_ksymbol_mod(iter)) {
if (!get_ksymbol_ftrace_mod(iter))
return get_ksymbol_bpf(iter); return get_ksymbol_bpf(iter);
}
return 1;
} }
/* Returns false if pos at or past end of file. */ /* Returns false if pos at or past end of file. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment