mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Avoid a lot of #ifdef PC98 code by giving a couple of the Chunk functions
an extra argument for all archs.
This commit is contained in:
parent
cf8cc48964
commit
1e08b0a637
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=105685
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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__;
|
||||
|
@ -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);
|
||||
|
@ -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]",
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user