Lines Matching refs:attr
72 static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, in sys_bpf() argument
75 return syscall(__NR_bpf, cmd, attr, size); in sys_bpf()
78 static inline int sys_bpf_fd(enum bpf_cmd cmd, union bpf_attr *attr, in sys_bpf_fd() argument
83 fd = sys_bpf(cmd, attr, size); in sys_bpf_fd()
87 int sys_bpf_prog_load(union bpf_attr *attr, unsigned int size, int attempts) in sys_bpf_prog_load() argument
92 fd = sys_bpf_fd(BPF_PROG_LOAD, attr, size); in sys_bpf_prog_load()
114 union bpf_attr attr; in probe_memcg_account() local
118 memset(&attr, 0, attr_sz); in probe_memcg_account()
119 attr.prog_type = BPF_PROG_TYPE_SOCKET_FILTER; in probe_memcg_account()
120 attr.insns = ptr_to_u64(insns); in probe_memcg_account()
121 attr.insn_cnt = insn_cnt; in probe_memcg_account()
122 attr.license = ptr_to_u64("GPL"); in probe_memcg_account()
123 attr.prog_token_fd = token_fd; in probe_memcg_account()
125 attr.prog_flags |= BPF_F_TOKEN_FD; in probe_memcg_account()
127 prog_fd = sys_bpf_fd(BPF_PROG_LOAD, &attr, attr_sz); in probe_memcg_account()
176 union bpf_attr attr; in bpf_map_create() local
181 memset(&attr, 0, attr_sz); in bpf_map_create()
186 attr.map_type = map_type; in bpf_map_create()
188 libbpf_strlcpy(attr.map_name, map_name, sizeof(attr.map_name)); in bpf_map_create()
189 attr.key_size = key_size; in bpf_map_create()
190 attr.value_size = value_size; in bpf_map_create()
191 attr.max_entries = max_entries; in bpf_map_create()
193 attr.btf_fd = OPTS_GET(opts, btf_fd, 0); in bpf_map_create()
194 attr.btf_key_type_id = OPTS_GET(opts, btf_key_type_id, 0); in bpf_map_create()
195 attr.btf_value_type_id = OPTS_GET(opts, btf_value_type_id, 0); in bpf_map_create()
196 attr.btf_vmlinux_value_type_id = OPTS_GET(opts, btf_vmlinux_value_type_id, 0); in bpf_map_create()
197 attr.value_type_btf_obj_fd = OPTS_GET(opts, value_type_btf_obj_fd, 0); in bpf_map_create()
199 attr.inner_map_fd = OPTS_GET(opts, inner_map_fd, 0); in bpf_map_create()
200 attr.map_flags = OPTS_GET(opts, map_flags, 0); in bpf_map_create()
201 attr.map_extra = OPTS_GET(opts, map_extra, 0); in bpf_map_create()
202 attr.numa_node = OPTS_GET(opts, numa_node, 0); in bpf_map_create()
203 attr.map_ifindex = OPTS_GET(opts, map_ifindex, 0); in bpf_map_create()
205 attr.map_token_fd = OPTS_GET(opts, token_fd, 0); in bpf_map_create()
207 fd = sys_bpf_fd(BPF_MAP_CREATE, &attr, attr_sz); in bpf_map_create()
247 union bpf_attr attr; in bpf_prog_load() local
261 memset(&attr, 0, attr_sz); in bpf_prog_load()
263 attr.prog_type = prog_type; in bpf_prog_load()
264 attr.expected_attach_type = OPTS_GET(opts, expected_attach_type, 0); in bpf_prog_load()
266 attr.prog_btf_fd = OPTS_GET(opts, prog_btf_fd, 0); in bpf_prog_load()
267 attr.prog_flags = OPTS_GET(opts, prog_flags, 0); in bpf_prog_load()
268 attr.prog_ifindex = OPTS_GET(opts, prog_ifindex, 0); in bpf_prog_load()
269 attr.kern_version = OPTS_GET(opts, kern_version, 0); in bpf_prog_load()
270 attr.prog_token_fd = OPTS_GET(opts, token_fd, 0); in bpf_prog_load()
273 libbpf_strlcpy(attr.prog_name, prog_name, sizeof(attr.prog_name)); in bpf_prog_load()
274 attr.license = ptr_to_u64(license); in bpf_prog_load()
279 attr.insns = ptr_to_u64(insns); in bpf_prog_load()
280 attr.insn_cnt = (__u32)insn_cnt; in bpf_prog_load()
288 attr.attach_btf_id = OPTS_GET(opts, attach_btf_id, 0); in bpf_prog_load()
290 attr.attach_prog_fd = attach_prog_fd; in bpf_prog_load()
292 attr.attach_btf_obj_fd = attach_btf_obj_fd; in bpf_prog_load()
303 attr.func_info_rec_size = func_info_rec_size; in bpf_prog_load()
304 attr.func_info = ptr_to_u64(func_info); in bpf_prog_load()
305 attr.func_info_cnt = OPTS_GET(opts, func_info_cnt, 0); in bpf_prog_load()
309 attr.line_info_rec_size = line_info_rec_size; in bpf_prog_load()
310 attr.line_info = ptr_to_u64(line_info); in bpf_prog_load()
311 attr.line_info_cnt = OPTS_GET(opts, line_info_cnt, 0); in bpf_prog_load()
313 attr.fd_array = ptr_to_u64(OPTS_GET(opts, fd_array, NULL)); in bpf_prog_load()
316 attr.log_buf = ptr_to_u64(log_buf); in bpf_prog_load()
317 attr.log_size = log_size; in bpf_prog_load()
318 attr.log_level = log_level; in bpf_prog_load()
321 fd = sys_bpf_prog_load(&attr, attr_sz, attempts); in bpf_prog_load()
322 OPTS_SET(opts, log_true_size, attr.log_true_size); in bpf_prog_load()
331 if (!finfo && attr.func_info_cnt && in bpf_prog_load()
332 attr.func_info_rec_size < func_info_rec_size) { in bpf_prog_load()
335 attr.func_info_cnt, in bpf_prog_load()
337 attr.func_info_rec_size); in bpf_prog_load()
343 attr.func_info = ptr_to_u64(finfo); in bpf_prog_load()
344 attr.func_info_rec_size = func_info_rec_size; in bpf_prog_load()
345 } else if (!linfo && attr.line_info_cnt && in bpf_prog_load()
346 attr.line_info_rec_size < line_info_rec_size) { in bpf_prog_load()
348 attr.line_info_cnt, in bpf_prog_load()
350 attr.line_info_rec_size); in bpf_prog_load()
356 attr.line_info = ptr_to_u64(linfo); in bpf_prog_load()
357 attr.line_info_rec_size = line_info_rec_size; in bpf_prog_load()
362 fd = sys_bpf_prog_load(&attr, attr_sz, attempts); in bpf_prog_load()
363 OPTS_SET(opts, log_true_size, attr.log_true_size); in bpf_prog_load()
373 attr.log_buf = ptr_to_u64(log_buf); in bpf_prog_load()
374 attr.log_size = log_size; in bpf_prog_load()
375 attr.log_level = 1; in bpf_prog_load()
377 fd = sys_bpf_prog_load(&attr, attr_sz, attempts); in bpf_prog_load()
378 OPTS_SET(opts, log_true_size, attr.log_true_size); in bpf_prog_load()
391 union bpf_attr attr; in bpf_map_update_elem() local
394 memset(&attr, 0, attr_sz); in bpf_map_update_elem()
395 attr.map_fd = fd; in bpf_map_update_elem()
396 attr.key = ptr_to_u64(key); in bpf_map_update_elem()
397 attr.value = ptr_to_u64(value); in bpf_map_update_elem()
398 attr.flags = flags; in bpf_map_update_elem()
400 ret = sys_bpf(BPF_MAP_UPDATE_ELEM, &attr, attr_sz); in bpf_map_update_elem()
407 union bpf_attr attr; in bpf_map_lookup_elem() local
410 memset(&attr, 0, attr_sz); in bpf_map_lookup_elem()
411 attr.map_fd = fd; in bpf_map_lookup_elem()
412 attr.key = ptr_to_u64(key); in bpf_map_lookup_elem()
413 attr.value = ptr_to_u64(value); in bpf_map_lookup_elem()
415 ret = sys_bpf(BPF_MAP_LOOKUP_ELEM, &attr, attr_sz); in bpf_map_lookup_elem()
422 union bpf_attr attr; in bpf_map_lookup_elem_flags() local
425 memset(&attr, 0, attr_sz); in bpf_map_lookup_elem_flags()
426 attr.map_fd = fd; in bpf_map_lookup_elem_flags()
427 attr.key = ptr_to_u64(key); in bpf_map_lookup_elem_flags()
428 attr.value = ptr_to_u64(value); in bpf_map_lookup_elem_flags()
429 attr.flags = flags; in bpf_map_lookup_elem_flags()
431 ret = sys_bpf(BPF_MAP_LOOKUP_ELEM, &attr, attr_sz); in bpf_map_lookup_elem_flags()
438 union bpf_attr attr; in bpf_map_lookup_and_delete_elem() local
441 memset(&attr, 0, attr_sz); in bpf_map_lookup_and_delete_elem()
442 attr.map_fd = fd; in bpf_map_lookup_and_delete_elem()
443 attr.key = ptr_to_u64(key); in bpf_map_lookup_and_delete_elem()
444 attr.value = ptr_to_u64(value); in bpf_map_lookup_and_delete_elem()
446 ret = sys_bpf(BPF_MAP_LOOKUP_AND_DELETE_ELEM, &attr, attr_sz); in bpf_map_lookup_and_delete_elem()
453 union bpf_attr attr; in bpf_map_lookup_and_delete_elem_flags() local
456 memset(&attr, 0, attr_sz); in bpf_map_lookup_and_delete_elem_flags()
457 attr.map_fd = fd; in bpf_map_lookup_and_delete_elem_flags()
458 attr.key = ptr_to_u64(key); in bpf_map_lookup_and_delete_elem_flags()
459 attr.value = ptr_to_u64(value); in bpf_map_lookup_and_delete_elem_flags()
460 attr.flags = flags; in bpf_map_lookup_and_delete_elem_flags()
462 ret = sys_bpf(BPF_MAP_LOOKUP_AND_DELETE_ELEM, &attr, attr_sz); in bpf_map_lookup_and_delete_elem_flags()
469 union bpf_attr attr; in bpf_map_delete_elem() local
472 memset(&attr, 0, attr_sz); in bpf_map_delete_elem()
473 attr.map_fd = fd; in bpf_map_delete_elem()
474 attr.key = ptr_to_u64(key); in bpf_map_delete_elem()
476 ret = sys_bpf(BPF_MAP_DELETE_ELEM, &attr, attr_sz); in bpf_map_delete_elem()
483 union bpf_attr attr; in bpf_map_delete_elem_flags() local
486 memset(&attr, 0, attr_sz); in bpf_map_delete_elem_flags()
487 attr.map_fd = fd; in bpf_map_delete_elem_flags()
488 attr.key = ptr_to_u64(key); in bpf_map_delete_elem_flags()
489 attr.flags = flags; in bpf_map_delete_elem_flags()
491 ret = sys_bpf(BPF_MAP_DELETE_ELEM, &attr, attr_sz); in bpf_map_delete_elem_flags()
498 union bpf_attr attr; in bpf_map_get_next_key() local
501 memset(&attr, 0, attr_sz); in bpf_map_get_next_key()
502 attr.map_fd = fd; in bpf_map_get_next_key()
503 attr.key = ptr_to_u64(key); in bpf_map_get_next_key()
504 attr.next_key = ptr_to_u64(next_key); in bpf_map_get_next_key()
506 ret = sys_bpf(BPF_MAP_GET_NEXT_KEY, &attr, attr_sz); in bpf_map_get_next_key()
513 union bpf_attr attr; in bpf_map_freeze() local
516 memset(&attr, 0, attr_sz); in bpf_map_freeze()
517 attr.map_fd = fd; in bpf_map_freeze()
519 ret = sys_bpf(BPF_MAP_FREEZE, &attr, attr_sz); in bpf_map_freeze()
529 union bpf_attr attr; in bpf_map_batch_common() local
535 memset(&attr, 0, attr_sz); in bpf_map_batch_common()
536 attr.batch.map_fd = fd; in bpf_map_batch_common()
537 attr.batch.in_batch = ptr_to_u64(in_batch); in bpf_map_batch_common()
538 attr.batch.out_batch = ptr_to_u64(out_batch); in bpf_map_batch_common()
539 attr.batch.keys = ptr_to_u64(keys); in bpf_map_batch_common()
540 attr.batch.values = ptr_to_u64(values); in bpf_map_batch_common()
541 attr.batch.count = *count; in bpf_map_batch_common()
542 attr.batch.elem_flags = OPTS_GET(opts, elem_flags, 0); in bpf_map_batch_common()
543 attr.batch.flags = OPTS_GET(opts, flags, 0); in bpf_map_batch_common()
545 ret = sys_bpf(cmd, &attr, attr_sz); in bpf_map_batch_common()
546 *count = attr.batch.count; in bpf_map_batch_common()
585 union bpf_attr attr; in bpf_obj_pin_opts() local
591 memset(&attr, 0, attr_sz); in bpf_obj_pin_opts()
592 attr.path_fd = OPTS_GET(opts, path_fd, 0); in bpf_obj_pin_opts()
593 attr.pathname = ptr_to_u64((void *)pathname); in bpf_obj_pin_opts()
594 attr.file_flags = OPTS_GET(opts, file_flags, 0); in bpf_obj_pin_opts()
595 attr.bpf_fd = fd; in bpf_obj_pin_opts()
597 ret = sys_bpf(BPF_OBJ_PIN, &attr, attr_sz); in bpf_obj_pin_opts()
614 union bpf_attr attr; in bpf_obj_get_opts() local
620 memset(&attr, 0, attr_sz); in bpf_obj_get_opts()
621 attr.path_fd = OPTS_GET(opts, path_fd, 0); in bpf_obj_get_opts()
622 attr.pathname = ptr_to_u64((void *)pathname); in bpf_obj_get_opts()
623 attr.file_flags = OPTS_GET(opts, file_flags, 0); in bpf_obj_get_opts()
625 fd = sys_bpf_fd(BPF_OBJ_GET, &attr, attr_sz); in bpf_obj_get_opts()
645 union bpf_attr attr; in bpf_prog_attach_opts() local
658 memset(&attr, 0, attr_sz); in bpf_prog_attach_opts()
659 attr.target_fd = target; in bpf_prog_attach_opts()
660 attr.attach_bpf_fd = prog_fd; in bpf_prog_attach_opts()
661 attr.attach_type = type; in bpf_prog_attach_opts()
662 attr.replace_bpf_fd = OPTS_GET(opts, replace_fd, 0); in bpf_prog_attach_opts()
663 attr.expected_revision = OPTS_GET(opts, expected_revision, 0); in bpf_prog_attach_opts()
666 attr.attach_flags = flags | BPF_F_ID; in bpf_prog_attach_opts()
667 attr.relative_id = relative_id; in bpf_prog_attach_opts()
669 attr.attach_flags = flags; in bpf_prog_attach_opts()
670 attr.relative_fd = relative_fd; in bpf_prog_attach_opts()
673 ret = sys_bpf(BPF_PROG_ATTACH, &attr, attr_sz); in bpf_prog_attach_opts()
683 union bpf_attr attr; in bpf_prog_detach_opts() local
696 memset(&attr, 0, attr_sz); in bpf_prog_detach_opts()
697 attr.target_fd = target; in bpf_prog_detach_opts()
698 attr.attach_bpf_fd = prog_fd; in bpf_prog_detach_opts()
699 attr.attach_type = type; in bpf_prog_detach_opts()
700 attr.expected_revision = OPTS_GET(opts, expected_revision, 0); in bpf_prog_detach_opts()
703 attr.attach_flags = flags | BPF_F_ID; in bpf_prog_detach_opts()
704 attr.relative_id = relative_id; in bpf_prog_detach_opts()
706 attr.attach_flags = flags; in bpf_prog_detach_opts()
707 attr.relative_fd = relative_fd; in bpf_prog_detach_opts()
710 ret = sys_bpf(BPF_PROG_DETACH, &attr, attr_sz); in bpf_prog_detach_opts()
731 union bpf_attr attr; in bpf_link_create() local
747 memset(&attr, 0, attr_sz); in bpf_link_create()
748 attr.link_create.prog_fd = prog_fd; in bpf_link_create()
749 attr.link_create.target_fd = target_fd; in bpf_link_create()
750 attr.link_create.attach_type = attach_type; in bpf_link_create()
751 attr.link_create.flags = OPTS_GET(opts, flags, 0); in bpf_link_create()
754 attr.link_create.target_btf_id = target_btf_id; in bpf_link_create()
760 attr.link_create.iter_info = ptr_to_u64(OPTS_GET(opts, iter_info, (void *)0)); in bpf_link_create()
761 attr.link_create.iter_info_len = iter_info_len; in bpf_link_create()
764 attr.link_create.perf_event.bpf_cookie = OPTS_GET(opts, perf_event.bpf_cookie, 0); in bpf_link_create()
770 attr.link_create.kprobe_multi.flags = OPTS_GET(opts, kprobe_multi.flags, 0); in bpf_link_create()
771 attr.link_create.kprobe_multi.cnt = OPTS_GET(opts, kprobe_multi.cnt, 0); in bpf_link_create()
772 attr.link_create.kprobe_multi.syms = ptr_to_u64(OPTS_GET(opts, kprobe_multi.syms, 0)); in bpf_link_create()
773 attr.link_create.kprobe_multi.addrs = ptr_to_u64(OPTS_GET(opts, kprobe_multi.addrs, 0)); in bpf_link_create()
774 attr.link_create.kprobe_multi.cookies = ptr_to_u64(OPTS_GET(opts, kprobe_multi.cookies, 0)); in bpf_link_create()
779 attr.link_create.uprobe_multi.flags = OPTS_GET(opts, uprobe_multi.flags, 0); in bpf_link_create()
780 attr.link_create.uprobe_multi.cnt = OPTS_GET(opts, uprobe_multi.cnt, 0); in bpf_link_create()
781 attr.link_create.uprobe_multi.path = ptr_to_u64(OPTS_GET(opts, uprobe_multi.path, 0)); in bpf_link_create()
782 attr.link_create.uprobe_multi.offsets = ptr_to_u64(OPTS_GET(opts, uprobe_multi.offsets, 0)); in bpf_link_create()
783 …attr.link_create.uprobe_multi.ref_ctr_offsets = ptr_to_u64(OPTS_GET(opts, uprobe_multi.ref_ctr_off… in bpf_link_create()
784 attr.link_create.uprobe_multi.cookies = ptr_to_u64(OPTS_GET(opts, uprobe_multi.cookies, 0)); in bpf_link_create()
785 attr.link_create.uprobe_multi.pid = OPTS_GET(opts, uprobe_multi.pid, 0); in bpf_link_create()
794 attr.link_create.tracing.cookie = OPTS_GET(opts, tracing.cookie, 0); in bpf_link_create()
799 attr.link_create.netfilter.pf = OPTS_GET(opts, netfilter.pf, 0); in bpf_link_create()
800 attr.link_create.netfilter.hooknum = OPTS_GET(opts, netfilter.hooknum, 0); in bpf_link_create()
801 attr.link_create.netfilter.priority = OPTS_GET(opts, netfilter.priority, 0); in bpf_link_create()
802 attr.link_create.netfilter.flags = OPTS_GET(opts, netfilter.flags, 0); in bpf_link_create()
813 attr.link_create.tcx.relative_id = relative_id; in bpf_link_create()
814 attr.link_create.flags |= BPF_F_ID; in bpf_link_create()
816 attr.link_create.tcx.relative_fd = relative_fd; in bpf_link_create()
818 attr.link_create.tcx.expected_revision = OPTS_GET(opts, tcx.expected_revision, 0); in bpf_link_create()
829 attr.link_create.netkit.relative_id = relative_id; in bpf_link_create()
830 attr.link_create.flags |= BPF_F_ID; in bpf_link_create()
832 attr.link_create.netkit.relative_fd = relative_fd; in bpf_link_create()
834 attr.link_create.netkit.expected_revision = OPTS_GET(opts, netkit.expected_revision, 0); in bpf_link_create()
844 fd = sys_bpf_fd(BPF_LINK_CREATE, &attr, attr_sz); in bpf_link_create()
857 if (attr.link_create.target_fd || attr.link_create.target_btf_id) in bpf_link_create()
881 union bpf_attr attr; in bpf_link_detach() local
884 memset(&attr, 0, attr_sz); in bpf_link_detach()
885 attr.link_detach.link_fd = link_fd; in bpf_link_detach()
887 ret = sys_bpf(BPF_LINK_DETACH, &attr, attr_sz); in bpf_link_detach()
895 union bpf_attr attr; in bpf_link_update() local
904 memset(&attr, 0, attr_sz); in bpf_link_update()
905 attr.link_update.link_fd = link_fd; in bpf_link_update()
906 attr.link_update.new_prog_fd = new_prog_fd; in bpf_link_update()
907 attr.link_update.flags = OPTS_GET(opts, flags, 0); in bpf_link_update()
909 attr.link_update.old_prog_fd = OPTS_GET(opts, old_prog_fd, 0); in bpf_link_update()
911 attr.link_update.old_map_fd = OPTS_GET(opts, old_map_fd, 0); in bpf_link_update()
913 ret = sys_bpf(BPF_LINK_UPDATE, &attr, attr_sz); in bpf_link_update()
920 union bpf_attr attr; in bpf_iter_create() local
923 memset(&attr, 0, attr_sz); in bpf_iter_create()
924 attr.iter_create.link_fd = link_fd; in bpf_iter_create()
926 fd = sys_bpf_fd(BPF_ITER_CREATE, &attr, attr_sz); in bpf_iter_create()
934 union bpf_attr attr; in bpf_prog_query_opts() local
940 memset(&attr, 0, attr_sz); in bpf_prog_query_opts()
941 attr.query.target_fd = target; in bpf_prog_query_opts()
942 attr.query.attach_type = type; in bpf_prog_query_opts()
943 attr.query.query_flags = OPTS_GET(opts, query_flags, 0); in bpf_prog_query_opts()
944 attr.query.count = OPTS_GET(opts, count, 0); in bpf_prog_query_opts()
945 attr.query.prog_ids = ptr_to_u64(OPTS_GET(opts, prog_ids, NULL)); in bpf_prog_query_opts()
946 attr.query.link_ids = ptr_to_u64(OPTS_GET(opts, link_ids, NULL)); in bpf_prog_query_opts()
947 attr.query.prog_attach_flags = ptr_to_u64(OPTS_GET(opts, prog_attach_flags, NULL)); in bpf_prog_query_opts()
948 attr.query.link_attach_flags = ptr_to_u64(OPTS_GET(opts, link_attach_flags, NULL)); in bpf_prog_query_opts()
950 ret = sys_bpf(BPF_PROG_QUERY, &attr, attr_sz); in bpf_prog_query_opts()
952 OPTS_SET(opts, attach_flags, attr.query.attach_flags); in bpf_prog_query_opts()
953 OPTS_SET(opts, revision, attr.query.revision); in bpf_prog_query_opts()
954 OPTS_SET(opts, count, attr.query.count); in bpf_prog_query_opts()
981 union bpf_attr attr; in bpf_prog_test_run_opts() local
987 memset(&attr, 0, attr_sz); in bpf_prog_test_run_opts()
988 attr.test.prog_fd = prog_fd; in bpf_prog_test_run_opts()
989 attr.test.batch_size = OPTS_GET(opts, batch_size, 0); in bpf_prog_test_run_opts()
990 attr.test.cpu = OPTS_GET(opts, cpu, 0); in bpf_prog_test_run_opts()
991 attr.test.flags = OPTS_GET(opts, flags, 0); in bpf_prog_test_run_opts()
992 attr.test.repeat = OPTS_GET(opts, repeat, 0); in bpf_prog_test_run_opts()
993 attr.test.duration = OPTS_GET(opts, duration, 0); in bpf_prog_test_run_opts()
994 attr.test.ctx_size_in = OPTS_GET(opts, ctx_size_in, 0); in bpf_prog_test_run_opts()
995 attr.test.ctx_size_out = OPTS_GET(opts, ctx_size_out, 0); in bpf_prog_test_run_opts()
996 attr.test.data_size_in = OPTS_GET(opts, data_size_in, 0); in bpf_prog_test_run_opts()
997 attr.test.data_size_out = OPTS_GET(opts, data_size_out, 0); in bpf_prog_test_run_opts()
998 attr.test.ctx_in = ptr_to_u64(OPTS_GET(opts, ctx_in, NULL)); in bpf_prog_test_run_opts()
999 attr.test.ctx_out = ptr_to_u64(OPTS_GET(opts, ctx_out, NULL)); in bpf_prog_test_run_opts()
1000 attr.test.data_in = ptr_to_u64(OPTS_GET(opts, data_in, NULL)); in bpf_prog_test_run_opts()
1001 attr.test.data_out = ptr_to_u64(OPTS_GET(opts, data_out, NULL)); in bpf_prog_test_run_opts()
1003 ret = sys_bpf(BPF_PROG_TEST_RUN, &attr, attr_sz); in bpf_prog_test_run_opts()
1005 OPTS_SET(opts, data_size_out, attr.test.data_size_out); in bpf_prog_test_run_opts()
1006 OPTS_SET(opts, ctx_size_out, attr.test.ctx_size_out); in bpf_prog_test_run_opts()
1007 OPTS_SET(opts, duration, attr.test.duration); in bpf_prog_test_run_opts()
1008 OPTS_SET(opts, retval, attr.test.retval); in bpf_prog_test_run_opts()
1016 union bpf_attr attr; in bpf_obj_get_next_id() local
1019 memset(&attr, 0, attr_sz); in bpf_obj_get_next_id()
1020 attr.start_id = start_id; in bpf_obj_get_next_id()
1022 err = sys_bpf(cmd, &attr, attr_sz); in bpf_obj_get_next_id()
1024 *next_id = attr.next_id; in bpf_obj_get_next_id()
1053 union bpf_attr attr; in bpf_prog_get_fd_by_id_opts() local
1059 memset(&attr, 0, attr_sz); in bpf_prog_get_fd_by_id_opts()
1060 attr.prog_id = id; in bpf_prog_get_fd_by_id_opts()
1061 attr.open_flags = OPTS_GET(opts, open_flags, 0); in bpf_prog_get_fd_by_id_opts()
1063 fd = sys_bpf_fd(BPF_PROG_GET_FD_BY_ID, &attr, attr_sz); in bpf_prog_get_fd_by_id_opts()
1076 union bpf_attr attr; in bpf_map_get_fd_by_id_opts() local
1082 memset(&attr, 0, attr_sz); in bpf_map_get_fd_by_id_opts()
1083 attr.map_id = id; in bpf_map_get_fd_by_id_opts()
1084 attr.open_flags = OPTS_GET(opts, open_flags, 0); in bpf_map_get_fd_by_id_opts()
1086 fd = sys_bpf_fd(BPF_MAP_GET_FD_BY_ID, &attr, attr_sz); in bpf_map_get_fd_by_id_opts()
1099 union bpf_attr attr; in bpf_btf_get_fd_by_id_opts() local
1105 memset(&attr, 0, attr_sz); in bpf_btf_get_fd_by_id_opts()
1106 attr.btf_id = id; in bpf_btf_get_fd_by_id_opts()
1107 attr.open_flags = OPTS_GET(opts, open_flags, 0); in bpf_btf_get_fd_by_id_opts()
1109 fd = sys_bpf_fd(BPF_BTF_GET_FD_BY_ID, &attr, attr_sz); in bpf_btf_get_fd_by_id_opts()
1122 union bpf_attr attr; in bpf_link_get_fd_by_id_opts() local
1128 memset(&attr, 0, attr_sz); in bpf_link_get_fd_by_id_opts()
1129 attr.link_id = id; in bpf_link_get_fd_by_id_opts()
1130 attr.open_flags = OPTS_GET(opts, open_flags, 0); in bpf_link_get_fd_by_id_opts()
1132 fd = sys_bpf_fd(BPF_LINK_GET_FD_BY_ID, &attr, attr_sz); in bpf_link_get_fd_by_id_opts()
1144 union bpf_attr attr; in bpf_obj_get_info_by_fd() local
1147 memset(&attr, 0, attr_sz); in bpf_obj_get_info_by_fd()
1148 attr.info.bpf_fd = bpf_fd; in bpf_obj_get_info_by_fd()
1149 attr.info.info_len = *info_len; in bpf_obj_get_info_by_fd()
1150 attr.info.info = ptr_to_u64(info); in bpf_obj_get_info_by_fd()
1152 err = sys_bpf(BPF_OBJ_GET_INFO_BY_FD, &attr, attr_sz); in bpf_obj_get_info_by_fd()
1154 *info_len = attr.info.info_len; in bpf_obj_get_info_by_fd()
1181 union bpf_attr attr; in bpf_raw_tracepoint_open_opts() local
1187 memset(&attr, 0, attr_sz); in bpf_raw_tracepoint_open_opts()
1188 attr.raw_tracepoint.prog_fd = prog_fd; in bpf_raw_tracepoint_open_opts()
1189 attr.raw_tracepoint.name = ptr_to_u64(OPTS_GET(opts, tp_name, NULL)); in bpf_raw_tracepoint_open_opts()
1190 attr.raw_tracepoint.cookie = OPTS_GET(opts, cookie, 0); in bpf_raw_tracepoint_open_opts()
1192 fd = sys_bpf_fd(BPF_RAW_TRACEPOINT_OPEN, &attr, attr_sz); in bpf_raw_tracepoint_open_opts()
1206 union bpf_attr attr; in bpf_btf_load() local
1214 memset(&attr, 0, attr_sz); in bpf_btf_load()
1228 attr.btf = ptr_to_u64(btf_data); in bpf_btf_load()
1229 attr.btf_size = btf_size; in bpf_btf_load()
1231 attr.btf_flags = OPTS_GET(opts, btf_flags, 0); in bpf_btf_load()
1232 attr.btf_token_fd = OPTS_GET(opts, token_fd, 0); in bpf_btf_load()
1240 attr.btf_log_buf = ptr_to_u64(log_buf); in bpf_btf_load()
1241 attr.btf_log_size = (__u32)log_size; in bpf_btf_load()
1242 attr.btf_log_level = log_level; in bpf_btf_load()
1245 fd = sys_bpf_fd(BPF_BTF_LOAD, &attr, attr_sz); in bpf_btf_load()
1247 attr.btf_log_buf = ptr_to_u64(log_buf); in bpf_btf_load()
1248 attr.btf_log_size = (__u32)log_size; in bpf_btf_load()
1249 attr.btf_log_level = 1; in bpf_btf_load()
1250 fd = sys_bpf_fd(BPF_BTF_LOAD, &attr, attr_sz); in bpf_btf_load()
1253 OPTS_SET(opts, log_true_size, attr.btf_log_true_size); in bpf_btf_load()
1262 union bpf_attr attr; in bpf_task_fd_query() local
1265 memset(&attr, 0, attr_sz); in bpf_task_fd_query()
1266 attr.task_fd_query.pid = pid; in bpf_task_fd_query()
1267 attr.task_fd_query.fd = fd; in bpf_task_fd_query()
1268 attr.task_fd_query.flags = flags; in bpf_task_fd_query()
1269 attr.task_fd_query.buf = ptr_to_u64(buf); in bpf_task_fd_query()
1270 attr.task_fd_query.buf_len = *buf_len; in bpf_task_fd_query()
1272 err = sys_bpf(BPF_TASK_FD_QUERY, &attr, attr_sz); in bpf_task_fd_query()
1274 *buf_len = attr.task_fd_query.buf_len; in bpf_task_fd_query()
1275 *prog_id = attr.task_fd_query.prog_id; in bpf_task_fd_query()
1276 *fd_type = attr.task_fd_query.fd_type; in bpf_task_fd_query()
1277 *probe_offset = attr.task_fd_query.probe_offset; in bpf_task_fd_query()
1278 *probe_addr = attr.task_fd_query.probe_addr; in bpf_task_fd_query()
1286 union bpf_attr attr; in bpf_enable_stats() local
1289 memset(&attr, 0, attr_sz); in bpf_enable_stats()
1290 attr.enable_stats.type = type; in bpf_enable_stats()
1292 fd = sys_bpf_fd(BPF_ENABLE_STATS, &attr, attr_sz); in bpf_enable_stats()
1300 union bpf_attr attr; in bpf_prog_bind_map() local
1306 memset(&attr, 0, attr_sz); in bpf_prog_bind_map()
1307 attr.prog_bind_map.prog_fd = prog_fd; in bpf_prog_bind_map()
1308 attr.prog_bind_map.map_fd = map_fd; in bpf_prog_bind_map()
1309 attr.prog_bind_map.flags = OPTS_GET(opts, flags, 0); in bpf_prog_bind_map()
1311 ret = sys_bpf(BPF_PROG_BIND_MAP, &attr, attr_sz); in bpf_prog_bind_map()
1318 union bpf_attr attr; in bpf_token_create() local
1324 memset(&attr, 0, attr_sz); in bpf_token_create()
1325 attr.token_create.bpffs_fd = bpffs_fd; in bpf_token_create()
1326 attr.token_create.flags = OPTS_GET(opts, flags, 0); in bpf_token_create()
1328 fd = sys_bpf_fd(BPF_TOKEN_CREATE, &attr, attr_sz); in bpf_token_create()