aboutsummaryrefslogtreecommitdiff
path: root/sys/geom
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2003-09-23 07:53:59 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2003-09-23 07:53:59 +0000
commiteb98005f8d4d638b0781a4eb2f7b9260aebc6a07 (patch)
tree6f410c7ca813c89544156c8c70ad71180617f639 /sys/geom
parent68f1756b2a10c244136e62e395dc1709155dc550 (diff)
downloadsrc-eb98005f8d4d638b0781a4eb2f7b9260aebc6a07.tar.gz
src-eb98005f8d4d638b0781a4eb2f7b9260aebc6a07.zip
Be more careful in dumpconf: softc may be NULL for departing devices.
Allow drivers to initialize the d_devstat if they want magic params.
Notes
Notes: svn path=/head/; revision=120374
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_disk.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index 5746415e24b8..11f6b4631c00 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -299,6 +299,8 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g
struct disk *dp;
dp = gp->softc;
+ if (dp == NULL)
+ return;
if (indent == NULL) {
sbuf_printf(sb, " hd %u", dp->d_fwheads);
sbuf_printf(sb, " sc %u", dp->d_fwsectors);
@@ -366,9 +368,10 @@ disk_create(int unit, struct disk *dp, int flags, void *unused __unused, void *
if (bootverbose || 1)
printf("GEOM: create disk %s%d dp=%p\n",
dp->d_name, dp->d_unit, dp);
- dp->d_devstat = devstat_new_entry(dp->d_name, dp->d_unit,
- dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED,
- DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX);
+ if (dp->d_devstat == NULL)
+ dp->d_devstat = devstat_new_entry(dp->d_name, dp->d_unit,
+ dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED,
+ DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX);
dp->d_geom = NULL;
g_post_event(g_disk_create, dp, M_WAITOK, dp, NULL);
}