Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Make DIOCKLABEL work. Set default to keep the diskla...



details:   https://anonhg.NetBSD.org/src/rev/08c74a80428d
branches:  trunk
changeset: 337201:08c74a80428d
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Apr 06 12:02:08 2015 +0000

description:
Make DIOCKLABEL work. Set default to keep the disklabel after close to
not change current behaviour.

diffstat:

 sys/dev/vnd.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r 1ed97707eda0 -r 08c74a80428d sys/dev/vnd.c
--- a/sys/dev/vnd.c     Mon Apr 06 10:49:13 2015 +0000
+++ b/sys/dev/vnd.c     Mon Apr 06 12:02:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.241 2015/01/28 16:27:43 bouyer Exp $ */
+/*     $NetBSD: vnd.c,v 1.242 2015/04/06 12:02:08 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.241 2015/01/28 16:27:43 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.242 2015/04/06 12:02:08 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -332,6 +332,9 @@
                sc = vnd_spawn(unit);
                if (sc == NULL)
                        return ENOMEM;
+
+               /* compatibility, keep disklabel after close */
+               sc->sc_flags = VNF_KLABEL;
        }
 
        if ((error = vndlock(sc)) != 0)
@@ -434,6 +437,12 @@
        sc->sc_dkdev.dk_openmask =
            sc->sc_dkdev.dk_copenmask | sc->sc_dkdev.dk_bopenmask;
 
+       /* are we last opener ? */
+       if (sc->sc_dkdev.dk_openmask == 0) {
+               if ((sc->sc_flags & VNF_KLABEL) == 0)
+                       sc->sc_flags &= ~VNF_VLABEL;
+       }
+
        vndunlock(sc);
 
        if ((sc->sc_flags & VNF_INITED) == 0) {
@@ -1696,7 +1705,7 @@
        }
 #endif /* VND_COMPRESSION */
        vnd->sc_flags &=
-           ~(VNF_INITED | VNF_READONLY | VNF_VLABEL
+           ~(VNF_INITED | VNF_READONLY | VNF_KLABEL | VNF_VLABEL
              | VNF_VUNCONF | VNF_COMP | VNF_CLEARING);
        if (vp == NULL)
                panic("vndclear: null vp");



Home | Main Index | Thread Index | Old Index