Lines Matching refs:iter
576 static int get_ksymbol_mod(struct kallsym_iter *iter) in get_ksymbol_mod() argument
578 int ret = module_get_kallsym(iter->pos - kallsyms_num_syms, in get_ksymbol_mod()
579 &iter->value, &iter->type, in get_ksymbol_mod()
580 iter->name, iter->module_name, in get_ksymbol_mod()
581 &iter->exported); in get_ksymbol_mod()
583 iter->pos_mod_end = iter->pos; in get_ksymbol_mod()
595 static int get_ksymbol_ftrace_mod(struct kallsym_iter *iter) in get_ksymbol_ftrace_mod() argument
597 int ret = ftrace_mod_get_kallsym(iter->pos - iter->pos_mod_end, in get_ksymbol_ftrace_mod()
598 &iter->value, &iter->type, in get_ksymbol_ftrace_mod()
599 iter->name, iter->module_name, in get_ksymbol_ftrace_mod()
600 &iter->exported); in get_ksymbol_ftrace_mod()
602 iter->pos_ftrace_mod_end = iter->pos; in get_ksymbol_ftrace_mod()
609 static int get_ksymbol_bpf(struct kallsym_iter *iter) in get_ksymbol_bpf() argument
613 strscpy(iter->module_name, "bpf", MODULE_NAME_LEN); in get_ksymbol_bpf()
614 iter->exported = 0; in get_ksymbol_bpf()
615 ret = bpf_get_kallsym(iter->pos - iter->pos_ftrace_mod_end, in get_ksymbol_bpf()
616 &iter->value, &iter->type, in get_ksymbol_bpf()
617 iter->name); in get_ksymbol_bpf()
619 iter->pos_bpf_end = iter->pos; in get_ksymbol_bpf()
631 static int get_ksymbol_kprobe(struct kallsym_iter *iter) in get_ksymbol_kprobe() argument
633 strscpy(iter->module_name, "__builtin__kprobes", MODULE_NAME_LEN); in get_ksymbol_kprobe()
634 iter->exported = 0; in get_ksymbol_kprobe()
635 return kprobe_get_kallsym(iter->pos - iter->pos_bpf_end, in get_ksymbol_kprobe()
636 &iter->value, &iter->type, in get_ksymbol_kprobe()
637 iter->name) < 0 ? 0 : 1; in get_ksymbol_kprobe()
641 static unsigned long get_ksymbol_core(struct kallsym_iter *iter) in get_ksymbol_core() argument
643 unsigned off = iter->nameoff; in get_ksymbol_core()
645 iter->module_name[0] = '\0'; in get_ksymbol_core()
646 iter->value = kallsyms_sym_address(iter->pos); in get_ksymbol_core()
648 iter->type = kallsyms_get_symbol_type(off); in get_ksymbol_core()
650 off = kallsyms_expand_symbol(off, iter->name, ARRAY_SIZE(iter->name)); in get_ksymbol_core()
652 return off - iter->nameoff; in get_ksymbol_core()
655 static void reset_iter(struct kallsym_iter *iter, loff_t new_pos) in reset_iter() argument
657 iter->name[0] = '\0'; in reset_iter()
658 iter->nameoff = get_symbol_offset(new_pos); in reset_iter()
659 iter->pos = new_pos; in reset_iter()
661 iter->pos_mod_end = 0; in reset_iter()
662 iter->pos_ftrace_mod_end = 0; in reset_iter()
663 iter->pos_bpf_end = 0; in reset_iter()
672 static int update_iter_mod(struct kallsym_iter *iter, loff_t pos) in update_iter_mod() argument
674 iter->pos = pos; in update_iter_mod()
676 if ((!iter->pos_mod_end || iter->pos_mod_end > pos) && in update_iter_mod()
677 get_ksymbol_mod(iter)) in update_iter_mod()
680 if ((!iter->pos_ftrace_mod_end || iter->pos_ftrace_mod_end > pos) && in update_iter_mod()
681 get_ksymbol_ftrace_mod(iter)) in update_iter_mod()
684 if ((!iter->pos_bpf_end || iter->pos_bpf_end > pos) && in update_iter_mod()
685 get_ksymbol_bpf(iter)) in update_iter_mod()
688 return get_ksymbol_kprobe(iter); in update_iter_mod()
692 static int update_iter(struct kallsym_iter *iter, loff_t pos) in update_iter() argument
696 return update_iter_mod(iter, pos); in update_iter()
699 if (pos != iter->pos) in update_iter()
700 reset_iter(iter, pos); in update_iter()
702 iter->nameoff += get_ksymbol_core(iter); in update_iter()
703 iter->pos++; in update_iter()
731 struct kallsym_iter *iter = m->private; in s_show() local
734 if (!iter->name[0]) in s_show()
737 value = iter->show_value ? (void *)iter->value : NULL; in s_show()
739 if (iter->module_name[0]) { in s_show()
746 type = iter->exported ? toupper(iter->type) : in s_show()
747 tolower(iter->type); in s_show()
749 type, iter->name, iter->module_name); in s_show()
752 iter->type, iter->name); in s_show()
808 struct kallsym_iter *iter = priv_data; in bpf_iter_ksym_init() local
810 reset_iter(iter, 0); in bpf_iter_ksym_init()
815 iter->show_value = kallsyms_show_value(current_cred()); in bpf_iter_ksym_init()
860 struct kallsym_iter *iter; in kallsyms_open() local
861 iter = __seq_open_private(file, &kallsyms_op, sizeof(*iter)); in kallsyms_open()
862 if (!iter) in kallsyms_open()
864 reset_iter(iter, 0); in kallsyms_open()
870 iter->show_value = kallsyms_show_value(file->f_cred); in kallsyms_open()