On Fri, Mar 4, 2022 at 9:31 AM Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx> wrote: > [...] > +#endif > + > +static inline bool bpf_hid_link_empty(struct bpf_hid *bpf, > + enum bpf_hid_attach_type type) > +{ > + return list_empty(&bpf->links[type]); > +} > + > +struct bpf_hid_hooks { > + struct hid_device *(*hdev_from_fd)(int fd); > + int (*link_attach)(struct hid_device *hdev, enum bpf_hid_attach_type type); > + void (*array_detached)(struct hid_device *hdev, enum bpf_hid_attach_type type); shall we call this array_detach()? detached sounds like a function that checks the status of link/hook. [...] > --- /dev/null > +++ b/kernel/bpf/hid.c > @@ -0,0 +1,437 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * based on kernel/bpf/net-namespace.c > + */ I guess we don't need this comment. > + > +#include <linux/bpf.h> > +#include <linux/bpf-hid.h> > +#include <linux/filter.h> > +#include <linux/hid.h> > +#include <linux/hidraw.h> [...]