#include <linux/module.h>
#include <linux/net.h>
#include <linux/socket.h>
#include <net/sock.h>
#include <xen/events.h>
#include <xen/grant_table.h>
#include <xen/xen.h>
#include <xen/xenbus.h>
#include <xen/interface/io/pvcalls.h>
#include "pvcalls-front.h"
#define PVCALLS_INVALID_ID …
#define PVCALLS_RING_ORDER …
#define PVCALLS_NR_RSP_PER_RING …
#define PVCALLS_FRONT_MAX_SPIN …
static struct proto pvcalls_proto = …;
struct pvcalls_bedata { … };
static struct xenbus_device *pvcalls_front_dev;
static atomic_t pvcalls_refcount;
#define pvcalls_enter() …
#define pvcalls_exit() …
struct sock_mapping { … };
static inline struct sock_mapping *pvcalls_enter_sock(struct socket *sock)
{ … }
static inline void pvcalls_exit_sock(struct socket *sock)
{ … }
static inline int get_request(struct pvcalls_bedata *bedata, int *req_id)
{ … }
static bool pvcalls_front_write_todo(struct sock_mapping *map)
{ … }
static bool pvcalls_front_read_todo(struct sock_mapping *map)
{ … }
static irqreturn_t pvcalls_front_event_handler(int irq, void *dev_id)
{ … }
static void free_active_ring(struct sock_mapping *map);
static void pvcalls_front_destroy_active(struct pvcalls_bedata *bedata,
struct sock_mapping *map)
{ … }
static void pvcalls_front_free_map(struct pvcalls_bedata *bedata,
struct sock_mapping *map)
{ … }
static irqreturn_t pvcalls_front_conn_handler(int irq, void *sock_map)
{ … }
int pvcalls_front_socket(struct socket *sock)
{ … }
static void free_active_ring(struct sock_mapping *map)
{ … }
static int alloc_active_ring(struct sock_mapping *map)
{ … }
static int create_active(struct sock_mapping *map, evtchn_port_t *evtchn)
{ … }
int pvcalls_front_connect(struct socket *sock, struct sockaddr *addr,
int addr_len, int flags)
{ … }
static int __write_ring(struct pvcalls_data_intf *intf,
struct pvcalls_data *data,
struct iov_iter *msg_iter,
int len)
{ … }
int pvcalls_front_sendmsg(struct socket *sock, struct msghdr *msg,
size_t len)
{ … }
static int __read_ring(struct pvcalls_data_intf *intf,
struct pvcalls_data *data,
struct iov_iter *msg_iter,
size_t len, int flags)
{ … }
int pvcalls_front_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
int flags)
{ … }
int pvcalls_front_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
{ … }
int pvcalls_front_listen(struct socket *sock, int backlog)
{ … }
int pvcalls_front_accept(struct socket *sock, struct socket *newsock, int flags)
{ … }
static __poll_t pvcalls_front_poll_passive(struct file *file,
struct pvcalls_bedata *bedata,
struct sock_mapping *map,
poll_table *wait)
{ … }
static __poll_t pvcalls_front_poll_active(struct file *file,
struct pvcalls_bedata *bedata,
struct sock_mapping *map,
poll_table *wait)
{ … }
__poll_t pvcalls_front_poll(struct file *file, struct socket *sock,
poll_table *wait)
{ … }
int pvcalls_front_release(struct socket *sock)
{ … }
static const struct xenbus_device_id pvcalls_front_ids[] = …;
static void pvcalls_front_remove(struct xenbus_device *dev)
{ … }
static int pvcalls_front_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id)
{ … }
static void pvcalls_front_changed(struct xenbus_device *dev,
enum xenbus_state backend_state)
{ … }
static struct xenbus_driver pvcalls_front_driver = …;
static int __init pvcalls_frontend_init(void)
{ … }
module_init(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;