Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/net/lib/libvirtif allow VIF_DYING() implementation ...



details:   https://anonhg.NetBSD.org/src/rev/6cdc79cc594e
branches:  trunk
changeset: 327672:6cdc79cc594e
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Mar 13 20:55:26 2014 +0000

description:
allow VIF_DYING() implementation to protest

diffstat:

 sys/rump/net/lib/libvirtif/if_virt.c     |   8 +++++---
 sys/rump/net/lib/libvirtif/virtif_user.c |  10 ++++++++--
 sys/rump/net/lib/libvirtif/virtif_user.h |   4 ++--
 3 files changed, 15 insertions(+), 7 deletions(-)

diffs (87 lines):

diff -r 8ebfac51f936 -r 6cdc79cc594e sys/rump/net/lib/libvirtif/if_virt.c
--- a/sys/rump/net/lib/libvirtif/if_virt.c      Thu Mar 13 20:36:01 2014 +0000
+++ b/sys/rump/net/lib/libvirtif/if_virt.c      Thu Mar 13 20:55:26 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_virt.c,v 1.41 2014/03/13 18:14:13 pooka Exp $       */
+/*     $NetBSD: if_virt.c,v 1.42 2014/03/13 20:55:26 pooka Exp $       */
 
 /*
  * Copyright (c) 2008, 2013 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.41 2014/03/13 18:14:13 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.42 2014/03/13 20:55:26 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -151,11 +151,13 @@
 virtif_unclone(struct ifnet *ifp)
 {
        struct virtif_sc *sc = ifp->if_softc;
+       int rv;
 
        if (ifp->if_flags & IFF_UP)
                return EBUSY;
 
-       VIFHYPER_DYING(sc->sc_viu);
+       if ((rv = VIFHYPER_DYING(sc->sc_viu)) != 0)
+               return rv;
 
        virtif_stop(ifp, 1);
        if_down(ifp);
diff -r 8ebfac51f936 -r 6cdc79cc594e sys/rump/net/lib/libvirtif/virtif_user.c
--- a/sys/rump/net/lib/libvirtif/virtif_user.c  Thu Mar 13 20:36:01 2014 +0000
+++ b/sys/rump/net/lib/libvirtif/virtif_user.c  Thu Mar 13 20:55:26 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: virtif_user.c,v 1.1 2014/03/13 18:14:13 pooka Exp $    */
+/*     $NetBSD: virtif_user.c,v 1.2 2014/03/13 20:55:26 pooka Exp $    */
 
 /*
  * Copyright (c) 2013 Antti Kantee.  All Rights Reserved.
@@ -251,7 +251,7 @@
        rumpuser_component_schedule(cookie);
 }
 
-void
+int
 VIFHYPER_DYING(struct virtif_user *viu)
 {
        void *cookie = rumpuser_component_unschedule();
@@ -259,11 +259,17 @@
        viu->viu_dying = 1;
        if (write(viu->viu_pipe[1],
            &viu->viu_dying, sizeof(viu->viu_dying)) == -1) {
+               /*
+                * this is here mostly to avoid a compiler warning
+                * about ignoring the return value of write()
+                */
                fprintf(stderr, "%s: failed to signal thread\n",
                    VIF_STRING(VIFHYPER_DYING));
        }
 
        rumpuser_component_schedule(cookie);
+
+       return 0;
 }
 
 void
diff -r 8ebfac51f936 -r 6cdc79cc594e sys/rump/net/lib/libvirtif/virtif_user.h
--- a/sys/rump/net/lib/libvirtif/virtif_user.h  Thu Mar 13 20:36:01 2014 +0000
+++ b/sys/rump/net/lib/libvirtif/virtif_user.h  Thu Mar 13 20:55:26 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: virtif_user.h,v 1.1 2014/03/13 18:14:13 pooka Exp $    */
+/*     $NetBSD: virtif_user.h,v 1.2 2014/03/13 20:55:26 pooka Exp $    */
 
 /*
  * Copyright (c) 2013 Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 int    VIFHYPER_CREATE(const char *, struct virtif_sc *, uint8_t *,
                        struct virtif_user **);
-void   VIFHYPER_DYING(struct virtif_user *);
+int    VIFHYPER_DYING(struct virtif_user *);
 void   VIFHYPER_DESTROY(struct virtif_user *);
 
 void   VIFHYPER_SEND(struct virtif_user *, struct iovec *, size_t);



Home | Main Index | Thread Index | Old Index