Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

VSOCK: transport-specific vsock_transport functions

struct vsock_transport contains function pointers called by AF_VSOCK
core code. The transport may want its own transport-specific function
pointers and they can be added after struct vsock_transport.

Allow the transport to fetch vsock_transport. It can downcast it to
access transport-specific function pointers.

The virtio transport will use this.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Stefan Hajnoczi and committed by
Michael S. Tsirkin
0b01aeb3 6190efb0

+12
+3
include/net/af_vsock.h
··· 165 165 } 166 166 void vsock_core_exit(void); 167 167 168 + /* The transport may downcast this to access transport-specific functions */ 169 + const struct vsock_transport *vsock_core_get_transport(void); 170 + 168 171 /**** UTILS ****/ 169 172 170 173 void vsock_release_pending(struct sock *pending);
+9
net/vmw_vsock/af_vsock.c
··· 1995 1995 } 1996 1996 EXPORT_SYMBOL_GPL(vsock_core_exit); 1997 1997 1998 + const struct vsock_transport *vsock_core_get_transport(void) 1999 + { 2000 + /* vsock_register_mutex not taken since only the transport uses this 2001 + * function and only while registered. 2002 + */ 2003 + return transport; 2004 + } 2005 + EXPORT_SYMBOL_GPL(vsock_core_get_transport); 2006 + 1998 2007 MODULE_AUTHOR("VMware, Inc."); 1999 2008 MODULE_DESCRIPTION("VMware Virtual Socket Family"); 2000 2009 MODULE_VERSION("1.0.1.0-k");