Lines Matching refs:d
29 struct btf_dump *d; in btf_dump_all_types() local
32 d = btf_dump__new(btf, btf_dump_printf, ctx, NULL); in btf_dump_all_types()
33 err = libbpf_get_error(d); in btf_dump_all_types()
38 err = btf_dump__dump_type(d, id); in btf_dump_all_types()
44 btf_dump__free(d); in btf_dump_all_types()
131 struct btf_dump *d; member
141 btf_dump__free(t->d); in test_ctx__free()
153 t->d = btf_dump__new(t->btf, btf_dump_printf, t->dump_buf_file, NULL); in test_ctx__init()
154 if (!ASSERT_OK(libbpf_get_error(t->d), "btf_dump__new")) in test_ctx__init()
171 err = btf_dump__dump_type(t->d, i); in test_ctx__dump_and_compare()
339 static int btf_dump_data(struct btf *btf, struct btf_dump *d, in btf_dump_data() argument
364 ret = btf_dump__dump_type_data(d, type_id, ptr, ptr_sz, &opts); in btf_dump_data()
420 static void test_btf_dump_int_data(struct btf *btf, struct btf_dump *d, in test_btf_dump_int_data() argument
432 TEST_BTF_DUMP_DATA_C(btf, d, NULL, str, int, BTF_F_COMPACT, 1234); in test_btf_dump_int_data()
433 TEST_BTF_DUMP_DATA(btf, d, NULL, str, int, BTF_F_COMPACT | BTF_F_NONAME, in test_btf_dump_int_data()
435 TEST_BTF_DUMP_DATA(btf, d, NULL, str, int, 0, "(int)1234", 1234); in test_btf_dump_int_data()
438 TEST_BTF_DUMP_DATA(btf, d, NULL, str, int, BTF_F_COMPACT, "(int)0", 0); in test_btf_dump_int_data()
439 TEST_BTF_DUMP_DATA(btf, d, NULL, str, int, BTF_F_COMPACT | BTF_F_NONAME, in test_btf_dump_int_data()
441 TEST_BTF_DUMP_DATA(btf, d, NULL, str, int, BTF_F_COMPACT | BTF_F_ZERO, in test_btf_dump_int_data()
443 TEST_BTF_DUMP_DATA(btf, d, NULL, str, int, in test_btf_dump_int_data()
446 TEST_BTF_DUMP_DATA_C(btf, d, NULL, str, int, BTF_F_COMPACT, -4567); in test_btf_dump_int_data()
447 TEST_BTF_DUMP_DATA(btf, d, NULL, str, int, BTF_F_COMPACT | BTF_F_NONAME, in test_btf_dump_int_data()
449 TEST_BTF_DUMP_DATA(btf, d, NULL, str, int, 0, "(int)-4567", -4567); in test_btf_dump_int_data()
451 TEST_BTF_DUMP_DATA_OVER(btf, d, NULL, str, int, sizeof(int)-1, "", 1); in test_btf_dump_int_data()
459 TEST_BTF_DUMP_DATA(btf, d, NULL, str, unsigned __int128, BTF_F_COMPACT, in test_btf_dump_int_data()
462 ASSERT_OK(btf_dump_data(btf, d, "unsigned __int128", NULL, 0, &i, 16, str, in test_btf_dump_int_data()
466 TEST_BTF_DUMP_DATA(btf, d, NULL, str, __int128 unsigned, BTF_F_COMPACT, in test_btf_dump_int_data()
469 ASSERT_OK(btf_dump_data(btf, d, "__int128 unsigned", NULL, 0, &i, 16, str, in test_btf_dump_int_data()
478 static void test_btf_dump_float_data(struct btf *btf, struct btf_dump *d, in test_btf_dump_float_data() argument
496 ASSERT_OK(btf_dump_data(btf, d, "test_float", NULL, 0, &t1, 4, str, in test_btf_dump_float_data()
498 ASSERT_OK(btf_dump_data(btf, d, "test_float", NULL, 0, &t2, 4, str, in test_btf_dump_float_data()
500 ASSERT_OK(btf_dump_data(btf, d, "test_float", NULL, 0, &t3, 4, str, in test_btf_dump_float_data()
504 ASSERT_OK(btf_dump_data(btf, d, "test_double", NULL, 0, &t4, 8, str, in test_btf_dump_float_data()
506 ASSERT_OK(btf_dump_data(btf, d, "test_double", NULL, 0, &t5, 8, str, in test_btf_dump_float_data()
508 ASSERT_OK(btf_dump_data(btf, d, "test_double", NULL, 0, &t6, 8, str, in test_btf_dump_float_data()
512 ASSERT_OK(btf_dump_data(btf, d, "test_long_double", NULL, 0, &t7, 16, in test_btf_dump_float_data()
515 ASSERT_OK(btf_dump_data(btf, d, "test_long_double", NULL, 0, &t8, 16, in test_btf_dump_float_data()
518 ASSERT_OK(btf_dump_data(btf, d, "test_long_double", NULL, 0, &t9, 16, in test_btf_dump_float_data()
523 static void test_btf_dump_char_data(struct btf *btf, struct btf_dump *d, in test_btf_dump_char_data() argument
527 TEST_BTF_DUMP_DATA_C(btf, d, NULL, str, char, BTF_F_COMPACT, 100); in test_btf_dump_char_data()
528 TEST_BTF_DUMP_DATA(btf, d, NULL, str, char, BTF_F_COMPACT | BTF_F_NONAME, in test_btf_dump_char_data()
530 TEST_BTF_DUMP_DATA(btf, d, NULL, str, char, 0, "(char)100", 100); in test_btf_dump_char_data()
532 TEST_BTF_DUMP_DATA(btf, d, NULL, str, char, BTF_F_COMPACT, in test_btf_dump_char_data()
534 TEST_BTF_DUMP_DATA(btf, d, NULL, str, char, BTF_F_COMPACT | BTF_F_NONAME, in test_btf_dump_char_data()
536 TEST_BTF_DUMP_DATA(btf, d, NULL, str, char, BTF_F_COMPACT | BTF_F_ZERO, in test_btf_dump_char_data()
538 TEST_BTF_DUMP_DATA(btf, d, NULL, str, char, BTF_F_COMPACT | BTF_F_NONAME | BTF_F_ZERO, in test_btf_dump_char_data()
540 TEST_BTF_DUMP_DATA(btf, d, NULL, str, char, 0, "(char)0", 0); in test_btf_dump_char_data()
542 TEST_BTF_DUMP_DATA_OVER(btf, d, NULL, str, char, sizeof(char)-1, "", 100); in test_btf_dump_char_data()
545 static void test_btf_dump_typedef_data(struct btf *btf, struct btf_dump *d, in test_btf_dump_typedef_data() argument
549 TEST_BTF_DUMP_DATA_C(btf, d, NULL, str, uint64_t, BTF_F_COMPACT, 100); in test_btf_dump_typedef_data()
550 TEST_BTF_DUMP_DATA(btf, d, NULL, str, u64, BTF_F_COMPACT | BTF_F_NONAME, in test_btf_dump_typedef_data()
552 TEST_BTF_DUMP_DATA(btf, d, NULL, str, u64, 0, "(u64)1", 1); in test_btf_dump_typedef_data()
554 TEST_BTF_DUMP_DATA(btf, d, NULL, str, u64, BTF_F_COMPACT, "(u64)0", 0); in test_btf_dump_typedef_data()
555 TEST_BTF_DUMP_DATA(btf, d, NULL, str, u64, BTF_F_COMPACT | BTF_F_NONAME, in test_btf_dump_typedef_data()
557 TEST_BTF_DUMP_DATA(btf, d, NULL, str, u64, BTF_F_COMPACT | BTF_F_ZERO, in test_btf_dump_typedef_data()
559 TEST_BTF_DUMP_DATA(btf, d, NULL, str, u64, in test_btf_dump_typedef_data()
562 TEST_BTF_DUMP_DATA(btf, d, NULL, str, u64, 0, "(u64)0", 0); in test_btf_dump_typedef_data()
565 TEST_BTF_DUMP_DATA_C(btf, d, NULL, str, atomic_t, BTF_F_COMPACT, in test_btf_dump_typedef_data()
567 TEST_BTF_DUMP_DATA(btf, d, NULL, str, atomic_t, BTF_F_COMPACT | BTF_F_NONAME, in test_btf_dump_typedef_data()
569 TEST_BTF_DUMP_DATA(btf, d, NULL, str, atomic_t, 0, in test_btf_dump_typedef_data()
575 TEST_BTF_DUMP_DATA(btf, d, NULL, str, atomic_t, BTF_F_COMPACT, "(atomic_t){}", in test_btf_dump_typedef_data()
577 TEST_BTF_DUMP_DATA(btf, d, NULL, str, atomic_t, BTF_F_COMPACT | BTF_F_NONAME, in test_btf_dump_typedef_data()
579 TEST_BTF_DUMP_DATA(btf, d, NULL, str, atomic_t, 0, in test_btf_dump_typedef_data()
583 TEST_BTF_DUMP_DATA(btf, d, NULL, str, atomic_t, BTF_F_COMPACT | BTF_F_ZERO, in test_btf_dump_typedef_data()
586 TEST_BTF_DUMP_DATA(btf, d, NULL, str, atomic_t, in test_btf_dump_typedef_data()
589 TEST_BTF_DUMP_DATA(btf, d, NULL, str, atomic_t, BTF_F_ZERO, in test_btf_dump_typedef_data()
596 TEST_BTF_DUMP_DATA_OVER(btf, d, NULL, str, atomic_t, sizeof(atomic_t)-1, in test_btf_dump_typedef_data()
600 static void test_btf_dump_enum_data(struct btf *btf, struct btf_dump *d, in test_btf_dump_enum_data() argument
604 TEST_BTF_DUMP_DATA_C(btf, d, "enum", str, enum bpf_cmd, BTF_F_COMPACT, in test_btf_dump_enum_data()
606 TEST_BTF_DUMP_DATA(btf, d, "enum", str, enum bpf_cmd, BTF_F_COMPACT, in test_btf_dump_enum_data()
608 TEST_BTF_DUMP_DATA(btf, d, "enum", str, enum bpf_cmd, in test_btf_dump_enum_data()
612 TEST_BTF_DUMP_DATA(btf, d, "enum", str, enum bpf_cmd, 0, in test_btf_dump_enum_data()
615 TEST_BTF_DUMP_DATA(btf, d, "enum", str, enum bpf_cmd, in test_btf_dump_enum_data()
618 TEST_BTF_DUMP_DATA(btf, d, "enum", str, enum bpf_cmd, in test_btf_dump_enum_data()
622 TEST_BTF_DUMP_DATA(btf, d, "enum", str, enum bpf_cmd, in test_btf_dump_enum_data()
625 TEST_BTF_DUMP_DATA_C(btf, d, "enum", str, enum bpf_cmd, BTF_F_COMPACT, 2000); in test_btf_dump_enum_data()
626 TEST_BTF_DUMP_DATA(btf, d, "enum", str, enum bpf_cmd, in test_btf_dump_enum_data()
629 TEST_BTF_DUMP_DATA(btf, d, "enum", str, enum bpf_cmd, 0, in test_btf_dump_enum_data()
632 TEST_BTF_DUMP_DATA_OVER(btf, d, "enum", str, enum bpf_cmd, in test_btf_dump_enum_data()
636 static void test_btf_dump_struct_data(struct btf *btf, struct btf_dump *d, in test_btf_dump_struct_data() argument
652 TEST_BTF_DUMP_DATA_C(btf, d, "struct", str, struct btf_enum, BTF_F_COMPACT, in test_btf_dump_struct_data()
654 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct btf_enum, in test_btf_dump_struct_data()
658 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct btf_enum, 0, in test_btf_dump_struct_data()
664 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct btf_enum, in test_btf_dump_struct_data()
668 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct btf_enum, in test_btf_dump_struct_data()
673 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct btf_enum, BTF_F_COMPACT, in test_btf_dump_struct_data()
676 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct btf_enum, in test_btf_dump_struct_data()
680 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct btf_enum, 0, in test_btf_dump_struct_data()
684 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct btf_enum, in test_btf_dump_struct_data()
688 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct btf_enum, in test_btf_dump_struct_data()
697 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct list_head, BTF_F_COMPACT, in test_btf_dump_struct_data()
700 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct list_head, 0, in test_btf_dump_struct_data()
706 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct list_head, BTF_F_COMPACT, in test_btf_dump_struct_data()
709 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct list_head, 0, in test_btf_dump_struct_data()
720 ret = btf_dump__dump_type_data(d, type_id, fops, type_sz, &opts); in test_btf_dump_struct_data()
732 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct bpf_prog_info, BTF_F_COMPACT, in test_btf_dump_struct_data()
735 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct bpf_prog_info, in test_btf_dump_struct_data()
739 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct bpf_prog_info, 0, in test_btf_dump_struct_data()
749 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct bpf_prog_info, BTF_F_COMPACT, in test_btf_dump_struct_data()
753 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct bpf_prog_info, BTF_F_COMPACT, in test_btf_dump_struct_data()
758 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct __sk_buff, BTF_F_COMPACT, in test_btf_dump_struct_data()
761 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct __sk_buff, in test_btf_dump_struct_data()
765 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct __sk_buff, 0, in test_btf_dump_struct_data()
777 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct __sk_buff, BTF_F_COMPACT, in test_btf_dump_struct_data()
780 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct __sk_buff, 0, in test_btf_dump_struct_data()
793 TEST_BTF_DUMP_DATA_C(btf, d, "struct", str, struct bpf_insn, BTF_F_COMPACT, in test_btf_dump_struct_data()
795 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct bpf_insn, in test_btf_dump_struct_data()
800 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct bpf_insn, 0, in test_btf_dump_struct_data()
811 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct bpf_insn, BTF_F_COMPACT, in test_btf_dump_struct_data()
822 ret = btf_dump__dump_type_data(d, type_id, zero_data, type_sz, &opts); in test_btf_dump_struct_data()
831 TEST_BTF_DUMP_DATA(btf, d, "struct", str, struct bpf_sock_ops, BTF_F_COMPACT, in test_btf_dump_struct_data()
836 TEST_BTF_DUMP_DATA(btf, d, "union", str, union bpf_iter_link_info, BTF_F_COMPACT, in test_btf_dump_struct_data()
849 ret = btf_dump__dump_type_data(d, type_id, skb, type_sz, &opts); in test_btf_dump_struct_data()
861 TEST_BTF_DUMP_DATA_OVER(btf, d, "struct", str, struct bpf_sock_ops, in test_btf_dump_struct_data()
865 TEST_BTF_DUMP_DATA_OVER(btf, d, "struct", str, struct bpf_sock_ops, in test_btf_dump_struct_data()
871 static void test_btf_dump_var_data(struct btf *btf, struct btf_dump *d, in test_btf_dump_var_data() argument
875 TEST_BTF_DUMP_VAR(btf, d, NULL, str, "cpu_number", int, BTF_F_COMPACT, in test_btf_dump_var_data()
878 TEST_BTF_DUMP_VAR(btf, d, NULL, str, "bpf_cgrp_storage_busy", int, BTF_F_COMPACT, in test_btf_dump_var_data()
884 struct btf_dump *d; member
899 ret = btf_dump__dump_type_data(ctx->d, ctx->array_id, ptr, ptr_sz, ctx->opts); in btf_dump_one_string()
966 struct btf_dump *d; in test_btf_dump_string_data() local
974 d = btf_dump__new(t.btf, btf_dump_snprintf, str, NULL); in test_btf_dump_string_data()
975 if (!ASSERT_OK_PTR(d, "could not create BTF dump")) in test_btf_dump_string_data()
987 ctx.d = d; in test_btf_dump_string_data()
994 btf_dump__free(d); in test_btf_dump_string_data()
998 static void test_btf_datasec(struct btf *btf, struct btf_dump *d, char *str, in test_btf_datasec() argument
1017 ret = btf_dump__dump_type_data(d, type_id, data, data_sz, &opts); in test_btf_datasec()
1028 struct btf_dump *d; in test_btf_dump_datasec_data() local
1034 d = btf_dump__new(btf, btf_dump_snprintf, str, NULL); in test_btf_dump_datasec_data()
1035 if (!ASSERT_OK_PTR(d, "could not create BTF dump")) in test_btf_dump_datasec_data()
1038 test_btf_datasec(btf, d, str, "license", in test_btf_dump_datasec_data()
1042 btf_dump__free(d); in test_btf_dump_datasec_data()
1048 struct btf_dump *d; in test_btf_dump() local
1070 d = btf_dump__new(btf, btf_dump_snprintf, str, NULL); in test_btf_dump()
1071 if (!ASSERT_OK_PTR(d, "could not create BTF dump")) in test_btf_dump()
1076 test_btf_dump_int_data(btf, d, str); in test_btf_dump()
1078 test_btf_dump_float_data(btf, d, str); in test_btf_dump()
1080 test_btf_dump_char_data(btf, d, str); in test_btf_dump()
1082 test_btf_dump_typedef_data(btf, d, str); in test_btf_dump()
1084 test_btf_dump_enum_data(btf, d, str); in test_btf_dump()
1086 test_btf_dump_struct_data(btf, d, str); in test_btf_dump()
1088 test_btf_dump_var_data(btf, d, str); in test_btf_dump()
1091 btf_dump__free(d); in test_btf_dump()