Source-Changes-HG archive

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

[src/trunk]: src/sbin/raidctl Access to the SET_LAST_UNIT ioctl.



details:   https://anonhg.NetBSD.org/src/rev/5464a9723a13
branches:  trunk
changeset: 342725:5464a9723a13
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jan 06 17:41:36 2016 +0000

description:
Access to the SET_LAST_UNIT ioctl.

diffstat:

 sbin/raidctl/raidctl.8 |  13 +++++++++++--
 sbin/raidctl/raidctl.c |  19 ++++++++++++++++---
 2 files changed, 27 insertions(+), 5 deletions(-)

diffs (104 lines):

diff -r edfc8c2ac0ed -r 5464a9723a13 sbin/raidctl/raidctl.8
--- a/sbin/raidctl/raidctl.8    Wed Jan 06 17:40:50 2016 +0000
+++ b/sbin/raidctl/raidctl.8    Wed Jan 06 17:41:36 2016 +0000
@@ -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 @@
 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
diff -r edfc8c2ac0ed -r 5464a9723a13 sbin/raidctl/raidctl.c
--- a/sbin/raidctl/raidctl.c    Wed Jan 06 17:40:50 2016 +0000
+++ b/sbin/raidctl/raidctl.c    Wed Jan 06 17:41:36 2016 +0000
@@ -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 @@
        int fd;
        int force;
        int openmode;
+       int last_unit;
 
        num_options = 0;
        action = 0;
@@ -122,9 +123,10 @@
        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 @@
                        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 @@
        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;
        }



Home | Main Index | Thread Index | Old Index