#include <linux/compat.h>
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/cred.h>
#include <linux/errqueue.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/sched/signal.h>
#include <linux/kmod.h>
#include <linux/list.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/net.h>
#include <linux/poll.h>
#include <linux/random.h>
#include <linux/skbuff.h>
#include <linux/smp.h>
#include <linux/socket.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
#include <net/sock.h>
#include <net/af_vsock.h>
#include <uapi/linux/vm_sockets.h>
static int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr);
static void vsock_sk_destruct(struct sock *sk);
static int vsock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
struct proto vsock_proto = …;
#define VSOCK_DEFAULT_CONNECT_TIMEOUT …
#define VSOCK_DEFAULT_BUFFER_SIZE …
#define VSOCK_DEFAULT_BUFFER_MAX_SIZE …
#define VSOCK_DEFAULT_BUFFER_MIN_SIZE …
static const struct vsock_transport *transport_h2g;
static const struct vsock_transport *transport_g2h;
static const struct vsock_transport *transport_dgram;
static const struct vsock_transport *transport_local;
static DEFINE_MUTEX(vsock_register_mutex);
#define MAX_PORT_RETRIES …
#define VSOCK_HASH(addr) …
#define vsock_bound_sockets(addr) …
#define vsock_unbound_sockets …
#define VSOCK_CONN_HASH(src, dst) …
#define vsock_connected_sockets(src, dst) …
#define vsock_connected_sockets_vsk(vsk) …
struct list_head vsock_bind_table[VSOCK_HASH_SIZE + 1];
EXPORT_SYMBOL_GPL(…);
struct list_head vsock_connected_table[VSOCK_HASH_SIZE];
EXPORT_SYMBOL_GPL(…);
DEFINE_SPINLOCK(…);
EXPORT_SYMBOL_GPL(…);
static int vsock_auto_bind(struct vsock_sock *vsk)
{ … }
static void vsock_init_tables(void)
{ … }
static void __vsock_insert_bound(struct list_head *list,
struct vsock_sock *vsk)
{ … }
static void __vsock_insert_connected(struct list_head *list,
struct vsock_sock *vsk)
{ … }
static void __vsock_remove_bound(struct vsock_sock *vsk)
{ … }
static void __vsock_remove_connected(struct vsock_sock *vsk)
{ … }
static struct sock *__vsock_find_bound_socket(struct sockaddr_vm *addr)
{ … }
static struct sock *__vsock_find_connected_socket(struct sockaddr_vm *src,
struct sockaddr_vm *dst)
{ … }
static void vsock_insert_unbound(struct vsock_sock *vsk)
{ … }
void vsock_insert_connected(struct vsock_sock *vsk)
{ … }
EXPORT_SYMBOL_GPL(…);
void vsock_remove_bound(struct vsock_sock *vsk)
{ … }
EXPORT_SYMBOL_GPL(…);
void vsock_remove_connected(struct vsock_sock *vsk)
{ … }
EXPORT_SYMBOL_GPL(…);
struct sock *vsock_find_bound_socket(struct sockaddr_vm *addr)
{ … }
EXPORT_SYMBOL_GPL(…);
struct sock *vsock_find_connected_socket(struct sockaddr_vm *src,
struct sockaddr_vm *dst)
{ … }
EXPORT_SYMBOL_GPL(…);
void vsock_remove_sock(struct vsock_sock *vsk)
{ … }
EXPORT_SYMBOL_GPL(…);
void vsock_for_each_connected_socket(struct vsock_transport *transport,
void (*fn)(struct sock *sk))
{ … }
EXPORT_SYMBOL_GPL(…);
void vsock_add_pending(struct sock *listener, struct sock *pending)
{ … }
EXPORT_SYMBOL_GPL(…);
void vsock_remove_pending(struct sock *listener, struct sock *pending)
{ … }
EXPORT_SYMBOL_GPL(…);
void vsock_enqueue_accept(struct sock *listener, struct sock *connected)
{ … }
EXPORT_SYMBOL_GPL(…);
static bool vsock_use_local_transport(unsigned int remote_cid)
{ … }
static void vsock_deassign_transport(struct vsock_sock *vsk)
{ … }
int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
{ … }
EXPORT_SYMBOL_GPL(…);
bool vsock_find_cid(unsigned int cid)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct sock *vsock_dequeue_accept(struct sock *listener)
{ … }
static bool vsock_is_accept_queue_empty(struct sock *sk)
{ … }
static bool vsock_is_pending(struct sock *sk)
{ … }
static int vsock_send_shutdown(struct sock *sk, int mode)
{ … }
static void vsock_pending_work(struct work_struct *work)
{ … }
static int __vsock_bind_connectible(struct vsock_sock *vsk,
struct sockaddr_vm *addr)
{ … }
static int __vsock_bind_dgram(struct vsock_sock *vsk,
struct sockaddr_vm *addr)
{ … }
static int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr)
{ … }
static void vsock_connect_timeout(struct work_struct *work);
static struct sock *__vsock_create(struct net *net,
struct socket *sock,
struct sock *parent,
gfp_t priority,
unsigned short type,
int kern)
{ … }
static bool sock_type_connectible(u16 type)
{ … }
static void __vsock_release(struct sock *sk, int level)
{ … }
static void vsock_sk_destruct(struct sock *sk)
{ … }
static int vsock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
{ … }
struct sock *vsock_create_connected(struct sock *parent)
{ … }
EXPORT_SYMBOL_GPL(…);
s64 vsock_stream_has_data(struct vsock_sock *vsk)
{ … }
EXPORT_SYMBOL_GPL(…);
s64 vsock_connectible_has_data(struct vsock_sock *vsk)
{ … }
EXPORT_SYMBOL_GPL(…);
s64 vsock_stream_has_space(struct vsock_sock *vsk)
{ … }
EXPORT_SYMBOL_GPL(…);
void vsock_data_ready(struct sock *sk)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vsock_release(struct socket *sock)
{ … }
static int
vsock_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
{ … }
static int vsock_getname(struct socket *sock,
struct sockaddr *addr, int peer)
{ … }
static int vsock_shutdown(struct socket *sock, int mode)
{ … }
static __poll_t vsock_poll(struct file *file, struct socket *sock,
poll_table *wait)
{ … }
static int vsock_read_skb(struct sock *sk, skb_read_actor_t read_actor)
{ … }
static int vsock_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
size_t len)
{ … }
static int vsock_dgram_connect(struct socket *sock,
struct sockaddr *addr, int addr_len, int flags)
{ … }
int vsock_dgram_recvmsg(struct socket *sock, struct msghdr *msg,
size_t len, int flags)
{ … }
EXPORT_SYMBOL_GPL(…);
static const struct proto_ops vsock_dgram_ops = …;
static int vsock_transport_cancel_pkt(struct vsock_sock *vsk)
{ … }
static void vsock_connect_timeout(struct work_struct *work)
{ … }
static int vsock_connect(struct socket *sock, struct sockaddr *addr,
int addr_len, int flags)
{ … }
static int vsock_accept(struct socket *sock, struct socket *newsock,
struct proto_accept_arg *arg)
{ … }
static int vsock_listen(struct socket *sock, int backlog)
{ … }
static void vsock_update_buffer_size(struct vsock_sock *vsk,
const struct vsock_transport *transport,
u64 val)
{ … }
static int vsock_connectible_setsockopt(struct socket *sock,
int level,
int optname,
sockptr_t optval,
unsigned int optlen)
{ … }
static int vsock_connectible_getsockopt(struct socket *sock,
int level, int optname,
char __user *optval,
int __user *optlen)
{ … }
static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg,
size_t len)
{ … }
static int vsock_connectible_wait_data(struct sock *sk,
struct wait_queue_entry *wait,
long timeout,
struct vsock_transport_recv_notify_data *recv_data,
size_t target)
{ … }
static int __vsock_stream_recvmsg(struct sock *sk, struct msghdr *msg,
size_t len, int flags)
{ … }
static int __vsock_seqpacket_recvmsg(struct sock *sk, struct msghdr *msg,
size_t len, int flags)
{ … }
int
vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
int flags)
{ … }
EXPORT_SYMBOL_GPL(…);
static int vsock_set_rcvlowat(struct sock *sk, int val)
{ … }
static const struct proto_ops vsock_stream_ops = …;
static const struct proto_ops vsock_seqpacket_ops = …;
static int vsock_create(struct net *net, struct socket *sock,
int protocol, int kern)
{ … }
static const struct net_proto_family vsock_family_ops = …;
static long vsock_dev_do_ioctl(struct file *filp,
unsigned int cmd, void __user *ptr)
{ … }
static long vsock_dev_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg)
{ … }
#ifdef CONFIG_COMPAT
static long vsock_dev_compat_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg)
{ … }
#endif
static const struct file_operations vsock_device_ops = …;
static struct miscdevice vsock_device = …;
static int __init vsock_init(void)
{ … }
static void __exit vsock_exit(void)
{ … }
const struct vsock_transport *vsock_core_get_transport(struct vsock_sock *vsk)
{ … }
EXPORT_SYMBOL_GPL(…);
int vsock_core_register(const struct vsock_transport *t, int features)
{ … }
EXPORT_SYMBOL_GPL(…);
void vsock_core_unregister(const struct vsock_transport *t)
{ … }
EXPORT_SYMBOL_GPL(…);
module_init(…) …;
module_exit(vsock_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_VERSION(…) …;
MODULE_LICENSE(…) …;