Lines Matching refs:iter
627 static int get_ksymbol_mod(struct kallsym_iter *iter) in get_ksymbol_mod() argument
629 int ret = module_get_kallsym(iter->pos - kallsyms_num_syms, in get_ksymbol_mod()
630 &iter->value, &iter->type, in get_ksymbol_mod()
631 iter->name, iter->module_name, in get_ksymbol_mod()
632 &iter->exported); in get_ksymbol_mod()
634 iter->pos_mod_end = iter->pos; in get_ksymbol_mod()
646 static int get_ksymbol_ftrace_mod(struct kallsym_iter *iter) in get_ksymbol_ftrace_mod() argument
648 int ret = ftrace_mod_get_kallsym(iter->pos - iter->pos_mod_end, in get_ksymbol_ftrace_mod()
649 &iter->value, &iter->type, in get_ksymbol_ftrace_mod()
650 iter->name, iter->module_name, in get_ksymbol_ftrace_mod()
651 &iter->exported); in get_ksymbol_ftrace_mod()
653 iter->pos_ftrace_mod_end = iter->pos; in get_ksymbol_ftrace_mod()
660 static int get_ksymbol_bpf(struct kallsym_iter *iter) in get_ksymbol_bpf() argument
664 strscpy(iter->module_name, "bpf", MODULE_NAME_LEN); in get_ksymbol_bpf()
665 iter->exported = 0; in get_ksymbol_bpf()
666 ret = bpf_get_kallsym(iter->pos - iter->pos_ftrace_mod_end, in get_ksymbol_bpf()
667 &iter->value, &iter->type, in get_ksymbol_bpf()
668 iter->name); in get_ksymbol_bpf()
670 iter->pos_bpf_end = iter->pos; in get_ksymbol_bpf()
682 static int get_ksymbol_kprobe(struct kallsym_iter *iter) in get_ksymbol_kprobe() argument
684 strscpy(iter->module_name, "__builtin__kprobes", MODULE_NAME_LEN); in get_ksymbol_kprobe()
685 iter->exported = 0; in get_ksymbol_kprobe()
686 return kprobe_get_kallsym(iter->pos - iter->pos_bpf_end, in get_ksymbol_kprobe()
687 &iter->value, &iter->type, in get_ksymbol_kprobe()
688 iter->name) < 0 ? 0 : 1; in get_ksymbol_kprobe()
692 static unsigned long get_ksymbol_core(struct kallsym_iter *iter) in get_ksymbol_core() argument
694 unsigned off = iter->nameoff; in get_ksymbol_core()
696 iter->module_name[0] = '\0'; in get_ksymbol_core()
697 iter->value = kallsyms_sym_address(iter->pos); in get_ksymbol_core()
699 iter->type = kallsyms_get_symbol_type(off); in get_ksymbol_core()
701 off = kallsyms_expand_symbol(off, iter->name, ARRAY_SIZE(iter->name)); in get_ksymbol_core()
703 return off - iter->nameoff; in get_ksymbol_core()
706 static void reset_iter(struct kallsym_iter *iter, loff_t new_pos) in reset_iter() argument
708 iter->name[0] = '\0'; in reset_iter()
709 iter->nameoff = get_symbol_offset(new_pos); in reset_iter()
710 iter->pos = new_pos; in reset_iter()
712 iter->pos_mod_end = 0; in reset_iter()
713 iter->pos_ftrace_mod_end = 0; in reset_iter()
714 iter->pos_bpf_end = 0; in reset_iter()
723 static int update_iter_mod(struct kallsym_iter *iter, loff_t pos) in update_iter_mod() argument
725 iter->pos = pos; in update_iter_mod()
727 if ((!iter->pos_mod_end || iter->pos_mod_end > pos) && in update_iter_mod()
728 get_ksymbol_mod(iter)) in update_iter_mod()
731 if ((!iter->pos_ftrace_mod_end || iter->pos_ftrace_mod_end > pos) && in update_iter_mod()
732 get_ksymbol_ftrace_mod(iter)) in update_iter_mod()
735 if ((!iter->pos_bpf_end || iter->pos_bpf_end > pos) && in update_iter_mod()
736 get_ksymbol_bpf(iter)) in update_iter_mod()
739 return get_ksymbol_kprobe(iter); in update_iter_mod()
743 static int update_iter(struct kallsym_iter *iter, loff_t pos) in update_iter() argument
747 return update_iter_mod(iter, pos); in update_iter()
750 if (pos != iter->pos) in update_iter()
751 reset_iter(iter, pos); in update_iter()
753 iter->nameoff += get_ksymbol_core(iter); in update_iter()
754 iter->pos++; in update_iter()
782 struct kallsym_iter *iter = m->private; in s_show() local
785 if (!iter->name[0]) in s_show()
788 value = iter->show_value ? (void *)iter->value : NULL; in s_show()
790 if (iter->module_name[0]) { in s_show()
797 type = iter->exported ? toupper(iter->type) : in s_show()
798 tolower(iter->type); in s_show()
800 type, iter->name, iter->module_name); in s_show()
803 iter->type, iter->name); in s_show()
859 struct kallsym_iter *iter = priv_data; in bpf_iter_ksym_init() local
861 reset_iter(iter, 0); in bpf_iter_ksym_init()
866 iter->show_value = kallsyms_show_value(current_cred()); in bpf_iter_ksym_init()
911 struct kallsym_iter *iter; in kallsyms_open() local
912 iter = __seq_open_private(file, &kallsyms_op, sizeof(*iter)); in kallsyms_open()
913 if (!iter) in kallsyms_open()
915 reset_iter(iter, 0); in kallsyms_open()
921 iter->show_value = kallsyms_show_value(file->f_cred); in kallsyms_open()