newsock->sk = sk_alloc(sock_net(sock->sk), PF_INET, GFP_KERNEL, &pvcalls_proto, false);
#include <linux/module.h>
#include <linux/socket.h>
#include <xen/grant_table.h>
#include <xen/interface/io/pvcalls.h>
#include "pvcalls-front.h"
#define PVCALLS_INVALID_ID UINT_MAX
#define PVCALLS_RING_ORDER XENBUS_MAX_RING_GRANT_ORDER
#define PVCALLS_NR_RSP_PER_RING __CONST_RING_SIZE(xen_pvcalls, XEN_PAGE_SIZE)
#define PVCALLS_FRONT_MAX_SPIN 5000
static struct proto pvcalls_proto = {
.obj_size = sizeof(struct sock),
struct xen_pvcalls_front_ring ring;
struct list_head socket_mappings;
wait_queue_head_t inflight_req;
struct xen_pvcalls_response rsp[PVCALLS_NR_RSP_PER_RING];
static struct xenbus_device *pvcalls_front_dev;
static atomic_t pvcalls_refcount;
#define pvcalls_enter() { \
atomic_inc(&pvcalls_refcount); \
#define pvcalls_exit() { \
atomic_dec(&pvcalls_refcount); \