diff options
author | phk <phk@FreeBSD.org> | 1995-05-03 22:36:52 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1995-05-03 22:36:52 +0000 |
commit | 3a333cad859d44b252ad9f74ed4e333d4c0eeaeb (patch) | |
tree | d3172256de629248edc621730939916b87dcf99f /lib/libdisk/chunk.c | |
parent | 455d2a327bf7898d4a18138d09508e0f2318e82f (diff) | |
download | FreeBSD-src-3a333cad859d44b252ad9f74ed4e333d4c0eeaeb.zip FreeBSD-src-3a333cad859d44b252ad9f74ed4e333d4c0eeaeb.tar.gz |
Add the private void *pointer to the chunks, and the functions to manage it.
Make the reassignment of partition names less bogus.
Diffstat (limited to 'lib/libdisk/chunk.c')
-rw-r--r-- | lib/libdisk/chunk.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libdisk/chunk.c b/lib/libdisk/chunk.c index ef4192d..d49a94e 100644 --- a/lib/libdisk/chunk.c +++ b/lib/libdisk/chunk.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: chunk.c,v 1.4 1995/04/30 06:09:24 phk Exp $ + * $Id: chunk.c,v 1.5 1995/05/01 21:30:22 jkh Exp $ * */ @@ -79,6 +79,8 @@ Free_Chunk(struct chunk *c1) { /* XXX remove all chunks which "ref" us */ if(!c1) return; + if(c1->private && c1->private_free) + (*c1->private_free)(c1->private); if(c1->part) Free_Chunk(c1->part); if(c1->next) @@ -96,6 +98,8 @@ Clone_Chunk(struct chunk *c1) c2 = new_chunk(); if (!c2) err(1,"malloc failed"); *c2 = *c1; + if (c1->private && c1->private_clone) + c2->private_clone(c2->private); c2->name = strdup(c2->name); c2->next = Clone_Chunk(c2->next); c2->part = Clone_Chunk(c2->part); @@ -109,13 +113,12 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, char *name, chunk_e t ct = new_chunk(); if (!ct) err(1,"malloc failed"); + memset(ct,0,sizeof *ct); ct->offset = offset; ct->size = size; ct->end = offset + size - 1; ct->type = type; ct->name = strdup(name); - ct->next = 0; - ct->part = 0; ct->subtype = subtype; ct->flags = flags; |