aboutsummaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/prog.c
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2018-12-10 17:14:10 -0500
committerAlexei Starovoitov <ast@kernel.org>2018-12-10 17:51:45 -0500
commitcfc542411bd40ff4f8a70b3d061bd6acdfb05629 (patch)
tree5821df7fea9335a55010c21dcfba92e704c92d32 /tools/bpf/bpftool/prog.c
parentb4f8623c0cefdfb818f99b3eb3c1e4c7708dd84e (diff)
tools/bpf: rename *_info_cnt to nr_*_info
Rename all occurances of *_info_cnt field access to nr_*_info in tools directory. The local variables finfo_cnt, linfo_cnt and jited_linfo_cnt in function do_dump() of tools/bpf/bpftool/prog.c are also changed to nr_finfo, nr_linfo and nr_jited_linfo to keep naming convention consistent. Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/bpf/bpftool/prog.c')
-rw-r--r--tools/bpf/bpftool/prog.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 9a78ebbcea1d..b73b4e473948 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -425,7 +425,7 @@ static int do_dump(int argc, char **argv)
425{ 425{
426 unsigned int finfo_rec_size, linfo_rec_size, jited_linfo_rec_size; 426 unsigned int finfo_rec_size, linfo_rec_size, jited_linfo_rec_size;
427 void *func_info = NULL, *linfo = NULL, *jited_linfo = NULL; 427 void *func_info = NULL, *linfo = NULL, *jited_linfo = NULL;
428 unsigned int finfo_cnt, linfo_cnt = 0, jited_linfo_cnt = 0; 428 unsigned int nr_finfo, nr_linfo = 0, nr_jited_linfo = 0;
429 struct bpf_prog_linfo *prog_linfo = NULL; 429 struct bpf_prog_linfo *prog_linfo = NULL;
430 unsigned long *func_ksyms = NULL; 430 unsigned long *func_ksyms = NULL;
431 struct bpf_prog_info info = {}; 431 struct bpf_prog_info info = {};
@@ -537,10 +537,10 @@ static int do_dump(int argc, char **argv)
537 } 537 }
538 } 538 }
539 539
540 finfo_cnt = info.func_info_cnt; 540 nr_finfo = info.nr_func_info;
541 finfo_rec_size = info.func_info_rec_size; 541 finfo_rec_size = info.func_info_rec_size;
542 if (finfo_cnt && finfo_rec_size) { 542 if (nr_finfo && finfo_rec_size) {
543 func_info = malloc(finfo_cnt * finfo_rec_size); 543 func_info = malloc(nr_finfo * finfo_rec_size);
544 if (!func_info) { 544 if (!func_info) {
545 p_err("mem alloc failed"); 545 p_err("mem alloc failed");
546 close(fd); 546 close(fd);
@@ -549,9 +549,9 @@ static int do_dump(int argc, char **argv)
549 } 549 }
550 550
551 linfo_rec_size = info.line_info_rec_size; 551 linfo_rec_size = info.line_info_rec_size;
552 if (info.line_info_cnt && linfo_rec_size && info.btf_id) { 552 if (info.nr_line_info && linfo_rec_size && info.btf_id) {
553 linfo_cnt = info.line_info_cnt; 553 nr_linfo = info.nr_line_info;
554 linfo = malloc(linfo_cnt * linfo_rec_size); 554 linfo = malloc(nr_linfo * linfo_rec_size);
555 if (!linfo) { 555 if (!linfo) {
556 p_err("mem alloc failed"); 556 p_err("mem alloc failed");
557 close(fd); 557 close(fd);
@@ -560,13 +560,13 @@ static int do_dump(int argc, char **argv)
560 } 560 }
561 561
562 jited_linfo_rec_size = info.jited_line_info_rec_size; 562 jited_linfo_rec_size = info.jited_line_info_rec_size;
563 if (info.jited_line_info_cnt && 563 if (info.nr_jited_line_info &&
564 jited_linfo_rec_size && 564 jited_linfo_rec_size &&
565 info.nr_jited_ksyms && 565 info.nr_jited_ksyms &&
566 info.nr_jited_func_lens && 566 info.nr_jited_func_lens &&
567 info.btf_id) { 567 info.btf_id) {
568 jited_linfo_cnt = info.jited_line_info_cnt; 568 nr_jited_linfo = info.nr_jited_line_info;
569 jited_linfo = malloc(jited_linfo_cnt * jited_linfo_rec_size); 569 jited_linfo = malloc(nr_jited_linfo * jited_linfo_rec_size);
570 if (!jited_linfo) { 570 if (!jited_linfo) {
571 p_err("mem alloc failed"); 571 p_err("mem alloc failed");
572 close(fd); 572 close(fd);
@@ -582,13 +582,13 @@ static int do_dump(int argc, char **argv)
582 info.nr_jited_ksyms = nr_func_ksyms; 582 info.nr_jited_ksyms = nr_func_ksyms;
583 info.jited_func_lens = ptr_to_u64(func_lens); 583 info.jited_func_lens = ptr_to_u64(func_lens);
584 info.nr_jited_func_lens = nr_func_lens; 584 info.nr_jited_func_lens = nr_func_lens;
585 info.func_info_cnt = finfo_cnt; 585 info.nr_func_info = nr_finfo;
586 info.func_info_rec_size = finfo_rec_size; 586 info.func_info_rec_size = finfo_rec_size;
587 info.func_info = ptr_to_u64(func_info); 587 info.func_info = ptr_to_u64(func_info);
588 info.line_info_cnt = linfo_cnt; 588 info.nr_line_info = nr_linfo;
589 info.line_info_rec_size = linfo_rec_size; 589 info.line_info_rec_size = linfo_rec_size;
590 info.line_info = ptr_to_u64(linfo); 590 info.line_info = ptr_to_u64(linfo);
591 info.jited_line_info_cnt = jited_linfo_cnt; 591 info.nr_jited_line_info = nr_jited_linfo;
592 info.jited_line_info_rec_size = jited_linfo_rec_size; 592 info.jited_line_info_rec_size = jited_linfo_rec_size;
593 info.jited_line_info = ptr_to_u64(jited_linfo); 593 info.jited_line_info = ptr_to_u64(jited_linfo);
594 594
@@ -614,9 +614,9 @@ static int do_dump(int argc, char **argv)
614 goto err_free; 614 goto err_free;
615 } 615 }
616 616
617 if (info.func_info_cnt != finfo_cnt) { 617 if (info.nr_func_info != nr_finfo) {
618 p_err("incorrect func_info_cnt %d vs. expected %d", 618 p_err("incorrect nr_func_info %d vs. expected %d",
619 info.func_info_cnt, finfo_cnt); 619 info.nr_func_info, nr_finfo);
620 goto err_free; 620 goto err_free;
621 } 621 }
622 622
@@ -630,12 +630,12 @@ static int do_dump(int argc, char **argv)
630 /* kernel.kptr_restrict is set. No func_info available. */ 630 /* kernel.kptr_restrict is set. No func_info available. */
631 free(func_info); 631 free(func_info);
632 func_info = NULL; 632 func_info = NULL;
633 finfo_cnt = 0; 633 nr_finfo = 0;
634 } 634 }
635 635
636 if (linfo && info.line_info_cnt != linfo_cnt) { 636 if (linfo && info.nr_line_info != nr_linfo) {
637 p_err("incorrect line_info_cnt %u vs. expected %u", 637 p_err("incorrect nr_line_info %u vs. expected %u",
638 info.line_info_cnt, linfo_cnt); 638 info.nr_line_info, nr_linfo);
639 goto err_free; 639 goto err_free;
640 } 640 }
641 641
@@ -645,9 +645,9 @@ static int do_dump(int argc, char **argv)
645 goto err_free; 645 goto err_free;
646 } 646 }
647 647
648 if (jited_linfo && info.jited_line_info_cnt != jited_linfo_cnt) { 648 if (jited_linfo && info.nr_jited_line_info != nr_jited_linfo) {
649 p_err("incorrect jited_line_info_cnt %u vs. expected %u", 649 p_err("incorrect nr_jited_line_info %u vs. expected %u",
650 info.jited_line_info_cnt, jited_linfo_cnt); 650 info.nr_jited_line_info, nr_jited_linfo);
651 goto err_free; 651 goto err_free;
652 } 652 }
653 653
@@ -670,7 +670,7 @@ static int do_dump(int argc, char **argv)
670 goto err_free; 670 goto err_free;
671 } 671 }
672 672
673 if (linfo_cnt) { 673 if (nr_linfo) {
674 prog_linfo = bpf_prog_linfo__new(&info); 674 prog_linfo = bpf_prog_linfo__new(&info);
675 if (!prog_linfo) 675 if (!prog_linfo)
676 p_info("error in processing bpf_line_info. continue without it."); 676 p_info("error in processing bpf_line_info. continue without it.");