#include <linux/vmw_vmci_defs.h>
#include <linux/vmw_vmci_api.h>
#include <linux/miscdevice.h>
#include <linux/interrupt.h>
#include <linux/highmem.h>
#include <linux/atomic.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/sched.h>
#include <linux/cred.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/pci.h>
#include <linux/smp.h>
#include <linux/fs.h>
#include <linux/io.h>
#include "vmci_handle_array.h"
#include "vmci_queue_pair.h"
#include "vmci_datagram.h"
#include "vmci_doorbell.h"
#include "vmci_resource.h"
#include "vmci_context.h"
#include "vmci_driver.h"
#include "vmci_event.h"
#define VMCI_UTIL_NUM_RESOURCES …
enum { … };
enum { … };
struct vmci_init_blk { … };
struct vmci_qp_alloc_info_vmvm { … };
struct vmci_set_notify_info { … };
struct vmci_host_dev { … };
static struct vmci_ctx *host_context;
static bool vmci_host_device_initialized;
static atomic_t vmci_host_active_users = …;
bool vmci_host_code_active(void)
{ … }
int vmci_host_users(void)
{ … }
static int vmci_host_open(struct inode *inode, struct file *filp)
{ … }
static int vmci_host_close(struct inode *inode, struct file *filp)
{ … }
static __poll_t vmci_host_poll(struct file *filp, poll_table *wait)
{ … }
static int drv_cp_harray_to_user(void __user *user_buf_uva,
u64 *user_buf_size,
struct vmci_handle_arr *handle_array,
int *retval)
{ … }
static int vmci_host_setup_notify(struct vmci_ctx *context,
unsigned long uva)
{ … }
static int vmci_host_get_version(struct vmci_host_dev *vmci_host_dev,
unsigned int cmd, void __user *uptr)
{ … }
#define vmci_ioctl_err(fmt, ...) …
static int vmci_host_do_init_context(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_send_datagram(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_receive_datagram(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_alloc_queuepair(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_queuepair_setva(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_queuepair_setpf(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_qp_detach(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_ctx_add_notify(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_ctx_remove_notify(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_ctx_get_cpt_state(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_ctx_set_cpt_state(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_get_context_id(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_set_notify(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_notify_resource(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static int vmci_host_do_recv_notifications(struct vmci_host_dev *vmci_host_dev,
const char *ioctl_name,
void __user *uptr)
{ … }
static long vmci_host_unlocked_ioctl(struct file *filp,
unsigned int iocmd, unsigned long ioarg)
{ … }
static const struct file_operations vmuser_fops = …;
static struct miscdevice vmci_host_miscdev = …;
int __init vmci_host_init(void)
{ … }
void __exit vmci_host_exit(void)
{ … }