Source-Changes-HG archive

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

[src/netbsd-7]: src Pull up following revision(s) (requested by christos in t...



details:   https://anonhg.NetBSD.org/src/rev/8ba11d3efe6a
branches:  netbsd-7
changeset: 800254:8ba11d3efe6a
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jul 14 15:39:32 2017 +0000

description:
Pull up following revision(s) (requested by christos in ticket #1457):
        sbin/raidctl/raidctl.c: revision 1.64
        sbin/raidctl/raidctl.8: revision 1.70
        sys/dev/raidframe/rf_netbsdkintf.c: revision 1.341
        sys/dev/raidframe/raidframeio.h: revision 1.7
Add a SET_LAST_UNIT ioctl.
Access to the SET_LAST_UNIT ioctl.

diffstat:

 sbin/raidctl/raidctl.8             |  13 +++++++++++--
 sbin/raidctl/raidctl.c             |  19 ++++++++++++++++---
 sys/dev/raidframe/raidframeio.h    |   3 ++-
 sys/dev/raidframe/rf_netbsdkintf.c |  25 +++++++++++++++++++++----
 4 files changed, 50 insertions(+), 10 deletions(-)

diffs (194 lines):

diff -r 7f062b6667d2 -r 8ba11d3efe6a sbin/raidctl/raidctl.8
--- a/sbin/raidctl/raidctl.8    Wed Jul 12 15:35:18 2017 +0000
+++ b/sbin/raidctl/raidctl.8    Fri Jul 14 15:39:32 2017 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: raidctl.8,v 1.67.4.1 2015/07/05 20:22:34 snj Exp $
+.\"     $NetBSD: raidctl.8,v 1.67.4.2 2017/07/14 15:39:32 martin 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 7f062b6667d2 -r 8ba11d3efe6a sbin/raidctl/raidctl.c
--- a/sbin/raidctl/raidctl.c    Wed Jul 12 15:35:18 2017 +0000
+++ b/sbin/raidctl/raidctl.c    Fri Jul 14 15:39:32 2017 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: raidctl.c,v 1.57.4.3 2015/07/05 20:20:10 snj Exp $   */
+/*      $NetBSD: raidctl.c,v 1.57.4.4 2017/07/14 15:39:32 martin 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.57.4.3 2015/07/05 20:20:10 snj Exp $");
+__RCSID("$NetBSD: raidctl.c,v 1.57.4.4 2017/07/14 15:39:32 martin 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;
        }
diff -r 7f062b6667d2 -r 8ba11d3efe6a sys/dev/raidframe/raidframeio.h
--- a/sys/dev/raidframe/raidframeio.h   Wed Jul 12 15:35:18 2017 +0000
+++ b/sys/dev/raidframe/raidframeio.h   Fri Jul 14 15:39:32 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: raidframeio.h,v 1.6 2009/11/17 18:54:26 jld Exp $ */
+/*     $NetBSD: raidframeio.h,v 1.6.38.1 2017/07/14 15:39:32 martin Exp $ */
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -131,5 +131,6 @@
 #define RAIDFRAME_PARITYMAP_GET_DISABLE _IOR('r', 38, int)
 #define RAIDFRAME_PARITYMAP_SET_DISABLE _IOW('r', 39, int)
 #define RAIDFRAME_PARITYMAP_SET_PARAMS _IOW('r', 40, struct rf_pmparams)
+#define RAIDFRAME_SET_LAST_UNIT _IOW('r', 41, int)
 
 #endif                         /* !_RF_RAIDFRAMEIO_H_ */
diff -r 7f062b6667d2 -r 8ba11d3efe6a sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Wed Jul 12 15:35:18 2017 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Fri Jul 14 15:39:32 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.312.2.4 2014/12/22 02:19:32 msaitoh Exp $ */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.312.2.5 2017/07/14 15:39:32 martin Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.312.2.4 2014/12/22 02:19:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.312.2.5 2017/07/14 15:39:32 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -251,6 +251,7 @@
 #define RAIDF_SHUTDOWN 0x08    /* unit is being shutdown */
 #define RAIDF_WANTED   0x40    /* someone is waiting to obtain a lock */
 #define RAIDF_LOCKED   0x80    /* unit is locked */
+#define RAIDF_UNIT_CHANGED     0x100   /* unit is being changed */
 
 #define        raidunit(x)     DISKUNIT(x)
 
@@ -1761,6 +1762,19 @@
                                  sizeof(RF_ProgressInfo_t));
                return (retcode);
 
+       case RAIDFRAME_SET_LAST_UNIT:
+               for (column = 0; column < raidPtr->numCol; column++)
+                       if (raidPtr->Disks[column].status != rf_ds_optimal)
+                               return EBUSY;
+
+               for (column = 0; column < raidPtr->numCol; column++) {
+                       clabel = raidget_component_label(raidPtr, column);
+                       clabel->last_unit = *(int *)data;
+                       raidflush_component_label(raidPtr, column);
+               }
+               rs->sc_cflags |= RAIDF_UNIT_CHANGED;
+               return 0;
+
                /* the sparetable daemon calls this to wait for the kernel to
                 * need a spare table. this ioctl does not return until a
                 * spare table is needed. XXX -- calling mpsleep here in the
@@ -2849,6 +2863,7 @@
        int c;
        int j;
        int scol;
+       struct raid_softc *rs = raidPtr->softc;
 
        scol = -1;
 
@@ -2864,7 +2879,8 @@
                        clabel->status = rf_ds_optimal;
                        
                        /* note what unit we are configured as */
-                       clabel->last_unit = raidPtr->raidid;
+                       if ((rs->sc_cflags & RAIDF_UNIT_CHANGED) == 0)
+                               clabel->last_unit = raidPtr->raidid;
 
                        raidflush_component_label(raidPtr, c);
                        if (final == RF_FINAL_COMPONENT_UPDATE) {
@@ -2904,7 +2920,8 @@
 
                        clabel->column = scol;
                        clabel->status = rf_ds_optimal;
-                       clabel->last_unit = raidPtr->raidid;
+                       if ((rs->sc_cflags & RAIDF_UNIT_CHANGED) == 0)
+                               clabel->last_unit = raidPtr->raidid;
 
                        raidflush_component_label(raidPtr, sparecol);
                        if (final == RF_FINAL_COMPONENT_UPDATE) {



Home | Main Index | Thread Index | Old Index