#define pr_fmt(fmt) …
#include <linux/bitops.h>
#include <linux/btf.h>
#include <linux/btf_ids.h>
#include <linux/filter.h>
#include <linux/hid.h>
#include <linux/hid_bpf.h>
#include <linux/init.h>
#include <linux/kfifo.h>
#include <linux/minmax.h>
#include <linux/module.h>
#include "hid_bpf_dispatch.h"
struct hid_ops *hid_ops;
EXPORT_SYMBOL(…);
u8 *
dispatch_hid_bpf_device_event(struct hid_device *hdev, enum hid_report_type type, u8 *data,
u32 *size, int interrupt, u64 source, bool from_bpf)
{ … }
EXPORT_SYMBOL_GPL(…);
int dispatch_hid_bpf_raw_requests(struct hid_device *hdev,
unsigned char reportnum, u8 *buf,
u32 size, enum hid_report_type rtype,
enum hid_class_request reqtype,
u64 source, bool from_bpf)
{ … }
EXPORT_SYMBOL_GPL(…);
int dispatch_hid_bpf_output_report(struct hid_device *hdev,
__u8 *buf, u32 size, u64 source,
bool from_bpf)
{ … }
EXPORT_SYMBOL_GPL(…);
u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, const u8 *rdesc, unsigned int *size)
{ … }
EXPORT_SYMBOL_GPL(…);
static int device_match_id(struct device *dev, const void *id)
{ … }
struct hid_device *hid_get_device(unsigned int hid_id)
{ … }
void hid_put_device(struct hid_device *hid)
{ … }
static int __hid_bpf_allocate_data(struct hid_device *hdev, u8 **data, u32 *size)
{ … }
int hid_bpf_allocate_event_data(struct hid_device *hdev)
{ … }
int hid_bpf_reconnect(struct hid_device *hdev)
{ … }
__bpf_kfunc_start_defs();
__bpf_kfunc __u8 *
hid_bpf_get_data(struct hid_bpf_ctx *ctx, unsigned int offset, const size_t rdwr_buf_size)
{ … }
__bpf_kfunc struct hid_bpf_ctx *
hid_bpf_allocate_context(unsigned int hid_id)
{ … }
__bpf_kfunc void
hid_bpf_release_context(struct hid_bpf_ctx *ctx)
{ … }
static int
__hid_bpf_hw_check_params(struct hid_bpf_ctx *ctx, __u8 *buf, size_t *buf__sz,
enum hid_report_type rtype)
{ … }
__bpf_kfunc int
hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz,
enum hid_report_type rtype, enum hid_class_request reqtype)
{ … }
__bpf_kfunc int
hid_bpf_hw_output_report(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz)
{ … }
static int
__hid_bpf_input_report(struct hid_bpf_ctx *ctx, enum hid_report_type type, u8 *buf,
size_t size, bool lock_already_taken)
{ … }
__bpf_kfunc int
hid_bpf_try_input_report(struct hid_bpf_ctx *ctx, enum hid_report_type type, u8 *buf,
const size_t buf__sz)
{ … }
__bpf_kfunc int
hid_bpf_input_report(struct hid_bpf_ctx *ctx, enum hid_report_type type, u8 *buf,
const size_t buf__sz)
{ … }
__bpf_kfunc_end_defs();
BTF_KFUNCS_START(hid_bpf_kfunc_ids)
BTF_ID_FLAGS(…)
BTF_ID_FLAGS(…)
BTF_ID_FLAGS(…)
BTF_ID_FLAGS(…)
BTF_ID_FLAGS(…)
BTF_ID_FLAGS(…)
BTF_ID_FLAGS(…)
BTF_KFUNCS_END(…)
static const struct btf_kfunc_id_set hid_bpf_kfunc_set = …;
BTF_KFUNCS_START(hid_bpf_syscall_kfunc_ids)
BTF_ID_FLAGS(…)
BTF_ID_FLAGS(…)
BTF_ID_FLAGS(…)
BTF_ID_FLAGS(…)
BTF_ID_FLAGS(…)
BTF_KFUNCS_END(…)
static const struct btf_kfunc_id_set hid_bpf_syscall_kfunc_set = …;
int hid_bpf_connect_device(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
void hid_bpf_disconnect_device(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
void hid_bpf_destroy_device(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
int hid_bpf_device_init(struct hid_device *hdev)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __init hid_bpf_init(void)
{ … }
late_initcall(hid_bpf_init);
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;