Module Name: src Committed By: mlelstv Date: Tue Mar 29 04:55:53 UTC 2016
Modified Files: src/sys/dev/mscp: mscp_disk.c Log Message: Initialize disk_geom information, DIOCGPARTINFO relies on it. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/dev/mscp/mscp_disk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/mscp/mscp_disk.c diff -u src/sys/dev/mscp/mscp_disk.c:1.88 src/sys/dev/mscp/mscp_disk.c:1.89 --- src/sys/dev/mscp/mscp_disk.c:1.88 Sun Apr 26 15:15:20 2015 +++ src/sys/dev/mscp/mscp_disk.c Tue Mar 29 04:55:53 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mscp_disk.c,v 1.88 2015/04/26 15:15:20 mlelstv Exp $ */ +/* $NetBSD: mscp_disk.c,v 1.89 2016/03/29 04:55:53 mlelstv Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -82,7 +82,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.88 2015/04/26 15:15:20 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.89 2016/03/29 04:55:53 mlelstv Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -724,6 +724,29 @@ raattach(device_t parent, device_t self, } /* + * Initialize drive geometry data from disklabel + */ +static void +ra_set_geometry(struct ra_softc *ra) +{ + struct disklabel *dl; + struct disk_geom *dg; + + dl = ra->ra_disk.dk_label; + dg = &ra->ra_disk.dk_geom; + + memset(dg, 0, sizeof(*dg)); + dg->dg_secsize = dl->d_secsize; + dg->dg_nsectors = dl->d_nsectors; + dg->dg_ntracks = dl->d_ntracks; + + dg->dg_ncylinders = dl->d_ncylinders; + dg->dg_secperunit = dl->d_secperunit; + + disk_set_info(ra->ra_dev, &ra->ra_disk, NULL); +} + +/* * (Try to) put the drive online. This is done the first time the * drive is opened, or if it har fallen offline. */ @@ -968,6 +991,7 @@ rronline(device_t usc, struct mscp *mp) dl->d_rpm = 300; } rrmakelabel(dl, ra->ra_mediaid); + ra_set_geometry(ra); return (MSCP_DONE); }