Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/raidctl support NAME=<wedge name> syntax for disks and ...
details: https://anonhg.NetBSD.org/src/rev/0205eaf393e8
branches: trunk
changeset: 827954:0205eaf393e8
user: kardel <kardel%NetBSD.org@localhost>
date: Mon Nov 20 18:37:56 2017 +0000
description:
support NAME=<wedge name> syntax for disks and spares
diffstat:
sbin/raidctl/raidctl.8 | 3 ++-
sbin/raidctl/rf_configure.c | 36 +++++++++++++++++++++++++++++++-----
2 files changed, 33 insertions(+), 6 deletions(-)
diffs (104 lines):
diff -r 740c2583cde1 -r 0205eaf393e8 sbin/raidctl/raidctl.8
--- a/sbin/raidctl/raidctl.8 Mon Nov 20 17:03:31 2017 +0000
+++ b/sbin/raidctl/raidctl.8 Mon Nov 20 18:37:56 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: raidctl.8,v 1.72 2017/07/03 21:33:42 wiz Exp $
+.\" $NetBSD: raidctl.8,v 1.73 2017/11/20 18:37:56 kardel Exp $
.\"
.\" Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -388,6 +388,7 @@
.Ed
.Pp
specifies the three component disks to be used in the RAID device.
+Disk wedges may also be specified with the NAME=<wedge name> syntax.
If any of the specified drives cannot be found when the RAID device is
configured, then they will be marked as
.Sq failed ,
diff -r 740c2583cde1 -r 0205eaf393e8 sbin/raidctl/rf_configure.c
--- a/sbin/raidctl/rf_configure.c Mon Nov 20 17:03:31 2017 +0000
+++ b/sbin/raidctl/rf_configure.c Mon Nov 20 18:37:56 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_configure.c,v 1.26 2016/03/09 19:53:32 christos Exp $ */
+/* $NetBSD: rf_configure.c,v 1.27 2017/11/20 18:37:56 kardel Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
@@ -49,7 +49,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: rf_configure.c,v 1.26 2016/03/09 19:53:32 christos Exp $");
+__RCSID("$NetBSD: rf_configure.c,v 1.27 2017/11/20 18:37:56 kardel Exp $");
#endif
@@ -58,6 +58,7 @@
#include <errno.h>
#include <strings.h>
#include <err.h>
+#include <util.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -72,6 +73,7 @@
#define RF_ERRORMSG(s) printf((s))
#define RF_ERRORMSG1(s,a) printf((s),(a))
#define RF_ERRORMSG2(s,a,b) printf((s),(a),(b))
+#define RF_ERRORMSG3(s,a,b,c) printf((s),(a),(b),(c))
int distSpareYes = 1;
int distSpareNo = 0;
@@ -231,12 +233,25 @@
}
for (r = 0; r < cfgPtr->numRow; r++) {
for (c = 0; c < cfgPtr->numCol; c++) {
+ char b1[80];
+ const char *b;
+
if (rf_get_next_nonblank_line(
- &cfgPtr->devnames[r][c][0], 50, fp, NULL)) {
+ buf, sizeof(buf), fp, NULL)) {
RF_ERRORMSG2("Config file error: unable to get device file for disk at row %d col %d\n", r, c);
retcode = -1;
goto out;
}
+
+ b = getfsspecname(b1, sizeof(b1), buf);
+ if (b == NULL) {
+ RF_ERRORMSG3(
+ "Config file error: warning: unable to get device file for disk at row %d col %d: %s\n",
+ r, c, b1);
+ b = buf;
+ }
+
+ strncpy(&cfgPtr->devnames[r][c][0], b, 50);
}
}
@@ -245,12 +260,23 @@
if (rf_search_file_for_start_of("spare", buf, 256, fp))
cfgPtr->numSpare = 0;
for (c = 0; c < cfgPtr->numSpare; c++) {
- if (rf_get_next_nonblank_line(&cfgPtr->spare_names[c][0],
- 256, fp, NULL)) {
+ char b1[80];
+ const char *b;
+
+ if (rf_get_next_nonblank_line(buf,
+ sizeof(buf), fp, NULL)) {
RF_ERRORMSG1("Config file error: unable to get device file for spare disk %d\n", c);
retcode = -1;
goto out;
}
+
+ b = getfsspecname(b1, sizeof(b1), buf);
+ if (b == NULL) {
+ RF_ERRORMSG2("Config file error: warning: unable to get device file for spare disk %d: %s\n", c, b);
+ b = buf;
+ }
+
+ strncpy(&cfgPtr->spare_names[r][0], b, 50);
}
/* scan the file for the block related to layout */
Home |
Main Index |
Thread Index |
Old Index