summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_disk.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-04-19 09:24:12 +0000
committerphk <phk@FreeBSD.org>2002-04-19 09:24:12 +0000
commit4509f96cc589342df08f0237df6f9add315b10dc (patch)
tree78bdb30d9090fbc82c33e35fbf8e451f4f7f28f1 /sys/geom/geom_disk.c
parenta274092cf658e3818cf7022f777b07ae66e89fe5 (diff)
downloadFreeBSD-src-4509f96cc589342df08f0237df6f9add315b10dc.zip
FreeBSD-src-4509f96cc589342df08f0237df6f9add315b10dc.tar.gz
Make kernel dumps work with GEOM.
Notice that if the device on which the dump is set is destroyed for any reason, the dump setting is lost. This in particular will happen in the case of spoilage. For instance if you set dump on ad0s1b and open ad0 for writing, ad0s* will be spoilt and the dump setting lost. See geom(4) for more about spoiling. Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/geom/geom_disk.c')
-rw-r--r--sys/geom/geom_disk.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index e6a2bcd..6abb492 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -99,6 +99,24 @@ g_disk_access(struct g_provider *pp, int r, int w, int e)
}
static void
+g_disk_kerneldump(struct bio *bp, struct disk *dp)
+{
+ int error;
+ struct g_kerneldump *gkd;
+ struct dumperinfo di;
+
+ gkd = (struct g_kerneldump*)bp->bio_data;
+ printf("Kerneldump off=%lld len=%lld\n", gkd->offset, gkd->length);
+ di.dumper = (dumper_t *)dp->d_devsw->d_dump;
+ di.priv = dp->d_dev;
+ di.blocksize = dp->d_label.d_secsize;
+ di.mediaoffset = gkd->offset;
+ di.mediasize = gkd->length;
+ error = set_dumper(&di);
+ g_io_fail(bp, error);
+}
+
+static void
g_disk_done(struct bio *bp)
{
@@ -148,6 +166,8 @@ g_disk_start(struct bio *bp)
break;
else if (g_haveattr_off_t(bp, "GEOM::frontstuff", 0))
break;
+ else if (!strcmp(bp->bio_attribute, "GEOM::kerneldump"))
+ g_disk_kerneldump(bp, dp);
else if (!strcmp(bp->bio_attribute, "GEOM::ioctl") &&
bp->bio_length == sizeof *gio) {
gio = (struct g_ioctl *)bp->bio_data;
OpenPOWER on IntegriCloud