diff --git a/sbin/raidctl/Makefile b/sbin/raidctl/Makefile index 1dba2108ed34..1c243a8d2895 100644 --- a/sbin/raidctl/Makefile +++ b/sbin/raidctl/Makefile @@ -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 --git a/sbin/raidctl/raidctl.c b/sbin/raidctl/raidctl.c index caecaaf3098b..36ed71ce6d07 100644 --- a/sbin/raidctl/raidctl.c +++ b/sbin/raidctl/raidctl.c @@ -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 #include #include +#include + #include #include #include #include #include #include -#include #include -#include -#include #include #include @@ -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 add_hot_spare __P((int, char *)); 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 @@ rf_configure(fd,config_file,force) 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 @@ check_status( fd, meter ) } } -char *tbits = "|/-\\"; +const char *tbits = "|/-\\"; static void do_meter(fd, option) diff --git a/sbin/raidctl/rf_configure.c b/sbin/raidctl/rf_configure.c index 2d3972ece709..cc7d6247bec1 100644 --- a/sbin/raidctl/rf_configure.c +++ b/sbin/raidctl/rf_configure.c @@ -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 @@ char *rf_find_white(char *p); -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 @@ int rf_MakeConfig(configname, cfgPtr) 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 @@ rf_find_white(char *p) * 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 @@ int rf_get_next_nonblank_line(buf, len, fp, errmsg) char *buf; int len; FILE *fp; - char *errmsg; + const char *errmsg; { char *p;