Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136984197
D19991.id56437.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D19991.id56437.diff
View Options
Index: sys/geom/nop/g_nop.c
===================================================================
--- sys/geom/nop/g_nop.c
+++ sys/geom/nop/g_nop.c
@@ -97,6 +97,42 @@
g_resize_provider(pp, size);
}
+static int
+g_nop_dumper(void *priv, void *virtual, vm_offset_t physical, off_t offset,
+ size_t length)
+{
+ return (0);
+}
+
+static void
+g_nop_kerneldump(struct bio *bp, struct g_nop_softc *sc)
+{
+ struct g_kerneldump *gkd;
+ struct g_geom *gp;
+ struct g_provider *pp;
+
+ gkd = (struct g_kerneldump *)bp->bio_data;
+ gp = bp->bio_to->geom;
+ g_trace(G_T_TOPOLOGY, "%s(%s, %jd, %jd)", __func__, gp->name,
+ (intmax_t)gkd->offset, (intmax_t)gkd->length);
+
+ pp = LIST_FIRST(&gp->provider);
+
+ gkd->di.dumper = g_nop_dumper;
+ gkd->di.priv = sc;
+ gkd->di.blocksize = pp->sectorsize;
+ gkd->di.maxiosize = DFLTPHYS;
+ gkd->di.mediaoffset = sc->sc_offset + gkd->offset;
+ if (gkd->offset > sc->sc_explicitsize) {
+ g_io_deliver(bp, ENODEV);
+ return;
+ }
+ if ((gkd->offset + gkd->length) > sc->sc_explicitsize)
+ gkd->length = sc->sc_explicitsize - gkd->offset;
+ gkd->di.mediasize = gkd->length;
+ g_io_deliver(bp, 0);
+}
+
static void
g_nop_start(struct bio *bp)
{
@@ -127,11 +163,18 @@
case BIO_GETATTR:
sc->sc_getattrs++;
if (sc->sc_physpath &&
- g_handleattr_str(bp, "GEOM::physpath", sc->sc_physpath)) {
- mtx_unlock(&sc->sc_lock);
- return;
- }
- break;
+ g_handleattr_str(bp, "GEOM::physpath", sc->sc_physpath))
+ ;
+ else if (strcmp(bp->bio_attribute, "GEOM::kerneldump") == 0)
+ g_nop_kerneldump(bp, sc);
+ else
+ /*
+ * Fallthrough to forwarding the GETATTR down to the
+ * lower level device.
+ */
+ break;
+ mtx_unlock(&sc->sc_lock);
+ return;
case BIO_FLUSH:
sc->sc_flushes++;
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 21, 10:08 PM (8 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25814103
Default Alt Text
D19991.id56437.diff (1 KB)
Attached To
Mode
D19991: gnop(8): Nopify configuration as a kernel dump device
Attached
Detach File
Event Timeline
Log In to Comment