summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2013-08-07 00:00:48 +0000
committermarcel <marcel@FreeBSD.org>2013-08-07 00:00:48 +0000
commit9f2f2e171a6de4c6d713a50366f3572946665fb5 (patch)
treeb8704cff2de99c4cf2da972288c8d1271ec33598 /sys/geom
parentf5fd32bca5d6cadbe86d031375653c183adce356 (diff)
downloadFreeBSD-src-9f2f2e171a6de4c6d713a50366f3572946665fb5.zip
FreeBSD-src-9f2f2e171a6de4c6d713a50366f3572946665fb5.tar.gz
Change <sys/diskpc98.h> to not redefine the same symbols that are
being defined in <sys/diskmbr.h>. Instead give the symbols here a "PC98_" prefix. This way, both <sys/diskmbr.h> and <sys/diskpc98.h> can be included in the same C source file. The renaming is trivial. The only gotcha is that DOSBBSECTOR is also redefined from 0 to 1. This because DOSBBSECTOR was always used in conjunction with an addition of 1. The PC98_BBSECTOR symbol is defined as 1 and the expression is simplified. Note: it is not believed that ports are seriously impacted; or at all for that matter. Approved by: nyan@
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/geom_pc98.c15
-rw-r--r--sys/geom/part/g_part_pc98.c24
2 files changed, 20 insertions, 19 deletions
diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c
index 8e14f09..42c9962 100644
--- a/sys/geom/geom_pc98.c
+++ b/sys/geom/geom_pc98.c
@@ -56,7 +56,7 @@ FEATURE(geom_pc98, "GEOM NEC PC9800 partitioning support");
struct g_pc98_softc {
u_int fwsectors, fwheads, sectorsize;
- int type[NDOSPART];
+ int type[PC98_NPARTS];
u_char sec[8192];
};
@@ -84,8 +84,8 @@ static int
g_pc98_modify(struct g_geom *gp, struct g_pc98_softc *ms, u_char *sec, int len __unused)
{
int i, error;
- off_t s[NDOSPART], l[NDOSPART];
- struct pc98_partition dp[NDOSPART];
+ off_t s[PC98_NPARTS], l[PC98_NPARTS];
+ struct pc98_partition dp[PC98_NPARTS];
g_topology_assert();
@@ -114,11 +114,11 @@ g_pc98_modify(struct g_geom *gp, struct g_pc98_softc *ms, u_char *sec, int len _
return (EBUSY);
#endif
- for (i = 0; i < NDOSPART; i++)
+ for (i = 0; i < PC98_NPARTS; i++)
pc98_partition_dec(
sec + 512 + i * sizeof(struct pc98_partition), &dp[i]);
- for (i = 0; i < NDOSPART; i++) {
+ for (i = 0; i < PC98_NPARTS; i++) {
/* If start and end are identical it's bogus */
if (dp[i].dp_ssect == dp[i].dp_esect &&
dp[i].dp_shd == dp[i].dp_ehd &&
@@ -146,7 +146,7 @@ g_pc98_modify(struct g_geom *gp, struct g_pc98_softc *ms, u_char *sec, int len _
return (error);
}
- for (i = 0; i < NDOSPART; i++) {
+ for (i = 0; i < PC98_NPARTS; i++) {
ms->type[i] = (dp[i].dp_sid << 8) | dp[i].dp_mid;
g_slice_config(gp, i, G_SLICE_CONFIG_SET, s[i], l[i],
ms->sectorsize, "%ss%d", gp->name, i + 1);
@@ -269,7 +269,8 @@ g_pc98_taste(struct g_class *mp, struct g_provider *pp, int flags)
if (flags == G_TF_NORMAL &&
!strcmp(pp->geom->class->name, PC98_CLASS_NAME))
return (NULL);
- gp = g_slice_new(mp, NDOSPART, pp, &cp, &ms, sizeof *ms, g_pc98_start);
+ gp = g_slice_new(mp, PC98_NPARTS, pp, &cp, &ms, sizeof *ms,
+ g_pc98_start);
if (gp == NULL)
return (NULL);
g_topology_unlock();
diff --git a/sys/geom/part/g_part_pc98.c b/sys/geom/part/g_part_pc98.c
index 4d2b60c..d18d5cf 100644
--- a/sys/geom/part/g_part_pc98.c
+++ b/sys/geom/part/g_part_pc98.c
@@ -109,8 +109,8 @@ static struct g_part_scheme g_part_pc98_scheme = {
g_part_pc98_methods,
sizeof(struct g_part_pc98_table),
.gps_entrysz = sizeof(struct g_part_pc98_entry),
- .gps_minent = NDOSPART,
- .gps_maxent = NDOSPART,
+ .gps_minent = PC98_NPARTS,
+ .gps_maxent = PC98_NPARTS,
.gps_bootcodesz = BOOTSIZE,
};
G_PART_SCHEME_DECLARE(g_part_pc98);
@@ -259,7 +259,7 @@ g_part_pc98_create(struct g_part_table *basetable, struct g_part_parms *gpp)
basetable->gpt_last = MIN(pp->mediasize / SECSIZE, UINT32_MAX) - 1;
table = (struct g_part_pc98_table *)basetable;
- le16enc(table->boot + DOSMAGICOFFSET, DOSMAGIC);
+ le16enc(table->boot + PC98_MAGICOFS, PC98_MAGIC);
return (0);
}
@@ -396,8 +396,8 @@ g_part_pc98_probe(struct g_part_table *table, struct g_consumer *cp)
/* We goto out on mismatch. */
res = ENXIO;
- magic = le16dec(buf + DOSMAGICOFFSET);
- if (magic != DOSMAGIC)
+ magic = le16dec(buf + PC98_MAGICOFS);
+ if (magic != PC98_MAGIC)
goto out;
sum = 0;
@@ -408,8 +408,8 @@ g_part_pc98_probe(struct g_part_table *table, struct g_consumer *cp)
goto out;
}
- for (index = 0; index < NDOSPART; index++) {
- p = buf + SECSIZE + index * DOSPARTSIZE;
+ for (index = 0; index < PC98_NPARTS; index++) {
+ p = buf + SECSIZE + index * PC98_PARTSIZE;
if (p[0] == 0 || p[1] == 0) /* !dp_mid || !dp_sid */
continue;
scyl = le16dec(p + 10);
@@ -456,8 +456,8 @@ g_part_pc98_read(struct g_part_table *basetable, struct g_consumer *cp)
bcopy(buf + SECSIZE, table->table, sizeof(table->table));
bcopy(buf + SECSIZE*2, table->menu, sizeof(table->menu));
- for (index = NDOSPART - 1; index >= 0; index--) {
- p = buf + SECSIZE + index * DOSPARTSIZE;
+ for (index = PC98_NPARTS - 1; index >= 0; index--) {
+ p = buf + SECSIZE + index * PC98_PARTSIZE;
ent.dp_mid = p[0];
ent.dp_sid = p[1];
ent.dp_dum1 = p[2];
@@ -482,7 +482,7 @@ g_part_pc98_read(struct g_part_table *basetable, struct g_consumer *cp)
entry->ent = ent;
}
- basetable->gpt_entries = NDOSPART;
+ basetable->gpt_entries = PC98_NPARTS;
basetable->gpt_first = cyl;
basetable->gpt_last = msize - 1;
@@ -569,7 +569,7 @@ g_part_pc98_write(struct g_part_table *basetable, struct g_consumer *cp)
table = (struct g_part_pc98_table *)basetable;
baseentry = LIST_FIRST(&basetable->gpt_entry);
for (index = 1; index <= basetable->gpt_entries; index++) {
- p = table->table + (index - 1) * DOSPARTSIZE;
+ p = table->table + (index - 1) * PC98_PARTSIZE;
entry = (baseentry != NULL && index == baseentry->gpe_index)
? (struct g_part_pc98_entry *)baseentry : NULL;
if (entry != NULL && !baseentry->gpe_deleted) {
@@ -589,7 +589,7 @@ g_part_pc98_write(struct g_part_table *basetable, struct g_consumer *cp)
bcopy(entry->ent.dp_name, p + 16,
sizeof(entry->ent.dp_name));
} else
- bzero(p, DOSPARTSIZE);
+ bzero(p, PC98_PARTSIZE);
if (entry != NULL)
baseentry = LIST_NEXT(baseentry, gpe_entry);
OpenPOWER on IntegriCloud