bosserver-invoke-salvager-fully-specifying-force-20090611
[openafs.git] / src / bozo / bos.c
index 565bd35..5121fc4 100644 (file)
@@ -39,30 +39,29 @@ RCSID
 #include <sys/stat.h>
 #include <rx/xdr.h>
 #include <afs/auth.h>
-#include <rx/rxkad.h>
 #include <afs/cellconfig.h>
 #include <stdio.h>
 #include <afs/cmd.h>
 #include <afs/com_err.h>
 #include <ubik.h>
 #include <afs/ktime.h>
+#include <des.h>
+#include <des_prototypes.h>
+#include <afs/kautils.h>
+#include <afs/volser.h>
 
-
-
-extern char *volutil_PartitionName();
-extern struct rx_call *rx_NewCall();
-extern char *volutil_PartitionName();
-extern struct hostent *hostutil_GetHostByName();
-
-static IStatServer();
-static DoStat();
+static int IStatServer(register struct cmd_syndesc *as, int int32p);
+static int DoStat(char *aname, register struct rx_connection *aconn, 
+                 int aint32p, int firstTime);
 
 #include "bosint.h"
 
-#define MRAFS_OFFSET  9
-#define ADDPARMOFFSET 26
+/* command offsets for bos salvage command */
+#define MRAFS_OFFSET  10
+#define ADDPARMOFFSET 27
 
-static struct SalvageParms {
+/* MR-AFS salvage parameters */
+struct MRAFSSalvageParms {
     afs_int32 Optdebug;
     afs_int32 Optnowrite;
     afs_int32 Optforce;
@@ -81,32 +80,32 @@ static struct SalvageParms {
     afs_int32 OptLogLevel;
     afs_int32 OptRxDebug;
     afs_uint32 OptResidencies;
-} mrafsParm;
+};
 
 /* dummy routine for the audit work.  It should do nothing since audits */
 /* occur at the server level and bos is not a server. */
-osi_audit()
+int osi_audit(void )
 {
     return 0;
 }
 
 /* keep those lines small */
 static char *
-em(acode)
-     afs_int32 acode;
+em(afs_int32 acode)
 {
     if (acode == -1)
        return "communications failure (-1)";
     else if (acode == -3)
        return "communications timeout (-3)";
     else
-       return (char *)error_message(acode);
+       return (char *)afs_error_message(acode);
 }
 
 /* get partition id from a name */
+/* XXX - unused code - could be removed? */
+#if 0
 static afs_int32
-GetPartitionID(aname)
-     char *aname;
+GetPartitionID(char *aname)
 {
     register char tc;
     char ascii[3];
@@ -144,15 +143,16 @@ GetPartitionID(aname)
        return (ascii[0] - 'a') * 26 + (ascii[1] - 'a') + 26;
     }
 }
+#endif
 
 /* make ctime easier to use */
 static char *
-DateOf(atime)
-     afs_int32 atime;
+DateOf(afs_int32 atime)
 {
     static char tbuffer[30];
     register char *tp;
-    tp = ctime((time_t *) & atime);
+    time_t t = (time_t) atime;
+    tp = ctime(&t);
     if (tp) {
        strcpy(tbuffer, tp);
        tbuffer[24] = 0;        /* get rid of new line */
@@ -169,9 +169,7 @@ static int scIndex;
  * aencrypt is set if we want to encrypt the data on the wire.
  */
 static struct rx_connection *
-GetConn(as, aencrypt)
-     int aencrypt;
-     struct cmd_syndesc *as;
+GetConn(struct cmd_syndesc *as, int aencrypt)
 {
     struct hostent *th;
     char *hostname;
@@ -210,7 +208,7 @@ GetConn(as, aencrypt)
         * local cell */
        code = afsconf_GetCellInfo(tdir, tname, NULL, &info);
        if (code) {
-           com_err("bos", code, "(can't find cell '%s' in cell database)",
+           afs_com_err("bos", code, "(can't find cell '%s' in cell database)",
                    (tname ? tname : "<default>"));
            exit(1);
        } else
@@ -230,14 +228,14 @@ GetConn(as, aencrypt)
        if (as->parms[ADDPARMOFFSET + 2].items) {       /* -localauth */
            code = afsconf_GetLatestKey(tdir, 0, 0);
            if (code)
-               com_err("bos", code, "(getting key from local KeyFile)");
+               afs_com_err("bos", code, "(getting key from local KeyFile)");
            else {
                if (aencrypt)
                    code = afsconf_ClientAuthSecure(tdir, &sc[2], &scIndex);
                else
                    code = afsconf_ClientAuth(tdir, &sc[2], &scIndex);
                if (code)
-                   com_err("bos", code, "(calling ClientAuth)");
+                   afs_com_err("bos", code, "(calling ClientAuth)");
                else if (scIndex != 2)  /* this shouldn't happen */
                    sc[scIndex] = sc[2];
            }
@@ -245,7 +243,7 @@ GetConn(as, aencrypt)
            code = ktc_GetToken(&sname, &ttoken, sizeof(ttoken), NULL);
            if (code == 0) {
                /* have tickets, will travel */
-               if (ttoken.kvno >= 0 && ttoken.kvno <= 255);
+               if (ttoken.kvno >= 0 && ttoken.kvno <= 256);
                else {
                    fprintf(stderr,
                            "bos: funny kvno (%d) in ticket, proceeding\n",
@@ -264,7 +262,7 @@ GetConn(as, aencrypt)
                                                  ttoken.ticket);
                scIndex = 2;
            } else
-               com_err("bos", code, "(getting tickets)");
+               afs_com_err("bos", code, "(getting tickets)");
        }
        if ((scIndex == 0) || (sc[scIndex] == 0)) {
            fprintf(stderr, "bos: running unauthenticated\n");
@@ -283,9 +281,8 @@ GetConn(as, aencrypt)
     return tconn;
 }
 
-static
-SetAuth(as)
-     struct cmd_syndesc *as;
+static int
+SetAuth(struct cmd_syndesc *as, void *arock)
 {
     register afs_int32 code;
     register struct rx_connection *tconn;
@@ -306,16 +303,14 @@ SetAuth(as)
     }
     code = BOZO_SetNoAuthFlag(tconn, flag);
     if (code)
-       com_err("bos", code, "(failed to set authentication flag)");
+       afs_com_err("bos", code, "(failed to set authentication flag)");
     return 0;
 }
 
 /* take a name (e.g. foo/bar, and a dir e.g. /usr/afs/bin, and construct
  * /usr/afs/bin/bar */
-static
-ComputeDestDir(aname, adir, aresult, alen)
-     char *aname, *adir, *aresult;
-     afs_int32 alen;
+static int
+ComputeDestDir(char *aname, char *adir, char *aresult, afs_int32 alen)
 {
     register char *tp;
 
@@ -333,10 +328,8 @@ ComputeDestDir(aname, adir, aresult, alen)
 }
 
 /* copy data from fd afd to rx call acall */
-static
-CopyBytes(afd, acall)
-     int afd;
-     register struct rx_call *acall;
+static int
+CopyBytes(int afd, register struct rx_call *acall)
 {
     register afs_int32 code;
     register afs_int32 len;
@@ -354,9 +347,8 @@ CopyBytes(afd, acall)
     }
 }
 
-static
-Prune(as)
-     register struct cmd_syndesc *as;
+static int
+Prune(register struct cmd_syndesc *as, void *arock)
 {
     register afs_int32 code;
     register struct rx_connection *tconn;
@@ -374,13 +366,12 @@ Prune(as)
        flags |= 0xff;
     code = BOZO_Prune(tconn, flags);
     if (code)
-       com_err("bos", code, "(failed to prune server files)");
+       afs_com_err("bos", code, "(failed to prune server files)");
     return code;
 }
 
-static
-Exec(as)
-     register struct cmd_syndesc *as;
+static int
+Exec(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -392,9 +383,8 @@ Exec(as)
     return code;
 }
 
-static
-GetDate(as)
-     register struct cmd_syndesc *as;
+static int
+GetDate(register struct cmd_syndesc *as, void *arock)
 {
     register afs_int32 code;
     char tbuffer[256];
@@ -443,9 +433,8 @@ GetDate(as)
     return 0;
 }
 
-static
-UnInstall(as)
-     register struct cmd_syndesc *as;
+static int
+UnInstall(register struct cmd_syndesc *as, void *arock)
 {
     register afs_int32 code;
     char tbuffer[256];
@@ -479,9 +468,7 @@ UnInstall(as)
 }
 
 static afs_int32
-GetServerGoal(aconn, aname)
-     char *aname;
-     struct rx_connection *aconn;
+GetServerGoal(struct rx_connection *aconn, char *aname)
 {
     char buffer[500];
     char *tp;
@@ -502,9 +489,8 @@ GetServerGoal(aconn, aname)
        return BSTAT_NORMAL;
 }
 
-static
-Install(as)
-     struct cmd_syndesc *as;
+static int
+Install(struct cmd_syndesc *as, void *arock)
 {
     struct rx_connection *tconn;
     register afs_int32 code;
@@ -560,9 +546,8 @@ Install(as)
     return 0;
 }
 
-static
-Shutdown(as)
-     struct cmd_syndesc *as;
+static int
+Shutdown(struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -590,10 +575,8 @@ Shutdown(as)
     return 0;
 }
 
-static
-BlockScannerCmd(as, arock)
-     struct cmd_syndesc *as;
-     char *arock;
+static int
+BlockScannerCmd(struct cmd_syndesc *as, void *arock)
 {
     register afs_int32 code;
     struct rx_connection *tconn;
@@ -608,10 +591,8 @@ BlockScannerCmd(as, arock)
     return 0;
 }
 
-static
-UnBlockScannerCmd(as, arock)
-     struct cmd_syndesc *as;
-     char *arock;
+static int
+UnBlockScannerCmd(struct cmd_syndesc *as, void *arock)
 {
     register afs_int32 code;
     struct rx_connection *tconn;
@@ -626,10 +607,8 @@ UnBlockScannerCmd(as, arock)
     return 0;
 }
 
-static
-GetRestartCmd(as, arock)
-     struct cmd_syndesc *as;
-     char *arock;
+static int
+GetRestartCmd(struct cmd_syndesc *as, void *arock)
 {
     register afs_int32 code;
     struct ktime generalTime, newBinaryTime;
@@ -640,13 +619,13 @@ GetRestartCmd(as, arock)
     hostp = as->parms[0].items->data;  /* host name for messages */
     tconn = GetConn(as, 0);
 
-    code = BOZO_GetRestartTime(tconn, 1, &generalTime);
+    code = BOZO_GetRestartTime(tconn, 1, (struct bozo_netKTime *) &generalTime);
     if (code) {
        printf("bos: failed to retrieve restart information (%s)\n",
               em(code));
        return code;
     }
-    code = BOZO_GetRestartTime(tconn, 2, &newBinaryTime);
+    code = BOZO_GetRestartTime(tconn, 2, (struct bozo_netKTime *) &newBinaryTime);
     if (code) {
        printf("bos: failed to retrieve restart information (%s)\n",
               em(code));
@@ -671,15 +650,13 @@ GetRestartCmd(as, arock)
     return 0;
 }
 
-static
-SetRestartCmd(as, arock)
-     struct cmd_syndesc *as;
-     char *arock;
+static int
+SetRestartCmd(struct cmd_syndesc *as, void *arock)
 {
-    afs_int32 count;
+    afs_int32 count = 0;
     register afs_int32 code;
     struct ktime restartTime;
-    afs_int32 type;
+    afs_int32 type = 0 ;
     struct rx_connection *tconn;
 
     count = 0;
@@ -699,13 +676,13 @@ SetRestartCmd(as, arock)
     if (count == 0)
        type = 1;               /* by default set general restart time */
 
-    if (code = ktime_ParsePeriodic(as->parms[1].items->data, &restartTime)) {
+    if ((code = ktime_ParsePeriodic(as->parms[1].items->data, &restartTime))) {
        printf("bos: failed to parse '%s' as periodic restart time(%s)\n",
               as->parms[1].items->data, em(code));
        return code;
     }
 
-    code = BOZO_SetRestartTime(tconn, type, &restartTime);
+    code = BOZO_SetRestartTime(tconn, type, (struct bozo_netKTime *) &restartTime);
     if (code) {
        printf("bos: failed to set restart time at server (%s)\n", em(code));
        return code;
@@ -713,9 +690,8 @@ SetRestartCmd(as, arock)
     return 0;
 }
 
-static
-Startup(as)
-     struct cmd_syndesc *as;
+static int
+Startup(struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -737,9 +713,8 @@ Startup(as)
     return 0;
 }
 
-static
-Restart(as)
-     struct cmd_syndesc *as;
+static int
+Restart(struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -783,9 +758,8 @@ Restart(as)
     return 0;
 }
 
-static
-SetCellName(as)
-     struct cmd_syndesc *as;
+static int
+SetCellName(struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -797,9 +771,8 @@ SetCellName(as)
     return 0;
 }
 
-static
-AddHost(as)
-     register struct cmd_syndesc *as;
+static int
+AddHost(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -825,9 +798,8 @@ AddHost(as)
     return 0;
 }
 
-static
-RemoveHost(as)
-     register struct cmd_syndesc *as;
+static int
+RemoveHost(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -843,9 +815,8 @@ RemoveHost(as)
     return 0;
 }
 
-static
-ListHosts(as)
-     register struct cmd_syndesc *as;
+static int
+ListHosts(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -874,9 +845,8 @@ ListHosts(as)
     return 0;
 }
 
-static
-AddKey(as)
-     register struct cmd_syndesc *as;
+static int
+AddKey(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -944,9 +914,8 @@ AddKey(as)
     return 0;
 }
 
-static
-RemoveKey(as)
-     register struct cmd_syndesc *as;
+static int
+RemoveKey(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -965,9 +934,8 @@ RemoveKey(as)
     return 0;
 }
 
-static
-ListKeys(as)
-     IN register struct cmd_syndesc *as;
+static int
+ListKeys(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -1006,9 +974,8 @@ ListKeys(as)
     return 0;
 }
 
-static
-AddSUser(as)
-     register struct cmd_syndesc *as;
+static int
+AddSUser(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -1027,9 +994,8 @@ AddSUser(as)
     return failed;
 }
 
-static
-RemoveSUser(as)
-     register struct cmd_syndesc *as;
+static int
+RemoveSUser(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register struct cmd_item *ti;
@@ -1053,9 +1019,8 @@ RemoveSUser(as)
 }
 
 #define        NPERLINE    10          /* dudes to print per line */
-static
-ListSUsers(as)
-     register struct cmd_syndesc *as;
+static int
+ListSUsers(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register int i;
@@ -1093,9 +1058,8 @@ ListSUsers(as)
     return 0;
 }
 
-static
-StatServer(as)
-     register struct cmd_syndesc *as;
+static int
+StatServer(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -1128,9 +1092,8 @@ StatServer(as)
     return 0;
 }
 
-static
-CreateServer(as)
-     register struct cmd_syndesc *as;
+static int
+CreateServer(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -1147,7 +1110,7 @@ CreateServer(as)
     }
     name = as->parms[1].items->data;
     type = as->parms[2].items->data;
-    if (ti = as->parms[4].items) {
+    if ((ti = as->parms[4].items)) {
        notifier = ti->data;
     }
     code =
@@ -1161,9 +1124,8 @@ CreateServer(as)
     return code;
 }
 
-static
-DeleteServer(as)
-     register struct cmd_syndesc *as;
+static int
+DeleteServer(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -1184,9 +1146,8 @@ DeleteServer(as)
     return code;
 }
 
-static
-StartServer(as)
-     register struct cmd_syndesc *as;
+static int
+StartServer(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -1203,9 +1164,8 @@ StartServer(as)
     return code;
 }
 
-static
-StopServer(as)
-     register struct cmd_syndesc *as;
+static int
+StopServer(register struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code;
@@ -1230,17 +1190,11 @@ StopServer(as)
 
 #define PARMBUFFERSSIZE 32
 
-static
-DoSalvage(aconn, aparm1, aparm2, aoutName, showlog, parallel, atmpDir,
-         orphans)
-     struct rx_connection *aconn;
-     char *aoutName;
-     char *aparm1;
-     char *aparm2;
-     afs_int32 showlog;
-     char *parallel;
-     char *atmpDir;
-     char *orphans;
+static afs_int32
+DoSalvage(struct rx_connection * aconn, char * aparm1, char * aparm2, 
+         char * aoutName, afs_int32 showlog, char * parallel, 
+         char * atmpDir, char * orphans, int dafs, 
+         struct MRAFSSalvageParms * mrafsParm)
 {
     register afs_int32 code;
     char *parms[6];
@@ -1291,96 +1245,128 @@ DoSalvage(aconn, aparm1, aparm2, aoutName, showlog, parallel, atmpDir,
        parms[code] = "";
     if (!aparm2)
        aparm2 = "";
+
     /* MUST pass canonical (wire-format) salvager path to bosserver */
-    strncpy(tbuffer, AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH, BOZO_BSSIZE);
     if (*aparm2 != 0) {
-       if ((strlen(tbuffer) + 1 + strlen(partName) + 1 + strlen(aparm2) +
-            1) > BOZO_BSSIZE) {
-           printf("bos: command line too big\n");
-           return (E2BIG);
+       /* single volume salvage */
+       if (dafs) {
+           /* for DAFS, we call the salvagserver binary with special options.
+            * in this mode, it simply uses SALVSYNC to tell the currently
+            * running salvageserver to offline and salvage the volume in question */
+           strncpy(tbuffer, AFSDIR_CANONICAL_SERVER_SALSRV_FILEPATH, BOZO_BSSIZE);
+
+           if ((strlen(tbuffer) + 9 + strlen(partName) + 1 + strlen(aparm2) +
+                1) > BOZO_BSSIZE) {
+               printf("bos: command line too big\n");
+               return (E2BIG);
+           }
+
+           strcat(tbuffer, " -client ");
+           strcat(tbuffer, partName);
+           strcat(tbuffer, " ");
+           strcat(tbuffer, aparm2);
+       } else {
+           strncpy(tbuffer, AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH, BOZO_BSSIZE);
+
+           if ((strlen(tbuffer) + 1 + strlen(partName) + 1 + strlen(aparm2) +
+                1) > BOZO_BSSIZE) {
+               printf("bos: command line too big\n");
+               return (E2BIG);
+           }
+
+           strcat(tbuffer, " ");
+           strcat(tbuffer, partName);
+           strcat(tbuffer, " ");
+           strcat(tbuffer, aparm2);
        }
-       strcat(tbuffer, " ");
-       strcat(tbuffer, partName);
-       strcat(tbuffer, " ");
-       strcat(tbuffer, aparm2);
     } else {
+       /* partition salvage */
+       strncpy(tbuffer, AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH, BOZO_BSSIZE);
        if ((strlen(tbuffer) + 4 + strlen(partName) + 1) > BOZO_BSSIZE) {
            printf("bos: command line too big\n");
            return (E2BIG);
        }
-       strcat(tbuffer, " -f ");
+       strcat(tbuffer, " -force ");
        strcat(tbuffer, partName);
     }
 
-    /* add the parallel option if given */
-    if (parallel != NULL) {
-       if ((strlen(tbuffer) + 11 + strlen(parallel) + 1) > BOZO_BSSIZE) {
-           printf("bos: command line too big\n");
-           return (E2BIG);
+    /* For DAFS, specifying a single volume does not result in a standard
+     * salvager call.  Instead, it simply results in a SALVSYNC call to the
+     * online salvager daemon.  This interface does not give us the same rich
+     * set of call flags.  Thus, we skip these steps for DAFS single-volume 
+     * calls */
+    if (!dafs || (*aparm2 == 0)) {
+       /* add the parallel option if given */
+       if (parallel != NULL) {
+           if ((strlen(tbuffer) + 11 + strlen(parallel) + 1) > BOZO_BSSIZE) {
+               printf("bos: command line too big\n");
+               return (E2BIG);
+           }
+           strcat(tbuffer, " -parallel ");
+           strcat(tbuffer, parallel);
        }
-       strcat(tbuffer, " -parallel ");
-       strcat(tbuffer, parallel);
-    }
 
-    /* add the tmpdir option if given */
-    if (atmpDir != NULL) {
-       if ((strlen(tbuffer) + 9 + strlen(atmpDir) + 1) > BOZO_BSSIZE) {
-           printf("bos: command line too big\n");
-           return (E2BIG);
+       /* add the tmpdir option if given */
+       if (atmpDir != NULL) {
+           if ((strlen(tbuffer) + 9 + strlen(atmpDir) + 1) > BOZO_BSSIZE) {
+               printf("bos: command line too big\n");
+               return (E2BIG);
+           }
+           strcat(tbuffer, " -tmpdir ");
+           strcat(tbuffer, atmpDir);
        }
-       strcat(tbuffer, " -tmpdir ");
-       strcat(tbuffer, atmpDir);
-    }
 
-    /* add the orphans option if given */
-    if (orphans != NULL) {
-       if ((strlen(tbuffer) + 10 + strlen(orphans) + 1) > BOZO_BSSIZE) {
-           printf("bos: command line too big\n");
-           return (E2BIG);
+       /* add the orphans option if given */
+       if (orphans != NULL) {
+           if ((strlen(tbuffer) + 10 + strlen(orphans) + 1) > BOZO_BSSIZE) {
+               printf("bos: command line too big\n");
+               return (E2BIG);
+           }
+           strcat(tbuffer, " -orphans ");
+           strcat(tbuffer, orphans);
+       }
+
+       if (mrafsParm->Optdebug)
+           strcat(tbuffer, " -debug");
+       if (mrafsParm->Optnowrite)
+           strcat(tbuffer, " -nowrite");
+       if (mrafsParm->Optforce)
+           strcat(tbuffer, " -force");
+       if (mrafsParm->Optoktozap)
+           strcat(tbuffer, " -oktozap");
+       if (mrafsParm->Optrootfiles)
+           strcat(tbuffer, " -rootfiles");
+       if (mrafsParm->Optsalvagedirs)
+           strcat(tbuffer, " -salvagedirs");
+       if (mrafsParm->Optblockreads)
+           strcat(tbuffer, " -blockreads");
+       if (mrafsParm->OptListResidencies)
+           strcat(tbuffer, " -ListResidencies");
+       if (mrafsParm->OptSalvageRemote)
+           strcat(tbuffer, " -SalvageRemote");
+       if (mrafsParm->OptSalvageArchival)
+           strcat(tbuffer, " -SalvageArchival");
+       if (mrafsParm->OptIgnoreCheck)
+           strcat(tbuffer, " -IgnoreCheck");
+       if (mrafsParm->OptForceOnLine)
+           strcat(tbuffer, " -ForceOnLine");
+       if (mrafsParm->OptUseRootDirACL)
+           strcat(tbuffer, " -UseRootDirACL");
+       if (mrafsParm->OptTraceBadLinkCounts)
+           strcat(tbuffer, " -TraceBadLinkCounts");
+       if (mrafsParm->OptDontAskFS)
+           strcat(tbuffer, " -DontAskFS");
+       if (mrafsParm->OptLogLevel) {
+           sprintf(pbuffer, " -LogLevel %ld", afs_cast_int32(mrafsParm->OptLogLevel));
+           strcat(tbuffer, pbuffer);
+       }
+       if (mrafsParm->OptRxDebug)
+           strcat(tbuffer, " -rxdebug");
+       if (mrafsParm->OptResidencies) {
+           sprintf(pbuffer, " -Residencies %lu", 
+                   afs_cast_uint32(mrafsParm->OptResidencies));
+           strcat(tbuffer, pbuffer);
        }
-       strcat(tbuffer, " -orphans ");
-       strcat(tbuffer, orphans);
-    }
-
-    if (mrafsParm.Optdebug)
-       strcat(tbuffer, " -debug");
-    if (mrafsParm.Optnowrite)
-       strcat(tbuffer, " -nowrite");
-    if (mrafsParm.Optforce)
-       strcat(tbuffer, " -force");
-    if (mrafsParm.Optoktozap)
-       strcat(tbuffer, " -oktozap");
-    if (mrafsParm.Optrootfiles)
-       strcat(tbuffer, " -rootfiles");
-    if (mrafsParm.Optsalvagedirs)
-       strcat(tbuffer, " -salvagedirs");
-    if (mrafsParm.Optblockreads)
-       strcat(tbuffer, " -blockreads");
-    if (mrafsParm.OptListResidencies)
-       strcat(tbuffer, " -ListResidencies");
-    if (mrafsParm.OptSalvageRemote)
-       strcat(tbuffer, " -SalvageRemote");
-    if (mrafsParm.OptSalvageArchival)
-       strcat(tbuffer, " -SalvageArchival");
-    if (mrafsParm.OptIgnoreCheck)
-       strcat(tbuffer, " -IgnoreCheck");
-    if (mrafsParm.OptForceOnLine)
-       strcat(tbuffer, " -ForceOnLine");
-    if (mrafsParm.OptUseRootDirACL)
-       strcat(tbuffer, " -UseRootDirACL");
-    if (mrafsParm.OptTraceBadLinkCounts)
-       strcat(tbuffer, " -TraceBadLinkCounts");
-    if (mrafsParm.OptDontAskFS)
-       strcat(tbuffer, " -DontAskFS");
-    if (mrafsParm.OptLogLevel) {
-       sprintf(pbuffer, " -LogLevel %ld", mrafsParm.OptLogLevel);
-       strcat(tbuffer, pbuffer);
-    }
-    if (mrafsParm.OptRxDebug)
-       strcat(tbuffer, " -rxdebug");
-    if (mrafsParm.OptResidencies) {
-       sprintf(pbuffer, " -Residencies %lu", mrafsParm.OptResidencies);
-       strcat(tbuffer, pbuffer);
     }
 
     parms[0] = tbuffer;
@@ -1438,9 +1424,8 @@ DoSalvage(aconn, aparm1, aparm2, aoutName, showlog, parallel, atmpDir,
     return code;
 }
 
-static
-GetLogCmd(as)
-     register struct cmd_syndesc *as;
+static int
+GetLogCmd(register struct cmd_syndesc *as, void *arock)
 {
     struct rx_connection *tconn;
     register struct rx_call *tcall;
@@ -1473,13 +1458,12 @@ GetLogCmd(as)
 
   done:
     if (code)
-       com_err("bos", code, "(while reading log)");
+       afs_com_err("bos", code, "(while reading log)");
     return code;
 }
 
-static
-SalvageCmd(as)
-     struct cmd_syndesc *as;
+static int
+SalvageCmd(struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     register afs_int32 code, rc, i;
@@ -1487,22 +1471,36 @@ SalvageCmd(as)
     char tname[BOZO_BSSIZE];
     afs_int32 newID;
     extern struct ubik_client *cstruct;
-    afs_int32 curGoal, showlog = 0, mrafs = 0;
+    afs_int32 curGoal, showlog = 0, dafs = 0, mrafs = 0;
     char *parallel;
     char *tmpDir;
     char *orphans;
     char *tp;
+    char * serviceName;
+    struct MRAFSSalvageParms mrafsParm;
 
     memset(&mrafsParm, 0, sizeof(mrafsParm));
 
     /* parm 0 is machine name, 1 is partition, 2 is volume, 3 is -all flag */
     tconn = GetConn(as, 0);
 
-    /* Find out whether fileserver is running MR-AFS (has a scanner instance) */
-    /* XXX this should really be done some other way, potentially by RPC */
-    tp = &tname;
-    if (code = BOZO_GetInstanceParm(tconn, "fs", 3, &tp) == 0)
-       mrafs = 1;
+    tp = &tname[0];
+
+    /* find out whether fileserver is running demand attach fs */
+    if ((code = BOZO_GetInstanceParm(tconn, "dafs", 0, &tp) == 0)) {
+       dafs = 1;
+       serviceName = "dafs";
+       /* Find out whether fileserver is running MR-AFS (has a scanner instance) */
+       /* XXX this should really be done some other way, potentially by RPC */
+       if ((code = BOZO_GetInstanceParm(tconn, serviceName, 4, &tp) == 0))
+           mrafs = 1;
+    } else {
+       serviceName = "fs";
+       /* Find out whether fileserver is running MR-AFS (has a scanner instance) */
+       /* XXX this should really be done some other way, potentially by RPC */
+       if ((code = BOZO_GetInstanceParm(tconn, serviceName, 3, &tp) == 0))
+           mrafs = 1;
+    }
 
     /* we can do a volume, a partition or the whole thing, but not mixtures
      * thereof */
@@ -1548,6 +1546,14 @@ SalvageCmd(as)
        orphans = as->parms[8].items->data;
     }
 
+    if (dafs) {
+       if (!as->parms[9].items) { /* -forceDAFS flag */
+           printf("This is a demand attach fileserver.  Are you sure you want to proceed with a manual salvage?\n");
+           printf("must specify -forceDAFS flag in order to proceed.\n");
+           return EINVAL;
+       }
+    }
+
     if (mrafs) {
        if (as->parms[MRAFS_OFFSET].items)
            mrafsParm.Optdebug = 1;
@@ -1603,7 +1609,7 @@ SalvageCmd(as)
     } else {
        int stop = 0;
 
-       for (i = 9; i < ADDPARMOFFSET; i++) {
+       for (i = MRAFS_OFFSET; i < ADDPARMOFFSET; i++) {
            if (as->parms[i].items) {
                printf(" %s only possible for MR-AFS fileserver.\n",
                       as->parms[i].name);
@@ -1616,12 +1622,12 @@ SalvageCmd(as)
 
     if (as->parms[4].items) {
        /* salvage whole enchilada */
-       curGoal = GetServerGoal(tconn, "fs");
+       curGoal = GetServerGoal(tconn, serviceName);
        if (curGoal == BSTAT_NORMAL) {
-           printf("bos: shutting down fs.\n");
-           code = BOZO_SetTStatus(tconn, "fs", BSTAT_SHUTDOWN);
+           printf("bos: shutting down '%s'.\n", serviceName);
+           code = BOZO_SetTStatus(tconn, serviceName, BSTAT_SHUTDOWN);
            if (code) {
-               printf("bos: failed to stop 'fs' (%s)\n", em(code));
+               printf("bos: failed to stop '%s' (%s)\n", serviceName, em(code));
                return code;
            }
            code = BOZO_WaitAll(tconn); /* wait for shutdown to complete */
@@ -1632,12 +1638,12 @@ SalvageCmd(as)
        /* now do the salvage operation */
        printf("Starting salvage.\n");
        rc = DoSalvage(tconn, NULL, NULL, outName, showlog, parallel, tmpDir,
-                      orphans);
+                      orphans, dafs, &mrafsParm);
        if (curGoal == BSTAT_NORMAL) {
-           printf("bos: restarting fs.\n");
-           code = BOZO_SetTStatus(tconn, "fs", BSTAT_NORMAL);
+           printf("bos: restarting %s.\n", serviceName);
+           code = BOZO_SetTStatus(tconn, serviceName, BSTAT_NORMAL);
            if (code) {
-               printf("bos: failed to restart 'fs' (%s)\n", em(code));
+               printf("bos: failed to restart '%s' (%s)\n", serviceName, em(code));
                return code;
            }
        }
@@ -1657,13 +1663,13 @@ SalvageCmd(as)
                   as->parms[1].items->data);
            return -1;
        }
-       curGoal = GetServerGoal(tconn, "fs");
+       curGoal = GetServerGoal(tconn, serviceName);
        /* salvage a whole partition (specified by parms[1]) */
        if (curGoal == BSTAT_NORMAL) {
-           printf("bos: shutting down fs.\n");
-           code = BOZO_SetTStatus(tconn, "fs", BSTAT_SHUTDOWN);
+           printf("bos: shutting down '%s'.\n", serviceName);
+           code = BOZO_SetTStatus(tconn, serviceName, BSTAT_SHUTDOWN);
            if (code) {
-               printf("bos: can't stop 'fs' (%s)\n", em(code));
+               printf("bos: can't stop '%s' (%s)\n", serviceName, em(code));
                return code;
            }
            code = BOZO_WaitAll(tconn); /* wait for shutdown to complete */
@@ -1674,12 +1680,12 @@ SalvageCmd(as)
        /* now do the salvage operation */
        printf("Starting salvage.\n");
        rc = DoSalvage(tconn, as->parms[1].items->data, NULL, outName,
-                      showlog, parallel, tmpDir, orphans);
+                      showlog, parallel, tmpDir, orphans, dafs, &mrafsParm);
        if (curGoal == BSTAT_NORMAL) {
-           printf("bos: restarting fs.\n");
-           code = BOZO_SetTStatus(tconn, "fs", BSTAT_NORMAL);
+           printf("bos: restarting '%s'.\n", serviceName);
+           code = BOZO_SetTStatus(tconn, serviceName, BSTAT_NORMAL);
            if (code) {
-               printf("bos: failed to restart 'fs' (%s)\n", em(code));
+               printf("bos: failed to restart '%s' (%s)\n", serviceName, em(code));
                return code;
            }
        }
@@ -1716,7 +1722,7 @@ SalvageCmd(as)
        } else {
            printf
                ("bos: can't initialize volume system client (code %d), trying anyway.\n",
-                as->parms[2].items->data, code);
+                code);
            strncpy(tname, as->parms[2].items->data, sizeof(tname));
        }
        if (volutil_GetPartitionID(as->parms[1].items->data) < 0) {
@@ -1729,17 +1735,15 @@ SalvageCmd(as)
        }
        printf("Starting salvage.\n");
        rc = DoSalvage(tconn, as->parms[1].items->data, tname, outName,
-                      showlog, parallel, tmpDir, orphans);
+                      showlog, parallel, tmpDir, orphans, dafs, &mrafsParm);
        if (rc)
            return rc;
     }
     return 0;
 }
 
-static
-IStatServer(as, int32p)
-     int int32p;
-     register struct cmd_syndesc *as;
+static int
+IStatServer(register struct cmd_syndesc *as, int int32p)
 {
     register struct rx_connection *tconn;
     register struct cmd_item *ti;
@@ -1753,12 +1757,11 @@ IStatServer(as, int32p)
     return 0;
 }
 
-static
-DoStat(aname, aconn, aint32p, firstTime)
-     IN char *aname;
-     IN register struct rx_connection *aconn;
-     IN int aint32p;
-     IN int firstTime;         /* true iff first instance in cmd */
+static int
+DoStat(IN char *aname, 
+       IN register struct rx_connection *aconn, 
+       IN int aint32p, 
+       IN int firstTime)       /* true iff first instance in cmd */
 {
     afs_int32 temp;
     char buffer[500];
@@ -1802,7 +1805,7 @@ DoStat(aname, aconn, aint32p, firstTime)
        printf("bos: failed to get status for instance '%s' (%s)\n", aname,
               em(code));
     else {
-       printf("currently ", aname);
+       printf("currently ");
        if (temp == BSTAT_NORMAL)
            printf("running normally.\n");
        else if (temp == BSTAT_SHUTDOWN)
@@ -1873,9 +1876,8 @@ DoStat(aname, aconn, aint32p, firstTime)
 }
 
 #ifdef BOS_RESTRICTED_MODE
-static
-GetRestrict(as)
-     struct cmd_syndesc *as;
+static int
+GetRestrict(struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     afs_int32 code, val;
@@ -1890,9 +1892,8 @@ GetRestrict(as)
     return 0;
 }
 
-static
-SetRestrict(as)
-     struct cmd_syndesc *as;
+static int
+SetRestrict(struct cmd_syndesc *as, void *arock)
 {
     register struct rx_connection *tconn;
     afs_int32 code, val;
@@ -1907,8 +1908,7 @@ SetRestrict(as)
 #endif
 
 static void
-add_std_args(ts)
-     register struct cmd_syndesc *ts;
+add_std_args(register struct cmd_syndesc *ts)
 {
     cmd_Seek(ts, ADDPARMOFFSET);
     /* + 0 */ cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
@@ -1920,9 +1920,8 @@ add_std_args(ts)
 
 #include "AFS_component_version_number.c"
 
-main(argc, argv)
-     int argc;
-     char **argv;
+int
+main(int argc, char **argv)
 {
     register afs_int32 code;
     register struct cmd_syndesc *ts;
@@ -1965,12 +1964,12 @@ main(argc, argv)
     initialize_CMD_error_table();
     initialize_BZ_error_table();
 
-    ts = cmd_CreateSyntax("start", StartServer, 0, "start running a server");
+    ts = cmd_CreateSyntax("start", StartServer, NULL, "start running a server");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, 0, "server process name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("stop", StopServer, 0, "halt a server instance");
+    ts = cmd_CreateSyntax("stop", StopServer, NULL, "halt a server instance");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, 0, "server process name");
     cmd_Seek(ts, 8);
@@ -1978,7 +1977,7 @@ main(argc, argv)
                "wait for process to stop");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("status", StatServer, 0,
+    ts = cmd_CreateSyntax("status", StatServer, NULL,
                          "show server instance status");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, CMD_OPTIONAL,
@@ -1986,7 +1985,7 @@ main(argc, argv)
     cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL, "long status");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("shutdown", Shutdown, 0, "shutdown all processes");
+    ts = cmd_CreateSyntax("shutdown", Shutdown, NULL, "shutdown all processes");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, CMD_OPTIONAL, "instances");
     cmd_Seek(ts, 8);
@@ -1994,12 +1993,12 @@ main(argc, argv)
                "wait for process to stop");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("startup", Startup, 0, "start all processes");
+    ts = cmd_CreateSyntax("startup", Startup, NULL, "start all processes");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, CMD_OPTIONAL, "instances");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("restart", Restart, 0, "restart processes");
+    ts = cmd_CreateSyntax("restart", Restart, NULL, "restart processes");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, CMD_OPTIONAL, "instances");
     cmd_AddParm(ts, "-bosserver", CMD_FLAG, CMD_OPTIONAL,
@@ -2009,7 +2008,7 @@ main(argc, argv)
 
 #ifndef OPBOS
 
-    ts = cmd_CreateSyntax("create", CreateServer, 0,
+    ts = cmd_CreateSyntax("create", CreateServer, NULL,
                          "create a new server instance");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_SINGLE, 0, "server process name");
@@ -2019,105 +2018,105 @@ main(argc, argv)
                "Notifier program");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("delete", DeleteServer, 0,
+    ts = cmd_CreateSyntax("delete", DeleteServer, NULL,
                          "delete a server instance");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-instance", CMD_LIST, 0, "server process name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("adduser", AddSUser, 0,
+    ts = cmd_CreateSyntax("adduser", AddSUser, NULL,
                          "add users to super-user list");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-user", CMD_LIST, 0, "user names");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("removeuser", RemoveSUser, 0,
+    ts = cmd_CreateSyntax("removeuser", RemoveSUser, NULL,
                          "remove users from super-user list");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-user", CMD_LIST, 0, "user names");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("listusers", ListSUsers, 0, "list super-users");
+    ts = cmd_CreateSyntax("listusers", ListSUsers, NULL, "list super-users");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("addkey", AddKey, 0,
+    ts = cmd_CreateSyntax("addkey", AddKey, NULL,
                          "add keys to key dbase (kvno 999 is bcrypt)");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-key", CMD_SINGLE, CMD_OPTIONAL, "key");
     cmd_AddParm(ts, "-kvno", CMD_SINGLE, 0, "key version number");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("removekey", RemoveKey, 0,
+    ts = cmd_CreateSyntax("removekey", RemoveKey, NULL,
                          "remove keys from key dbase");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-kvno", CMD_LIST, 0, "key version number");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("listkeys", ListKeys, 0, "list keys");
+    ts = cmd_CreateSyntax("listkeys", ListKeys, NULL, "list keys");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-showkey", CMD_FLAG, CMD_OPTIONAL,
                "show the actual key rather than the checksum");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("listhosts", ListHosts, 0, "get cell host list");
+    ts = cmd_CreateSyntax("listhosts", ListHosts, NULL, "get cell host list");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     add_std_args(ts);
     cmd_CreateAlias(ts, "getcell");
 
-    ts = cmd_CreateSyntax("setcellname", SetCellName, 0, "set cell name");
+    ts = cmd_CreateSyntax("setcellname", SetCellName, NULL, "set cell name");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-name", CMD_SINGLE, 0, "cell name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("addhost", AddHost, 0, "add host to cell dbase");
+    ts = cmd_CreateSyntax("addhost", AddHost, NULL, "add host to cell dbase");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-host", CMD_LIST, 0, "host name");
     cmd_AddParm(ts, "-clone", CMD_FLAG, CMD_OPTIONAL, "vote doesn't count");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("removehost", RemoveHost, 0,
+    ts = cmd_CreateSyntax("removehost", RemoveHost, NULL,
                          "remove host from cell dbase");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-host", CMD_LIST, 0, "host name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("setauth", SetAuth, 0,
+    ts = cmd_CreateSyntax("setauth", SetAuth, NULL,
                          "set authentication required flag");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-authrequired", CMD_SINGLE, 0,
                "on or off: authentication required for admin requests");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("install", Install, 0, "install program");
+    ts = cmd_CreateSyntax("install", Install, NULL, "install program");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-file", CMD_LIST, 0, "files to install");
     cmd_AddParm(ts, "-dir", CMD_SINGLE, CMD_OPTIONAL, "destination dir");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("uninstall", UnInstall, 0, "uninstall program");
+    ts = cmd_CreateSyntax("uninstall", UnInstall, NULL, "uninstall program");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-file", CMD_LIST, 0, "files to uninstall");
     cmd_AddParm(ts, "-dir", CMD_SINGLE, CMD_OPTIONAL, "destination dir");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("getlog", GetLogCmd, 0, "examine log file");
+    ts = cmd_CreateSyntax("getlog", GetLogCmd, NULL, "examine log file");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-file", CMD_SINGLE, 0, "log file to examine");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("getdate", GetDate, 0, "get dates for programs");
+    ts = cmd_CreateSyntax("getdate", GetDate, NULL, "get dates for programs");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-file", CMD_LIST, 0, "files to check");
     cmd_AddParm(ts, "-dir", CMD_SINGLE, CMD_OPTIONAL, "destination dir");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("exec", Exec, 0, "execute shell command on server");
+    ts = cmd_CreateSyntax("exec", Exec, NULL, "execute shell command on server");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-cmd", CMD_SINGLE, 0, "command to execute");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("prune", Prune, 0, "prune server files");
+    ts = cmd_CreateSyntax("prune", Prune, NULL, "prune server files");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-bak", CMD_FLAG, CMD_OPTIONAL, "delete .BAK files");
     cmd_AddParm(ts, "-old", CMD_FLAG, CMD_OPTIONAL, "delete .OLD files");
@@ -2125,7 +2124,7 @@ main(argc, argv)
     cmd_AddParm(ts, "-all", CMD_FLAG, CMD_OPTIONAL, "delete all junk files");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("setrestart", SetRestartCmd, 0,
+    ts = cmd_CreateSyntax("setrestart", SetRestartCmd, NULL,
                          "set restart times");
     cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
     cmd_AddParm(ts, "-time", CMD_SINGLE, CMD_REQUIRED,
@@ -2136,12 +2135,12 @@ main(argc, argv)
                "set new binary restart time");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("getrestart", GetRestartCmd, 0,
+    ts = cmd_CreateSyntax("getrestart", GetRestartCmd, NULL,
                          "get restart times");
     cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("salvage", SalvageCmd, 0,
+    ts = cmd_CreateSyntax("salvage", SalvageCmd, NULL,
                          "salvage partition or volumes");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-partition", CMD_SINGLE, CMD_OPTIONAL,
@@ -2159,6 +2158,8 @@ main(argc, argv)
                "directory to place tmp files");
     cmd_AddParm(ts, "-orphans", CMD_SINGLE, CMD_OPTIONAL,
                "ignore | remove | attach");
+    cmd_AddParm(ts, "-forceDAFS", CMD_FLAG, CMD_OPTIONAL,
+               "(DAFS) force salvage of demand attach fileserver");
     cmd_AddParm(ts, "-debug", CMD_FLAG, CMD_OPTIONAL,
                "(MR-AFS) Run in Debugging mode");
     cmd_AddParm(ts, "-nowrite", CMD_FLAG, CMD_OPTIONAL,
@@ -2197,23 +2198,23 @@ main(argc, argv)
                "(MR-AFS) Numeric mask of residencies to be included in the salvage.  Do not use with -SalvageRemote or -SalvageArchival");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("blockscanner", BlockScannerCmd, 0,
+    ts = cmd_CreateSyntax("blockscanner", BlockScannerCmd, NULL,
                          "block scanner daemon from making migration requests");
     cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("unblockscanner", UnBlockScannerCmd, 0,
+    ts = cmd_CreateSyntax("unblockscanner", UnBlockScannerCmd, NULL,
                          "allow scanner daemon to make migration requests again");
     cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name");
     add_std_args(ts);
 
 #ifdef BOS_RESTRICTED_MODE
-    ts = cmd_CreateSyntax("getrestricted", GetRestrict, 0,
+    ts = cmd_CreateSyntax("getrestricted", GetRestrict, NULL,
                          "get restrict mode");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     add_std_args(ts);
 
-    ts = cmd_CreateSyntax("setrestricted", SetRestrict, 0,
+    ts = cmd_CreateSyntax("setrestricted", SetRestrict, NULL,
                          "set restrict mode");
     cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name");
     cmd_AddParm(ts, "-mode", CMD_SINGLE, 0, "mode to set");