Re: [PATCH hid v11 02/14] HID: initial BPF implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 25, 2022 at 11:34:46AM +0200, Benjamin Tissoires wrote:
>  include/linux/hid.h                           |   5 +
>  include/linux/hid_bpf.h                       | 102 +++
>  include/uapi/linux/hid_bpf.h                  |  25 +
>  tools/include/uapi/linux/hid.h                |  62 ++
>  tools/include/uapi/linux/hid_bpf.h            |  25 +

...

> +++ b/include/linux/hid_bpf.h
> @@ -0,0 +1,102 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +
> +#ifndef __HID_BPF_H
> +#define __HID_BPF_H
> +
> +#include <linux/spinlock.h>
> +#include <uapi/linux/hid.h>
> +#include <uapi/linux/hid_bpf.h>
> +
> +struct hid_device;
> +
> +/*
> + * The following is the HID BPF API.
> + *
> + * It should be treated as UAPI, so extra care is required
> + * when making change to this file.
> + */

I thought at the maintainer summit we discussed that it shouldn't be
treated as uapi. There is no need to draw this line right now.
If the whole concept turns out to be useful and api is stable
then promote it.

> +++ b/include/uapi/linux/hid_bpf.h
> @@ -0,0 +1,25 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +
> +#ifndef _UAPI_HID_BPF_H
> +#define _UAPI_HID_BPF_H
> +
> +#include <linux/const.h>
> +#include <linux/hid.h>
> +
> +/**
> + * enum hid_bpf_attach_flags - flags used when attaching a HIF-BPF program
> + *
> + * @HID_BPF_FLAG_NONE: no specific flag is used, the kernel choses where to
> + *                     insert the program
> + * @HID_BPF_FLAG_INSERT_HEAD: insert the given program before any other program
> + *                            currently attached to the device. This doesn't
> + *                            guarantee that this program will always be first
> + * @HID_BPF_FLAG_MAX: sentinel value, not to be used by the callers
> + */
> +enum hid_bpf_attach_flags {
> +	HID_BPF_FLAG_NONE = 0,
> +	HID_BPF_FLAG_INSERT_HEAD = _BITUL(0),
> +	HID_BPF_FLAG_MAX,
> +};
> +
> +#endif /* _UAPI_HID_BPF_H */

Not sure what is the purpose of this uapi file.
Since it's enum the progs can get it from vmlinux.h.

> diff --git a/tools/include/uapi/linux/hid.h b/tools/include/uapi/linux/hid.h
> new file mode 100644
> index 000000000000..3e63bea3b3e2
> --- /dev/null
> +++ b/tools/include/uapi/linux/hid.h
> @@ -0,0 +1,62 @@
> +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
> +/*
> + *  Copyright (c) 1999 Andreas Gal
> + *  Copyright (c) 2000-2001 Vojtech Pavlik
> + *  Copyright (c) 2006-2007 Jiri Kosina
> + */
> +#ifndef _UAPI__HID_H
> +#define _UAPI__HID_H

This is a copy of include/uapi/linux/hid.h ?
Probably should be a separate commit to make it obvious.



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux