bozo: Tidy header includes
[openafs.git] / src / bozo / fsbnodeops.c
index 160c244..ed4f02d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
 #include <afsconfig.h>
 #include <afs/param.h>
 
+#include <afs/procmgmt.h>
+#include <roken.h>
 
-#include <sys/types.h>
 #include <lwp.h>
 #include <rx/rx.h>
-#include <errno.h>
-#include <stdio.h>
-#ifdef AFS_SUN5_ENV
-#include <fcntl.h>
-#endif
-#ifdef AFS_NT40_ENV
-#include <io.h>
-#include <fcntl.h>
-#else
-#include <sys/file.h>
-
-#include <string.h>
-#include <stdlib.h>
-
-#endif /* AFS_NT40_ENV */
-#include <sys/stat.h>
-#include <afs/procmgmt.h>      /* signal(), kill(), wait(), etc. */
 #include <afs/afsutil.h>
+
 #include "bnode.h"
 #include "bosprototypes.h"
 
@@ -45,20 +30,20 @@ static int emergency = 0;
 
 /*  basic rules:
     Normal operation involves having the file server and the vol server both running.
-    
+
     If the vol server terminates, it can simply be restarted.
-    
+
     If the file server terminates, the disk must salvaged before the file server
     can be restarted.  In order to restart either the file server or the salvager,
     the vol server must be shut down.
-    
+
     If the file server terminates *normally* (exits after receiving a SIGQUIT)
     then we don't have to salvage it.
-    
+
     The needsSalvage flag is set when the file server is started.  It is cleared
     if the file server exits when fileSDW is true but fileKillSent is false,
     indicating that it exited after receiving a quit, but before we sent it a kill.
-    
+
     The needsSalvage flag is cleared when the salvager exits.
 */
 
@@ -98,9 +83,9 @@ struct fsbnode {
     char needsClock;           /* do we need clock ticks */
 };
 
