summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2021-07-11 20:51:51 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2021-07-11 20:51:51 +0000
commit00c97a776de24da2a689ada3ba85ae5d84275aaf (patch)
tree188521863063f900df1304c493d4ece12002a02e /sbin
parentaa81d1f793a66a1a6507fe7fc229c264dc8c7522 (diff)
Add 'prt_' prefix to struct prt field names.
Use 'dp' instead of 'prt' for struct dos_partition * paramters, and 'prt' instead of 'partn' for struct prt * parameters. No functional change.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fdisk/cmd.c50
-rw-r--r--sbin/fdisk/mbr.c72
-rw-r--r--sbin/fdisk/part.c184
-rw-r--r--sbin/fdisk/part.h14
-rw-r--r--sbin/fdisk/user.c8
5 files changed, 164 insertions, 164 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c
index a548874339e..1ab8065913c 100644
--- a/sbin/fdisk/cmd.c
+++ b/sbin/fdisk/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.122 2021/07/11 19:43:19 krw Exp $ */
+/* $OpenBSD: cmd.c,v 1.123 2021/07/11 20:51:50 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -241,8 +241,8 @@ edit(int pn, struct mbr *mbr)
oldpp = *pp;
setpid(pn, mbr);
- if (pp->id == DOSPTYP_UNUSED) {
- if (oldpp.id != DOSPTYP_UNUSED) {
+ if (pp->prt_id == DOSPTYP_UNUSED) {
+ if (oldpp.prt_id != DOSPTYP_UNUSED) {
memset(pp, 0, sizeof(*pp));
printf("Partition %d is disabled.\n", pn);
}
@@ -250,19 +250,19 @@ edit(int pn, struct mbr *mbr)
}
if (ask_yn("Do you wish to edit in CHS mode?")) {
- pp->scyl = ask_num("BIOS Starting cylinder", pp->scyl, 0,
+ pp->prt_scyl = ask_num("BIOS Starting cylinder", pp->prt_scyl, 0,
disk.cylinders - 1);
- pp->shead = ask_num("BIOS Starting head", pp->shead, 0,
+ pp->prt_shead = ask_num("BIOS Starting head", pp->prt_shead, 0,
disk.heads - 1);
- pp->ssect = ask_num("BIOS Starting sector", pp->ssect, 1,
+ pp->prt_ssect = ask_num("BIOS Starting sector", pp->prt_ssect, 1,
disk.sectors);
- pp->ecyl = ask_num("BIOS Ending cylinder", pp->ecyl,
- pp->scyl, disk.cylinders - 1);
- pp->ehead = ask_num("BIOS Ending head", pp->ehead,
- (pp->scyl == pp->ecyl) ? pp->shead : 0, disk.heads - 1);
- pp->esect = ask_num("BIOS Ending sector", pp->esect,
- (pp->scyl == pp->ecyl && pp->shead == pp->ehead) ? pp->ssect
+ pp->prt_ecyl = ask_num("BIOS Ending cylinder", pp->prt_ecyl,
+ pp->prt_scyl, disk.cylinders - 1);
+ pp->prt_ehead = ask_num("BIOS Ending head", pp->prt_ehead,
+ (pp->prt_scyl == pp->prt_ecyl) ? pp->prt_shead : 0, disk.heads - 1);
+ pp->prt_esect = ask_num("BIOS Ending sector", pp->prt_esect,
+ (pp->prt_scyl == pp->prt_ecyl && pp->prt_shead == pp->prt_ehead) ? pp->prt_ssect
: 1, disk.sectors);
/* Fix up off/size values */
@@ -270,9 +270,9 @@ edit(int pn, struct mbr *mbr)
/* Fix up CHS values for LBA */
PRT_fix_CHS(pp);
} else {
- pp->bs = getuint64("Partition offset", pp->bs, 0, disk.size - 1);
- pp->ns = getuint64("Partition size", pp->ns, 1,
- disk.size - pp->bs);
+ pp->prt_bs = getuint64("Partition offset", pp->prt_bs, 0, disk.size - 1);
+ pp->prt_ns = getuint64("Partition size", pp->prt_ns, 1,
+ disk.size - pp->prt_bs);
/* Fix up CHS values */
PRT_fix_CHS(pp);
@@ -366,11 +366,11 @@ setpid(int pn, struct mbr *mbr)
PRT_print(pn, pp, NULL);
/* Ask for MBR partition type */
- num = ask_pid(pp->id, NULL);
- if (num == pp->id)
+ num = ask_pid(pp->prt_id, NULL);
+ if (num == pp->prt_id)
return CMD_CONT;
- pp->id = num;
+ pp->prt_id = num;
return CMD_DIRTY;
}
@@ -401,11 +401,11 @@ Xselect(char *args, struct mbr *mbr)
if (pn == -1)
return CMD_CONT;
- off = mbr->mbr_prt[pn].bs;
+ off = mbr->mbr_prt[pn].prt_bs;
/* Sanity checks */
- if ((mbr->mbr_prt[pn].id != DOSPTYP_EXTEND) &&
- (mbr->mbr_prt[pn].id != DOSPTYP_EXTENDL)) {
+ if ((mbr->mbr_prt[pn].prt_id != DOSPTYP_EXTEND) &&
+ (mbr->mbr_prt[pn].prt_id != DOSPTYP_EXTENDL)) {
printf("Partition %d is not an extended partition.\n", pn);
return CMD_CONT;
}
@@ -448,7 +448,7 @@ Xwrite(char *args, struct mbr *mbr)
int efi, i, n;
for (i = 0, n = 0; i < NDOSPART; i++)
- if (mbr->mbr_prt[i].id == 0xA6)
+ if (mbr->mbr_prt[i].prt_id == 0xA6)
n++;
if (n >= 2) {
warnx("MBR contains more than one OpenBSD partition!");
@@ -559,7 +559,7 @@ Xflag(char *args, struct mbr *mbr)
if (letoh64(gh.gh_sig) == GPTSIGNATURE)
gp[pn].gp_attrs = htole64(val);
else
- mbr->mbr_prt[pn].flag = val;
+ mbr->mbr_prt[pn].prt_flag = val;
printf("Partition %d flag value set to 0x%llx.\n", pn, val);
} else {
/* Set active flag */
@@ -573,9 +573,9 @@ Xflag(char *args, struct mbr *mbr)
} else {
for (i = 0; i < NDOSPART; i++) {
if (i == pn)
- mbr->mbr_prt[i].flag = DOSACTIVE;
+ mbr->mbr_prt[i].prt_flag = DOSACTIVE;
else
- mbr->mbr_prt[i].flag = 0x00;
+ mbr->mbr_prt[i].prt_flag = 0x00;
}
}
printf("Partition %d marked active.\n", pn);
diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c
index 37246b444d6..956d272bca7 100644
--- a/sbin/fdisk/mbr.c
+++ b/sbin/fdisk/mbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbr.c,v 1.81 2021/07/11 19:43:19 krw Exp $ */
+/* $OpenBSD: mbr.c,v 1.82 2021/07/11 20:51:50 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -66,9 +66,9 @@ MBR_init_GPT(struct mbr *mbr)
* about the size of the disk, thus making it impossible to boot
* such devices.
*/
- mbr->mbr_prt[0].id = DOSPTYP_EFI;
- mbr->mbr_prt[0].bs = 1;
- mbr->mbr_prt[0].ns = UINT32_MAX;
+ mbr->mbr_prt[0].prt_id = DOSPTYP_EFI;
+ mbr->mbr_prt[0].prt_bs = 1;
+ mbr->mbr_prt[0].prt_ns = UINT32_MAX;
/* Fix up start/length fields. */
PRT_fix_CHS(&mbr->mbr_prt[0]);
@@ -90,69 +90,69 @@ MBR_init(struct mbr *mbr)
* from disk!! Just mark them inactive until -b goodness spreads
* further.
*/
- mbr->mbr_prt[0].flag = 0;
- mbr->mbr_prt[1].flag = 0;
- mbr->mbr_prt[2].flag = 0;
+ mbr->mbr_prt[0].prt_flag = 0;
+ mbr->mbr_prt[1].prt_flag = 0;
+ mbr->mbr_prt[2].prt_flag = 0;
- mbr->mbr_prt[3].flag = DOSACTIVE;
+ mbr->mbr_prt[3].prt_flag = DOSACTIVE;
mbr->mbr_signature = DOSMBR_SIGNATURE;
/* Use whole disk. Reserve first track, or first cyl, if possible. */
- mbr->mbr_prt[3].id = DOSPTYP_OPENBSD;
+ mbr->mbr_prt[3].prt_id = DOSPTYP_OPENBSD;
if (disk.heads > 1)
- mbr->mbr_prt[3].shead = 1;
+ mbr->mbr_prt[3].prt_shead = 1;
else
- mbr->mbr_prt[3].shead = 0;
+ mbr->mbr_prt[3].prt_shead = 0;
if (disk.heads < 2 && disk.cylinders > 1)
- mbr->mbr_prt[3].scyl = 1;
+ mbr->mbr_prt[3].prt_scyl = 1;
else
- mbr->mbr_prt[3].scyl = 0;
- mbr->mbr_prt[3].ssect = 1;
+ mbr->mbr_prt[3].prt_scyl = 0;
+ mbr->mbr_prt[3].prt_ssect = 1;
/* Go right to the end */
- mbr->mbr_prt[3].ecyl = disk.cylinders - 1;
- mbr->mbr_prt[3].ehead = disk.heads - 1;
- mbr->mbr_prt[3].esect = disk.sectors;
+ mbr->mbr_prt[3].prt_ecyl = disk.cylinders - 1;
+ mbr->mbr_prt[3].prt_ehead = disk.heads - 1;
+ mbr->mbr_prt[3].prt_esect = disk.sectors;
/* Fix up start/length fields */
PRT_fix_BN(&mbr->mbr_prt[3], 3);
#if defined(__powerpc__) || defined(__mips__)
/* Now fix up for the MS-DOS boot partition on PowerPC. */
- mbr->mbr_prt[0].flag = DOSACTIVE; /* Boot from dos part */
- mbr->mbr_prt[3].flag = 0;
- mbr->mbr_prt[3].ns += mbr->mbr_prt[3].bs;
- mbr->mbr_prt[3].bs = mbr->mbr_prt[0].bs + mbr->mbr_prt[0].ns;
- mbr->mbr_prt[3].ns -= mbr->mbr_prt[3].bs;
+ mbr->mbr_prt[0].prt_flag = DOSACTIVE; /* Boot from dos part */
+ mbr->mbr_prt[3].prt_flag = 0;
+ mbr->mbr_prt[3].prt_ns += mbr->mbr_prt[3].prt_bs;
+ mbr->mbr_prt[3].prt_bs = mbr->mbr_prt[0].prt_bs + mbr->mbr_prt[0].prt_ns;
+ mbr->mbr_prt[3].prt_ns -= mbr->mbr_prt[3].prt_bs;
PRT_fix_CHS(&mbr->mbr_prt[3]);
- if ((mbr->mbr_prt[3].shead != 1) || (mbr->mbr_prt[3].ssect != 1)) {
+ if ((mbr->mbr_prt[3].prt_shead != 1) || (mbr->mbr_prt[3].prt_ssect != 1)) {
/* align the partition on a cylinder boundary */
- mbr->mbr_prt[3].shead = 0;
- mbr->mbr_prt[3].ssect = 1;
- mbr->mbr_prt[3].scyl += 1;
+ mbr->mbr_prt[3].prt_shead = 0;
+ mbr->mbr_prt[3].prt_ssect = 1;
+ mbr->mbr_prt[3].prt_scyl += 1;
}
/* Fix up start/length fields */
PRT_fix_BN(&mbr->mbr_prt[3], 3);
#else
if (b_sectors > 0) {
- mbr->mbr_prt[0].id = b_type;
- mbr->mbr_prt[0].bs = b_offset;
- mbr->mbr_prt[0].ns = b_sectors;
+ mbr->mbr_prt[0].prt_id = b_type;
+ mbr->mbr_prt[0].prt_bs = b_offset;
+ mbr->mbr_prt[0].prt_ns = b_sectors;
PRT_fix_CHS(&mbr->mbr_prt[0]);
- mbr->mbr_prt[3].ns += mbr->mbr_prt[3].bs;
- mbr->mbr_prt[3].bs = mbr->mbr_prt[0].bs + mbr->mbr_prt[0].ns;
- mbr->mbr_prt[3].ns -= mbr->mbr_prt[3].bs;
+ mbr->mbr_prt[3].prt_ns += mbr->mbr_prt[3].prt_bs;
+ mbr->mbr_prt[3].prt_bs = mbr->mbr_prt[0].prt_bs + mbr->mbr_prt[0].prt_ns;
+ mbr->mbr_prt[3].prt_ns -= mbr->mbr_prt[3].prt_bs;
PRT_fix_CHS(&mbr->mbr_prt[3]);
}
#endif
/* Start OpenBSD MBR partition on a power of 2 block number. */
daddr = 1;
- while (daddr < DL_SECTOBLK(&dl, mbr->mbr_prt[3].bs))
+ while (daddr < DL_SECTOBLK(&dl, mbr->mbr_prt[3].prt_bs))
daddr *= 2;
- adj = DL_BLKTOSEC(&dl, daddr) - mbr->mbr_prt[3].bs;
- mbr->mbr_prt[3].bs += adj;
- mbr->mbr_prt[3].ns -= adj;
+ adj = DL_BLKTOSEC(&dl, daddr) - mbr->mbr_prt[3].prt_bs;
+ mbr->mbr_prt[3].prt_bs += adj;
+ mbr->mbr_prt[3].prt_ns -= adj;
PRT_fix_CHS(&mbr->mbr_prt[3]);
}
diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c
index 929b5f14033..3beeba27396 100644
--- a/sbin/fdisk/part.c
+++ b/sbin/fdisk/part.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: part.c,v 1.90 2021/07/11 19:43:19 krw Exp $ */
+/* $OpenBSD: part.c,v 1.91 2021/07/11 20:51:50 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -30,7 +30,7 @@
#include "misc.h"
#include "part.h"
-int check_chs(struct prt *partn);
+int check_chs(struct prt *);
const char *ascii_id(int);
static const struct part_type {
@@ -222,54 +222,54 @@ ascii_id(int id)
}
void
-PRT_parse(struct dos_partition *prt, off_t lba_self, off_t lba_firstembr,
- struct prt *partn)
+PRT_parse(struct dos_partition *dp, off_t lba_self, off_t lba_firstembr,
+ struct prt *prt)
{
off_t off;
uint32_t t;
- partn->flag = prt->dp_flag;
- partn->shead = prt->dp_shd;
+ prt->prt_flag = dp->dp_flag;
+ prt->prt_shead = dp->dp_shd;
- partn->ssect = (prt->dp_ssect) & 0x3F;
- partn->scyl = ((prt->dp_ssect << 2) & 0xFF00) | prt->dp_scyl;
+ prt->prt_ssect = (dp->dp_ssect) & 0x3F;
+ prt->prt_scyl = ((dp->dp_ssect << 2) & 0xFF00) | dp->dp_scyl;
- partn->id = prt->dp_typ;
- partn->ehead = prt->dp_ehd;
- partn->esect = (prt->dp_esect) & 0x3F;
- partn->ecyl = ((prt->dp_esect << 2) & 0xFF00) | prt->dp_ecyl;
+ prt->prt_id = dp->dp_typ;
+ prt->prt_ehead = dp->dp_ehd;
+ prt->prt_esect = (dp->dp_esect) & 0x3F;
+ prt->prt_ecyl = ((dp->dp_esect << 2) & 0xFF00) | dp->dp_ecyl;
- if ((partn->id == DOSPTYP_EXTEND) || (partn->id == DOSPTYP_EXTENDL))
+ if ((prt->prt_id == DOSPTYP_EXTEND) || (prt->prt_id == DOSPTYP_EXTENDL))
off = lba_firstembr;
else
off = lba_self;
#if 0 /* XXX */
- partn->bs = letoh32(prt->dp_start) + off;
- partn->ns = letoh32(prt->dp_size);
- if (partn->id == DOSPTYP_EFI && partn == UINT32_MAX)
- partn->ns = DL_GETDSIZE(&dl) - partn->bs;
+ prt->prt_bs = letoh32(dp->dp_start) + off;
+ prt->prt_ns = letoh32(dp->dp_size);
+ if (prt->prt_id == DOSPTYP_EFI && partn == UINT32_MAX)
+ prt->prt_ns = DL_GETDSIZE(&dl) - prt->prt_bs;
#else
- memcpy(&t, &prt->dp_start, sizeof(uint32_t));
- partn->bs = letoh32(t) + off;
- memcpy(&t, &prt->dp_size, sizeof(uint32_t));
- partn->ns = letoh32(t);
- if (partn->id == DOSPTYP_EFI && partn->ns == UINT32_MAX)
- partn->ns = DL_GETDSIZE(&dl) - partn->bs;
+ memcpy(&t, &dp->dp_start, sizeof(uint32_t));
+ prt->prt_bs = letoh32(t) + off;
+ memcpy(&t, &dp->dp_size, sizeof(uint32_t));
+ prt->prt_ns = letoh32(t);
+ if (prt->prt_id == DOSPTYP_EFI && prt->prt_ns == UINT32_MAX)
+ prt->prt_ns = DL_GETDSIZE(&dl) - prt->prt_bs;
#endif
- PRT_fix_CHS(partn);
+ PRT_fix_CHS(prt);
}
int
-check_chs(struct prt *partn)
+check_chs(struct prt *prt)
{
- if ( (partn->shead > 255) ||
- (partn->ssect >63) ||
- (partn->scyl > 1023) ||
- (partn->ehead >255) ||
- (partn->esect >63) ||
- (partn->ecyl > 1023) )
+ if ( (prt->prt_shead > 255) ||
+ (prt->prt_ssect >63) ||
+ (prt->prt_scyl > 1023) ||
+ (prt->prt_ehead >255) ||
+ (prt->prt_esect >63) ||
+ (prt->prt_ecyl > 1023) )
{
return 0;
}
@@ -277,57 +277,57 @@ check_chs(struct prt *partn)
}
void
-PRT_make(struct prt *partn, off_t offset, off_t reloff,
- struct dos_partition *prt)
+PRT_make(struct prt *prt, off_t lba_self, off_t lba_firstembr,
+ struct dos_partition *dp)
{
off_t off;
uint32_t ecsave, scsave;
uint64_t t;
/* Save (and restore below) cylinder info we may fiddle with. */
- scsave = partn->scyl;
- ecsave = partn->ecyl;
+ scsave = prt->prt_scyl;
+ ecsave = prt->prt_ecyl;
- if ((partn->scyl > 1023) || (partn->ecyl > 1023)) {
- partn->scyl = (partn->scyl > 1023)? 1023: partn->scyl;
- partn->ecyl = (partn->ecyl > 1023)? 1023: partn->ecyl;
+ if ((prt->prt_scyl > 1023) || (prt->prt_ecyl > 1023)) {
+ prt->prt_scyl = (prt->prt_scyl > 1023)? 1023: prt->prt_scyl;
+ prt->prt_ecyl = (prt->prt_ecyl > 1023)? 1023: prt->prt_ecyl;
}
- if ((partn->id == DOSPTYP_EXTEND) || (partn->id == DOSPTYP_EXTENDL))
- off = reloff;
+ if ((prt->prt_id == DOSPTYP_EXTEND) || (prt->prt_id == DOSPTYP_EXTENDL))
+ off = lba_firstembr;
else
- off = offset;
-
- if (check_chs(partn)) {
- prt->dp_shd = partn->shead & 0xFF;
- prt->dp_ssect = (partn->ssect & 0x3F) |
- ((partn->scyl & 0x300) >> 2);
- prt->dp_scyl = partn->scyl & 0xFF;
- prt->dp_ehd = partn->ehead & 0xFF;
- prt->dp_esect = (partn->esect & 0x3F) |
- ((partn->ecyl & 0x300) >> 2);
- prt->dp_ecyl = partn->ecyl & 0xFF;
+ off = lba_self;
+
+ if (check_chs(prt)) {
+ dp->dp_shd = prt->prt_shead & 0xFF;
+ dp->dp_ssect = (prt->prt_ssect & 0x3F) |
+ ((prt->prt_scyl & 0x300) >> 2);
+ dp->dp_scyl = prt->prt_scyl & 0xFF;
+ dp->dp_ehd = prt->prt_ehead & 0xFF;
+ dp->dp_esect = (prt->prt_esect & 0x3F) |
+ ((prt->prt_ecyl & 0x300) >> 2);
+ dp->dp_ecyl = prt->prt_ecyl & 0xFF;
} else {
- memset(prt, 0xFF, sizeof(*prt));
+ memset(dp, 0xFF, sizeof(*dp));
}
- prt->dp_flag = partn->flag & 0xFF;
- prt->dp_typ = partn->id & 0xFF;
+ dp->dp_flag = prt->prt_flag & 0xFF;
+ dp->dp_typ = prt->prt_id & 0xFF;
- t = htole64(partn->bs - off);
- memcpy(&prt->dp_start, &t, sizeof(uint32_t));
- if (partn->id == DOSPTYP_EFI && (partn->bs + partn->ns) >
+ t = htole64(prt->prt_bs - off);
+ memcpy(&dp->dp_start, &t, sizeof(uint32_t));
+ if (prt->prt_id == DOSPTYP_EFI && (prt->prt_bs + prt->prt_ns) >
DL_GETDSIZE(&dl))
t = htole64(UINT32_MAX);
else
- t = htole64(partn->ns);
- memcpy(&prt->dp_size, &t, sizeof(uint32_t));
+ t = htole64(prt->prt_ns);
+ memcpy(&dp->dp_size, &t, sizeof(uint32_t));
- partn->scyl = scsave;
- partn->ecyl = ecsave;
+ prt->prt_scyl = scsave;
+ prt->prt_ecyl = ecsave;
}
void
-PRT_print(int num, struct prt *partn, char *units)
+PRT_print(int num, struct prt *prt, char *units)
{
const int secsize = unit_types[SECTORS].conversion;
double size;
@@ -335,7 +335,7 @@ PRT_print(int num, struct prt *partn, char *units)
i = unit_lookup(units);
- if (partn == NULL) {
+ if (prt == NULL) {
printf(" Starting Ending "
" LBA Info:\n");
printf(" #: id C H S - C H S "
@@ -343,29 +343,29 @@ PRT_print(int num, struct prt *partn, char *units)
printf("---------------------------------------"
"----------------------------------------\n");
} else {
- size = ((double)partn->ns * secsize) / unit_types[i].conversion;
+ size = ((double)prt->prt_ns * secsize) / unit_types[i].conversion;
printf("%c%1d: %.2X %6u %3u %3u - %6u %3u %3u "
"[%12llu:%12.0f%s] %s\n",
- (partn->flag == DOSACTIVE)?'*':' ',
- num, partn->id,
- partn->scyl, partn->shead, partn->ssect,
- partn->ecyl, partn->ehead, partn->esect,
- partn->bs, size,
+ (prt->prt_flag == DOSACTIVE)?'*':' ',
+ num, prt->prt_id,
+ prt->prt_scyl, prt->prt_shead, prt->prt_ssect,
+ prt->prt_ecyl, prt->prt_ehead, prt->prt_esect,
+ prt->prt_bs, size,
unit_types[i].abbr,
- ascii_id(partn->id));
+ ascii_id(prt->prt_id));
}
}
void
-PRT_fix_BN(struct prt *part, int pn)
+PRT_fix_BN(struct prt *prt, int pn)
{
uint32_t spt, tpc, spc;
uint32_t start = 0;
uint32_t end = 0;
/* Zero out entry if not used */
- if (part->id == DOSPTYP_UNUSED) {
- memset(part, 0, sizeof(*part));
+ if (prt->prt_id == DOSPTYP_UNUSED) {
+ memset(prt, 0, sizeof(*prt));
return;
}
@@ -374,32 +374,32 @@ PRT_fix_BN(struct prt *part, int pn)
tpc = disk.heads;
spc = spt * tpc;
- start += part->scyl * spc;
- start += part->shead * spt;
- start += part->ssect - 1;
+ start += prt->prt_scyl * spc;
+ start += prt->prt_shead * spt;
+ start += prt->prt_ssect - 1;
- end += part->ecyl * spc;
- end += part->ehead * spt;
- end += part->esect - 1;
+ end += prt->prt_ecyl * spc;
+ end += prt->prt_ehead * spt;
+ end += prt->prt_esect - 1;
/* XXX - Should handle this... */
if (start > end)
warnx("Start of partition #%d after end!", pn);
- part->bs = start;
- part->ns = (end - start) + 1;
+ prt->prt_bs = start;
+ prt->prt_ns = (end - start) + 1;
}
void
-PRT_fix_CHS(struct prt *part)
+PRT_fix_CHS(struct prt *prt)
{
uint32_t spt, tpc, spc;
uint32_t start, end, size;
uint32_t cyl, head, sect;
/* Zero out entry if not used */
- if (part->id == DOSPTYP_UNUSED || part->ns == 0) {
- memset(part, 0, sizeof(*part));
+ if (prt->prt_id == DOSPTYP_UNUSED || prt->prt_ns == 0) {
+ memset(prt, 0, sizeof(*prt));
return;
}
@@ -408,8 +408,8 @@ PRT_fix_CHS(struct prt *part)
tpc = disk.heads;
spc = spt * tpc;
- start = part->bs;
- size = part->ns;
+ start = prt->prt_bs;
+ size = prt->prt_ns;
end = (start + size) - 1;
/* Figure out starting CHS values */
@@ -417,18 +417,18 @@ PRT_fix_CHS(struct prt *part)
head = (start / spt); start -= (head * spt);
sect = (start + 1);
- part->scyl = cyl;
- part->shead = head;
- part->ssect = sect;
+ prt->prt_scyl = cyl;
+ prt->prt_shead = head;
+ prt->prt_ssect = sect;
/* Figure out ending CHS values */
cyl = (end / spc); end -= (cyl * spc);
head = (end / spt); end -= (head * spt);
sect = (end + 1);
- part->ecyl = cyl;
- part->ehead = head;
- part->esect = sect;
+ prt->prt_ecyl = cyl;
+ prt->prt_ehead = head;
+ prt->prt_esect = sect;
}
char *
diff --git a/sbin/fdisk/part.h b/sbin/fdisk/part.h
index fd32c9ff0a3..a6c61a4055d 100644
--- a/sbin/fdisk/part.h
+++ b/sbin/fdisk/part.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: part.h,v 1.25 2021/07/11 13:23:18 krw Exp $ */
+/* $OpenBSD: part.h,v 1.26 2021/07/11 20:51:50 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -20,12 +20,12 @@
#define _PART_H
struct prt {
- uint64_t bs;
- uint64_t ns;
- uint32_t shead, scyl, ssect;
- uint32_t ehead, ecyl, esect;
- unsigned char flag;
- unsigned char id;
+ uint64_t prt_bs;
+ uint64_t prt_ns;
+ uint32_t prt_shead, prt_scyl, prt_ssect;
+ uint32_t prt_ehead, prt_ecyl, prt_esect;
+ unsigned char prt_flag;
+ unsigned char prt_id;
};
void PRT_printall(void);
diff --git a/sbin/fdisk/user.c b/sbin/fdisk/user.c
index 70d3e6554b6..e078281fc6e 100644
--- a/sbin/fdisk/user.c
+++ b/sbin/fdisk/user.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: user.c,v 1.58 2021/07/11 19:43:19 krw Exp $ */
+/* $OpenBSD: user.c,v 1.59 2021/07/11 20:51:50 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -192,9 +192,9 @@ USER_print_disk(int verbosity)
/* Print out extended partitions too */
for (offset = i = 0; i < 4; i++)
- if (mbr.mbr_prt[i].id == DOSPTYP_EXTEND ||
- mbr.mbr_prt[i].id == DOSPTYP_EXTENDL) {
- offset = (off_t)mbr.mbr_prt[i].bs;
+ if (mbr.mbr_prt[i].prt_id == DOSPTYP_EXTEND ||
+ mbr.mbr_prt[i].prt_id == DOSPTYP_EXTENDL) {
+ offset = (off_t)mbr.mbr_prt[i].prt_bs;
if (firstoff == 0)
firstoff = offset;
}