/*
* 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/stds.h>
+#include <roken.h>
-#include <afs/stds.h>
-#include <sys/types.h>
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
#ifdef AFS_NT40_ENV
-#include <winsock2.h>
#include <WINNT/afsevent.h>
#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#include <stdio.h>
-#include <string.h>
#include <ctype.h>
#include <afs/afsutil.h>
#include <afs/cmd.h>
#include <lock.h>
#include <ubik.h>
+
#include "vlserver.h"
void fill_listattributes_entry(struct VldbListByAttributes *, char **, int);
struct Vlent *
GetVolume(int vol, struct vldbentry *entry)
{
- register int i;
- register struct Vlent *vl;
+ int i;
+ struct Vlent *vl;
if (!vol)
return NULL;
vl_Initialize(int auth, char *confDir, int server, char *cellp)
{
return ugen_ClientInit(auth?0:1, confDir, cellp, 0,
- &cstruct, NULL, "vl_Initialize", rxkad_clear,
+ &cstruct, NULL, "vl_Initialize", rxkad_clear,
MAXSERVERS, AFSCONF_VLDBSERVICE, 50, server,
htons(AFSCONF_VLDBPORT), USER_SERVICE_ID);
}
afs_int32
GetServer(char *aname)
{
- register struct hostent *th;
+ struct hostent *th;
afs_uint32 addr;
int b1, b2, b3, b4;
- register afs_int32 code;
+ afs_int32 code;
code = sscanf(aname, "%d.%d.%d.%d", &b1, &b2, &b3, &b4);
if (code == 4) {
static int
handleit(struct cmd_syndesc *as, void *arock)
{
- register struct cmd_item *ti;
- register afs_int32 code, server = 0, sawserver = 0;
+ struct cmd_item *ti;
+ afs_int32 code, server = 0, sawserver = 0;
afs_int32 id, voltype;
struct vldbentry entry;
char *cellp = 0;
exit(0);
} else {
char *oper, *vname;
- register char **argp = args;
+ char **argp = args;
+
GetArgs(line, argp, &nargs);
oper = &argp[0][0];
++argp, --nargs;
- if (!strcmp(oper, "cr")) {
+ if (!*line) {
+ } else if (!strcmp(oper, "cr")) {
fill_entry(&entry, argp, nargs);
display_entry(&entry, 0);
code = ubik_VL_CreateEntry(cstruct, 0, &entry);
("Volumes not found in main hash tables in vldb will be fixed...\n");
memset(&updateentry, 0, sizeof(updateentry));
for (index = 0; 1; index = next_index) {
- /* FIXME: n2 is never changed for some reason */
- int n1 = 0, n2 = 0, n3 = 0, n4 = 0;
memset(&entry, 0, sizeof(entry));
code =
ubik_VL_ListEntry(cstruct, 0, index, &count,
&tentry);
if (code == VL_NOENT) {
num1++;
- n1 = 1;
updateentry.Mask = VLUPDATE_VOLNAMEHASH;
printf("\tVolume %s %d (not in namehash)\n",
entry.name, entry.volumeId[RWVOL]);
}
x++;
}
- if (entry.volumeId[BACKVOL] && !n2) {
+ if (entry.volumeId[BACKVOL]) {
code =
ubik_VL_GetEntryByID(cstruct, 0,
entry.volumeId[BACKVOL], BACKVOL,
&tentry);
if (code == VL_NOENT) {
- n3 = 1;
num1++;
updateentry.Mask = VLUPDATE_BACKUPID;
updateentry.BackupId = entry.volumeId[BACKVOL];
}
}
}
- if (entry.volumeId[ROVOL && !n2]) {
+ if (entry.volumeId[ROVOL]) {
code =
ubik_VL_GetEntryByID(cstruct, 0,
entry.volumeId[ROVOL], ROVOL, &tentry);
if (code == VL_NOENT) {
- n4 = 1;
num1++;
updateentry.Mask = VLUPDATE_READONLYID;
updateentry.ReadOnlyId = entry.volumeId[ROVOL];
printf("VL_ChangeAddr returned code = %d\n", code);
continue;
}
- } else if ((!strcmp(oper, "?")) || !strcmp(oper, "h"))
+ } else if ((!strcmp(oper, "?")) || !strcmp(oper, "h") || !strcmp(oper, "help"))
print_usage();
else if ((!strcmp(oper, "q")) || !strcmp(oper, "quit"))
exit(0);
else {
- printf("Unknown oper!\n");
+ printf("Unknown oper (%s)!\n", oper);
+ print_usage();
}
}
}
int
main(int argc, char **argv)
{
- register struct cmd_syndesc *ts;
+ struct cmd_syndesc *ts;
afs_int32 code;
strcpy(confdir, AFSDIR_CLIENT_ETC_DIRPATH);
{
*nargs = 0;
while (*line) {
- register char *last = line;
+ char *last = line;
while (isspace(*line))
line++;
if (isspace(*last))