#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/compat.h>
#include <linux/miscdevice.h>
#include "vchiq_core.h"
#include "vchiq_ioctl.h"
#include "vchiq_arm.h"
#include "vchiq_debugfs.h"
static const char *const ioctl_names[] = …;
static_assert(…);
static void
user_service_free(void *userdata)
{ … }
static void close_delivered(struct user_service *user_service)
{ … }
struct vchiq_io_copy_callback_context { … };
static ssize_t vchiq_ioc_copy_element_data(void *context, void *dest,
size_t offset, size_t maxsize)
{ … }
static int
vchiq_ioc_queue_message(struct vchiq_instance *instance, unsigned int handle,
struct vchiq_element *elements, unsigned long count)
{ … }
static int vchiq_ioc_create_service(struct vchiq_instance *instance,
struct vchiq_create_service *args)
{ … }
static int vchiq_ioc_dequeue_message(struct vchiq_instance *instance,
struct vchiq_dequeue_message *args)
{ … }
static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
struct vchiq_queue_bulk_transfer *args,
enum vchiq_bulk_dir dir,
enum vchiq_bulk_mode __user *mode)
{ … }
static inline int vchiq_get_user_ptr(void __user **buf, void __user *ubuf, int index)
{ … }
struct vchiq_completion_data32 { … };
static int vchiq_put_completion(struct vchiq_completion_data __user *buf,
struct vchiq_completion_data *completion,
int index)
{ … }
static int vchiq_ioc_await_completion(struct vchiq_instance *instance,
struct vchiq_await_completion *args,
int __user *msgbufcountp)
{ … }
static long
vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
#if defined(CONFIG_COMPAT)
struct vchiq_service_params32 { … };
struct vchiq_create_service32 { … };
#define VCHIQ_IOC_CREATE_SERVICE32 …
static long
vchiq_compat_ioctl_create_service(struct file *file, unsigned int cmd,
struct vchiq_create_service32 __user *ptrargs32)
{ … }
struct vchiq_element32 { … };
struct vchiq_queue_message32 { … };
#define VCHIQ_IOC_QUEUE_MESSAGE32 …
static long
vchiq_compat_ioctl_queue_message(struct file *file,
unsigned int cmd,
struct vchiq_queue_message32 __user *arg)
{ … }
struct vchiq_queue_bulk_transfer32 { … };
#define VCHIQ_IOC_QUEUE_BULK_TRANSMIT32 …
#define VCHIQ_IOC_QUEUE_BULK_RECEIVE32 …
static long
vchiq_compat_ioctl_queue_bulk(struct file *file,
unsigned int cmd,
struct vchiq_queue_bulk_transfer32 __user *argp)
{ … }
struct vchiq_await_completion32 { … };
#define VCHIQ_IOC_AWAIT_COMPLETION32 …
static long
vchiq_compat_ioctl_await_completion(struct file *file,
unsigned int cmd,
struct vchiq_await_completion32 __user *argp)
{ … }
struct vchiq_dequeue_message32 { … };
#define VCHIQ_IOC_DEQUEUE_MESSAGE32 …
static long
vchiq_compat_ioctl_dequeue_message(struct file *file,
unsigned int cmd,
struct vchiq_dequeue_message32 __user *arg)
{ … }
struct vchiq_get_config32 { … };
#define VCHIQ_IOC_GET_CONFIG32 …
static long
vchiq_compat_ioctl_get_config(struct file *file,
unsigned int cmd,
struct vchiq_get_config32 __user *arg)
{ … }
static long
vchiq_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
#endif
static int vchiq_open(struct inode *inode, struct file *file)
{ … }
static int vchiq_release(struct inode *inode, struct file *file)
{ … }
static const struct file_operations
vchiq_fops = …;
static struct miscdevice vchiq_miscdev = …;
int vchiq_register_chrdev(struct device *parent)
{ … }
void vchiq_deregister_chrdev(void)
{ … }