No intentional functional change.
-/* $OpenBSD: cmd.c,v 1.166 2023/03/04 14:47:18 krw Exp $ */
+/* $OpenBSD: cmd.c,v 1.167 2023/03/04 21:22:51 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
int
Xwrite(const char *args, struct mbr *mbr)
{
- int i, n;
+ unsigned int i, n;
- for (i = 0, n = 0; i < NDOSPART; i++)
+ for (i = 0, n = 0; i < nitems(mbr->mbr_prt); i++)
if (mbr->mbr_prt[i].prt_id == DOSPTYP_OPENBSD)
n++;
if (n > 1) {
gp[i].gp_attrs = 0;
}
} else {
- for (i = 0; i < NDOSPART; i++) {
+ for (i = 0; i < nitems(mbr->mbr_prt); i++) {
if (i == pn)
mbr->mbr_prt[i].prt_flag = DOSACTIVE;
else
-/* $OpenBSD: mbr.c,v 1.121 2022/07/26 14:30:37 krw Exp $ */
+/* $OpenBSD: mbr.c,v 1.122 2023/03/04 21:22:51 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
void
MBR_print(const struct mbr *mbr, const char *units)
{
- int i;
+ unsigned int i;
DISK_printgeometry("s");
printf("Signature: 0x%X\n", (int)mbr->mbr_signature);
PRT_print_parthdr();
- for (i = 0; i < NDOSPART; i++)
+ for (i = 0; i < nitems(mbr->mbr_prt); i++)
PRT_print_part(i, &mbr->mbr_prt[i], units);
}
return 1; /* All zeros struct dos_mbr is editable. */
nprt = 0;
- for (i = 0; i < NDOSPART; i++) {
+ for (i = 0; i < nitems(mbr->mbr_prt); i++) {
bs = mbr->mbr_prt[i].prt_bs;
ns = mbr->mbr_prt[i].prt_ns;
id = mbr->mbr_prt[i].prt_id;
-/* $OpenBSD: user.c,v 1.84 2022/07/25 17:45:16 krw Exp $ */
+/* $OpenBSD: user.c,v 1.85 2023/03/04 21:22:51 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
{
struct mbr mbr;
uint64_t lba_self, lba_firstembr;
- int i;
+ unsigned int i;
lba_self = lba_firstembr = 0;
MBR_print(&mbr, "s");
- for (lba_self = i = 0; i < 4; i++)
+ for (lba_self = i = 0; i < nitems(mbr.mbr_prt); i++)
if (mbr.mbr_prt[i].prt_id == DOSPTYP_EXTEND ||
mbr.mbr_prt[i].prt_id == DOSPTYP_EXTENDL) {
lba_self = mbr.mbr_prt[i].prt_bs;