summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-10-22 10:51:58 +0000
committerphk <phk@FreeBSD.org>2002-10-22 10:51:58 +0000
commit1bc5baf5c9b8f1c322eb6e8d3f27f4eb15cdb39b (patch)
tree26f0bd91bd85cfd83899ea119406ae967380a962
parent92fdfeb04440d61d1ec34a35c90db06ca8c4ef66 (diff)
downloadFreeBSD-src-1bc5baf5c9b8f1c322eb6e8d3f27f4eb15cdb39b.zip
FreeBSD-src-1bc5baf5c9b8f1c322eb6e8d3f27f4eb15cdb39b.tar.gz
Avoid a lot of #ifdef PC98 code by giving a couple of the Chunk functions
an extra argument for all archs.
-rw-r--r--lib/libdisk/change.c9
-rw-r--r--lib/libdisk/chunk.c17
-rw-r--r--lib/libdisk/create_chunk.c12
-rw-r--r--lib/libdisk/disk.c8
-rw-r--r--lib/libdisk/libdisk.h13
5 files changed, 3 insertions, 56 deletions
diff --git a/lib/libdisk/change.c b/lib/libdisk/change.c
index 18b8bc3..816f31f 100644
--- a/lib/libdisk/change.c
+++ b/lib/libdisk/change.c
@@ -91,19 +91,10 @@ All_FreeBSD(struct disk *d, int force_all)
c = d->chunks;
if (force_all) {
Sanitize_Bios_Geom(d);
-#ifdef PC98
Create_Chunk(d, c->offset, c->size, freebsd, 0x494,
CHUNK_FORCE_ALL, "FreeBSD");
-#else
- Create_Chunk(d, c->offset, c->size, freebsd, 0xa5,
- CHUNK_FORCE_ALL);
-#endif
} else {
-#ifdef PC98
Create_Chunk(d, c->offset, c->size, freebsd, 0x494, 0,
"FreeBSD");
-#else
- Create_Chunk(d, c->offset, c->size, freebsd, 0xa5, 0);
-#endif
}
}
diff --git a/lib/libdisk/chunk.c b/lib/libdisk/chunk.c
index 8434f6b..e72ad63 100644
--- a/lib/libdisk/chunk.c
+++ b/lib/libdisk/chunk.c
@@ -123,13 +123,8 @@ Clone_Chunk(const struct chunk *c1)
}
static int
-#ifdef PC98
Insert_Chunk(struct chunk *c2, u_long offset, u_long size, const char *name,
chunk_e type, int subtype, u_long flags, const char *sname)
-#else
-Insert_Chunk(struct chunk *c2, u_long offset, u_long size, const char *name,
- chunk_e type, int subtype, u_long flags)
-#endif
{
struct chunk *ct,*cs;
@@ -218,13 +213,8 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, const char *name,
}
int
-#ifdef PC98
Add_Chunk(struct disk *d, long offset, u_long size, const char *name,
chunk_e type, int subtype, u_long flags, const char *sname)
-#else
-Add_Chunk(struct disk *d, long offset, u_long size, const char *name,
- chunk_e type, int subtype, u_long flags)
-#endif
{
struct chunk *c1,*c2,ct;
u_long end = offset + size - 1;
@@ -243,10 +233,8 @@ Add_Chunk(struct disk *d, long offset, u_long size, const char *name,
c2->offset = c1->offset = offset;
c2->size = c1->size = size;
c2->end = c1->end = end;
-#ifdef PC98
c1->sname = strdup(sname);
c2->sname = strdup("-");
-#endif
c1->name = strdup(name);
c2->name = strdup("-");
c1->type = type;
@@ -313,13 +301,8 @@ Add_Chunk(struct disk *d, long offset, u_long size, const char *name,
size -= offset;
doit:
-#ifdef PC98
return Insert_Chunk(c2, offset, size, name,
type, subtype, flags, sname);
-#else
- return Insert_Chunk(c2, offset, size, name,
- type, subtype, flags);
-#endif
}
}
return __LINE__;
diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c
index dbc5b58..5efe0d9 100644
--- a/lib/libdisk/create_chunk.c
+++ b/lib/libdisk/create_chunk.c
@@ -176,11 +176,7 @@ Fixup_Names(struct disk *d)
}
int
-#ifdef PC98
Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type, int subtype, u_long flags, const char *sname)
-#else
-Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type, int subtype, u_long flags)
-#endif
{
int i;
u_long l;
@@ -205,11 +201,7 @@ Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type, int subty
size -= l;
}
-#ifdef PC98
i = Add_Chunk(d, offset, size, "X", type, subtype, flags, sname);
-#else
- i = Add_Chunk(d, offset, size, "X", type, subtype, flags);
-#endif
Fixup_Names(d);
return i;
}
@@ -231,11 +223,7 @@ Create_Chunk_DWIM(struct disk *d, const struct chunk *parent , u_long size, chun
}
return 0;
found:
-#ifdef PC98
i = Add_Chunk(d, offset, size, "X", type, subtype, flags, "-");
-#else
- i = Add_Chunk(d, offset, size, "X", type, subtype, flags);
-#endif
if (i)
return 0;
Fixup_Names(d);
diff --git a/lib/libdisk/disk.c b/lib/libdisk/disk.c
index 3f83f2a..0ea8f33 100644
--- a/lib/libdisk/disk.c
+++ b/lib/libdisk/disk.c
@@ -624,11 +624,7 @@ Int_Open_Disk(const char *name, u_long size)
if (dl.d_ntracks && dl.d_nsectors)
d->bios_cyl = size / (dl.d_ntracks * dl.d_nsectors);
-#ifdef PC98
if (Add_Chunk(d, 0, size, name, whole, 0, 0, "-"))
-#else
- if (Add_Chunk(d, 0, size, name, whole, 0, 0))
-#endif
DPRINT(("Failed to add 'whole' chunk"));
#ifdef __i386__
@@ -699,7 +695,7 @@ Int_Open_Disk(const char *name, u_long size)
ds.dss_slices[i].ds_name))
#else
if (Add_Chunk(d, ds.dss_slices[i].ds_offset,
- ds.dss_slices[i].ds_size, sname, ce, subtype, flags))
+ ds.dss_slices[i].ds_size, sname, ce, subtype, flags, ""))
#endif
DPRINT(("failed to add chunk for slice %d", i - 1));
@@ -762,7 +758,7 @@ Int_Open_Disk(const char *name, u_long size)
0,
ds.dss_slices[i].ds_name) && j != 3)
#else
- 0) && j != 3)
+ 0, "") && j != 3)
#endif
DPRINT((
"Failed to add chunk for partition %c [%lu,%lu]",
diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h
index 86f786a..8790e7d 100644
--- a/lib/libdisk/libdisk.h
+++ b/lib/libdisk/libdisk.h
@@ -56,9 +56,7 @@ struct chunk {
long offset;
u_long size;
u_long end;
-#ifdef PC98
- char *sname;
-#endif
+ char *sname; /* PC98 field */
char *name;
char *oname;
/* Used during Fixup_Names() to avoid renaming more than
@@ -158,13 +156,8 @@ Collapse_Chunk(struct disk *disk, struct chunk *chunk);
*/
int
-#ifdef PC98
Create_Chunk(struct disk *disk, u_long offset, u_long size, chunk_e type,
int subtype, u_long flags, const char *);
-#else
-Create_Chunk(struct disk *disk, u_long offset, u_long size, chunk_e type,
- int subtype, u_long flags);
-#endif
/* Create a chunk with the specified paramters
*/
@@ -263,11 +256,7 @@ ShowChunkFlags(struct chunk *c);
void Debug_Chunk(struct chunk *);
void Free_Chunk(struct chunk *);
struct chunk * Clone_Chunk(const struct chunk *);
-#ifdef PC98
int Add_Chunk(struct disk *, long, u_long, const char *, chunk_e, int, u_long, const char *);
-#else
-int Add_Chunk(struct disk *, long, u_long, const char *, chunk_e, int, u_long);
-#endif
void * read_block(int, daddr_t, u_long);
int write_block(int, daddr_t, const void *, u_long);
struct disklabel * read_disklabel(int, daddr_t, u_long);
OpenPOWER on IntegriCloud