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/create_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/create_chunk.c')
-rw-r--r-- | lib/libdisk/create_chunk.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c index 9e3a079..06d65ec 100644 --- a/lib/libdisk/create_chunk.c +++ b/lib/libdisk/create_chunk.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: create_chunk.c,v 1.6 1995/05/01 04:05:24 phk Exp $ + * $Id: create_chunk.c,v 1.7 1995/05/03 06:30:50 phk Exp $ * */ @@ -30,8 +30,12 @@ Fixup_FreeBSD_Names(struct disk *d, struct chunk *c) if (!strcmp(c->name, "X")) return; /* reset all names to "X" */ - for (c1 = c->part; c1 ; c1 = c1->next) + for (c1 = c->part; c1 ; c1 = c1->next) { + c1->oname = c1->name; + c1->name = malloc(12); + if(!c1->name) err(1,"Malloc failed"); strcpy(c1->name,"X"); + } /* Allocate the first swap-partition we find */ for (c1 = c->part; c1 ; c1 = c1->next) { @@ -51,6 +55,15 @@ Fixup_FreeBSD_Names(struct disk *d, struct chunk *c) break; } + /* Try to give them the same as they had before */ + for (c1 = c->part; c1 ; c1 = c1->next) { + for(c3 = c->part; c3 ; c3 = c3->next) + if (c1 != c3 && !strcmp(c3->name, c1->oname)) { + strcpy(c1->name,c1->oname); + break; + } + } + /* Allocate the rest sequentially */ for (c1 = c->part; c1 ; c1 = c1->next) { const char order[] = "defghab"; @@ -69,6 +82,10 @@ Fixup_FreeBSD_Names(struct disk *d, struct chunk *c) continue; } } + for (c1 = c->part; c1 ; c1 = c1->next) { + free(c1->oname); + c1->oname = 0; + } } void |