Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163409957
D44519.id136241.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D44519.id136241.diff
View Options
diff --git a/sys/dev/hyperv/hvsock/hv_sock.h b/sys/dev/hyperv/hvsock/hv_sock.h
--- a/sys/dev/hyperv/hvsock/hv_sock.h
+++ b/sys/dev/hyperv/hvsock/hv_sock.h
@@ -88,32 +88,4 @@
LIST_ENTRY(hvs_pcb) connected_next;
};
-#define so2hvspcb(so) \
- ((struct hvs_pcb *)((so)->so_pcb))
-#define hsvpcb2so(hvspcb) \
- ((struct socket *)((hvspcb)->so))
-
-void hvs_addr_init(struct sockaddr_hvs *, const struct hyperv_guid *);
-void hvs_trans_close(struct socket *);
-void hvs_trans_detach(struct socket *);
-void hvs_trans_abort(struct socket *);
-int hvs_trans_attach(struct socket *, int, struct thread *);
-int hvs_trans_bind(struct socket *, struct sockaddr *, struct thread *);
-int hvs_trans_listen(struct socket *, int, struct thread *);
-int hvs_trans_accept(struct socket *, struct sockaddr *);
-int hvs_trans_connect(struct socket *,
- struct sockaddr *, struct thread *);
-int hvs_trans_peeraddr(struct socket *, struct sockaddr *);
-int hvs_trans_sockaddr(struct socket *, struct sockaddr *);
-int hvs_trans_soreceive(struct socket *, struct sockaddr **,
- struct uio *, struct mbuf **, struct mbuf **, int *);
-int hvs_trans_sosend(struct socket *, struct sockaddr *, struct uio *,
- struct mbuf *, struct mbuf *, int, struct thread *);
-int hvs_trans_disconnect(struct socket *);
-int hvs_trans_shutdown(struct socket *, enum shutdown_how);
-
-int hvs_trans_lock(void);
-void hvs_trans_unlock(void);
-
-void hvs_remove_socket_from_list(struct socket *, unsigned char);
#endif /* _HVSOCK_H */
diff --git a/sys/dev/hyperv/hvsock/hv_sock.c b/sys/dev/hyperv/hvsock/hv_sock.c
--- a/sys/dev/hyperv/hvsock/hv_sock.c
+++ b/sys/dev/hyperv/hvsock/hv_sock.c
@@ -81,40 +81,16 @@
#define HVSOCK_PKT_LEN(payload_len) (HVSOCK_HEADER_LEN + \
roundup2(payload_len, 8) + \
- sizeof(uint64_t))
+ sizeof(uint64_t))
+
+#define so2hvspcb(so) \
+ ((struct hvs_pcb *)((so)->so_pcb))
+#define hsvpcb2so(hvspcb) \
+ ((struct socket *)((hvspcb)->so))
/*
- * HyperV Transport sockets
+ * HyperV Transport socket functions
*/
-static struct protosw hv_socket_protosw = {
- .pr_type = SOCK_STREAM,
- .pr_protocol = HYPERV_SOCK_PROTO_TRANS,
- .pr_flags = PR_CONNREQUIRED,
- .pr_attach = hvs_trans_attach,
- .pr_bind = hvs_trans_bind,
- .pr_listen = hvs_trans_listen,
- .pr_accept = hvs_trans_accept,
- .pr_connect = hvs_trans_connect,
- .pr_peeraddr = hvs_trans_peeraddr,
- .pr_sockaddr = hvs_trans_sockaddr,
- .pr_soreceive = hvs_trans_soreceive,
- .pr_sosend = hvs_trans_sosend,
- .pr_disconnect = hvs_trans_disconnect,
- .pr_close = hvs_trans_close,
- .pr_detach = hvs_trans_detach,
- .pr_shutdown = hvs_trans_shutdown,
- .pr_abort = hvs_trans_abort,
-};
-
-static struct domain hv_socket_domain = {
- .dom_family = AF_HYPERV,
- .dom_name = "hyperv",
- .dom_probe = hvs_dom_probe,
- .dom_nprotosw = 1,
- .dom_protosw = { &hv_socket_protosw },
-};
-
-DOMAIN_SET(hv_socket_);
#define MAX_PORT ((uint32_t)0xFFFFFFFF)
#define MIN_PORT ((uint32_t)0x0)
@@ -221,7 +197,7 @@
pcb, connected_next);
}
-void
+static void
hvs_remove_socket_from_list(struct socket *so, unsigned char list)
{
if (!so || !so->so_pcb) {
@@ -290,20 +266,20 @@
addr->hvs_port = port;
}
-void
+static void
hvs_addr_init(struct sockaddr_hvs *addr, const struct hyperv_guid *svr_id)
{
hvs_addr_set(addr, get_port_by_srv_id(svr_id));
}
-int
+static int
hvs_trans_lock(void)
{
sx_xlock(&hvs_trans_socks_sx);
return (0);
}
-void
+static void
hvs_trans_unlock(void)
{
sx_xunlock(&hvs_trans_socks_sx);
@@ -342,7 +318,7 @@
* 1) When user calls socket();
* 2) When we accept new incoming conneciton and call sonewconn().
*/
-int
+static int
hvs_trans_attach(struct socket *so, int proto, struct thread *td)
{
struct hvs_pcb *pcb = so2hvspcb(so);
@@ -368,7 +344,7 @@
return (0);
}
-void
+static void
hvs_trans_detach(struct socket *so)
{
struct hvs_pcb *pcb;
@@ -392,7 +368,7 @@
hvs_trans_unlock();
}
-int
+static int
hvs_trans_bind(struct socket *so, struct sockaddr *addr, struct thread *td)
{
struct hvs_pcb *pcb = so2hvspcb(so);
@@ -444,7 +420,7 @@
return (error);
}
-int
+static int
hvs_trans_listen(struct socket *so, int backlog, struct thread *td)
{
struct hvs_pcb *pcb = so2hvspcb(so);
@@ -476,7 +452,7 @@
return (error);
}
-int
+static int
hvs_trans_accept(struct socket *so, struct sockaddr *sa)
{
struct hvs_pcb *pcb = so2hvspcb(so);
@@ -492,7 +468,7 @@
return (0);
}
-int
+static int
hvs_trans_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
{
struct hvs_pcb *pcb = so2hvspcb(so);
@@ -583,7 +559,7 @@
return (error);
}
-int
+static int
hvs_trans_disconnect(struct socket *so)
{
struct hvs_pcb *pcb;
@@ -612,7 +588,7 @@
struct sockbuf *sb;
};
-int
+static int
hvs_trans_soreceive(struct socket *so, struct sockaddr **paddr,
struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
{
@@ -777,7 +753,7 @@
return (error);
}
-int
+static int
hvs_trans_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
struct mbuf *top, struct mbuf *controlp, int flags, struct thread *td)
{
@@ -874,13 +850,13 @@
return (error);
}
-int
+static int
hvs_trans_peeraddr(struct socket *so, struct sockaddr *sa)
{
struct hvs_pcb *pcb = so2hvspcb(so);
HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
- "%s: HyperV Socket hvs_trans_peeraddr called\n", __func__);
+ "%s: HyperV Socket hvs_trans_peeraddr called\n", __func__);
if (pcb == NULL)
return (EINVAL);
@@ -890,7 +866,7 @@
return (0);
}
-int
+static int
hvs_trans_sockaddr(struct socket *so, struct sockaddr *sa)
{
struct hvs_pcb *pcb = so2hvspcb(so);
@@ -906,7 +882,7 @@
return (0);
}
-void
+static void
hvs_trans_close(struct socket *so)
{
struct hvs_pcb *pcb;
@@ -947,7 +923,7 @@
return;
}
-void
+static void
hvs_trans_abort(struct socket *so)
{
struct hvs_pcb *pcb = so2hvspcb(so);
@@ -976,7 +952,7 @@
return;
}
-int
+static int
hvs_trans_shutdown(struct socket *so, enum shutdown_how how)
{
struct hvs_pcb *pcb = so2hvspcb(so);
@@ -1018,6 +994,40 @@
return (0);
}
+/*
+ * HyperV Transport socket declaration
+ */
+
+static struct protosw hv_socket_protosw = {
+ .pr_type = SOCK_STREAM,
+ .pr_protocol = HYPERV_SOCK_PROTO_TRANS,
+ .pr_flags = PR_CONNREQUIRED,
+ .pr_attach = hvs_trans_attach,
+ .pr_bind = hvs_trans_bind,
+ .pr_listen = hvs_trans_listen,
+ .pr_accept = hvs_trans_accept,
+ .pr_connect = hvs_trans_connect,
+ .pr_peeraddr = hvs_trans_peeraddr,
+ .pr_sockaddr = hvs_trans_sockaddr,
+ .pr_soreceive = hvs_trans_soreceive,
+ .pr_sosend = hvs_trans_sosend,
+ .pr_disconnect = hvs_trans_disconnect,
+ .pr_close = hvs_trans_close,
+ .pr_detach = hvs_trans_detach,
+ .pr_shutdown = hvs_trans_shutdown,
+ .pr_abort = hvs_trans_abort,
+};
+
+static struct domain hv_socket_domain = {
+ .dom_family = AF_HYPERV,
+ .dom_name = "hyperv",
+ .dom_probe = hvs_dom_probe,
+ .dom_nprotosw = 1,
+ .dom_protosw = { &hv_socket_protosw },
+};
+
+DOMAIN_SET(hv_socket_);
+
/* In the VM, we support Hyper-V Sockets with AF_HYPERV, and the endpoint is
* <port> (see struct sockaddr_hvs).
*
@@ -1604,7 +1614,6 @@
}
hvs_trans_unlock();
}
-
}
static int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 23, 11:27 PM (1 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35419479
Default Alt Text
D44519.id136241.diff (7 KB)
Attached To
Mode
D44519: hvsock: make protosw functions static
Attached
Detach File
Event Timeline
Log In to Comment