summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/vsock/vsock_vio.c
blob: be20e95677afcd298b76616bbc9106a140dbc0ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 * This file and its contents are supplied under the terms of the
 * Common Development and Distribution License ("CDDL"), version 1.0.
 * You may only use this file in accordance with the terms of version
 * 1.0 of the CDDL.
 *
 * A full copy of the text of the CDDL should have accompanied this
 * source.  A copy of the CDDL is also available via the Internet at
 * http://www.illumos.org/license/CDDL.
 */

/*
 * Copyright 2021 Joyent, Inc.
 */

/*
 * AF_VSOCK VIRTIO TRANSPORT 
 */

#include <sys/stropts.h>
#include <sys/stream.h>
#include <sys/strsubr.h>
#include <sys/modctl.h>
#include <sys/strsun.h>

#include "virtio.h"
#include "vsock.h"

static struct cb_ops vsock_vio_cb_ops = {
	.cb_rev			CB_REV,
	.cb_flags =		D_MP | D_NEW,

	.cb_open =		nulldev,
	.cb_close =		nulldev,
	.cb_strategy =		nodev,
	.cb_print =		nodev,
	.cb_dump =		nodev,
	.cb_read =		nodev,
	.cb_write =		nodev,
	.cb_ioctl =		nodev,
	.cb_devmap = 		nodev,
	.cb_mmap =		nodev,
	.cb_segmap =		nodev,
	.cb_chpoll =		nochpoll,
	.cb_prop_op =		ddi_prop_op,
	.cb_str =		NULL,
	.cb_aread =		nodev,
	.cb_awrite =		nodev,
};

statuc struct dev_ops vsock_vio_dev_ops = {
	.devo_rev =		DEVO_REV,
	.devo_refcnt = 		0,

	.devo_attach =		vsock_vio_attach,
	.devo_detach =		vsock_vio_detach,
	.devo_quiesce =		vsock_vio_quiesce,

	.devo_cb_ops =		&vsock_vio_cb_ops,

	.devo_getinfo =		NULL,
	.devo_identify =	nulldev,
	.devo_probe =		nulldev,
	.devo_reset = 		nodev,
	.devo_bus_ops =		NULL,
	.devo_power =		NULL,
};

static struct modldrv vsock_vio_modldrv = {
	.drv_modops =		&mod_driverops,
	.drv_linkinfo =		"AF_VSOCK VIRTIO transport driver",
	.drv_dev_ops =		&vsock_vio_dev_ops,
};

static struct modlinkage vsock_vio_modlinkage = {
	.ml_rev =		MODREV_1,
	.ml_linkage =		{ &vsock_vio_modldrv, NULL }
};

int
_init(void)
{
	int rc;

	rc = mod_install(&vsock_vio_modlinkage);
	return (rc);
}

int
_fini(void)
{
	int rc;

	rc = mod_remove(&vsock_vio_modlinkage);
	return (rc);
}

int
_info(struct modinfo *modinfop)
{
	return (mod_info(&vsock_vio_modlinkage, modinfop));
}