Patchwork [PATCHv6,01/11] tap: add interface to get device fd

login
register
mail settings
Submitter Michael S. Tsirkin
Date March 17, 2010, 11:07 a.m.
Message ID <9dbe0adf87df1ccad0cfbaefca6a529ca5775828.1268823114.git.mst@redhat.com>
Download mbox | patch
Permalink /patch/47930/
State New
Headers show

Comments

Michael S. Tsirkin - March 17, 2010, 11:07 a.m.
Will be used by vhost to attach/detach to backend.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 net/tap.c |    7 +++++++
 net/tap.h |    2 ++
 2 files changed, 9 insertions(+), 0 deletions(-)
Anthony Liguori - April 1, 2010, 7:17 p.m.
On 03/17/2010 06:07 AM, Michael S. Tsirkin wrote:
> Will be used by vhost to attach/detach to backend.
>
> Signed-off-by: Michael S. Tsirkin<mst@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   net/tap.c |    7 +++++++
>   net/tap.h |    2 ++
>   2 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/net/tap.c b/net/tap.c
> index 7a7320c..fc59fd4 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -269,6 +269,13 @@ static void tap_poll(VLANClientState *nc, bool enable)
>       tap_write_poll(s, enable);
>   }
>
> +int tap_get_fd(VLANClientState *nc)
> +{
> +    TAPState *s = DO_UPCAST(TAPState, nc, nc);
> +    assert(nc->info->type == NET_CLIENT_TYPE_TAP);
> +    return s->fd;
> +}
> +
>   /* fd support */
>
>   static NetClientInfo net_tap_info = {
> diff --git a/net/tap.h b/net/tap.h
> index 538a562..a244b28 100644
> --- a/net/tap.h
> +++ b/net/tap.h
> @@ -48,4 +48,6 @@ int tap_probe_vnet_hdr(int fd);
>   int tap_probe_has_ufo(int fd);
>   void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
>
> +int tap_get_fd(VLANClientState *vc);
> +
>   #endif /* QEMU_NET_TAP_H */
>

Patch

diff --git a/net/tap.c b/net/tap.c
index 7a7320c..fc59fd4 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -269,6 +269,13 @@  static void tap_poll(VLANClientState *nc, bool enable)
     tap_write_poll(s, enable);
 }
 
+int tap_get_fd(VLANClientState *nc)
+{
+    TAPState *s = DO_UPCAST(TAPState, nc, nc);
+    assert(nc->info->type == NET_CLIENT_TYPE_TAP);
+    return s->fd;
+}
+
 /* fd support */
 
 static NetClientInfo net_tap_info = {
diff --git a/net/tap.h b/net/tap.h
index 538a562..a244b28 100644
--- a/net/tap.h
+++ b/net/tap.h
@@ -48,4 +48,6 @@  int tap_probe_vnet_hdr(int fd);
 int tap_probe_has_ufo(int fd);
 void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo);
 
+int tap_get_fd(VLANClientState *vc);
+
 #endif /* QEMU_NET_TAP_H */