-struct bnode * fs_create(char *ainstance, char *afilecmd, char *avolcmd, 
+struct bnode * fs_create(char *ainstance, char *afilecmd, char *avolcmd,
                         char *asalcmd, char *ascancmd, char *dummy);
-struct bnode * dafs_create(char *ainstance, char *afilecmd, char *avolcmd, 
+struct bnode * dafs_create(char *ainstance, char *afilecmd, char *avolcmd,
                           char * asalsrvcmd, char *asalcmd, char *ascancmd);
 
 static int fs_hascore(struct bnode *abnode);
@@ -111,9 +96,9 @@ static int fs_getstat(struct bnode *abnode, afs_int32 * astatus);
 static int fs_setstat(struct bnode *abnode, afs_int32 astatus);
 static int fs_procexit(struct bnode *abnode, struct bnode_proc *aproc);
 static int fs_getstring(struct bnode *abnode, char *abuffer, afs_int32 alen);
-static int fs_getparm(struct bnode *abnode, afs_int32 aindex, 
+static int fs_getparm(struct bnode *abnode, afs_int32 aindex,
                      char *abuffer, afs_int32 alen);
-static int dafs_getparm(struct bnode *abnode, afs_int32 aindex, 
+static int dafs_getparm(struct bnode *abnode, afs_int32 aindex,
                        char *abuffer, afs_int32 alen);
 
 static int SetSalFlag(struct fsbnode *abnode, int aflag);
@@ -158,10 +143,8 @@ struct bnode_ops dafsbnode_ops = {
  * dropping type information
  */
 
-#ifndef AFS_HPUX_ENV
-static_inline 
-#endif
-struct bnode * fsbnode2bnode(struct fsbnode *abnode) {
+static_inline struct bnode *
+fsbnode2bnode(struct fsbnode *abnode) {
     return (struct bnode *) abnode;
 }
 
@@ -210,7 +193,7 @@ fs_restartp(struct bnode *bn)
 {
     struct fsbnode *abnode = (struct fsbnode *)bn;
     struct bnode_token *tt;
-    register afs_int32 code;
+    afs_int32 code;
     struct stat tstat;
 
     code = bnode_ParseLine(abnode->filecmd, &tt);
@@ -262,7 +245,7 @@ fs_restartp(struct bnode *bn)
            bnode_FreeTokens(tt);
            return 0;
        }
-       if (tstat.st_ctime > abnode->lastScanStart)
+       if (tstat.st_ctime > abnode->lastSalsrvStart)
            code = 1;
        else
            code = 0;
@@ -294,7 +277,7 @@ fs_restartp(struct bnode *bn)
 /* set needsSalvage flag, creating file SALVAGE.<instancename> if
     we need to salvage the file system (so we can tell over panic reboots */
 static int
-SetSalFlag(register struct fsbnode *abnode, register int aflag)
+SetSalFlag(struct fsbnode *abnode, int aflag)
 {
     char tbuffer[AFSDIR_PATH_MAX];
     int fd;
@@ -316,7 +299,7 @@ SetSalFlag(register struct fsbnode *abnode, register int aflag)
 
 /* set the needsSalvage flag according to the existence of the salvage file */
 static int
-RestoreSalFlag(register struct fsbnode *abnode)
+RestoreSalFlag(struct fsbnode *abnode)
 {
     char tbuffer[AFSDIR_PATH_MAX];
 
@@ -337,9 +320,9 @@ RestoreSalFlag(register struct fsbnode *abnode)
 }
 
 char *
-copystr(register char *a)
+copystr(char *a)
 {
-    register char *b;
+    char *b;
     b = (char *)malloc(strlen(a) + 1);
     strcpy(b, a);
     return b;
@@ -349,7 +332,7 @@ static int
 fs_delete(struct bnode *bn)
 {
     struct fsbnode *abnode = (struct fsbnode *)bn;
-    
+
     free(abnode->filecmd);
     free(abnode->volcmd);
     free(abnode->salcmd);
@@ -382,14 +365,14 @@ fs_create(char *ainstance, char *afilecmd, char *avolcmd, char *asalcmd,
          char *ascancmd, char *dummy)
 {
     struct stat tstat;
-    register struct fsbnode *te;
+    struct fsbnode *te;
     char cmdname[AFSDIR_PATH_MAX];
     char *fileCmdpath, *volCmdpath, *salCmdpath, *scanCmdpath;
     int bailout = 0;
 
     fileCmdpath = volCmdpath = salCmdpath = scanCmdpath = NULL;
-    te = NULL; 
-    
+    te = NULL;
+
     /* construct local paths from canonical (wire-format) paths */
     if (ConstructLocalBinPath(afilecmd, &fileCmdpath)) {
        bozo_Log("BNODE: command path invalid '%s'\n", afilecmd);
@@ -469,7 +452,7 @@ fs_create(char *ainstance, char *afilecmd, char *avolcmd, char *asalcmd,
        bailout = 1;
        goto done;
     }
-    bnode_SetTimeout(fsbnode2bnode(te), POLLTIME);     
+    bnode_SetTimeout(fsbnode2bnode(te), POLLTIME);
                /* ask for timeout activations every 10 seconds */
     RestoreSalFlag(te);                /* restore needsSalvage flag based on file's existence */
     SetNeedsClock(te);         /* compute needsClock field */
@@ -494,18 +477,18 @@ fs_create(char *ainstance, char *afilecmd, char *avolcmd, char *asalcmd,
 
 /* create a demand attach fs bnode */
 struct bnode *
-dafs_create(char *ainstance, char *afilecmd, char *avolcmd, 
+dafs_create(char *ainstance, char *afilecmd, char *avolcmd,
            char * asalsrvcmd, char *asalcmd, char *ascancmd)
 {
     struct stat tstat;
-    register struct fsbnode *te;
+    struct fsbnode *te;
     char cmdname[AFSDIR_PATH_MAX];
     char *fileCmdpath, *volCmdpath, *salsrvCmdpath, *salCmdpath, *scanCmdpath;
     int bailout = 0;
 
     fileCmdpath = volCmdpath = salsrvCmdpath = salCmdpath = scanCmdpath = NULL;
     te = NULL;
-    
+
     /* construct local paths from canonical (wire-format) paths */
     if (ConstructLocalBinPath(afilecmd, &fileCmdpath)) {
        bozo_Log("BNODE: command path invalid '%s'\n", afilecmd);
@@ -598,7 +581,7 @@ dafs_create(char *ainstance, char *afilecmd, char *avolcmd,
        bailout = 1;
        goto done;
     }
-    bnode_SetTimeout(fsbnode2bnode(te), POLLTIME);     
+    bnode_SetTimeout(fsbnode2bnode(te), POLLTIME);
                /* ask for timeout activations every 10 seconds */
     RestoreSalFlag(te);                /* restore needsSalvage flag based on file's existence */
     SetNeedsClock(te);         /* compute needsClock field */
@@ -628,8 +611,8 @@ static int
 fs_timeout(struct bnode *bn)
 {
     struct fsbnode *abnode = (struct fsbnode *)bn;
-    
-    register afs_int32 now;
+
+    afs_int32 now;
 
     now = FT_ApproxTime();
     /* shutting down */
@@ -686,8 +669,8 @@ static int
 fs_getstat(struct bnode *bn, afs_int32 * astatus)
 {
     struct fsbnode *abnode = (struct fsbnode *) bn;
-    
-    register afs_int32 temp;
+
+    afs_int32 temp;
     if (abnode->volSDW || abnode->fileSDW || abnode->salSDW
        || abnode->scanSDW || abnode->salsrvSDW)
        temp = BSTAT_SHUTTINGDOWN;
@@ -717,7 +700,7 @@ static int
 fs_procexit(struct bnode *bn, struct bnode_proc *aproc)
 {
    struct fsbnode *abnode = (struct fsbnode *)bn;
-   
+
     /* process has exited */
 
     if (aproc == abnode->volProc) {
@@ -765,7 +748,7 @@ fs_procexit(struct bnode *bn, struct bnode_proc *aproc)
 
 /* make sure we're periodically checking the state if we need to */
 static void
-SetNeedsClock(register struct fsbnode *ab)
+SetNeedsClock(struct fsbnode *ab)
 {
     if (ab->b.goal == 1 && ab->fileRunning && ab->volRunning
        && (!ab->scancmd || ab->scanRunning)
@@ -783,10 +766,10 @@ SetNeedsClock(register struct fsbnode *ab)
 }
 
 static int
-NudgeProcs(register struct fsbnode *abnode)
+NudgeProcs(struct fsbnode *abnode)
 {
     struct bnode_proc *tp;     /* not register */
-    register afs_int32 code;
+    afs_int32 code;
     afs_int32 now;
 
     now = FT_ApproxTime();
@@ -948,7 +931,7 @@ static int
 fs_getstring(struct bnode *bn, char *abuffer, afs_int32 alen)
 {
     struct fsbnode *abnode = (struct fsbnode *)bn;
-    
+
     if (alen < 40)
        return -1;
     if (abnode->b.goal == 1) {
@@ -993,7 +976,7 @@ fs_getparm(struct bnode *bn, afs_int32 aindex, char *abuffer,
           afs_int32 alen)
 {
     struct fsbnode *abnode = (struct fsbnode *)bn;
-    
+
     if (aindex == 0)
        strcpy(abuffer, abnode->filecmd);
     else if (aindex == 1)
@@ -1012,7 +995,7 @@ dafs_getparm(struct bnode *bn, afs_int32 aindex, char *abuffer,
             afs_int32 alen)
 {
     struct fsbnode *abnode = (struct fsbnode *)bn;
-    
+
     if (aindex == 0)
        strcpy(abuffer, abnode->filecmd);
     else if (aindex == 1)