Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hp300/dev Set disk_geom parameters required by DIOC...



details:   https://anonhg.NetBSD.org/src/rev/71df771cfb22
branches:  trunk
changeset: 372467:71df771cfb22
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Wed Nov 30 17:39:12 2022 +0000

description:
Set disk_geom parameters required by DIOCGPARTINFO in disk_ioctl().

With this change raid(4) no longer complains before mountroot:
> RAIDframe: can't get disk size for dev rd0 (22)

Should be pulled up to netbsd-9.

diffstat:

 sys/arch/hp300/dev/rd.c |  23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diffs (58 lines):

diff -r e5a5bb35ca5e -r 71df771cfb22 sys/arch/hp300/dev/rd.c
--- a/sys/arch/hp300/dev/rd.c   Wed Nov 30 17:07:30 2022 +0000
+++ b/sys/arch/hp300/dev/rd.c   Wed Nov 30 17:39:12 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rd.c,v 1.118 2022/11/30 17:07:30 tsutsui Exp $ */
+/*     $NetBSD: rd.c,v 1.119 2022/11/30 17:39:12 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.118 2022/11/30 17:07:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.119 2022/11/30 17:39:12 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -428,6 +428,7 @@
                    struct hpibbus_attach_args *);
 static void    rdreset(struct rd_softc *);
 static void    rdreset_unit(int, int, int);
+static void    rd_set_geom(struct rd_softc *);
 static int     rdgetinfo(dev_t);
 static void    rdrestart(void *);
 static struct buf *rdfinish(struct rd_softc *, struct buf *);
@@ -531,6 +532,7 @@
        memset(&sc->sc_dkdev, 0, sizeof(sc->sc_dkdev));
        disk_init(&sc->sc_dkdev, device_xname(sc->sc_dev), NULL);
        disk_attach(&sc->sc_dkdev);
+       rd_set_geom(sc);
 
        sc->sc_slave = ha->ha_slave;
        sc->sc_punit = ha->ha_punit;
@@ -743,6 +745,23 @@
        hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
 }
 
+static void
+rd_set_geom(struct rd_softc *sc)
+{
+       struct disk_geom *dg = &sc->sc_dkdev.dk_geom;
+       const struct rdidentinfo *ri = &rdidentinfo[sc->sc_type];
+
+       memset(dg, 0, sizeof(*dg));
+
+       dg->dg_secsize = DEV_BSIZE;
+       dg->dg_nsectors = ri->ri_nbpt;
+       dg->dg_ntracks = ri->ri_ntpc;
+       dg->dg_ncylinders = ri->ri_ncyl;
+       dg->dg_secperunit = ri->ri_nblocks;
+
+       disk_set_info(sc->sc_dev, &sc->sc_dkdev, ri->ri_desc);
+}
+
 /*
  * Read or construct a disklabel
  */



Home | Main Index | Thread Index | Old Index