brintos

brintos / linux-shallow public Read only

0
0
Text · 3.1 KiB · 2eb3483 Raw
91 lines · c
1#ifndef __BPF_KFUNCS__2#define __BPF_KFUNCS__3 4struct bpf_sock_addr_kern;5 6/* Description7 *  Initializes an skb-type dynptr8 * Returns9 *  Error code10 */11extern int bpf_dynptr_from_skb(struct __sk_buff *skb, __u64 flags,12    struct bpf_dynptr *ptr__uninit) __ksym __weak;13 14/* Description15 *  Initializes an xdp-type dynptr16 * Returns17 *  Error code18 */19extern int bpf_dynptr_from_xdp(struct xdp_md *xdp, __u64 flags,20			       struct bpf_dynptr *ptr__uninit) __ksym __weak;21 22/* Description23 *  Obtain a read-only pointer to the dynptr's data24 * Returns25 *  Either a direct pointer to the dynptr data or a pointer to the user-provided26 *  buffer if unable to obtain a direct pointer27 */28extern void *bpf_dynptr_slice(const struct bpf_dynptr *ptr, __u32 offset,29			      void *buffer, __u32 buffer__szk) __ksym __weak;30 31/* Description32 *  Obtain a read-write pointer to the dynptr's data33 * Returns34 *  Either a direct pointer to the dynptr data or a pointer to the user-provided35 *  buffer if unable to obtain a direct pointer36 */37extern void *bpf_dynptr_slice_rdwr(const struct bpf_dynptr *ptr, __u32 offset,38			      void *buffer, __u32 buffer__szk) __ksym __weak;39 40extern int bpf_dynptr_adjust(const struct bpf_dynptr *ptr, __u32 start, __u32 end) __ksym __weak;41extern bool bpf_dynptr_is_null(const struct bpf_dynptr *ptr) __ksym __weak;42extern bool bpf_dynptr_is_rdonly(const struct bpf_dynptr *ptr) __ksym __weak;43extern __u32 bpf_dynptr_size(const struct bpf_dynptr *ptr) __ksym __weak;44extern int bpf_dynptr_clone(const struct bpf_dynptr *ptr, struct bpf_dynptr *clone__init) __ksym __weak;45 46/* Description47 *  Modify the address of a AF_UNIX sockaddr.48 * Returns49 *  -EINVAL if the address size is too big or, 0 if the sockaddr was successfully modified.50 */51extern int bpf_sock_addr_set_sun_path(struct bpf_sock_addr_kern *sa_kern,52				      const __u8 *sun_path, __u32 sun_path__sz) __ksym;53 54/* Description55 *  Allocate and configure a reqsk and link it with a listener and skb.56 * Returns57 *  Error code58 */59struct sock;60struct bpf_tcp_req_attrs;61extern int bpf_sk_assign_tcp_reqsk(struct __sk_buff *skb, struct sock *sk,62				   struct bpf_tcp_req_attrs *attrs, int attrs__sz) __ksym;63 64void *bpf_cast_to_kern_ctx(void *) __ksym;65 66extern void *bpf_rdonly_cast(const void *obj, __u32 btf_id) __ksym __weak;67 68extern int bpf_get_file_xattr(struct file *file, const char *name,69			      struct bpf_dynptr *value_ptr) __ksym;70extern int bpf_get_fsverity_digest(struct file *file, struct bpf_dynptr *digest_ptr) __ksym;71 72extern struct bpf_key *bpf_lookup_user_key(__u32 serial, __u64 flags) __ksym;73extern struct bpf_key *bpf_lookup_system_key(__u64 id) __ksym;74extern void bpf_key_put(struct bpf_key *key) __ksym;75extern int bpf_verify_pkcs7_signature(struct bpf_dynptr *data_ptr,76				      struct bpf_dynptr *sig_ptr,77				      struct bpf_key *trusted_keyring) __ksym;78 79extern bool bpf_session_is_return(void) __ksym __weak;80extern __u64 *bpf_session_cookie(void) __ksym __weak;81 82struct dentry;83/* Description84 *  Returns xattr of a dentry85 * Returns86 *  Error code87 */88extern int bpf_get_dentry_xattr(struct dentry *dentry, const char *name,89			      struct bpf_dynptr *value_ptr) __ksym __weak;90#endif91