diff options
author | John Baldwin <jhb@FreeBSD.org> | 2003-01-13 21:08:21 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2003-01-13 21:08:21 +0000 |
commit | 7dd9999442998b83882b09a047e00f37ca8de228 (patch) | |
tree | b7821abbabf25aecb6fe3c1905cb3414754f3cc1 | |
parent | 89defd3f99f24a0a5097ddd9c47f90a34b8a0577 (diff) |
Notes
-rw-r--r-- | lib/libdisk/chunk.c | 2 | ||||
-rw-r--r-- | lib/libdisk/create_chunk.c | 20 | ||||
-rw-r--r-- | lib/libdisk/libdisk.h | 4 |
3 files changed, 22 insertions, 4 deletions
diff --git a/lib/libdisk/chunk.c b/lib/libdisk/chunk.c index ee15a496e35a3..25c36467c97f5 100644 --- a/lib/libdisk/chunk.c +++ b/lib/libdisk/chunk.c @@ -18,7 +18,7 @@ __FBSDID("$FreeBSD$"); #include <err.h> #include "libdisk.h" -static struct chunk * +struct chunk * New_Chunk(void) { struct chunk *c; diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c index dfccb9d9d20fd..8ce90572e1459 100644 --- a/lib/libdisk/create_chunk.c +++ b/lib/libdisk/create_chunk.c @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include <pwd.h> #include "libdisk.h" +struct chunk *New_Chunk(void); + static int Fixup_FreeBSD_Names(struct disk *d, struct chunk *c) { @@ -215,7 +217,7 @@ Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type, } struct chunk * -Create_Chunk_DWIM(struct disk *d, const struct chunk *parent , u_long size, +Create_Chunk_DWIM(struct disk *d, struct chunk *parent, u_long size, chunk_e type, int subtype, u_long flags) { int i; @@ -224,6 +226,22 @@ Create_Chunk_DWIM(struct disk *d, const struct chunk *parent , u_long size, if (!parent) parent = d->chunks; + + if (parent->type == freebsd && type == part && parent->part == NULL) { + c1 = New_Chunk(); + if (c1 == NULL) + return (NULL); + c1->disk = parent->disk; + c1->offset = parent->offset; + c1->size = parent->size; + c1->end = parent->offset + parent->size - 1; + c1->type = unused; + if (parent->sname != NULL) + c1->sname = strdup(parent->sname); + c1->name = strdup("-"); + parent->part = c1; + } + for (c1 = parent->part; c1; c1 = c1->next) { if (c1->type != unused) continue; diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h index b3c5e0852c4a8..ade39d73d2ebe 100644 --- a/lib/libdisk/libdisk.h +++ b/lib/libdisk/libdisk.h @@ -258,7 +258,7 @@ Prev_Track_Aligned(const struct disk *, u_long); /* Check if offset is aligned on a track according to the bios geometry */ struct chunk * -Create_Chunk_DWIM(struct disk *, const struct chunk *, u_long, chunk_e, int, +Create_Chunk_DWIM(struct disk *, struct chunk *, u_long, chunk_e, int, u_long); /* * This one creates a partition inside the given parent of the given @@ -294,7 +294,7 @@ __END_DECLS /* TODO * - * Need a error string mechanism from the functions instead of warn() + * Need an error string mechanism from the functions instead of warn() * * Make sure only FreeBSD start at offset==0 * |