aboutsummaryrefslogtreecommitdiff
path: root/lib/libdisk/create_chunk.c
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2003-11-02 08:39:08 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2003-11-02 08:39:08 +0000
commitf5ea9b34c6eb57643f328200a84f5823c7b94b98 (patch)
tree0b660467a6ec395d84ae807df947f19bb634d396 /lib/libdisk/create_chunk.c
parent78cb7a7cd056161d24214f5912afb6b943a8892e (diff)
o Move Int_Open_Disk() from disk.c to open_disk.c for use by all
platforms except ia64 and use Int_Open_Disk() in open_ia64_disk.c on ia64. We need to know more than GEOM can provide us so we're forced to read from the disk. Move uuid_type() to open_ia64_disk.c and remove all references on non-ia64. o Pass the GEOM conftxt to Int_Open_Disk() so that only Open_Disk() needs to know about GEOM and libdisk can more easily be used with media not handled by GEOM. o Create an ia64 specific definiton of struct disk on ia64, because we don't need/have most of the fields other platforms need and other fields not applicable on platforms other than ia64. o Do not compile change.c on ia64. It's too PC specific. o In Fixup_Names() in create_chunk.c, try all partition numbers that are valid for the GPT disk. We have the total number of partitions that can be allocated in the disk structure on ia64. Also, use the GPT partition naming if we're creating one under a chunk of type "whole". It's a GPT partition in that case. o In Create_Chunk(), compile-out the PC specific code on ia64 that checks BIOS geometry restrictions. o In Debug_Disk() in disk.c, dump the ia64 specific fields. o Save the partition index in the chunk on ia64 so that we can preserve it when we write the data back to disk. This avoids that partitions get moved around or swapped after installing FreeBSD, which may render a disk unusable.
Notes
Notes: svn path=/head/; revision=121888
Diffstat (limited to 'lib/libdisk/create_chunk.c')
-rw-r--r--lib/libdisk/create_chunk.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c
index d8e35e8ce232..fb3daecd2dd6 100644
--- a/lib/libdisk/create_chunk.c
+++ b/lib/libdisk/create_chunk.c
@@ -140,7 +140,7 @@ Fixup_Names(struct disk *d)
struct chunk *c1, *c2;
#if defined(__i386__) || defined(__ia64__) || defined(__amd64__)
struct chunk *c3;
- int j;
+ int j, max;
#endif
c1 = d->chunks;
@@ -153,8 +153,14 @@ Fixup_Names(struct disk *d)
c2->oname = malloc(12);
if (!c2->oname)
return -1;
- for (j = 1; j <= NDOSPART; j++) {
- sprintf(c2->oname, "%ss%d", c1->name, j);
+#ifdef __ia64__
+ max = d->gpt_size;
+#else
+ max = NDOSPART;
+#endif
+ for (j = 1; j <= max; j++) {
+ sprintf(c2->oname, "%s%c%d", c1->name,
+ (c1->type == whole) ? 'p' : 's', j);
for (c3 = c1->part; c3; c3 = c3->next)
if (c3 != c2 && !strcmp(c3->name, c2->oname))
goto match;
@@ -188,9 +194,10 @@ Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type,
int subtype, u_long flags, const char *sname)
{
int i;
- u_long l;
-
+
+#ifndef __ia64__
if (!(flags & CHUNK_FORCE_ALL)) {
+ u_long l;
#ifdef PC98
/* Never use the first cylinder */
if (!offset) {
@@ -209,6 +216,7 @@ Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type,
l = (offset+size) % (d->bios_sect * d->bios_hd);
size -= l;
}
+#endif
i = Add_Chunk(d, offset, size, "X", type, subtype, flags, sname);
Fixup_Names(d);