Module Name:    src
Committed By:   christos
Date:           Wed Jan  6 17:41:36 UTC 2016

Modified Files:
        src/sbin/raidctl: raidctl.8 raidctl.c

Log Message:
Access to the SET_LAST_UNIT ioctl.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sbin/raidctl/raidctl.8
cvs rdiff -u -r1.63 -r1.64 src/sbin/raidctl/raidctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/raidctl/raidctl.8
diff -u src/sbin/raidctl/raidctl.8:1.69 src/sbin/raidctl/raidctl.8:1.70
--- src/sbin/raidctl/raidctl.8:1.69	Tue Jun 30 18:16:12 2015
+++ src/sbin/raidctl/raidctl.8	Wed Jan  6 12:41:36 2016
@@ -1,4 +1,4 @@
-.\"     $NetBSD: raidctl.8,v 1.69 2015/06/30 22:16:12 wiz Exp $
+.\"     $NetBSD: raidctl.8,v 1.70 2016/01/06 17:41:36 christos Exp $
 .\"
 .\" Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -53,7 +53,7 @@
 .\" any improvements or extensions that they make and grant Carnegie the
 .\" rights to redistribute these changes.
 .\"
-.Dd June 30, 2015
+.Dd January 6, 2016
 .Dt RAIDCTL 8
 .Os
 .Sh NAME
@@ -125,6 +125,9 @@
 .Nm
 .Op Fl v
 .Fl u Ar dev
+.Nm
+.Op Fl v
+.Fl U Ar unit Ar dev
 .Sh DESCRIPTION
 .Nm
 is the user-land control program for
@@ -318,6 +321,12 @@ achieved in each of these areas.
 Unconfigure the RAIDframe device.
 This does not remove any component labels or change any configuration
 settings (e.g. auto-configuration settings) for the RAID set.
+.It Fl U Ar unit Ar dev
+Set the
+.Dv last_unit
+field in all the raid components, so that the next time the raid
+will be autoconfigured it uses that
+.Ar unit .
 .It Fl v
 Be more verbose.
 For operations such as reconstructions, parity

Index: src/sbin/raidctl/raidctl.c
diff -u src/sbin/raidctl/raidctl.c:1.63 src/sbin/raidctl/raidctl.c:1.64
--- src/sbin/raidctl/raidctl.c:1.63	Tue Sep  8 04:59:09 2015
+++ src/sbin/raidctl/raidctl.c	Wed Jan  6 12:41:36 2016
@@ -1,4 +1,4 @@
-/*      $NetBSD: raidctl.c,v 1.63 2015/09/08 08:59:09 bad Exp $   */
+/*      $NetBSD: raidctl.c,v 1.64 2016/01/06 17:41:36 christos Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: raidctl.c,v 1.63 2015/09/08 08:59:09 bad Exp $");
+__RCSID("$NetBSD: raidctl.c,v 1.64 2016/01/06 17:41:36 christos Exp $");
 #endif
 
 
@@ -114,6 +114,7 @@ main(int argc,char *argv[])
 	int fd;
 	int force;
 	int openmode;
+	int last_unit;
 
 	num_options = 0;
 	action = 0;
@@ -122,9 +123,10 @@ main(int argc,char *argv[])
 	do_rewrite = 0;
 	serial_number = 0;
 	force = 0;
+	last_unit = 0;
 	openmode = O_RDWR;	/* default to read/write */
 
-	while ((ch = getopt(argc, argv, "a:A:Bc:C:f:F:g:GiI:l:mM:r:R:sSpPuv")) 
+	while ((ch = getopt(argc, argv, "a:A:Bc:C:f:F:g:GiI:l:mM:r:R:sSpPuU:v"))
 	       != -1)
 		switch(ch) {
 		case 'a':
@@ -244,6 +246,13 @@ main(int argc,char *argv[])
 			action = RAIDFRAME_SHUTDOWN;
 			num_options++;
 			break;
+		case 'U':
+			action = RAIDFRAME_SET_LAST_UNIT;
+			num_options++;
+			last_unit = atoi(optarg);
+			if (last_unit < 0)
+				errx(1, "Bad last unit %s", optarg);
+			break;
 		case 'v':
 			verbose = 1;
 			/* Don't bump num_options, as '-v' is not 
@@ -342,6 +351,10 @@ main(int argc,char *argv[])
 	case RAIDFRAME_SHUTDOWN:
 		do_ioctl(fd, RAIDFRAME_SHUTDOWN, NULL, "RAIDFRAME_SHUTDOWN");
 		break;
+	case RAIDFRAME_SET_LAST_UNIT:
+		do_ioctl(fd, RAIDFRAME_SET_LAST_UNIT, &last_unit,
+		    "RAIDFRAME_SET_LAST_UNIT");
+		break;
 	default:
 		break;
 	}

Reply via email to