Source-Changes-HG archive

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

[src/trunk]: src/sys Extend dkdriver interface with a d_firstopen function. T...



details:   https://anonhg.NetBSD.org/src/rev/abd501864cc4
branches:  trunk
changeset: 349194:abd501864cc4
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Nov 28 08:42:20 2016 +0000

description:
Extend dkdriver interface with a d_firstopen function. This is called
by dk_open() for the first opener and mirrors the use of the d_lastclose
callback.

Bump kernel version for the interface change.

diffstat:

 sys/dev/dksubr.c |  14 ++++++++++++--
 sys/sys/disk.h   |   3 ++-
 sys/sys/param.h  |   4 ++--
 3 files changed, 16 insertions(+), 5 deletions(-)

diffs (77 lines):

diff -r 9d2bbe3f3406 -r abd501864cc4 sys/dev/dksubr.c
--- a/sys/dev/dksubr.c  Mon Nov 28 08:31:17 2016 +0000
+++ b/sys/dev/dksubr.c  Mon Nov 28 08:42:20 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.91 2016/10/24 17:14:27 jdolecek Exp $ */
+/* $NetBSD: dksubr.c,v 1.92 2016/11/28 08:42:20 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.91 2016/10/24 17:14:27 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.92 2016/11/28 08:42:20 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -122,6 +122,7 @@
 dk_open(struct dk_softc *dksc, dev_t dev,
     int flags, int fmt, struct lwp *l)
 {
+       const struct dkdriver *dkd = dksc->sc_dkdev.dk_driver;
        struct  disklabel *lp = dksc->sc_dkdev.dk_label;
        int     part = DISKPART(dev);
        int     pmask = 1 << part;
@@ -143,6 +144,15 @@
        }
 
        /*
+        * initialize driver for the first opener
+        */
+       if (dk->dk_openmask == 0 && dkd->d_firstopen != NULL) {
+               ret = (*dkd->d_firstopen)(dksc->sc_dev, dev, flags, fmt);
+               if (ret)
+                       goto done;
+       }
+
+       /*
         * If we're init'ed and there are no other open partitions then
         * update the in-core disklabel.
         */
diff -r 9d2bbe3f3406 -r abd501864cc4 sys/sys/disk.h
--- a/sys/sys/disk.h    Mon Nov 28 08:31:17 2016 +0000
+++ b/sys/sys/disk.h    Mon Nov 28 08:42:20 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disk.h,v 1.67 2016/04/27 02:19:12 christos Exp $       */
+/*     $NetBSD: disk.h,v 1.68 2016/11/28 08:42:20 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
@@ -481,6 +481,7 @@
        int     (*d_dumpblocks)(device_t, void *, daddr_t, int);
        int     (*d_lastclose)(device_t);
        int     (*d_discard)(device_t, off_t, off_t);
+       int     (*d_firstopen)(device_t, dev_t, int, int);
 };
 #endif
 
diff -r 9d2bbe3f3406 -r abd501864cc4 sys/sys/param.h
--- a/sys/sys/param.h   Mon Nov 28 08:31:17 2016 +0000
+++ b/sys/sys/param.h   Mon Nov 28 08:42:20 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: param.h,v 1.509 2016/11/02 03:06:19 pgoyette Exp $     */
+/*     $NetBSD: param.h,v 1.510 2016/11/28 08:42:20 mlelstv Exp $      */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *     2.99.9          (299000900)
  */
 
-#define        __NetBSD_Version__      799004200       /* NetBSD 7.99.42 */
+#define        __NetBSD_Version__      799004300       /* NetBSD 7.99.43 */
 
 #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
     (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)



Home | Main Index | Thread Index | Old Index