Source-Changes-HG archive

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

[src/trunk]: src/sbin/raidctl Apply indent.



details:   https://anonhg.NetBSD.org/src/rev/a886a27b2a3c
branches:  trunk
changeset: 486473:a886a27b2a3c
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue May 23 01:03:05 2000 +0000

description:
Apply indent.

diffstat:

 sbin/raidctl/rf_configure.c |  676 +++++++++++++++++++++++--------------------
 1 files changed, 361 insertions(+), 315 deletions(-)

diffs (truncated from 777 to 300 lines):

diff -r 3d757e91f99d -r a886a27b2a3c sbin/raidctl/rf_configure.c
--- a/sbin/raidctl/rf_configure.c       Tue May 23 01:02:21 2000 +0000
+++ b/sbin/raidctl/rf_configure.c       Tue May 23 01:03:05 2000 +0000
@@ -1,4 +1,5 @@
-/*      $NetBSD: rf_configure.c,v 1.9 2000/05/23 00:46:53 thorpej Exp $   */
+/*     $NetBSD: rf_configure.c,v 1.10 2000/05/23 01:03:05 thorpej Exp $        */
+
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -58,17 +59,16 @@
 #include "rf_decluster.h"
 #include "rf_configure.h"
 
-/* 
-
-   XXX we include this here so we don't need to drag rf_debugMem.c into 
-   the picture...  This is userland, afterall... 
-
+/*
+ * XXX we include this here so we don't need to drag rf_debugMem.c into
+ * the picture...  This is userland, afterall...
  */
 
-/* XXX sucky hack to override the defn. of RF_Malloc as given in 
-rf_debugMem.c...  but I *really* don't want (nor need) to link with 
-that file here in userland..  GO
-*/
+/*
+ * XXX sucky hack to override the defn. of RF_Malloc as given in
+ * rf_debugMem.c...  but I *really* don't want (nor need) to link with
+ * that file here in userland..  GO
+ */
 
 #undef RF_Malloc
 #define RF_Malloc(_p_, _size_, _cast_) \
@@ -77,270 +77,290 @@
      bzero((char *)_p_, _size_); \
   }
 
-char   *rf_find_non_white(char *p);
-char   *rf_find_white(char *p);
-
-
+char *rf_find_non_white(char *p);
+char *rf_find_white(char *p);
 
-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,
-       const char *errmsg);
+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,
+    const char *errmsg);
 
-/* called from user level to read the configuration file and create
+/*
+ * called from user level to read the configuration file and create
  * a configuration control structure.  This is used in the user-level
  * version of the driver, and in the user-level program that configures
  * the system via ioctl.
  */
