Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/usr.sbin/sysinst Pull up following revision(s) (requested...
details: https://anonhg.NetBSD.org/src/rev/927c6c7b7b56
branches: netbsd-7
changeset: 799295:927c6c7b7b56
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Sat May 09 13:50:15 2015 +0000
description:
Pull up following revision(s) (requested by martin in ticket #744):
usr.sbin/sysinst/defs.h: revision 1.7
usr.sbin/sysinst/disks.c: revision 1.8
usr.sbin/sysinst/partman.c: revision 1.9
Add a new utility function "update_wedges()", which triggers a scan
for wedges on the given disk. Call this after writing a disklabel.
This makes all auto-discovered wedges go away after we changed the
partitioning (and are not using GPT) and fixes PR 49665.
diffstat:
usr.sbin/sysinst/defs.h | 9 ++++++++-
usr.sbin/sysinst/disks.c | 32 ++++++++++++--------------------
usr.sbin/sysinst/partman.c | 40 ++++++++++++++++++++++++++++++++--------
3 files changed, 52 insertions(+), 29 deletions(-)
diffs (173 lines):
diff -r 9606fc203cdf -r 927c6c7b7b56 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h Sat May 09 08:59:12 2015 +0000
+++ b/usr.sbin/sysinst/defs.h Sat May 09 13:50:15 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.3.4.2 2015/02/27 11:29:44 martin Exp $ */
+/* $NetBSD: defs.h,v 1.3.4.3 2015/05/09 13:50:15 msaitoh Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -598,6 +598,13 @@
int pm_gpt_convert(pm_devs_t *);
void pm_wedges_fill(pm_devs_t *);
void pm_make_bsd_partitions(pm_devs_t *);
+void update_wedges(const char *);
+
+/* flags whether to offer the respective options (depending on helper
+ programs available on install media */
+int have_raid, have_vnd, have_cgd, have_lvm, have_gpt, have_dk;
+/* initialize above variables */
+void check_available_binaries(void);
/* from bsddisklabel.c */
int make_bsd_partitions(void);
diff -r 9606fc203cdf -r 927c6c7b7b56 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c Sat May 09 08:59:12 2015 +0000
+++ b/usr.sbin/sysinst/disks.c Sat May 09 13:50:15 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disks.c,v 1.4.4.3 2015/01/11 04:32:38 snj Exp $ */
+/* $NetBSD: disks.c,v 1.4.4.4 2015/05/09 13:50:15 msaitoh Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -108,7 +108,6 @@
static void fixsb(const char *, const char *, char);
static bool is_gpt(const char *);
static int incoregpt(pm_devs_t *, partinfo *);
-static bool have_gpt_binary(void);
#ifndef DISK_NAMES
#define DISK_NAMES "wd", "sd", "ld", "raid"
@@ -577,26 +576,15 @@
return numdisks;
}
-static bool
-have_gpt_binary(void)
-{
- static bool did_test = false;
- static bool have_gpt;
-
- if (!did_test) {
- have_gpt = binary_available("gpt");
- did_test = true;
- }
-
- return have_gpt;
-}
void
label_read(void)
{
+ check_available_binaries();
+
/* Get existing/default label */
memset(&pm->oldlabel, 0, sizeof pm->oldlabel);
- if (!have_gpt_binary() || !pm->gpt)
+ if (!have_gpt || !pm->gpt)
incorelabel(pm->diskdev, pm->oldlabel);
else
incoregpt(pm, pm->oldlabel);
@@ -666,14 +654,16 @@
int
write_disklabel (void)
{
+ int rv = 0;
#ifdef DISKLABEL_CMD
/* disklabel the disk */
- return run_program(RUN_DISPLAY, "%s -f /tmp/disktab %s '%s'",
+ rv = run_program(RUN_DISPLAY, "%s -f /tmp/disktab %s '%s'",
DISKLABEL_CMD, pm->diskdev, pm->bsddiskname);
-#else
- return 0;
+ if (rv == 0)
+ update_wedges(pm->diskdev);
#endif
+ return rv;
}
@@ -1481,7 +1471,9 @@
static bool
is_gpt(const char *dev)
{
- if (!have_gpt_binary())
+ check_available_binaries();
+
+ if (!have_gpt)
return false;
return !run_program(RUN_SILENT | RUN_ERROR_OK,
diff -r 9606fc203cdf -r 927c6c7b7b56 usr.sbin/sysinst/partman.c
--- a/usr.sbin/sysinst/partman.c Sat May 09 08:59:12 2015 +0000
+++ b/usr.sbin/sysinst/partman.c Sat May 09 13:50:15 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: partman.c,v 1.4.4.2 2015/01/11 04:32:38 snj Exp $ */
+/* $NetBSD: partman.c,v 1.4.4.3 2015/05/09 13:50:15 msaitoh Exp $ */
/*
* Copyright 2012 Eugene Lozovoy
@@ -46,7 +46,7 @@
/* flags whether to offer the respective options (depending on helper
programs available on install media */
-static int have_raid, have_vnd, have_cgd, have_lvm, have_gpt, have_dk;
+int have_raid, have_vnd, have_cgd, have_lvm, have_gpt, have_dk;
/* XXX: replace all MAX_* defines with vars that depend on kernel settings */
#define MAX_ENTRIES 96
@@ -2692,6 +2692,23 @@
cursel = m->cursel;
}
+/* initialize have_* variables */
+void
+check_available_binaries()
+{
+ static int did_test = false;
+
+ if (did_test) return;
+ did_test = 1;
+
+ have_raid = binary_available("raidctl");
+ have_vnd = binary_available("vnconfig");
+ have_cgd = binary_available("cgdconfig");
+ have_lvm = binary_available("lvm");
+ have_gpt = binary_available("gpt");
+ have_dk = binary_available("dkctl");
+}
+
/* Main partman function */
int
partman(void)
@@ -2702,12 +2719,7 @@
part_entry_t args[MAX_ENTRIES];
if (firstrun) {
- have_raid = binary_available("raidctl");
- have_vnd = binary_available("vnconfig");
- have_cgd = binary_available("cgdconfig");
- have_lvm = binary_available("lvm");
- have_gpt = binary_available("gpt");
- have_dk = binary_available("dkctl");
+ check_available_binaries();
if (!have_raid)
remove_raid_options();
@@ -2801,3 +2813,15 @@
/* retvalue <0 - error, retvalue ==0 - user quits, retvalue >0 - all ok */
return (args[0].retvalue >= 0)?0:-1;
}
+
+void
+update_wedges(const char *disk)
+{
+ check_available_binaries();
+
+ if (!have_dk)
+ return;
+
+ run_program(RUN_SILENT | RUN_ERROR_OK,
+ "dkctl %s makewedges", disk);
+}
Home |
Main Index |
Thread Index |
Old Index