// SPDX-License-Identifier: GPL-2.0-only/* * Event char devices, giving access to raw input device events. * * Copyright (c) 1999-2002 Vojtech Pavlik */#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt#define EVDEV_MINOR_BASE 64#define EVDEV_MINORS 32#define EVDEV_MIN_BUFFER_SIZE 64U#define EVDEV_BUF_PACKETS 8#include<linux/poll.h>#include<linux/sched.h>#include<linux/slab.h>#include<linux/vmalloc.h>#include<linux/mm.h>#include<linux/module.h>#include<linux/init.h>#include<linux/input/mt.h>#include<linux/major.h>#include<linux/device.h>#include<linux/cdev.h>#include"input-compat.h"structevdev{intopen;structinput_handlehandle;wait_queue_head_twait;structevdev_client__rcu*grab;structlist_headclient_list;spinlock_tclient_lock;/* protects client_list */structmutexmutex;structdevicedev;structcdevcdev;boolexist;};structevdev_client{unsignedinthead;unsignedinttail;unsignedintpacket_head;/* [future] position of the first element of next packet */spinlock_tbuffer_lock;/* protects access to buffer, head and tail */structfasync_struct*fasync;structevdev*evdev;structlist_headnode;enuminput_clock_typeclk_type;boolrevoked;unsignedlong*evmasks[EV_CNT];unsignedintbufsize;structinput_eventbuffer[];};staticsize_t