diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2023-07-05 07:28:11 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2023-07-05 07:28:11 +0000 |
commit | f43fd801092e9812ce23a25421ee863079a44548 (patch) | |
tree | 28ccf6f13c84b204421f923591024b6053fa9ef0 /sbin/disklabel | |
parent | 110bd8f12e8283bd0e5c7c465606c9473dfab899 (diff) |
Restore (R)esize functionality to sparc64 disklabel(8).
Empty or FS_UNUSED partitions don't intrude into the OpenBSD area
of a disk and therefore should not disable partition resizing.
Encountered by claudio@
Diffstat (limited to 'sbin/disklabel')
-rw-r--r-- | sbin/disklabel/editor.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index ac4dc682af8..a1d1a2f6801 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.414 2023/07/03 06:07:40 krw Exp $ */ +/* $OpenBSD: editor.c,v 1.415 2023/07/05 07:28:10 krw Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <millert@openbsd.org> @@ -520,6 +520,7 @@ int editor_allocspace(struct disklabel *lp_org) { struct disklabel label; + struct partition *pp; u_int64_t pstart, pend; int i; @@ -530,8 +531,11 @@ editor_allocspace(struct disklabel *lp_org) for (i = 0; i < MAXPARTITIONS; i++) { if (i == RAW_PART) continue; - pstart = DL_GETPOFFSET(&lp_org->d_partitions[i]); - pend = pstart + DL_GETPSIZE(&lp_org->d_partitions[i]); + pp = &lp_org->d_partitions[i]; + if (DL_GETPSIZE(pp) == 0 || pp->p_fstype == FS_UNUSED) + continue; + pstart = DL_GETPOFFSET(pp); + pend = pstart + DL_GETPSIZE(pp); if (((pstart >= starting_sector && pstart < ending_sector) || (pend > starting_sector && pend <= ending_sector))) resizeok = 0; /* Part of OBSD area is in use! */ |