#include "bosprototypes.h"
/* command offsets for bos salvage command */
-#define ADDPARMOFFSET 10
+#define ADDPARMOFFSET 11
/* dummy routine for the audit work. It should do nothing since audits */
/* occur at the server level and bos is not a server. */
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)
+ char * atmpDir, char * orphans, int dafs, int dodirs)
{
afs_int32 code;
char *parms[6];
strcat(tbuffer, " -orphans ");
strcat(tbuffer, orphans);
}
+ /* add the salvagedirs option if given */
+ if (dodirs) {
+ if (strlen(tbuffer) + 14 > BOZO_BSSIZE) {
+ fprintf(stderr, "bos: command line too big\n");
+ return (E2BIG);
+ }
+ strcat(tbuffer, " -salvagedirs");
+ }
}
parms[0] = tbuffer;
afs_int32 newID;
extern struct ubik_client *cstruct;
afs_int32 curGoal, showlog = 0, dafs = 0;
+ int dodirs = 0;
char *parallel;
char *tmpDir;
char *orphans;
}
}
+ if (as->parms[10].items) { /* -salvagedirs */
+ if (as->parms[4].items) { /* -all */
+ dodirs = 1;
+ } else {
+ fprintf(stderr, " -salvagedirs only possible with -all.\n");
+ return EINVAL;
+ }
+ }
+
if (as->parms[4].items) {
/* salvage whole enchilada */
curGoal = GetServerGoal(tconn, serviceName);
/* now do the salvage operation */
printf("Starting salvage.\n");
rc = DoSalvage(tconn, NULL, NULL, outName, showlog, parallel, tmpDir,
- orphans, dafs);
+ orphans, dafs, dodirs);
if (curGoal == BSTAT_NORMAL) {
printf("bos: restarting %s.\n", serviceName);
code = BOZO_SetTStatus(tconn, serviceName, BSTAT_NORMAL);
/* now do the salvage operation */
printf("Starting salvage.\n");
rc = DoSalvage(tconn, as->parms[1].items->data, NULL, outName,
- showlog, parallel, tmpDir, orphans, dafs);
+ showlog, parallel, tmpDir, orphans, dafs, 0);
if (curGoal == BSTAT_NORMAL) {
printf("bos: restarting '%s'.\n", serviceName);
code = BOZO_SetTStatus(tconn, serviceName, BSTAT_NORMAL);
}
printf("Starting salvage.\n");
rc = DoSalvage(tconn, as->parms[1].items->data, tname, outName,
- showlog, parallel, tmpDir, orphans, dafs);
+ showlog, parallel, tmpDir, orphans, dafs, 0);
if (rc)
return rc;
}
"ignore | remove | attach");
cmd_AddParm(ts, "-forceDAFS", CMD_FLAG, CMD_OPTIONAL,
"(DAFS) force salvage of demand attach fileserver");
+ cmd_AddParm(ts, "-salvagedirs", CMD_FLAG, CMD_OPTIONAL,
+ "Force rebuild/salvage of all directories");
add_std_args(ts);
ts = cmd_CreateSyntax("getrestricted", GetRestrict, NULL, 0,