Source-Changes-HG archive

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

[src/trunk]: src/sys/dev invoke optional d_label callback to give the driver ...



details:   https://anonhg.NetBSD.org/src/rev/ba5e07a162a2
branches:  trunk
changeset: 349355:ba5e07a162a2
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Thu Dec 08 12:22:56 2016 +0000

description:
invoke optional d_label callback to give the driver the possibility
to adjust the label with driver specific data.

diffstat:

 sys/dev/dksubr.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r cb696114ef09 -r ba5e07a162a2 sys/dev/dksubr.c
--- a/sys/dev/dksubr.c  Thu Dec 08 12:21:54 2016 +0000
+++ b/sys/dev/dksubr.c  Thu Dec 08 12:22:56 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.92 2016/11/28 08:42:20 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.93 2016/12/08 12:22:56 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.92 2016/11/28 08:42:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.93 2016/12/08 12:22:56 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -815,6 +815,7 @@
 void
 dk_getdefaultlabel(struct dk_softc *dksc, struct disklabel *lp)
 {
+       const struct dkdriver *dkd = dksc->sc_dkdev.dk_driver;
        struct disk_geom *dg = &dksc->sc_dkdev.dk_geom;
 
        memset(lp, 0, sizeof(*lp));
@@ -843,7 +844,11 @@
 
        lp->d_magic = DISKMAGIC;
        lp->d_magic2 = DISKMAGIC;
-       lp->d_checksum = dkcksum(dksc->sc_dkdev.dk_label);
+
+       if (dkd->d_label)
+               dkd->d_label(dksc->sc_dev, lp);
+
+       lp->d_checksum = dkcksum(lp);
 }
 
 /* ARGSUSED */



Home | Main Index | Thread Index | Old Index