Path: blob/master/tools/testing/selftests/bpf/bpf_kfuncs.h
29270 views
#ifndef __BPF_KFUNCS__1#define __BPF_KFUNCS__23struct bpf_sock_addr_kern;45/* Description6* Initializes an skb-type dynptr7* Returns8* Error code9*/10extern int bpf_dynptr_from_skb(struct __sk_buff *skb, __u64 flags,11struct bpf_dynptr *ptr__uninit) __ksym __weak;1213/* Description14* Initializes an xdp-type dynptr15* Returns16* Error code17*/18extern int bpf_dynptr_from_xdp(struct xdp_md *xdp, __u64 flags,19struct bpf_dynptr *ptr__uninit) __ksym __weak;2021extern int bpf_dynptr_from_skb_meta(struct __sk_buff *skb, __u64 flags,22struct bpf_dynptr *ptr__uninit) __ksym __weak;2324/* Description25* Obtain a read-only pointer to the dynptr's data26* Returns27* Either a direct pointer to the dynptr data or a pointer to the user-provided28* buffer if unable to obtain a direct pointer29*/30extern void *bpf_dynptr_slice(const struct bpf_dynptr *ptr, __u32 offset,31void *buffer, __u32 buffer__szk) __ksym __weak;3233/* Description34* Obtain a read-write pointer to the dynptr's data35* Returns36* Either a direct pointer to the dynptr data or a pointer to the user-provided37* buffer if unable to obtain a direct pointer38*/39extern void *bpf_dynptr_slice_rdwr(const struct bpf_dynptr *ptr, __u32 offset,40void *buffer, __u32 buffer__szk) __ksym __weak;4142extern int bpf_dynptr_adjust(const struct bpf_dynptr *ptr, __u32 start, __u32 end) __ksym __weak;43extern bool bpf_dynptr_is_null(const struct bpf_dynptr *ptr) __ksym __weak;44extern bool bpf_dynptr_is_rdonly(const struct bpf_dynptr *ptr) __ksym __weak;45extern __u32 bpf_dynptr_size(const struct bpf_dynptr *ptr) __ksym __weak;46extern int bpf_dynptr_clone(const struct bpf_dynptr *ptr, struct bpf_dynptr *clone__init) __ksym __weak;4748/* Description49* Modify the address of a AF_UNIX sockaddr.50* Returns51* -EINVAL if the address size is too big or, 0 if the sockaddr was successfully modified.52*/53extern int bpf_sock_addr_set_sun_path(struct bpf_sock_addr_kern *sa_kern,54const __u8 *sun_path, __u32 sun_path__sz) __ksym;5556/* Description57* Allocate and configure a reqsk and link it with a listener and skb.58* Returns59* Error code60*/61struct sock;62struct bpf_tcp_req_attrs;63extern int bpf_sk_assign_tcp_reqsk(struct __sk_buff *skb, struct sock *sk,64struct bpf_tcp_req_attrs *attrs, int attrs__sz) __ksym;6566void *bpf_cast_to_kern_ctx(void *) __ksym;6768extern void *bpf_rdonly_cast(const void *obj, __u32 btf_id) __ksym __weak;6970extern int bpf_get_file_xattr(struct file *file, const char *name,71struct bpf_dynptr *value_ptr) __ksym;72extern int bpf_get_fsverity_digest(struct file *file, struct bpf_dynptr *digest_ptr) __ksym;7374extern struct bpf_key *bpf_lookup_user_key(__s32 serial, __u64 flags) __ksym;75extern struct bpf_key *bpf_lookup_system_key(__u64 id) __ksym;76extern void bpf_key_put(struct bpf_key *key) __ksym;77extern int bpf_verify_pkcs7_signature(struct bpf_dynptr *data_ptr,78struct bpf_dynptr *sig_ptr,79struct bpf_key *trusted_keyring) __ksym;8081extern bool bpf_session_is_return(void) __ksym __weak;82extern __u64 *bpf_session_cookie(void) __ksym __weak;8384struct dentry;85/* Description86* Returns xattr of a dentry87* Returns88* Error code89*/90extern int bpf_get_dentry_xattr(struct dentry *dentry, const char *name,91struct bpf_dynptr *value_ptr) __ksym __weak;9293extern int bpf_set_dentry_xattr(struct dentry *dentry, const char *name__str,94const struct bpf_dynptr *value_p, int flags) __ksym __weak;95extern int bpf_remove_dentry_xattr(struct dentry *dentry, const char *name__str) __ksym __weak;9697#endif9899100