linux/bpf: update helper definitions

Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
Tw 2023-11-15 11:38:31 +08:00 committed by Veikka Tuominen
parent 6b1a823b2b
commit 8ca4a5240e
2 changed files with 83 additions and 0 deletions

View File

@ -155,3 +155,71 @@ pub const skc_to_tcp_timewait_sock = @as(*const fn (sk: ?*anyopaque) ?*kern.TcpT
pub const skc_to_tcp_request_sock = @as(*const fn (sk: ?*anyopaque) ?*kern.TcpRequestSock, @ptrFromInt(139));
pub const skc_to_udp6_sock = @as(*const fn (sk: ?*anyopaque) ?*kern.Udp6Sock, @ptrFromInt(140));
pub const get_task_stack = @as(*const fn (task: ?*anyopaque, buf: ?*anyopaque, size: u32, flags: u64) c_long, @ptrFromInt(141));
pub const load_hdr_opt = @as(*const fn (?*kern.BpfSockOps, ?*anyopaque, u32, u64) c_long, @ptrFromInt(142));
pub const store_hdr_opt = @as(*const fn (?*kern.BpfSockOps, ?*const anyopaque, u32, u64) c_long, @ptrFromInt(143));
pub const reserve_hdr_opt = @as(*const fn (?*kern.BpfSockOps, u32, u64) c_long, @ptrFromInt(144));
pub const inode_storage_get = @as(*const fn (?*anyopaque, ?*anyopaque, ?*anyopaque, u64) ?*anyopaque, @ptrFromInt(145));
pub const inode_storage_delete = @as(*const fn (?*anyopaque, ?*anyopaque) c_int, @ptrFromInt(146));
pub const d_path = @as(*const fn (?*kern.Path, [*c]u8, u32) c_long, @ptrFromInt(147));
pub const copy_from_user = @as(*const fn (?*anyopaque, u32, ?*const anyopaque) c_long, @ptrFromInt(148));
pub const snprintf_btf = @as(*const fn ([*c]u8, u32, ?*kern.BTFPtr, u32, u64) c_long, @ptrFromInt(149));
pub const seq_printf_btf = @as(*const fn (?*kern.SeqFile, ?*kern.BTFPtr, u32, u64) c_long, @ptrFromInt(150));
pub const skb_cgroup_classid = @as(*const fn (?*kern.SkBuff) u64, @ptrFromInt(151));
pub const redirect_neigh = @as(*const fn (u32, ?*kern.BpfRedirNeigh, c_int, u64) c_long, @ptrFromInt(152));
pub const per_cpu_ptr = @as(*const fn (?*const anyopaque, u32) ?*anyopaque, @ptrFromInt(153));
pub const this_cpu_ptr = @as(*const fn (?*const anyopaque) ?*anyopaque, @ptrFromInt(154));
pub const redirect_peer = @as(*const fn (u32, u64) c_long, @ptrFromInt(155));
pub const task_storage_get = @as(*const fn (?*anyopaque, ?*kern.Task, ?*anyopaque, u64) ?*anyopaque, @ptrFromInt(156));
pub const task_storage_delete = @as(*const fn (?*anyopaque, ?*kern.Task) c_long, @ptrFromInt(157));
pub const get_current_task_btf = @as(*const fn () ?*kern.Task, @ptrFromInt(158));
pub const bprm_opts_set = @as(*const fn (?*kern.BinPrm, u64) c_long, @ptrFromInt(159));
pub const ktime_get_coarse_ns = @as(*const fn () u64, @ptrFromInt(160));
pub const ima_inode_hash = @as(*const fn (?*kern.Inode, ?*anyopaque, u32) c_long, @ptrFromInt(161));
pub const sock_from_file = @as(*const fn (?*kern.File) ?*kern.Socket, @ptrFromInt(162));
pub const check_mtu = @as(*const fn (?*anyopaque, u32, [*c]u32, i32, u64) c_long, @ptrFromInt(163));
pub const for_each_map_elem = @as(*const fn (?*anyopaque, ?*anyopaque, ?*anyopaque, u64) c_long, @ptrFromInt(164));
pub const snprintf = @as(*const fn ([*c]u8, u32, [*c]const u8, [*c]u64, u32) c_long, @ptrFromInt(165));
pub const sys_bpf = @as(*const fn (u32, ?*anyopaque, u32) c_long, @ptrFromInt(166));
pub const btf_find_by_name_kind = @as(*const fn ([*c]u8, c_int, u32, c_int) c_long, @ptrFromInt(167));
pub const sys_close = @as(*const fn (u32) c_long, @ptrFromInt(168));
pub const timer_init = @as(*const fn (?*kern.BpfTimer, ?*anyopaque, u64) c_long, @ptrFromInt(169));
pub const timer_set_callback = @as(*const fn (?*kern.BpfTimer, ?*anyopaque) c_long, @ptrFromInt(170));
pub const timer_start = @as(*const fn (?*kern.BpfTimer, u64, u64) c_long, @ptrFromInt(171));
pub const timer_cancel = @as(*const fn (?*kern.BpfTimer) c_long, @ptrFromInt(172));
pub const get_func_ip = @as(*const fn (?*anyopaque) u64, @ptrFromInt(173));
pub const get_attach_cookie = @as(*const fn (?*anyopaque) u64, @ptrFromInt(174));
pub const task_pt_regs = @as(*const fn (?*kern.Task) c_long, @ptrFromInt(175));
pub const get_branch_snapshot = @as(*const fn (?*anyopaque, u32, u64) c_long, @ptrFromInt(176));
pub const trace_vprintk = @as(*const fn ([*c]const u8, u32, ?*const anyopaque, u32) c_long, @ptrFromInt(177));
pub const skc_to_unix_sock = @as(*const fn (?*anyopaque) ?*kern.UnixSock, @ptrFromInt(178));
pub const kallsyms_lookup_name = @as(*const fn ([*c]const u8, c_int, c_int, [*c]u64) c_long, @ptrFromInt(179));
pub const find_vma = @as(*const fn (?*kern.Task, u64, ?*anyopaque, ?*anyopaque, u64) c_long, @ptrFromInt(180));
pub const loop = @as(*const fn (u32, ?*anyopaque, ?*anyopaque, u64) c_long, @ptrFromInt(181));
pub const strncmp = @as(*const fn ([*c]const u8, u32, [*c]const u8) c_long, @ptrFromInt(182));
pub const get_func_arg = @as(*const fn (?*anyopaque, u32, [*c]u64) c_long, @ptrFromInt(183));
pub const get_func_ret = @as(*const fn (?*anyopaque, [*c]u64) c_long, @ptrFromInt(184));
pub const get_func_arg_cnt = @as(*const fn (?*anyopaque) c_long, @ptrFromInt(185));
pub const get_retval = @as(*const fn () c_int, @ptrFromInt(186));
pub const set_retval = @as(*const fn (c_int) c_int, @ptrFromInt(187));
pub const xdp_get_buff_len = @as(*const fn (?*kern.XdpMd) u64, @ptrFromInt(188));
pub const xdp_load_bytes = @as(*const fn (?*kern.XdpMd, u32, ?*anyopaque, u32) c_long, @ptrFromInt(189));
pub const xdp_store_bytes = @as(*const fn (?*kern.XdpMd, u32, ?*anyopaque, u32) c_long, @ptrFromInt(190));
pub const copy_from_user_task = @as(*const fn (?*anyopaque, u32, ?*const anyopaque, ?*kern.Task, u64) c_long, @ptrFromInt(191));
pub const skb_set_tstamp = @as(*const fn (?*kern.SkBuff, u64, u32) c_long, @ptrFromInt(192));
pub const ima_file_hash = @as(*const fn (?*kern.File, ?*anyopaque, u32) c_long, @ptrFromInt(193));
pub const kptr_xchg = @as(*const fn (?*anyopaque, ?*anyopaque) ?*anyopaque, @ptrFromInt(194));
pub const map_lookup_percpu_elem = @as(*const fn (?*anyopaque, ?*const anyopaque, u32) ?*anyopaque, @ptrFromInt(195));
pub const skc_to_mptcp_sock = @as(*const fn (?*anyopaque) ?*kern.MpTcpSock, @ptrFromInt(196));
pub const dynptr_from_mem = @as(*const fn (?*anyopaque, u32, u64, ?*kern.BpfDynPtr) c_long, @ptrFromInt(197));
pub const ringbuf_reserve_dynptr = @as(*const fn (?*anyopaque, u32, u64, ?*kern.BpfDynPtr) c_long, @ptrFromInt(198));
pub const ringbuf_submit_dynptr = @as(*const fn (?*kern.BpfDynPtr, u64) void, @ptrFromInt(199));
pub const ringbuf_discard_dynptr = @as(*const fn (?*kern.BpfDynPtr, u64) void, @ptrFromInt(200));
pub const dynptr_read = @as(*const fn (?*anyopaque, u32, ?*kern.BpfDynPtr, u32, u64) c_long, @ptrFromInt(201));
pub const dynptr_write = @as(*const fn (?*kern.BpfDynPtr, u32, ?*anyopaque, u32, u64) c_long, @ptrFromInt(202));
pub const dynptr_data = @as(*const fn (?*kern.BpfDynPtr, u32, u32) ?*anyopaque, @ptrFromInt(203));
pub const tcp_raw_gen_syncookie_ipv4 = @as(*const fn (?*kern.IpHdr, ?*TcpHdr, u32) i64, @ptrFromInt(204));
pub const tcp_raw_gen_syncookie_ipv6 = @as(*const fn (?*kern.Ipv6Hdr, ?*TcpHdr, u32) i64, @ptrFromInt(205));
pub const tcp_raw_check_syncookie_ipv4 = @as(*const fn (?*kern.IpHdr, ?*TcpHdr) c_long, @ptrFromInt(206));
pub const tcp_raw_check_syncookie_ipv6 = @as(*const fn (?*kern.Ipv6Hdr, ?*TcpHdr) c_long, @ptrFromInt(207));
pub const ktime_get_tai_ns = @as(*const fn () u64, @ptrFromInt(208));
pub const user_ringbuf_drain = @as(*const fn (?*anyopaque, ?*anyopaque, ?*anyopaque, u64) c_long, @ptrFromInt(209));

View File

@ -8,10 +8,22 @@ const in_bpf_program = switch (builtin.cpu.arch) {
pub const helpers = if (in_bpf_program) @import("helpers.zig") else struct {};
pub const BinPrm = opaque {};
pub const BTFPtr = opaque {};
pub const BpfDynPtr = opaque {};
pub const BpfRedirNeigh = opaque {};
pub const BpfSock = opaque {};
pub const BpfSockAddr = opaque {};
pub const BpfSockOps = opaque {};
pub const BpfTimer = opaque {};
pub const FibLookup = opaque {};
pub const File = opaque {};
pub const Inode = opaque {};
pub const IpHdr = opaque {};
pub const Ipv6Hdr = opaque {};
pub const MapDef = opaque {};
pub const MpTcpSock = opaque {};
pub const Path = opaque {};
pub const PerfEventData = opaque {};
pub const PerfEventValue = opaque {};
pub const PidNsInfo = opaque {};
@ -20,16 +32,19 @@ pub const SkBuff = opaque {};
pub const SkMsgMd = opaque {};
pub const SkReusePortMd = opaque {};
pub const Sock = opaque {};
pub const Socket = opaque {};
pub const SockAddr = opaque {};
pub const SockOps = opaque {};
pub const SockTuple = opaque {};
pub const SpinLock = opaque {};
pub const SysCtl = opaque {};
pub const Task = opaque {};
pub const Tcp6Sock = opaque {};
pub const TcpRequestSock = opaque {};
pub const TcpSock = opaque {};
pub const TcpTimewaitSock = opaque {};
pub const TunnelKey = opaque {};
pub const Udp6Sock = opaque {};
pub const UnixSock = opaque {};
pub const XdpMd = opaque {};
pub const XfrmState = opaque {};