diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2003-05-02 05:33:27 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2003-05-02 05:33:27 +0000 |
commit | 82b53b8dc82c08120036004c87867fa6b674e599 (patch) | |
tree | a72efa0986df4b0ecffc24413f09288185d7b245 /sys/geom/geom_slice.c | |
parent | 4b065e2ce139ddf9505a09c68395a0b807d68513 (diff) | |
download | src-82b53b8dc82c08120036004c87867fa6b674e599.tar.gz src-82b53b8dc82c08120036004c87867fa6b674e599.zip |
Rename g_slice_init() to the more appropriate g_slice_alloc() and give
it a g_slice_free() partner function.
Notes
Notes:
svn path=/head/; revision=114493
Diffstat (limited to 'sys/geom/geom_slice.c')
-rw-r--r-- | sys/geom/geom_slice.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 2d31b7c6e27e..0ff13b2207db 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -57,7 +57,7 @@ static g_access_t g_slice_access; static g_start_t g_slice_start; static struct g_slicer * -g_slice_init(unsigned nslice, unsigned scsize) +g_slice_alloc(unsigned nslice, unsigned scsize) { struct g_slicer *gsp; @@ -69,6 +69,17 @@ g_slice_init(unsigned nslice, unsigned scsize) return (gsp); } +static void +g_slice_free(struct g_slicer *gsp) +{ + + g_free(gsp->slices); + if (gsp->hotspot != NULL) + g_free(gsp->hotspot); + g_free(gsp->softc); + g_free(gsp); +} + static int g_slice_access(struct g_provider *pp, int dr, int dw, int de) { @@ -416,7 +427,7 @@ g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_co g_topology_assert(); vp = (void **)extrap; gp = g_new_geomf(mp, "%s", pp->name); - gsp = g_slice_init(slices, extra); + gsp = g_slice_alloc(slices, extra); gsp->start = start; gp->access = g_slice_access; gp->orphan = g_slice_orphan; @@ -432,8 +443,7 @@ g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_co if (cp->provider != NULL) g_detach(cp); g_destroy_consumer(cp); - g_free(gsp->slices); - g_free(gp->softc); + g_slice_free(gsp); g_destroy_geom(gp); return (NULL); } |