diff options
author | phk <phk@FreeBSD.org> | 2003-09-23 07:53:59 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-09-23 07:53:59 +0000 |
commit | ac7d8771f0bd6a8543c290e4857c2350d581c282 (patch) | |
tree | 6f410c7ca813c89544156c8c70ad71180617f639 /sys/geom | |
parent | 7035863aec05a9f75ccd8c3cfda352c4b714e0c3 (diff) | |
download | FreeBSD-src-ac7d8771f0bd6a8543c290e4857c2350d581c282.zip FreeBSD-src-ac7d8771f0bd6a8543c290e4857c2350d581c282.tar.gz |
Be more careful in dumpconf: softc may be NULL for departing devices.
Allow drivers to initialize the d_devstat if they want magic params.
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_disk.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 5746415..11f6b46 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); } |