-int rf_MakeConfig(configname, cfgPtr)
-  char         *configname;
-  RF_Config_t  *cfgPtr;
+int 
+rf_MakeConfig(configname, cfgPtr)
+       char *configname;
+       RF_Config_t *cfgPtr;
 {
-  int numscanned, val, r, c, retcode, aa, bb, cc;
-  char buf[256], buf1[256], *cp;
-  RF_LayoutSW_t *lp;
-  FILE *fp;
+       int numscanned, val, r, c, retcode, aa, bb, cc;
+       char buf[256], buf1[256], *cp;
+       RF_LayoutSW_t *lp;
+       FILE *fp;
+
+       bzero((char *) cfgPtr, sizeof(RF_Config_t));
 
-  bzero((char *)cfgPtr, sizeof(RF_Config_t));
+       fp = fopen(configname, "r");
+       if (!fp) {
+               RF_ERRORMSG1("Can't open config file %s\n", configname);
+               return (-1);
+       }
+       rewind(fp);
+       if (rf_search_file_for_start_of("array", buf, 256, fp)) {
+               RF_ERRORMSG1("Unable to find start of \"array\" params in config file %s\n", configname);
+               retcode = -1;
+               goto out;
+       }
+       rf_get_next_nonblank_line(buf, 256, fp, "Config file error (\"array\" section):  unable to get numRow and numCol\n");
 
-  fp = fopen(configname, "r");
-  if (!fp) {
-    RF_ERRORMSG1("Can't open config file %s\n",configname);
-    return(-1);
-  }
-  
-  rewind(fp);
-  if (rf_search_file_for_start_of("array", buf, 256, fp)) {
-    RF_ERRORMSG1("Unable to find start of \"array\" params in config file %s\n",configname);
-    retcode = -1; goto out;
-  }
-  rf_get_next_nonblank_line(buf, 256, fp, "Config file error (\"array\" section):  unable to get numRow and numCol\n");
-  /*
-   * wackiness with aa, bb, cc to get around size problems on different platforms
-   */
-  numscanned = sscanf(buf,"%d %d %d", &aa, &bb, &cc);
-  if (numscanned != 3) {
-    RF_ERRORMSG("Config file error (\"array\" section):  unable to get numRow, numCol, numSpare\n");
-    retcode = -1; goto out;
-  }
-  cfgPtr->numRow = (RF_RowCol_t)aa;
-  cfgPtr->numCol = (RF_RowCol_t)bb;
-  cfgPtr->numSpare = (RF_RowCol_t)cc;
+       /*
+         * wackiness with aa, bb, cc to get around size problems on
+         * different platforms
+         */
+       numscanned = sscanf(buf, "%d %d %d", &aa, &bb, &cc);
+       if (numscanned != 3) {
+               RF_ERRORMSG("Config file error (\"array\" section):  unable to get numRow, numCol, numSpare\n");
+               retcode = -1;
+               goto out;
+       }
+       cfgPtr->numRow = (RF_RowCol_t) aa;
+       cfgPtr->numCol = (RF_RowCol_t) bb;
+       cfgPtr->numSpare = (RF_RowCol_t) cc;
 
-  /* debug section is optional */
-  for (c=0; c<RF_MAXDBGV; c++)
-    cfgPtr->debugVars[c][0] = '\0';
-  rewind(fp);
-  if (!rf_search_file_for_start_of("debug", buf, 256, fp)) {
-    for (c=0; c < RF_MAXDBGV; c++) {
-      if (rf_get_next_nonblank_line(buf, 256, fp, NULL)) break;
-      cp = rf_find_non_white(buf);
-      if (!strncmp(cp, "START", strlen("START"))) break;
-      (void) strcpy(&cfgPtr->debugVars[c][0], cp);
-    }
-  }
-  
-  rewind(fp);
-  strcpy(cfgPtr->diskQueueType,"fifo");
-  cfgPtr->maxOutstandingDiskReqs = 1;
-  /* scan the file for the block related to disk queues */
-  if (rf_search_file_for_start_of("queue",buf,256,fp)) {
-    RF_ERRORMSG2("[No disk queue discipline specified in config file %s.  Using %s.]\n",configname, cfgPtr->diskQueueType);
-  } else {
-    if (rf_get_next_nonblank_line(buf, 256, fp, NULL)) {
-      RF_ERRORMSG2("[No disk queue discipline specified in config file %s.  Using %s.]\n",configname, cfgPtr->diskQueueType);
-    }
-  }
+       /* debug section is optional */
+       for (c = 0; c < RF_MAXDBGV; c++)
+               cfgPtr->debugVars[c][0] = '\0';
+       rewind(fp);
+       if (!rf_search_file_for_start_of("debug", buf, 256, fp)) {
+               for (c = 0; c < RF_MAXDBGV; c++) {
+                       if (rf_get_next_nonblank_line(buf, 256, fp, NULL))
+                               break;
+                       cp = rf_find_non_white(buf);
+                       if (!strncmp(cp, "START", strlen("START")))
+                               break;
+                       (void) strcpy(&cfgPtr->debugVars[c][0], cp);
+               }
+       }
+       rewind(fp);
+       strcpy(cfgPtr->diskQueueType, "fifo");
+       cfgPtr->maxOutstandingDiskReqs = 1;
+       /* scan the file for the block related to disk queues */
+       if (rf_search_file_for_start_of("queue", buf, 256, fp)) {
+               RF_ERRORMSG2("[No disk queue discipline specified in config file %s.  Using %s.]\n", configname, cfgPtr->diskQueueType);
+       } else {
+               if (rf_get_next_nonblank_line(buf, 256, fp, NULL)) {
+                       RF_ERRORMSG2("[No disk queue discipline specified in config file %s.  Using %s.]\n", configname, cfgPtr->diskQueueType);
+               }
+       }
 
-  /* the queue specifier line contains two entries:
-   * 1st char of first word specifies queue to be used
-   * 2nd word specifies max num reqs that can be outstanding on the disk itself (typically 1)
-   */
-  if (sscanf(buf,"%s %d",buf1,&val)!=2) {
-    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 *ch;
-    bcopy(buf1, cfgPtr->diskQueueType, RF_MIN(sizeof(cfgPtr->diskQueueType), strlen(buf1)+1));
-    for(ch=buf1;*ch;ch++) {
-      if (*ch == ' ') {
-        *ch = '\0';
-        break;
-      }
-    }
-    cfgPtr->maxOutstandingDiskReqs = val;
-  }
+       /* the queue specifier line contains two entries: 1st char of first
+        * word specifies queue to be used 2nd word specifies max num reqs
+        * that can be outstanding on the disk itself (typically 1) */
+       if (sscanf(buf, "%s %d", buf1, &val) != 2) {
+               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 *ch;
+               bcopy(buf1, cfgPtr->diskQueueType,
+                   RF_MIN(sizeof(cfgPtr->diskQueueType), strlen(buf1) + 1));
+               for (ch = buf1; *ch; ch++) {
+                       if (*ch == ' ') {
+                               *ch = '\0';
+                               break;
+                       }
+               }
+               cfgPtr->maxOutstandingDiskReqs = val;
+       }
 
-  rewind(fp);
-
-
-  if (rf_search_file_for_start_of("disks",buf,256,fp)) {
-    RF_ERRORMSG1("Can't find \"disks\" section in config file %s\n",configname);
-    retcode = -1; goto out;
-  }
+       rewind(fp);
 
-  for (r=0; r<cfgPtr->numRow; r++) {
-    for (c=0; c<cfgPtr->numCol; c++) {
-      if (rf_get_next_nonblank_line(&cfgPtr->devnames[r][c][0], 50, fp, NULL)) {
-       RF_ERRORMSG2("Config file error: unable to get device file for disk at row %d col %d\n",r,c);
-       retcode = -1; goto out;
-      }
-    }
-  }
+       if (rf_search_file_for_start_of("disks", buf, 256, fp)) {
+               RF_ERRORMSG1("Can't find \"disks\" section in config file %s\n", configname);
+               retcode = -1;
+               goto out;
+       }
+       for (r = 0; r < cfgPtr->numRow; r++) {
+               for (c = 0; c < cfgPtr->numCol; c++) {
+                       if (rf_get_next_nonblank_line(
+                           &cfgPtr->devnames[r][c][0], 50, fp, NULL)) {
+                               RF_ERRORMSG2("Config file error: unable to get device file for disk at row %d col %d\n", r, c);
+                               retcode = -1;
+                               goto out;
+                       }
+               }
+       }
 
-  /* "spare" section is optional */
-  rewind(fp);
-  if (rf_search_file_for_start_of("spare",buf,256,fp)) cfgPtr->numSpare =0;
-  for (c = 0; c < cfgPtr->numSpare; c++) {
-    if (rf_get_next_nonblank_line(&cfgPtr->spare_names[c][0], 256, fp, NULL)) {
-      RF_ERRORMSG1("Config file error: unable to get device file for spare disk %d\n",c);
-      retcode = -1; goto out;
-    }
-  }
+       /* "spare" section is optional */
+       rewind(fp);
+       if (rf_search_file_for_start_of("spare", buf, 256, fp))
+               cfgPtr->numSpare = 0;
+       for (c = 0; c < cfgPtr->numSpare; c++) {
+               if (rf_get_next_nonblank_line(&cfgPtr->spare_names[c][0],
+                   256, fp, NULL)) {
+                       RF_ERRORMSG1("Config file error: unable to get device file for spare disk %d\n", c);
+                       retcode = -1;
+                       goto out;
+               }
+       }
 
-  /* scan the file for the block related to layout */
-  rewind(fp);
-  if (rf_search_file_for_start_of("layout",buf,256,fp)) {
-    RF_ERRORMSG1("Can't find \"layout\" section in configuration file %s\n",configname);
-    retcode = -1; goto out;
-  }
-  if (rf_get_next_nonblank_line(buf, 256, fp, NULL)) {
-    RF_ERRORMSG("Config file error (\"layout\" section): unable to find common layout param line\n");
-    retcode = -1; goto out;
-  }
-  c = sscanf(buf,"%d %d %d %c", &aa, &bb, &cc, &cfgPtr->parityConfig);
-  cfgPtr->sectPerSU = (RF_SectorNum_t)aa;
-  cfgPtr->SUsPerPU = (RF_StripeNum_t)bb;
-  cfgPtr->SUsPerRU = (RF_StripeNum_t)cc;
-  if (c != 4) {
-    RF_ERRORMSG("Unable to scan common layout line\n");
-    retcode = -1; goto out;
-  }
-  lp = rf_GetLayout(cfgPtr->parityConfig);
-  if (lp == NULL) {
-    RF_ERRORMSG1("Unknown parity config '%c'\n", cfgPtr->parityConfig);
-    retcode = -1;
-    goto out;
-  }
+       /* scan the file for the block related to layout */



Home | Main Index | Thread Index | Old Index