/*
* Copyright 2006, Sine Nomine Associates 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>
-RCSID
- ("$Header$");
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#endif /* ITIMER_REAL */
#endif
+
+#include <roken.h>
+
#include <rx/xdr.h>
#include <afs/afsint.h>
-#include <afs/assert.h>
-
+#include <afs/afs_assert.h>
+#include <afs/dir.h>
#include <fcntl.h>
#include <afs/afsutil.h>
#include <afs/fileutil.h>
-#include "nfs.h"
-#include "lwp.h"
-#include "lock.h"
-#include "ihandle.h"
-#include "vnode.h"
-#include "volume.h"
-#include "partition.h"
-#include "daemon_com.h"
-#include "salvsync.h"
+#include <afs/nfs.h>
+#include <lwp.h>
+#include <lock.h>
+#include <afs/ihandle.h>
+#include <afs/vnode.h>
+#include <afs/volume.h>
+#include <afs/partition.h>
+#include <afs/daemon_com.h>
+#include <afs/salvsync.h>
#ifdef AFS_NT40_ENV
#include <pthread.h>
#endif
static char * response_code_to_string(afs_int32);
static char * command_code_to_string(afs_int32);
static char * reason_code_to_string(afs_int32);
-static char * program_type_to_string(afs_int32);
static char * state_code_to_string(afs_int32);
{
struct cmd_syndesc *ts;
int err = 0;
- int i;
- extern char cml_version_number[];
/* Initialize directory paths */
if (!(initAFSDirPath() & AFSDIR_SERVER_PATHS_OK)) {
static int
common_prolog(struct cmd_syndesc * as, struct state * state)
{
- register struct cmd_item *ti;
+ struct cmd_item *ti;
+ VolumePackageOptions opts;
#ifdef AFS_NT40_ENV
if (afs_winsockInit() < 0) {
}
#endif
- VInitVolumePackage(debugUtility, 1, 1,
- DONT_CONNECT_FS, 0);
+ VOptDefaults(debugUtility, &opts);
+ if (VInitVolumePackage2(debugUtility, &opts)) {
+ /* VInitVolumePackage2 can fail on e.g. partition attachment errors,
+ * but we don't really care, since all we're doing is trying to use
+ * SALVSYNC */
+ fprintf(stderr, "errors encountered initializing volume package, but "
+ "trying to continue anyway\n");
+ }
DInit(1);
if ((ti = as->parms[COMMON_PARMS_OFFSET].items)) { /* -reason */
state->reason = atoi(ti->data);
+ } else {
+ state->reason = SALVSYNC_REASON_WHATEVER;
}
+
if ((ti = as->parms[COMMON_PARMS_OFFSET+1].items)) { /* -programtype */
if (!strcmp(ti->data, "fileServer")) {
programType = fileServer;
programType = salvager;
} else if (!strcmp(ti->data, "salvageServer")) {
programType = salvageServer;
+ } else if (!strcmp(ti->data, "volumeServer")) {
+ programType = volumeServer;
+ } else if (!strcmp(ti->data, "volumeSalvager")) {
+ programType = volumeSalvager;
} else {
programType = (ProgramType) atoi(ti->data);
}
static int
common_salv_prolog(struct cmd_syndesc * as, struct state * state)
{
- register struct cmd_item *ti;
- char pname[100], *temp;
+ struct cmd_item *ti;
state->sop = (struct salv_state *) calloc(1, sizeof(struct salv_state));
assert(state->sop != NULL);
hdr = (SALVSYNC_response_hdr *) res->payload.buf;
}
- fprintf(stderr, "calling SALVSYNC_SalvageVolume with command code %d (%s)\n",
+ fprintf(stderr, "calling SALVSYNC_SalvageVolume with command code %d (%s)\n",
command, command_code_to_string(command));
code = SALVSYNC_SalvageVolume(state->sop->volume,
}
fprintf(stderr, "SALVSYNC_SalvageVolume returned %d (%s)\n", code, response_code_to_string(code));
- fprintf(stderr, "protocol response code was %d (%s)\n",
+ fprintf(stderr, "protocol response code was %d (%s)\n",
res->hdr.response, response_code_to_string(res->hdr.response));
- fprintf(stderr, "protocol reason code was %d (%s)\n",
+ fprintf(stderr, "protocol reason code was %d (%s)\n",
res->hdr.reason, reason_code_to_string(res->hdr.reason));
printf("state = {\n");
printf("}\n");
VDisconnectSALV();
+
+ return 0;
}
static char *
}
}
+#if 0
static char *
program_type_to_string(afs_int32 type)
{
return "**UNKNOWN**";
}
}
+#endif
static char *
state_code_to_string(afs_int32 state)