From 3c75042939337967e38a6c0facd7c9aff7827f71 Mon Sep 17 00:00:00 2001 From: krw Date: Wed, 5 Jul 2023 07:28:10 +0000 Subject: [PATCH] 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@ --- sbin/disklabel/editor.c | 10 +++++++--- 1 file 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 @@ -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! */ -- 2.20.1