Source-Changes-HG archive

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

[src/trunk]: src/sbin/raidctl Build with WARNS=2.



details:   https://anonhg.NetBSD.org/src/rev/47a0c4b884d2
branches:  trunk
changeset: 486471:47a0c4b884d2
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue May 23 00:46:53 2000 +0000

description:
Build with WARNS=2.

diffstat:

 sbin/raidctl/Makefile       |   4 ++-
 sbin/raidctl/raidctl.c      |  60 ++++++++++++++++++++------------------------
 sbin/raidctl/rf_configure.c |  18 ++++++------
 3 files changed, 39 insertions(+), 43 deletions(-)

diffs (217 lines):

diff -r bdee6d5b367b -r 47a0c4b884d2 sbin/raidctl/Makefile
--- a/sbin/raidctl/Makefile     Tue May 23 00:44:38 2000 +0000
+++ b/sbin/raidctl/Makefile     Tue May 23 00:46:53 2000 +0000
@@ -1,8 +1,10 @@
-#      $NetBSD: Makefile,v 1.6 1999/08/07 23:48:11 oster Exp $
+#      $NetBSD: Makefile,v 1.7 2000/05/23 00:46:53 thorpej Exp $
 PROG=  raidctl 
 SRCS=  rf_configure.c rf_layout.c raidctl.c
 MAN=   raidctl.8
 
+WARNS=2
+
 LOOKHERE = ${.CURDIR}/../../sys/dev/raidframe
 
 CPPFLAGS+= -DRF_UTILITY=1 -I${LOOKHERE}
diff -r bdee6d5b367b -r 47a0c4b884d2 sbin/raidctl/raidctl.c
--- a/sbin/raidctl/raidctl.c    Tue May 23 00:44:38 2000 +0000
+++ b/sbin/raidctl/raidctl.c    Tue May 23 00:46:53 2000 +0000
@@ -1,4 +1,5 @@
-/*      $NetBSD: raidctl.c,v 1.17 2000/05/23 00:33:13 thorpej Exp $   */
+/*      $NetBSD: raidctl.c,v 1.18 2000/05/23 00:46:53 thorpej Exp $   */
+
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,28 +37,25 @@
  */
 
 /* 
-
-   This program is a re-write of the original rf_ctrl program 
-   distributed by CMU with RAIDframe 1.1.
-
-   This program is the user-land interface to the RAIDframe kernel
-   driver in NetBSD.
-
+ * This program is a re-write of the original rf_ctrl program 
+ * distributed by CMU with RAIDframe 1.1.
+ *
+ * This program is the user-land interface to the RAIDframe kernel
+ * driver in NetBSD.
  */
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <sys/disklabel.h>
+
 #include <util.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <ctype.h>
 #include <err.h>
 #include <errno.h>
-#include <sys/types.h>
 #include <string.h>
-#include <sys/disklabel.h>
-#include <machine/disklabel.h>
 #include <stdlib.h>
 #include <unistd.h>
 
@@ -66,9 +64,9 @@
 extern  char *__progname;
 
 int     main __P((int, char *[]));
-void   do_ioctl __P((int, unsigned long, void *, const char *));
+void   do_ioctl __P((int, u_long, void *, const char *));
 static  void rf_configure __P((int, char*, int));
-static  char *device_status __P((RF_DiskStatus_t));
+static  const char *device_status __P((RF_DiskStatus_t));
 static  void rf_get_device_status __P((int));
 static  void get_component_number __P((int, char *, int *, int *));
 static  void rf_fail_disk __P((int, char *, int));
@@ -81,12 +79,12 @@
 static  void remove_hot_spare __P((int, char *));
 static  void rebuild_in_place __P((int, char *));
 static  void check_status __P((int,int));
-static  void check_parity __P((int,int,char *));
+static  void check_parity __P((int,int, char *));
 static  void do_meter __P((int, u_long));
 static  void get_bar __P((char *, double, int));
 static  void get_time_string __P((char *, int));
 
-int verbose = 0;
+int verbose;
 
 int
 main(argc,argv)
