Thread (7 messages) 7 messages, 2 authors, 2009-11-05

Re: [PATCHv6 1/3] tun: export underlying socket

From: Arnd Bergmann <arnd@arndb.de>
Date: 2009-11-03 12:41:57
Also in: kvm, linux-mm, lkml

On Tuesday 03 November 2009, Michael S. Tsirkin wrote:
quoted
What was your reason for changing?
It turns out socket structure is really bound to specific a file, so we
can not have 2 files referencing the same socket.  Instead, as I say
above, it's possible to make sendmsg/recvmsg work on tap file directly.
Ah, I see.
I have implemented this (patch below), but decided to go with the simple
thing first.  Since no userspace-visible changes are involved, let's do
this by small steps: it will be easier to figure out when vhost
is upstream.
This may even make it easier for me to do the same with macvtap
if I resume work on that.
quoted hunk ↗ jump to hunk
@@ -416,8 +422,8 @@ int sock_map_fd(struct socket *sock, int flags)
 
 static struct socket *sock_from_file(struct file *file, int *err)
 {
-       if (file->f_op == &socket_file_ops)
-               return file->private_data;      /* set in sock_map_fd */
+       if (file->f_op->get_socket)
+               return file->f_op->get_socket(file);
 
        *err = -ENOTSOCK;
Or maybe do both (socket_file_ops and get_socket), to avoid an indirect
function call.

	Arnd <><
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help