summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_slice.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-05-31 19:25:05 +0000
committerphk <phk@FreeBSD.org>2003-05-31 19:25:05 +0000
commit926fff03bf522ba4aa811a8284d2e141ecdad6eb (patch)
tree3e16169cf79b73944fc451763088234779796dd2 /sys/geom/geom_slice.c
parent48e54f8060cec2d3d21a372cdaead1cc8986dfe4 (diff)
downloadFreeBSD-src-926fff03bf522ba4aa811a8284d2e141ecdad6eb.zip
FreeBSD-src-926fff03bf522ba4aa811a8284d2e141ecdad6eb.tar.gz
Add a destroy_geom method to the slice "library".
If a slice class has no destroy_geom method, use this one. This should allow all slicers to kldload.
Diffstat (limited to 'sys/geom/geom_slice.c')
-rw-r--r--sys/geom/geom_slice.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c
index 055facc..3b9db4e 100644
--- a/sys/geom/geom_slice.c
+++ b/sys/geom/geom_slice.c
@@ -300,13 +300,12 @@ g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length
struct g_slice *gsl;
va_list ap;
struct sbuf *sb;
- int error, acc;
+ int acc;
g_trace(G_T_TOPOLOGY, "g_slice_config(%s, %d, %d)",
gp->name, idx, how);
g_topology_assert();
gsp = gp->softc;
- error = 0;
if (idx >= gsp->nslice)
return(EINVAL);
gsl = &gsp->slices[idx];
@@ -430,6 +429,14 @@ g_slice_spoiled(struct g_consumer *cp)
g_wither_geom(gp, ENXIO);
}
+int
+g_slice_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp)
+{
+
+ g_slice_spoiled(LIST_FIRST(&gp->consumer));
+ return (0);
+}
+
struct g_geom *
g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_consumer **cpp, void *extrap, int extra, g_slice_start_t *start)
{
@@ -450,6 +457,8 @@ g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_co
gp->start = g_slice_start;
gp->spoiled = g_slice_spoiled;
gp->dumpconf = g_slice_dumpconf;
+ if (gp->class->destroy_geom == NULL)
+ gp->class->destroy_geom = g_slice_destroy_geom;
cp = g_new_consumer(gp);
error = g_attach(cp, pp);
if (error == 0)
OpenPOWER on IntegriCloud