vos-noresolve-option-20080410
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 10 Apr 2008 18:50:49 +0000 (18:50 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 10 Apr 2008 18:50:49 +0000 (18:50 +0000)
LICENSE MIT

Add a -noresolve option to all vos commands.  This permits the display
of servers by IP address instead of DNS name.  Very useful when 127.0.0.1
is registered as the server address or when trying to eliminate
multi-homed addresses.

src/volser/NTMakefile
src/volser/lockprocs.c
src/volser/lockprocs_prototypes.h [new file with mode: 0644]
src/volser/volser_prototypes.h
src/volser/vos.c
src/volser/vsprocs.c
src/volser/vsutils.c
src/volser/vsutils_prototypes.h [new file with mode: 0644]

index 7987e7a..632074c 100644 (file)
@@ -18,6 +18,8 @@ INCFILEDIR = $(DESTDIR)\include\afs  # header file install directory
 
 INCFILES = \
        $(INCFILEDIR)\volser_prototypes.h \
+       $(INCFILEDIR)\vsutils_prototypes.h \
+       $(INCFILEDIR)\lockprocs_prototypes.h \
        $(INCFILEDIR)\volser.h \
        $(INCFILEDIR)\volint.h
 
index 9b1d96c..1c28756 100644 (file)
@@ -37,15 +37,16 @@ RCSID
 #include "volser.h"
 #include "lockdata.h"
 
+#include <vsutils_prototypes.h>
+#include <lockprocs_prototypes.h>
+
 /* Finds an index in VLDB entry that matches the volume type, server, and partition.
  * If type is zero, will match first index of ANY type (RW, BK, or RO).
  * If server is zero, will match first index of ANY server and partition 
  * Zero is a valid partition field.
  */
 int
-FindIndex(entry, server, part, type)
-     struct nvldbentry *entry;
-     afs_int32 server, part, type;
+FindIndex(struct nvldbentry *entry, afs_int32 server, afs_int32 part, afs_int32 type)
 {
     int e;
     afs_int32 error = 0;
@@ -77,9 +78,8 @@ FindIndex(entry, server, part, type)
 
 /* Changes the rw site only */
 void
-SetAValue(entry, oserver, opart, nserver, npart, type)
-     struct nvldbentry *entry;
-     afs_int32 oserver, opart, nserver, npart, type;
+SetAValue(struct nvldbentry *entry, afs_int32 oserver, afs_int32 opart,
+          afs_int32 nserver, afs_int32 npart, afs_int32 type)
 {
     int e;
     afs_int32 error = 0;
@@ -103,26 +103,24 @@ SetAValue(entry, oserver, opart, nserver, npart, type)
 
 /* Changes the RW site only */
 void
-Lp_SetRWValue(entry, oserver, opart, nserver, npart)
-     struct nvldbentry *entry;
-     afs_int32 oserver, opart, nserver, npart;
+Lp_SetRWValue(struct nvldbentry *entry, afs_int32 oserver, afs_int32 opart, 
+              afs_int32 nserver, afs_int32 npart)
 {
     SetAValue(entry, oserver, opart, nserver, npart, ITSRWVOL);
 }
 
 /* Changes the RO site only */
 void
-Lp_SetROValue(entry, oserver, opart, nserver, npart)
-     struct nvldbentry *entry;
-     afs_int32 oserver, opart, nserver, npart;
+Lp_SetROValue(struct nvldbentry *entry, afs_int32 oserver, 
+              afs_int32 opart, afs_int32 nserver, afs_int32 npart)
 {
     SetAValue(entry, oserver, opart, nserver, npart, ITSROVOL);
 }
 
 /* Returns success if this server and partition matches the RW entry */
-Lp_Match(server, part, entry)
-     afs_int32 server, part;
-     struct nvldbentry *entry;
+int 
+Lp_Match(afs_int32 server, afs_int32 part,
+         struct nvldbentry *entry)
 {
     if (FindIndex(entry, server, part, ITSRWVOL) == -1)
        return 0;
@@ -130,24 +128,22 @@ Lp_Match(server, part, entry)
 }
 
 /* Return the index of the RO entry (plus 1) if it exists, else return 0 */
-Lp_ROMatch(server, part, entry)
-     afs_int32 server, part;
-     struct nvldbentry *entry;
+int 
+Lp_ROMatch(afs_int32 server, afs_int32 part, struct nvldbentry *entry)
 {
     return (FindIndex(entry, server, part, ITSROVOL) + 1);
 }
 
 /* Return the index of the RW entry if it exists, else return -1 */
-Lp_GetRwIndex(entry)
-     struct nvldbentry *entry;
+int 
+Lp_GetRwIndex(struct nvldbentry *entry)
 {
     return (FindIndex(entry, 0, 0, ITSRWVOL));
 }
 
 /*initialize queue pointed by <ahead>*/
 void
-Lp_QInit(ahead)
-     struct qHead *ahead;
+Lp_QInit(struct qHead *ahead)
 {
     ahead->count = 0;
     ahead->next = NULL;
@@ -155,9 +151,7 @@ Lp_QInit(ahead)
 
 /*add <elem> in front of queue <ahead> */
 void
-Lp_QAdd(ahead, elem)
-     struct qHead *ahead;
-     struct aqueue *elem;
+Lp_QAdd(struct qHead *ahead, struct aqueue *elem)
 {
     struct aqueue *temp;
 
@@ -173,11 +167,8 @@ Lp_QAdd(ahead, elem)
     }
 }
 
-Lp_QScan(ahead, id, success, elem)
-     struct qHead *ahead;
-     struct aqueue **elem;
-     afs_int32 id;
-     int *success;
+int 
+Lp_QScan(struct qHead *ahead, afs_int32 id, int *success, struct aqueue **elem)
 {
     struct aqueue *cptr;
 
@@ -197,10 +188,7 @@ Lp_QScan(ahead, id, success, elem)
 /*return the element in the beginning of the queue <ahead>, free
 *the space used by that element . <success> indicates if enumeration was ok*/
 void
-Lp_QEnumerate(ahead, success, elem)
-     struct qHead *ahead;
-     struct aqueue *elem;
-     int *success;
+Lp_QEnumerate(struct qHead *ahead, int *success, struct aqueue *elem)
 {
     int i;
     struct aqueue *temp;
@@ -223,8 +211,7 @@ Lp_QEnumerate(ahead, success, elem)
 }
 
 void
-Lp_QTraverse(ahead)
-     struct qHead *ahead;
+Lp_QTraverse(struct qHead *ahead)
 {
     int count;
     struct aqueue *old, *new;
diff --git a/src/volser/lockprocs_prototypes.h b/src/volser/lockprocs_prototypes.h
new file mode 100644 (file)
index 0000000..f3de763
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef        _LOCKPROCS_PROTOTYPES_H
+#define _LOCKPROCS_PROTOTYPES_H
+extern int FindIndex(struct nvldbentry *entry, afs_int32 server, afs_int32 part, afs_int32 type);
+extern void SetAValue(struct nvldbentry *entry, afs_int32 oserver, afs_int32 opart,
+          afs_int32 nserver, afs_int32 npart, afs_int32 type);
+extern void Lp_SetRWValue(struct nvldbentry *entry, afs_int32 oserver, afs_int32 opart, 
+              afs_int32 nserver, afs_int32 npart);
+extern void Lp_SetROValue(struct nvldbentry *entry, afs_int32 oserver, 
+              afs_int32 opart, afs_int32 nserver, afs_int32 npart);
+extern int Lp_Match(afs_int32 server, afs_int32 part, struct nvldbentry *entry);
+extern int Lp_ROMatch(afs_int32 server, afs_int32 part, struct nvldbentry *entry);
+extern int Lp_GetRwIndex(struct nvldbentry *entry);
+extern void Lp_QInit(struct qHead *ahead);
+extern void Lp_QAdd(struct qHead *ahead, struct aqueue *elem);
+extern int Lp_QScan(struct qHead *ahead, afs_int32 id, int *success, struct aqueue **elem);
+extern void Lp_QEnumerate(struct qHead *ahead, int *success, struct aqueue *elem);
+extern void Lp_QTraverse(struct qHead *ahead);
+#endif
\ No newline at end of file
index f2f0d2f..50fbe0f 100644 (file)
@@ -40,6 +40,9 @@ extern void sigint_handler(int x);
 extern int UV_MoveVolume(afs_int32 afromvol, afs_int32 afromserver,
                         afs_int32 afrompart, afs_int32 atoserver,
                         afs_int32 atopart);
+extern int UV_MoveVolume2(afs_int32 afromvol, afs_int32 afromserver, 
+                          afs_int32 afrompart, afs_int32 atoserver, 
+                          afs_int32 atopart, int flags);
 extern int UV_BackupVolume(afs_int32 aserver, afs_int32 apart,
                           afs_int32 avolid);
 extern int UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver,
@@ -49,8 +52,11 @@ extern int UV_DumpVolume(afs_int32 afromvol, afs_int32 afromserver,
                         afs_int32 afrompart, afs_int32 fromdate,
                         afs_int32(*DumpFunction) (), char *rock, afs_int32 flags);
 extern int UV_RestoreVolume(afs_int32 toserver, afs_int32 topart,
-                           afs_int32 tovolid, char tovolname[], int flags,
+                           afs_int32 tovolid, char tovolname[], int restoreflags,
                            afs_int32(*WriteData) (), char *rock);
+extern int UV_RestoreVolume2(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid,
+                            afs_int32 toparentid, char tovolname[], int flags,
+                            afs_int32(*WriteData) (), char *rock);
 extern int UV_LockRelease(afs_int32 volid);
 extern int UV_AddSite(afs_int32 server, afs_int32 part, afs_int32 volid, afs_int32 valid);
 extern int UV_RemoveSite(afs_int32 server, afs_int32 part, afs_int32 volid);
@@ -99,5 +105,20 @@ extern int UV_SetVolumeInfo(afs_int32 server, afs_int32 partition,
                            afs_int32 volid, volintInfo * infop);
 extern void MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new);
 extern void MapHostToNetwork(struct nvldbentry *entry);
+extern int UV_CopyVolume2(afs_int32 afromvol, afs_int32 afromserver, 
+                          afs_int32 afrompart, char *atovolname, 
+                          afs_int32 atoserver, afs_int32 atopart,
+                          afs_int32 atovolid, int flags);
+extern int UV_CloneVolume(afs_int32 aserver, afs_int32 apart, afs_int32 avolid,
+                          afs_int32 acloneid, char *aname, int flags);
+extern int UV_DumpClonedVolume(afs_int32 afromvol, afs_int32 afromserver,
+                               afs_int32 afrompart, afs_int32 fromdate,
+                               afs_int32(*DumpFunction) (), char *rock, 
+                               afs_int32 flags);
+extern int UV_GetSize(afs_int32 afromvol, afs_int32 afromserver, 
+                      afs_int32 afrompart, afs_int32 fromdate, 
+                      struct volintSize *vol_size);
 
+extern int verbose;
+extern int noresolve;
 #endif
index 309e7a5..0523fa8 100644 (file)
@@ -57,12 +57,19 @@ RCSID
 #ifdef AFS_AIX32_ENV
 #include <signal.h>
 #endif
-#include "volser_prototypes.h"
+#include <volser_prototypes.h>
+#include <vsutils_prototypes.h>
+#include <lockprocs_prototypes.h>
 
 #ifdef HAVE_POSIX_REGEX
 #include <regex.h>
 #endif
 
+/* Local Prototypes */
+int PrintDiagnostics(char *astring, afs_int32 acode);
+int GetVolumeInfo(afs_int32 volid, afs_int32 *server, afs_int32 *part, 
+                  afs_int32 *voltype, struct nvldbentry *rentry);
+
 struct tqElem {
     afs_int32 volid;
     struct tqElem *next;
@@ -79,10 +86,10 @@ cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL, "don't authenticate");\
 cmd_AddParm(ts, "-localauth",CMD_FLAG,CMD_OPTIONAL,"use server tickets");\
 cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");\
 cmd_AddParm(ts, "-encrypt", CMD_FLAG, CMD_OPTIONAL, "encrypt commands");\
+cmd_AddParm(ts, "-noresolve", CMD_FLAG, CMD_OPTIONAL, "don't resolve addresses"); \
 
 #define ERROR_EXIT(code) {error=(code); goto error_exit;}
 
-extern int verbose;
 int rxInitDone = 0;
 struct rx_connection *tconn;
 afs_int32 tserver;
@@ -342,7 +349,7 @@ WriteData(struct rx_call *call, char *rock)
        USD_SEEK(ufd, filesize, SEEK_END, &currOffset);
        hset64(filesize, hgethi(currOffset), hgetlo(currOffset)-sizeof(afs_uint32));
        USD_SEEK(ufd, filesize, SEEK_SET, &currOffset);
-       USD_READ(ufd, &buffer, sizeof(afs_uint32), &got);
+       USD_READ(ufd, (char *)&buffer, sizeof(afs_uint32), &got);
        if ((got != sizeof(afs_uint32)) || (ntohl(buffer) != DUMPENDMAGIC)) {
            fprintf(STDERR, "Signature missing from end of file '%s'\n", filename);
            error = VOLSERBADOP;
@@ -1390,8 +1397,7 @@ GetServerAndPart(entry, voltype, server, part, previdx)
 }
 
 static void
-PostVolumeStats(entry)
-     struct nvldbentry *entry;
+PostVolumeStats(struct nvldbentry *entry)
 {
     SubEnumerateEntry(entry);
     /* Check for VLOP_ALLOPERS */
@@ -2381,7 +2387,6 @@ ShadowVolume(register struct cmd_syndesc *as, void *arock)
     afs_int32 volid, fromserver, toserver, frompart, topart, tovolid;
     afs_int32 code, err, flags;
     char fromPartName[10], toPartName[10], toVolName[32], *tovolume;
-    struct nvldbentry entry;
     struct diskPartition64 partition;  /* for space check */
     volintInfo *p, *q;
 
@@ -4085,9 +4090,9 @@ RenameVolume(register struct cmd_syndesc *as, void *arock)
     return 0;
 }
 
-GetVolumeInfo(volid, server, part, voltype, rentry)
-     afs_int32 *server, volid, *part, *voltype;
-     register struct nvldbentry *rentry;
+int
+GetVolumeInfo(afs_int32 volid, afs_int32 *server, afs_int32 *part, afs_int32 *voltype, 
+              struct nvldbentry *rentry)
 {
     afs_int32 vcode;
     int i, index = -1;
@@ -5006,7 +5011,7 @@ PartitionInfo(register struct cmd_syndesc *as, void *arock)
     struct partList dummyPartList;
     int i, cnt;
     int printSummary=0, sumPartitions=0;
-    afs_uint64 sumFree, sumStorage, tmp;
+    afs_uint64 sumFree, sumStorage;
 
     ZeroInt64(sumFree);
     ZeroInt64(sumStorage);
@@ -5142,7 +5147,7 @@ ChangeAddr(register struct cmd_syndesc *as, void *arock)
 
 static void
 print_addrs(const bulkaddrs * addrs, const afsUUID * m_uuid, int nentries,
-           int print, int noresolve)
+           int print)
 {
     afs_int32 vcode;
     afs_int32 i, j;
@@ -5180,7 +5185,7 @@ print_addrs(const bulkaddrs * addrs, const afsUUID * m_uuid, int nentries,
                m_addrs.bulkaddrs_len = 0;
                vcode =
                    ubik_VL_GetAddrsU(cstruct, 0, &m_attrs, &m_uuid,
-                                     &vlcb, &m_nentries, &m_addrs);
+                                     (afs_int32 *)&vlcb, &m_nentries, &m_addrs);
                if (vcode) {
                    fprintf(STDERR,
                            "vos: could not list the multi-homed server addresses\n");
@@ -5230,7 +5235,7 @@ static int
 ListAddrs(register struct cmd_syndesc *as, void *arock)
 {
     afs_int32 vcode;
-    afs_int32 i, noresolve = 0, printuuid = 0;
+    afs_int32 i, printuuid = 0;
     struct VLCallBack vlcb;
     afs_int32 nentries;
     bulkaddrs m_addrs;
@@ -5268,9 +5273,6 @@ ListAddrs(register struct cmd_syndesc *as, void *arock)
        m_attrs.ipaddr = ntohl(saddr);
     }
     if (as->parms[2].items) {
-       noresolve = 1;
-    }
-    if (as->parms[3].items) {
        printuuid = 1;
     }
 
@@ -5323,7 +5325,7 @@ ListAddrs(register struct cmd_syndesc *as, void *arock)
            return (vcode);
        }
 
-       print_addrs(&m_addrs, &m_uuid, m_nentries, printuuid, noresolve);
+       print_addrs(&m_addrs, &m_uuid, m_nentries, printuuid);
        i++;
 
        if ((as->parms[1].items) || (as->parms[0].items) || (i > nentries))
@@ -5607,9 +5609,8 @@ Sizes(register struct cmd_syndesc *as, void *arock)
     return 0;
 }
 
-PrintDiagnostics(astring, acode)
-     char *astring;
-     afs_int32 acode;
+int
+PrintDiagnostics(char *astring, afs_int32 acode)
 {
     if (acode == EACCES) {
        fprintf(STDERR,
@@ -5654,6 +5655,10 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
        verbose = 1;
     else
        verbose = 0;
+    if (as->parms[17].items)   /* -noresolve flag set */
+       noresolve = 1;
+    else
+       noresolve = 0;
     return 0;
 }
 
@@ -6011,8 +6016,6 @@ main(argc, argv)
                          "list the IP address of all file servers registered in the VLDB");
     cmd_AddParm(ts, "-uuid", CMD_SINGLE, CMD_OPTIONAL, "uuid of server");
     cmd_AddParm(ts, "-host", CMD_SINGLE, CMD_OPTIONAL, "address of host");
-    cmd_AddParm(ts, "-noresolve", CMD_FLAG, CMD_OPTIONAL,
-               "don't resolve addresses");
     cmd_AddParm(ts, "-printuuid", CMD_FLAG, CMD_OPTIONAL,
                "print uuid of hosts");
     COMMONPARMS;
index 1c07dd3..bc3999d 100644 (file)
@@ -56,9 +56,11 @@ RCSID
 #include <setjmp.h>
 
 #include "volser_prototypes.h"
+#include <vsutils_prototypes.h>
+#include <lockprocs_prototypes.h>
 
 struct ubik_client *cstruct;
-int verbose = 0;
+int verbose = 0, noresolve = 0;
 
 struct release {
     afs_int32 crtime;
@@ -502,6 +504,7 @@ SubEnumerateEntry(struct nvldbentry *entry)
     int i;
     char pname[10];
     int isMixed = 0;
+    char hoststr[16];
 
 #ifdef notdef
     fprintf(STDOUT, "  readWriteID %-10u ", entry->volumeId[RWVOL]);
@@ -541,7 +544,8 @@ SubEnumerateEntry(struct nvldbentry *entry)
     for (i = 0; i < entry->nServers; i++) {
        MapPartIdIntoName(entry->serverPartition[i], pname);
        fprintf(STDOUT, "       server %s partition %s ",
-               hostutil_GetNameByINet(entry->serverNumber[i]), pname);
+               noresolve ? afs_inet_ntoa_r(entry->serverNumber[i], hoststr) : 
+                hostutil_GetNameByINet(entry->serverNumber[i]), pname);
        if (entry->serverFlags[i] & ITSRWVOL)
            fprintf(STDOUT, "RW Site ");
        else
@@ -1072,6 +1076,7 @@ UV_MoveVolume2(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afrompart,
     afs_int32 error;
     char in, lf;               /* for test code */
     int same;
+    char hoststr[16];
 
 #ifdef ENABLE_BUGFIX_1165
     volEntries volumeInfo;
@@ -1148,7 +1153,8 @@ UV_MoveVolume2(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afrompart,
                    char pname[10];
                    MapPartIdIntoName(entry.serverPartition[i], pname);
                    fprintf(STDERR, " server %s partition %s \n",
-                           hostutil_GetNameByINet(entry.serverNumber[i]),
+                           noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) :
+                            hostutil_GetNameByINet(entry.serverNumber[i]),
                            pname);
                }
            }
@@ -3027,6 +3033,7 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
     afs_int32 volid;
     struct volser_status tstatus;
     int code, rcode, tcode;
+    char hoststr[16];
 
     *connPtr = (struct rx_connection *)0;
     *transPtr = 0;
@@ -3048,6 +3055,7 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
     /* If the volume does not exist, create it */
     if (!volid || code) {
        char volname[64];
+        char hoststr[16];
 
        if (volid && (code != VNOVOL)) {
            PrintError("Failed to start a transaction on the RO volume.\n",
@@ -3062,7 +3070,9 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
            fprintf(STDOUT,
                    "Creating new volume %lu on replication site %s: ",
                    (unsigned long)volid,
-                   hostutil_GetNameByINet(vldbEntryPtr->
+                    noresolve ? afs_inet_ntoa_r(vldbEntryPtr->
+                                                serverNumber[index], hoststr) :
+                    hostutil_GetNameByINet(vldbEntryPtr->
                                           serverNumber[index]));
            fflush(STDOUT);
        }
@@ -3095,7 +3105,9 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
      */
     else {
        VPRINT2("Updating existing ro volume %u on %s ...\n", volid,
-               hostutil_GetNameByINet(vldbEntryPtr->serverNumber[index]));
+                noresolve ? afs_inet_ntoa_r(vldbEntryPtr->
+                                            serverNumber[index], hoststr) : 
+                hostutil_GetNameByINet(vldbEntryPtr->serverNumber[index]));
 
        code = AFSVolGetStatus(*connPtr, *transPtr, &tstatus);
        if (code) {
@@ -3186,6 +3198,7 @@ UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver,
     } remembertime[NMAXNSERVERS];
     int releasecount = 0;
     struct volser_status volstatus;
+    char hoststr[16];
 
     memset((char *)remembertime, 0, sizeof(remembertime));
     memset((char *)&results, 0, sizeof(results));
@@ -3589,13 +3602,17 @@ UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver,
        if (verbose) {
            fprintf(STDOUT, "Starting ForwardMulti from %lu to %u on %s",
                    (unsigned long)cloneVolId, entry.volumeId[ROVOL],
-                   hostutil_GetNameByINet(entry.
+                    noresolve ? afs_inet_ntoa_r(entry.serverNumber[times[0].
+                                                vldbEntryIndex], hoststr) :
+                    hostutil_GetNameByINet(entry.
                                           serverNumber[times[0].
                                                        vldbEntryIndex]));
 
            for (s = 1; s < volcount; s++) {
                fprintf(STDOUT, " and %s",
-                       hostutil_GetNameByINet(entry.
+                        noresolve ? afs_inet_ntoa_r(entry.serverNumber[times[s].
+                                                    vldbEntryIndex], hoststr) :
+                        hostutil_GetNameByINet(entry.
                                               serverNumber[times[s].
                                                            vldbEntryIndex]));
            }
@@ -3724,7 +3741,8 @@ UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver,
            if (!(entry.serverFlags[i] & NEW_REPSITE)) {
                MapPartIdIntoName(entry.serverPartition[i], pname);
                fprintf(STDERR, "\t%35s %s\n",
-                       hostutil_GetNameByINet(entry.serverNumber[i]), pname);
+                        noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) :
+                        hostutil_GetNameByINet(entry.serverNumber[i]), pname);
            }
        }
 
@@ -3795,9 +3813,10 @@ UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver,
                fprintf(STDERR,
                        "Failed to end transaction on ro volume %u at server %s\n",
                        entry.volumeId[ROVOL],
-                       hostutil_GetNameByINet(htonl
-                                              (replicas[i].server.
-                                               destHost)));
+                        noresolve ? afs_inet_ntoa_r(htonl(replicas[i].server.
+                                                        destHost), hoststr) :
+                        hostutil_GetNameByINet(htonl
+                                              (replicas[i].server.destHost)));
                if (!error)
                    error = code;
            }
@@ -4104,7 +4123,7 @@ UV_RestoreVolume2(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid,
     afs_int32 oldCreateDate, oldUpdateDate, newCreateDate, newUpdateDate;
     int index, same, errcode;
     char apartName[10];
-
+    char hoststr[16];
 
     memset(&cookie, 0, sizeof(cookie));
     islocked = 0;
@@ -4181,6 +4200,7 @@ UV_RestoreVolume2(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid,
     MapPartIdIntoName(topart, partName);
     fprintf(STDOUT, "Restoring volume %s Id %lu on server %s partition %s ..",
            tovolreal, (unsigned long)pvolid,
+            noresolve ? afs_inet_ntoa_r(toserver, hoststr) :
            hostutil_GetNameByINet(toserver), partName);
     fflush(STDOUT);
     code =
@@ -4432,6 +4452,7 @@ UV_RestoreVolume2(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid,
                        VPRINT2
                            ("Not deleting the previous volume %u on server %s, ...",
                             pvolid,
+                             noresolve ? afs_inet_ntoa_r(entry.serverNumber[index], hoststr) :
                             hostutil_GetNameByINet(entry.serverNumber[index]));
                    } else {
                        tempconn =
@@ -4443,6 +4464,7 @@ UV_RestoreVolume2(afs_int32 toserver, afs_int32 topart, afs_int32 tovolid,
                        VPRINT3
                            ("Deleting the previous volume %u on server %s, partition %s ...",
                             pvolid,
+                             noresolve ? afs_inet_ntoa_r(entry.serverNumber[index], hoststr) :
                             hostutil_GetNameByINet(entry.serverNumber[index]),
                             apartName);
                        code =
@@ -5286,6 +5308,7 @@ CheckVolume(volintInfo * volumeinfo, afs_int32 aserver, afs_int32 apart,
     char pname[10];
     int pass = 0, islocked = 0, createentry, addvolume, modified, mod, doit = 1;
     afs_int32 rwvolid;
+    char hoststr[16]; 
 
     if (modentry) {
        if (*modentry == 1)
@@ -5374,12 +5397,16 @@ CheckVolume(volintInfo * volumeinfo, afs_int32 aserver, afs_int32 apart,
                            fprintf(STDERR,
                                    "*** Warning: Orphaned RW volume %lu exists on %s %s\n",
                                    (unsigned long)rwvolid,
+                                    noresolve ?
+                                    afs_inet_ntoa_r(aserver, hoststr) :
                                    hostutil_GetNameByINet(aserver), pname);
                            MapPartIdIntoName(entry.serverPartition[idx],
                                              pname);
                            fprintf(STDERR,
                                    "    VLDB reports RW volume %lu exists on %s %s\n",
                                    (unsigned long)rwvolid,
+                                    noresolve ? 
+                                    afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
                                    hostutil_GetNameByINet(entry.
                                                           serverNumber[idx]),
                                    pname);
@@ -5396,6 +5423,8 @@ CheckVolume(volintInfo * volumeinfo, afs_int32 aserver, afs_int32 apart,
                                fprintf(STDERR,
                                        "*** Warning: Orphaned BK volume %u exists on %s %s\n",
                                        entry.volumeId[BACKVOL],
+                                        noresolve ?
+                                        afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
                                        hostutil_GetNameByINet(entry.
                                                               serverNumber
                                                               [idx]), pname);
@@ -5403,6 +5432,8 @@ CheckVolume(volintInfo * volumeinfo, afs_int32 aserver, afs_int32 apart,
                                fprintf(STDERR,
                                        "    VLDB reports its RW volume %lu exists on %s %s\n",
                                        (unsigned long)rwvolid,
+                                        noresolve ? 
+                                        afs_inet_ntoa_r(aserver, hoststr) :
                                        hostutil_GetNameByINet(aserver),
                                        pname);
                            }
@@ -5473,11 +5504,15 @@ CheckVolume(volintInfo * volumeinfo, afs_int32 aserver, afs_int32 apart,
                        fprintf(STDERR,
                                "*** Warning: Orphaned BK volume %lu exists on %s %s\n",
                                (unsigned long)volumeinfo->volid,
+                                noresolve ?
+                                afs_inet_ntoa_r(aserver, hoststr) :
                                hostutil_GetNameByINet(aserver), pname);
                        MapPartIdIntoName(entry.serverPartition[idx], pname);
                        fprintf(STDERR,
                                "    VLDB reports its RW/BK volume %lu exists on %s %s\n",
                                (unsigned long)rwvolid,
+                                noresolve ?
+                                afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
                                hostutil_GetNameByINet(entry.
                                                       serverNumber[idx]),
                                pname);
@@ -5496,6 +5531,8 @@ CheckVolume(volintInfo * volumeinfo, afs_int32 aserver, afs_int32 apart,
                                fprintf(STDERR,
                                        "*** Warning: Orphaned BK volume %u exists on %s %s\n",
                                        entry.volumeId[BACKVOL],
+                                        noresolve ?
+                                        afs_inet_ntoa_r(aserver, hoststr) :
                                        hostutil_GetNameByINet(aserver),
                                        pname);
                                fprintf(STDERR,
@@ -5508,8 +5545,10 @@ CheckVolume(volintInfo * volumeinfo, afs_int32 aserver, afs_int32 apart,
                                                  pname);
                                fprintf(STDERR,
                                        "*** Warning: Orphaned BK volume %lu exists on %s %s\n",
-                                       (unsigned long)volumeinfo->volid,
-                                       hostutil_GetNameByINet(aserver),
+                                        (unsigned long)volumeinfo->volid,
+                                        noresolve ?
+                                        afs_inet_ntoa_r(aserver, hoststr) :
+                                        hostutil_GetNameByINet(aserver),
                                        pname);
                                fprintf(STDERR,
                                        "    VLDB reports its BK volume ID is %u\n",
@@ -5579,7 +5618,9 @@ CheckVolume(volintInfo * volumeinfo, afs_int32 aserver, afs_int32 apart,
                            fprintf(STDERR,
                                    "*** Warning: Orphaned RO volume %u exists on %s %s\n",
                                    entry.volumeId[ROVOL],
-                                   hostutil_GetNameByINet(entry.
+                                    noresolve ?
+                                    afs_inet_ntoa_r(entry.serverNumber[j], hoststr) :
+                                    hostutil_GetNameByINet(entry.
                                                           serverNumber[j]),
                                    pname);
                            fprintf(STDERR,
@@ -5606,8 +5647,10 @@ CheckVolume(volintInfo * volumeinfo, afs_int32 aserver, afs_int32 apart,
                    MapPartIdIntoName(apart, pname);
                    fprintf(STDERR,
                            "*** Warning: Orphaned RO volume %lu exists on %s %s\n",
-                           (unsigned long)volumeinfo->volid,
-                           hostutil_GetNameByINet(aserver), pname);
+                            (unsigned long)volumeinfo->volid,
+                            noresolve ?
+                            afs_inet_ntoa_r(aserver, hoststr) :
+                            hostutil_GetNameByINet(aserver), pname);
                    fprintf(STDERR,
                            "    VLDB reports its RO volume ID is %u\n",
                            entry.volumeId[ROVOL]);
@@ -5986,6 +6029,7 @@ UV_SyncVldb(afs_int32 aserver, afs_int32 apart, int flags, int force)
     afs_int32 failures = 0, modifications = 0, tentries = 0;
     afs_int32 modified;
     afs_uint32 maxvolid = 0;
+    char hoststr[16];
 
     volumeInfo.volEntries_val = (volintInfo *) 0;
     volumeInfo.volEntries_len = 0;
@@ -6037,7 +6081,9 @@ UV_SyncVldb(afs_int32 aserver, afs_int32 apart, int flags, int force)
                fprintf(STDOUT,
                        "Processing volume entry %d: %s (%lu) on server %s %s...\n",
                        j + 1, vi->name, (unsigned long)vi->volid,
-                       hostutil_GetNameByINet(aserver), pname);
+                        noresolve ?
+                        afs_inet_ntoa_r(aserver, hoststr) :
+                        hostutil_GetNameByINet(aserver), pname);
                fflush(STDOUT);
            }
 
@@ -6066,7 +6112,9 @@ UV_SyncVldb(afs_int32 aserver, afs_int32 apart, int flags, int force)
        if (pfail) {
            fprintf(STDERR,
                    "Could not process entries on server %s partition %s\n",
-                   hostutil_GetNameByINet(aserver), pname);
+                    noresolve ?
+                    afs_inet_ntoa_r(aserver, hoststr) :
+                    hostutil_GetNameByINet(aserver), pname);
        }
        if (volumeInfo.volEntries_val) {
            free(volumeInfo.volEntries_val);
@@ -6152,6 +6200,7 @@ CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
     int idx;
     afs_int32 code, error = 0;
     char pname[10];
+    char hoststr[16];
 
     if (modified)
        *modified = 0;
@@ -6186,7 +6235,9 @@ CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
                fprintf(STDERR,
                        "Transaction call failed for RW volume %u on server %s %s\n",
                        entry->volumeId[RWVOL],
-                       hostutil_GetNameByINet(entry->serverNumber[idx]),
+                        noresolve ?
+                        afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
+                        hostutil_GetNameByINet(entry->serverNumber[idx]),
                        pname);
                ERROR_EXIT(code);
            }
@@ -6223,7 +6274,9 @@ CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
                fprintf(STDERR,
                        "Transaction call failed for BK volume %u on server %s %s\n",
                        entry->volumeId[BACKVOL],
-                       hostutil_GetNameByINet(entry->serverNumber[idx]),
+                        noresolve ?
+                        afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
+                        hostutil_GetNameByINet(entry->serverNumber[idx]),
                        pname);
                ERROR_EXIT(code);
            }
@@ -6254,6 +6307,7 @@ CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified)
     int foundro = 0, modentry = 0;
     afs_int32 code, error = 0;
     char pname[10];
+    char hoststr[16];
 
     if (modified)
        *modified = 0;
@@ -6282,7 +6336,9 @@ CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified)
            fprintf(STDERR,
                    "Transaction call failed for RO %u on server %s %s\n",
                    entry->volumeId[ROVOL],
-                   hostutil_GetNameByINet(entry->serverNumber[idx]), pname);
+                    noresolve ?
+                    afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
+                    hostutil_GetNameByINet(entry->serverNumber[idx]), pname);
            ERROR_EXIT(code);
        }
     }
@@ -6566,6 +6622,7 @@ UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
     afs_int32 tid;
     struct rx_connection *aconn;
     int islocked;
+    char hoststr[16];
 
     error = 0;
     aconn = (struct rx_connection *)0;
@@ -6730,7 +6787,9 @@ UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
                    if (!code) {
                        VPRINT2("Renamed RO volume %s on host %s\n",
                                nameBuffer,
-                               hostutil_GetNameByINet(entry->
+                                noresolve ?
+                                afs_inet_ntoa_r(entry->serverNumber[i], hoststr) :
+                                hostutil_GetNameByINet(entry->
                                                       serverNumber[i]));
                        code = AFSVolEndTrans(aconn, tid, &rcode);
                        tid = 0;
index e74b9e3..fa33b3a 100644 (file)
@@ -46,13 +46,14 @@ RCSID
 #include "volint.h"
 #include "lockdata.h"
 
+#include <vsutils_prototypes.h>
+
 struct ubik_client *cstruct;
 static rxkad_level vsu_rxkad_level = rxkad_clear;
 
 static void
-ovlentry_to_nvlentry(oentryp, nentryp)
-     struct vldbentry *oentryp;
-     struct nvldbentry *nentryp;
+ovlentry_to_nvlentry(struct vldbentry *oentryp,
+                     struct nvldbentry *nentryp)
 {
     register int i;
 
@@ -70,10 +71,9 @@ ovlentry_to_nvlentry(oentryp, nentryp)
     nentryp->flags = oentryp->flags;
 }
 
-static
-nvlentry_to_ovlentry(nentryp, oentryp)
-     struct nvldbentry *nentryp;
-     struct vldbentry *oentryp;
+static int
+nvlentry_to_ovlentry(struct nvldbentry *nentryp,
+                     struct vldbentry *oentryp)
 {
     register int i;
 
@@ -101,8 +101,8 @@ nvlentry_to_ovlentry(nentryp, oentryp)
 
 static int newvlserver = 0;
 
-VLDB_CreateEntry(entryp)
-     struct nvldbentry *entryp;
+int
+VLDB_CreateEntry(struct nvldbentry *entryp)
 {
     struct vldbentry oentry;
     register int code;
@@ -127,9 +127,8 @@ VLDB_CreateEntry(entryp)
     return code;
 }
 
-VLDB_GetEntryByID(volid, voltype, entryp)
-     afs_int32 volid, voltype;
-     struct nvldbentry *entryp;
+int
+VLDB_GetEntryByID(afs_int32 volid, afs_int32 voltype, struct nvldbentry *entryp)
 {
     struct vldbentry oentry;
     register int code;
@@ -154,9 +153,8 @@ VLDB_GetEntryByID(volid, voltype, entryp)
     return code;
 }
 
-VLDB_GetEntryByName(namep, entryp)
-     char *namep;
-     struct nvldbentry *entryp;
+int
+VLDB_GetEntryByName(char *namep, struct nvldbentry *entryp)
 {
     struct vldbentry oentry;
     register int code;
@@ -180,9 +178,8 @@ VLDB_GetEntryByName(namep, entryp)
     return code;
 }
 
-VLDB_ReplaceEntry(volid, voltype, entryp, releasetype)
-     afs_int32 volid, voltype, releasetype;
-     struct nvldbentry *entryp;
+int 
+VLDB_ReplaceEntry(afs_int32 volid, afs_int32 voltype, struct nvldbentry *entryp, afs_int32 releasetype)
 {
     struct vldbentry oentry;
     register int code;
@@ -212,11 +209,10 @@ VLDB_ReplaceEntry(volid, voltype, entryp, releasetype)
 }
 
 
-
-VLDB_ListAttributes(attrp, entriesp, blkentriesp)
-     VldbListByAttributes *attrp;
-     afs_int32 *entriesp;
-     nbulkentries *blkentriesp;
+int
+VLDB_ListAttributes(VldbListByAttributes *attrp,
+                    afs_int32 *entriesp,
+                    nbulkentries *blkentriesp)
 {
     bulkentries arrayEntries;
     register int code, i;
@@ -253,14 +249,13 @@ VLDB_ListAttributes(attrp, entriesp, blkentriesp)
     return code;
 }
 
-VLDB_ListAttributesN2(attrp, name, thisindex, nentriesp, blkentriesp,
-                     nextindexp)
-     VldbListByAttributes *attrp;
-     char *name;
-     afs_int32 thisindex;
-     afs_int32 *nentriesp;
-     nbulkentries *blkentriesp;
-     afs_int32 *nextindexp;
+int
+VLDB_ListAttributesN2(VldbListByAttributes *attrp,
+                      char *name,
+                      afs_int32 thisindex,
+                      afs_int32 *nentriesp,
+                      nbulkentries *blkentriesp,
+                      afs_int32 *nextindexp)
 {
     afs_int32 code;
 
@@ -286,8 +281,8 @@ struct cacheips {
 struct cacheips cacheips[GETADDRUCACHESIZE];
 int cacheip_index = 0;
 
-VLDB_IsSameAddrs(serv1, serv2, errorp)
-     afs_int32 serv1, serv2, *errorp;
+int
+VLDB_IsSameAddrs(afs_int32 serv1, afs_int32 serv2, afs_int32 *errorp)
 {
     register int code;
     ListAddrByAttributes attrs;
@@ -376,8 +371,7 @@ VLDB_IsSameAddrs(serv1, serv2, errorp)
   to get a rxkad_clear connection, simply don't call this.
 */
 void
-vsu_SetCrypt(cryptflag)
-     int cryptflag;
+vsu_SetCrypt(int cryptflag)
 {
     if (cryptflag) {
        vsu_rxkad_level = rxkad_crypt;
@@ -391,13 +385,8 @@ vsu_SetCrypt(cryptflag)
   Get the appropriate type of ubik client structure out from the system.
 */
 afs_int32
-vsu_ClientInit(noAuthFlag, confDir, cellName, sauth, uclientp, secproc)
-     int noAuthFlag;
-     int (*secproc) ();
-     char *cellName;
-     struct ubik_client **uclientp;
-     char *confDir;
-     afs_int32 sauth;
+vsu_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth,
+               struct ubik_client **uclientp, int (*secproc)())
 {
     return ugen_ClientInit(noAuthFlag, confDir, cellName, sauth, uclientp, 
                           secproc, "vsu_ClientInit", vsu_rxkad_level,
@@ -410,8 +399,7 @@ vsu_ClientInit(noAuthFlag, confDir, cellName, sauth, uclientp, secproc)
  * and return the result as <rname>.
  */
 int
-vsu_ExtractName(rname, name)
-     char rname[], name[];
+vsu_ExtractName(char rname[], char name[])
 {
     char sname[VOLSER_OLDMAXVOLNAME + 1];
     int total;
@@ -439,12 +427,8 @@ vsu_ExtractName(rname, name)
 
 /* returns 0 if failed */
 afs_uint32
-vsu_GetVolumeID(astring, acstruct, errp)
-     struct ubik_client *acstruct;
-     afs_int32 *errp;
-     char *astring;
+vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp)
 {
-    afs_uint32 value;
     char volname[VOLSER_OLDMAXVOLNAME + 1];
     struct nvldbentry entry;
     afs_int32 vcode = 0;
diff --git a/src/volser/vsutils_prototypes.h b/src/volser/vsutils_prototypes.h
new file mode 100644 (file)
index 0000000..6594a3e
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef        _VSUTILS_PROTOTYPES_H
+#define _VSUTILS_PROTOTYPES_H
+/* vsutils.c */
+extern int VLDB_CreateEntry(struct nvldbentry *entryp);
+extern int VLDB_GetEntryByID(afs_int32 volid, afs_int32 voltype, struct nvldbentry *entryp);
+extern int VLDB_GetEntryByName(char *namep, struct nvldbentry *entryp);
+extern int VLDB_ReplaceEntry(afs_int32 volid, afs_int32 voltype, struct nvldbentry *entryp, afs_int32 releasetype);
+extern int VLDB_ListAttributes(VldbListByAttributes *attrp, afs_int32 *entriesp, nbulkentries *blkentriesp);
+extern int VLDB_ListAttributesN2(VldbListByAttributes *attrp, char *name, afs_int32 thisindex,
+           afs_int32 *nentriesp, nbulkentries *blkentriesp, afs_int32 *nextindexp);
+extern int VLDB_IsSameAddrs(afs_int32 serv1, afs_int32 serv2, afs_int32 *errorp);
+extern void vsu_SetCrypt(int cryptflag);
+extern afs_int32 vsu_ClientInit(int noAuthFlag, char *confDir, char *cellName, afs_int32 sauth,
+               struct ubik_client **uclientp, int (*secproc)());
+extern int vsu_ExtractName(char rname[], char name[]);
+extern afs_uint32 vsu_GetVolumeID(char *astring, struct ubik_client *acstruct, afs_int32 *errp);
+#endif