#include <linux/kernel.h>
#include <linux/sched/signal.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/export.h>
#include <linux/usb.h>
#include <linux/poll.h>
#include <linux/compat.h>
#include <linux/mm.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/time64.h>
#include <linux/uaccess.h>
#include "usb_mon.h"
#define SETUP_LEN …
#define MON_IOC_MAGIC …
#define MON_IOCQ_URB_LEN …
#define MON_IOCG_STATS …
#define MON_IOCT_RING_SIZE …
#define MON_IOCQ_RING_SIZE …
#define MON_IOCX_GET …
#define MON_IOCX_MFETCH …
#define MON_IOCH_MFLUSH …
#define MON_IOCX_GETX …
#ifdef CONFIG_COMPAT
#define MON_IOCX_GET32 …
#define MON_IOCX_MFETCH32 …
#define MON_IOCX_GETX32 …
#endif
#define CHUNK_SIZE …
#define CHUNK_ALIGN(x) …
#define BUFF_MAX …
#define BUFF_DFL …
#define BUFF_MIN …
struct mon_bin_hdr { … };
struct mon_bin_isodesc { … };
struct mon_bin_stats { … };
struct mon_bin_get { … };
struct mon_bin_mfetch { … };
#ifdef CONFIG_COMPAT
struct mon_bin_get32 { … };
struct mon_bin_mfetch32 { … };
#endif
#define PKT_ALIGN …
#define PKT_SIZE …
#define PKT_SZ_API0 …
#define PKT_SZ_API1 …
#define ISODESC_MAX …
#define MON_BIN_MAX_MINOR …
struct mon_pgmap { … };
struct mon_reader_bin { … };
static inline struct mon_bin_hdr *MON_OFF2HDR(const struct mon_reader_bin *rp,
unsigned int offset)
{ … }
#define MON_RING_EMPTY(rp) …
static unsigned char xfer_to_pipe[4] = …;
static const struct class mon_bin_class = …;
static dev_t mon_bin_dev0;
static struct cdev mon_bin_cdev;
static void mon_buff_area_fill(const struct mon_reader_bin *rp,
unsigned int offset, unsigned int size);
static int mon_bin_wait_event(struct file *file, struct mon_reader_bin *rp);
static int mon_alloc_buff(struct mon_pgmap *map, int npages);
static void mon_free_buff(struct mon_pgmap *map, int npages);
static unsigned int mon_copy_to_buff(const struct mon_reader_bin *this,
unsigned int off, const unsigned char *from, unsigned int length)
{ … }
static int copy_from_buf(const struct mon_reader_bin *this, unsigned int off,
char __user *to, int length)
{ … }
static unsigned int mon_buff_area_alloc(struct mon_reader_bin *rp,
unsigned int size)
{ … }
static unsigned int mon_buff_area_alloc_contiguous(struct mon_reader_bin *rp,
unsigned int size)
{ … }
static void mon_buff_area_shrink(struct mon_reader_bin *rp, unsigned int size)
{ … }
static void mon_buff_area_free(struct mon_reader_bin *rp, unsigned int size)
{ … }
static void mon_buff_area_fill(const struct mon_reader_bin *rp,
unsigned int offset, unsigned int size)
{ … }
static inline char mon_bin_get_setup(unsigned char *setupb,
const struct urb *urb, char ev_type)
{ … }
static unsigned int mon_bin_get_data(const struct mon_reader_bin *rp,
unsigned int offset, struct urb *urb, unsigned int length,
char *flag)
{ … }
static unsigned int mon_bin_collate_isodesc(const struct mon_reader_bin *rp,
struct urb *urb, unsigned int ndesc)
{ … }
static void mon_bin_get_isodesc(const struct mon_reader_bin *rp,
unsigned int offset, struct urb *urb, char ev_type, unsigned int ndesc)
{ … }
static void mon_bin_event(struct mon_reader_bin *rp, struct urb *urb,
char ev_type, int status)
{ … }
static void mon_bin_submit(void *data, struct urb *urb)
{ … }
static void mon_bin_complete(void *data, struct urb *urb, int status)
{ … }
static void mon_bin_error(void *data, struct urb *urb, int error)
{ … }
static int mon_bin_open(struct inode *inode, struct file *file)
{ … }
static int mon_bin_get_event(struct file *file, struct mon_reader_bin *rp,
struct mon_bin_hdr __user *hdr, unsigned int hdrbytes,
void __user *data, unsigned int nbytes)
{ … }
static int mon_bin_release(struct inode *inode, struct file *file)
{ … }
static ssize_t mon_bin_read(struct file *file, char __user *buf,
size_t nbytes, loff_t *ppos)
{ … }
static int mon_bin_flush(struct mon_reader_bin *rp, unsigned nevents)
{ … }
static int mon_bin_fetch(struct file *file, struct mon_reader_bin *rp,
u32 __user *vec, unsigned int max)
{ … }
static int mon_bin_queued(struct mon_reader_bin *rp)
{ … }
static long mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
#ifdef CONFIG_COMPAT
static long mon_bin_compat_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{ … }
#endif
static __poll_t
mon_bin_poll(struct file *file, struct poll_table_struct *wait)
{ … }
static void mon_bin_vma_open(struct vm_area_struct *vma)
{ … }
static void mon_bin_vma_close(struct vm_area_struct *vma)
{ … }
static vm_fault_t mon_bin_vma_fault(struct vm_fault *vmf)
{ … }
static const struct vm_operations_struct mon_bin_vm_ops = …;
static int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma)
{ … }
static const struct file_operations mon_fops_binary = …;
static int mon_bin_wait_event(struct file *file, struct mon_reader_bin *rp)
{ … }
static int mon_alloc_buff(struct mon_pgmap *map, int npages)
{ … }
static void mon_free_buff(struct mon_pgmap *map, int npages)
{ … }
int mon_bin_add(struct mon_bus *mbus, const struct usb_bus *ubus)
{ … }
void mon_bin_del(struct mon_bus *mbus)
{ … }
int __init mon_bin_init(void)
{ … }
void mon_bin_exit(void)
{ … }