Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst Do not defer wedge deletions when we have n...



details:   https://anonhg.NetBSD.org/src/rev/7646ca539fc4
branches:  trunk
changeset: 359903:7646ca539fc4
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jan 30 11:58:29 2022 +0000

description:
Do not defer wedge deletions when we have nothing mounted.
Define and use a constant for maximum disk name length.

diffstat:

 usr.sbin/sysinst/defs.h   |   3 ++-
 usr.sbin/sysinst/gpt.c    |   4 ++--
 usr.sbin/sysinst/target.c |  12 +++++++++---
 3 files changed, 13 insertions(+), 6 deletions(-)

diffs (75 lines):

diff -r 354bd63fd2c2 -r 7646ca539fc4 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Sat Jan 29 21:37:07 2022 +0000
+++ b/usr.sbin/sysinst/defs.h   Sun Jan 30 11:58:29 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.78 2022/01/29 16:01:16 martin Exp $ */
+/*     $NetBSD: defs.h,v 1.79 2022/01/30 11:58:29 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -59,6 +59,7 @@
 #define STRSIZE                255
 #define        MENUSTRSIZE     80
 #define SSTRSIZE       30
+#define        DISKNAMESIZE    24      /* max(strlen("/dev/rsd22c")) */
 
 /* these are used for different alignment defaults */
 #define        HUGE_DISK_SIZE  (daddr_t)(128 * (GIG / 512))
diff -r 354bd63fd2c2 -r 7646ca539fc4 usr.sbin/sysinst/gpt.c
--- a/usr.sbin/sysinst/gpt.c    Sat Jan 29 21:37:07 2022 +0000
+++ b/usr.sbin/sysinst/gpt.c    Sun Jan 30 11:58:29 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gpt.c,v 1.27 2022/01/29 15:32:49 martin Exp $  */
+/*     $NetBSD: gpt.c,v 1.28 2022/01/30 11:58:29 martin Exp $  */
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
 #define GUID_STR_LEN   40
 #define        GPT_PTYPE_ALLOC 32      /* initial type array allocation, should be >
                                 * gpt type -l | wc -l */
-#define        GPT_DEV_LEN     16      /* dkNN */
+#define        GPT_DEV_LEN     DISKNAMESIZE    /* dkNN */
 
 #define        GPT_PARTS_PER_SEC       4       /* a 512 byte sector holds 4 entries */
 #define        GPT_DEFAULT_MAX_PARTS   128
diff -r 354bd63fd2c2 -r 7646ca539fc4 usr.sbin/sysinst/target.c
--- a/usr.sbin/sysinst/target.c Sat Jan 29 21:37:07 2022 +0000
+++ b/usr.sbin/sysinst/target.c Sun Jan 30 11:58:29 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: target.c,v 1.16 2022/01/29 15:32:49 martin Exp $       */
+/*     $NetBSD: target.c,v 1.17 2022/01/30 11:58:29 martin Exp $       */
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -71,7 +71,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: target.c,v 1.16 2022/01/29 15:32:49 martin Exp $");
+__RCSID("$NetBSD: target.c,v 1.17 2022/01/30 11:58:29 martin Exp $");
 #endif
 
 /*
@@ -123,7 +123,7 @@
 /* Record a wedge for later deletion after all file systems have been unmounted */
 struct umount_delwedge {
        struct umount_delwedge *next;
-       char disk[MAXPATHLEN], wedge[MAXPATHLEN];
+       char disk[DISKNAMESIZE], wedge[DISKNAMESIZE];
 };
 struct umount_delwedge *post_umount_dwlist = NULL;
 
@@ -549,6 +549,12 @@
 {
        struct umount_delwedge *dw;
 
+       if (unwind_mountlist == NULL) {
+               /* we have nothing mounted, can delete it right now */
+               delete_wedge(disk, wedge);
+               return;
+       }
+
        dw = calloc(1, sizeof(*dw));
        dw->next = post_umount_dwlist;
        strlcpy(dw->disk, disk, sizeof(dw->disk));



Home | Main Index | Thread Index | Old Index