@@ -358,50 +356,46 @@
        cfg.force = force;
 
        /* 
-
-          Note the extra level of redirection needed here, since
-          what we really want to pass in is a pointer to the pointer to 
-          the configuration structure. 
-
+        * Note the extra level of redirection needed here, since
+        * what we really want to pass in is a pointer to the pointer to 
+        * the configuration structure. 
         */
 
        generic = (void *) &cfg;
        do_ioctl(fd, RAIDFRAME_CONFIGURE, &generic, "RAIDFRAME_CONFIGURE");
 }
 
-static char *
+static const char *
 device_status(status)
        RF_DiskStatus_t status;
 {
-       static char status_string[256];
 
        switch (status) {
        case rf_ds_optimal:
-               strcpy(status_string,"optimal");
+               return ("optimal");
                break;
        case rf_ds_failed:
-               strcpy(status_string,"failed");
+               return ("failed");
                break;
        case rf_ds_reconstructing:
-               strcpy(status_string,"reconstructing");
+               return ("reconstructing");
                break;
        case rf_ds_dist_spared:
-               strcpy(status_string,"dist_spared");
+               return ("dist_spared");
                break;
        case rf_ds_spared:
-               strcpy(status_string,"spared");
+               return ("spared");
                break;
        case rf_ds_spare:
-               strcpy(status_string,"spare");
+               return ("spare");
                break;
        case rf_ds_used_spare:
-               strcpy(status_string,"used_spare");
+               return ("used_spare");
                break;
        default:
-               strcpy(status_string,"UNKNOWN");
-               break;
+               return ("UNKNOWN");
        }
-       return(status_string);
+       /* NOTREACHED */
 }
 
 static void
@@ -793,7 +787,7 @@
        }
 }
 
-char *tbits = "|/-\\";
+const char *tbits = "|/-\\";
 
 static void
 do_meter(fd, option)
diff -r bdee6d5b367b -r 47a0c4b884d2 sbin/raidctl/rf_configure.c
--- a/sbin/raidctl/rf_configure.c       Tue May 23 00:44:38 2000 +0000
+++ b/sbin/raidctl/rf_configure.c       Tue May 23 00:46:53 2000 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rf_configure.c,v 1.8 1999/08/13 03:37:42 oster Exp $   */
+/*      $NetBSD: rf_configure.c,v 1.9 2000/05/23 00:46:53 thorpej Exp $   */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -82,10 +82,10 @@
 
 
 
-static int rf_search_file_for_start_of(char *string, char *buf, int len,
+static int rf_search_file_for_start_of(const char *string, char *buf, int len,
        FILE *fp);
 static int rf_get_next_nonblank_line(char *buf, int len, FILE *fp,
-       char *errmsg);
+       const char *errmsg);
 
 /* called from user level to read the configuration file and create
  * a configuration control structure.  This is used in the user-level
@@ -160,11 +160,11 @@
     RF_ERRORMSG1("Can't determine queue type and/or max outstanding reqs from line: %s",buf);
     RF_ERRORMSG2("Using %s-%d\n", cfgPtr->diskQueueType, cfgPtr->maxOutstandingDiskReqs);
   } else {
-    char *c;
+    char *ch;
     bcopy(buf1, cfgPtr->diskQueueType, RF_MIN(sizeof(cfgPtr->diskQueueType), strlen(buf1)+1));
-    for(c=buf1;*c;c++) {
-      if (*c == ' ') {
-        *c = '\0';
+    for(ch=buf1;*ch;ch++) {
+      if (*ch == ' ') {
+        *ch = '\0';
         break;
       }
     }
@@ -367,7 +367,7 @@
  * specified as a parameter
  */
 static int rf_search_file_for_start_of(string, buf, len, fp)
-  char  *string;
+  const char *string;
   char  *buf;
   int    len;
   FILE  *fp;
@@ -390,7 +390,7 @@
   char  *buf;
   int    len;
   FILE  *fp;
-  char  *errmsg;
+  const char *errmsg;
 {
   char *p;
 



Home | Main Index | Thread Index | Old Index