From fc7931f4f23a7f2d368716abb6a194be559f9d0d Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 23 Nov 2003 04:52:52 +0000 Subject: [PATCH] joe-beuhler-patches-20031122 Joe Beuhler's many patches merged into the tree --- src/WINNT/afsd/NTMakefile | 5 +- src/WINNT/afsd/afsd.c | 4 +- src/WINNT/afsd/afsd_init.c | 4 +- src/WINNT/afsd/cm_config.c | 37 +- src/WINNT/afsd/cm_conn.c | 2 +- src/WINNT/afsd/cm_dns.c | 7 +- src/WINNT/afsd/cm_freelance.c | 11 +- src/WINNT/afsd/cm_ioctl.c | 18 +- src/WINNT/afsd/smb.c | 10 +- src/WINNT/afsd/smb.h | 12 +- src/WINNT/afsd/smb3.c | 2 +- src/WINNT/client_exp/afs_shl_ext.cpp | 5 +- src/WINNT/client_osi/osilog.c | 3 +- src/WINNT/pthread/test/native.cpp | 800 +++++++++++++-------------- src/auth/cellconfig.c | 4 +- src/bozo/bos.c | 2 +- src/bozo/bosoprocs.c | 2 +- src/bucoord/bc_status.c | 2 + src/bucoord/commands.c | 22 +- src/bucoord/config.c | 1 - src/bucoord/dlq.c | 1 + src/bucoord/dsvs.c | 4 +- src/bucoord/dump.c | 4 - src/bucoord/dump_sched.c | 3 +- src/bucoord/main.c | 8 +- src/bucoord/status.c | 2 + src/bucoord/ubik_db_if.c | 6 +- src/bucoord/vol_sets.c | 5 - src/budb/db_hash.c | 3 +- src/budb/db_text.c | 1 - src/budb/ol_verify.c | 5 +- src/budb/procs.c | 20 +- src/butc/dump.c | 11 +- src/butc/lwps.c | 21 +- src/butc/recoverDb.c | 7 +- src/butc/tcmain.c | 6 +- src/butc/tcprocs.c | 16 +- src/butc/tcudbprocs.c | 17 +- src/butm/file_tm.c | 18 +- src/butm/test_ftm.c | 1 - src/config/util_cr.c | 2 - src/des/NTMakefile | 1 + src/kauth/admin_tools.c | 5 +- src/kauth/kaauxdb.c | 2 +- src/kauth/kadatabase.c | 7 +- src/kauth/kaprocs.c | 1 - src/kauth/kaserver.c | 1 + src/libadmin/pts/afs_ptsAdmin.c | 2 - src/lwp/iomgr.c | 5 +- src/ptserver/ptprocs.c | 4 +- src/ptserver/pts.c | 5 +- src/ptserver/testpt.c | 19 +- src/ptserver/utils.c | 7 +- src/rx/NTMakefile | 2 +- src/rx/rxdebug.rc | 2 +- src/ubik/lock.c | 2 + src/util/pthread_nosigs.h | 6 +- src/viced/afsfileprocs.c | 22 +- src/viced/callback.c | 4 - src/viced/host.c | 11 +- src/viced/viced.c | 9 +- src/vlserver/vldb_check.c | 5 +- src/vol/ihandle.c | 1 - src/vol/nuke.c | 16 +- src/vol/vol-salvage.c | 5 +- src/volser/dumpstuff.c | 8 +- src/volser/volprocs.c | 3 +- src/volser/vos.c | 20 +- src/volser/vsprocs.c | 7 +- 69 files changed, 603 insertions(+), 693 deletions(-) diff --git a/src/WINNT/afsd/NTMakefile b/src/WINNT/afsd/NTMakefile index 0a3f5ec41..9ac219fb3 100644 --- a/src/WINNT/afsd/NTMakefile +++ b/src/WINNT/afsd/NTMakefile @@ -135,9 +135,12 @@ MIDL_FLAGS=/app_config \ CONF_DLLFILE = $(DESTDIR)\root.client\usr\vice\etc\libafsconf.dll +CONF_DLLLIBS = \ + $(DESTDIR)\lib\afs\afsutil.lib \ + $(DESTDIR)\lib\afs\afsreg.lib $(CONF_DLLFILE): $(CONFOBJS) $(OUT)\libafsconf.res - $(DLLGUILINK) -def:libafsconf.def + $(DLLGUILINK) -def:libafsconf.def $(CONF_DLLLIBS) $(DLLPREP) $(COPY) $*.lib $(ILIBDIR) $(DEL) $*.lib $*.exp diff --git a/src/WINNT/afsd/afsd.c b/src/WINNT/afsd/afsd.c index 0abd6198a..d5d31d193 100644 --- a/src/WINNT/afsd/afsd.c +++ b/src/WINNT/afsd/afsd.c @@ -130,9 +130,8 @@ BOOL InitInstance( HWND hWnd; HDC hDC; TEXTMETRIC textmetric; - RECT rect; INT nLineHeight; - long code; + long code; char *reason; /* remember this, since it is a useful thing for some of the Windows @@ -157,7 +156,6 @@ BOOL InitInstance( if (!hWnd) return (FALSE); - /* lookup text dimensions */ hDC = GetDC(hWnd); GetTextMetrics(hDC, &textmetric); diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index 95e04e81c..f0327d1bf 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -603,7 +603,7 @@ int afsd_InitDaemons(char **reasonP) code = cm_GetVolumeByName(cm_rootCellp, cm_rootVolumeName, cm_rootUserp, &req, CM_FLAG_CREATE, &cm_rootVolumep); afsi_log("cm_GetVolumeByName code %x root vol %x", code, - (code ? 0xffffffff : cm_rootVolumep)); + (code ? (cm_volume_t *)-1 : cm_rootVolumep)); if (code != 0) { *reasonP = "can't find root volume in root cell"; return -1; @@ -622,7 +622,7 @@ int afsd_InitDaemons(char **reasonP) code = cm_GetSCache(&cm_rootFid, &cm_rootSCachep, cm_rootUserp, &req); afsi_log("cm_GetSCache code %x scache %x", code, - (code ? 0xffffffff : cm_rootSCachep)); + (code ? (cm_scache_t *)-1 : cm_rootSCachep)); if (code != 0) { *reasonP = "unknown error"; return -1; diff --git a/src/WINNT/afsd/cm_config.c b/src/WINNT/afsd/cm_config.c index 1d52d4e7c..41b0e5df8 100644 --- a/src/WINNT/afsd/cm_config.c +++ b/src/WINNT/afsd/cm_config.c @@ -33,7 +33,9 @@ char AFSConfigKeyName[] = #define AFS_THISCELL "ThisCell" #define AFS_CELLSERVDB_UNIX "CellServDB" #define AFS_CELLSERVDB_NT "afsdcell.ini" +#ifndef AFSDIR_CLIENT_ETC_DIRPATH #define AFSDIR_CLIENT_ETC_DIRPATH "c:/afs" +#endif #if defined(DJGPP) || defined(AFS_WIN95_ENV) #define AFS_CELLSERVDB AFS_CELLSERVDB_UNIX #ifdef DJGPP @@ -350,13 +352,13 @@ long cm_GetRootCellName(char *cellNamep) { FILE *thisCell; char thisCellPath[256]; - char *afsconf_path; char *newline; #ifdef DJGPP strcpy(thisCellPath, cm_confDir); #else /* Win 95 */ + char *afsconf_path; afsconf_path = getenv("AFSCONF"); if (!afsconf_path) strcpy(thisCellPath, AFSDIR_CLIENT_ETC_DIRPATH); @@ -385,14 +387,14 @@ long cm_GetRootCellName(char *cellNamep) cm_configFile_t *cm_CommonOpen(char *namep, char *rwp) { char wdir[256]; - long code; - long tlen; - FILE *tfilep; - char *afsconf_path; + long code; + long tlen; + FILE *tfilep; #if !defined(DJGPP) && !defined(AFS_WIN95_ENV) code = GetWindowsDirectory(wdir, sizeof(wdir)); - if (code == 0 || code > sizeof(wdir)) return NULL; + if (code == 0 || code > sizeof(wdir)) + return 0; /* add trailing backslash, if required */ tlen = strlen(wdir); @@ -401,7 +403,7 @@ cm_configFile_t *cm_CommonOpen(char *namep, char *rwp) #ifdef DJGPP strcpy(wdir,cm_confDir); #else - afsconf_path = getenv("AFSCONF"); + char *afsconf_path = getenv("AFSCONF"); if (!afsconf_path) strcpy(wdir, AFSDIR_CLIENT_ETC_DIRPATH); else @@ -552,12 +554,13 @@ long cm_AppendNewCellLine(cm_configFile_t *filep, char *linep) long cm_CloseCellFile(cm_configFile_t *filep) { char wdir[256]; - char sdir[256]; - long code; - long closeCode; - int tlen; - char *afsconf_path; - + char sdir[256]; + long code; + long closeCode; + int tlen; +#ifdef AFS_WIN95_ENV + char *afsconf_path; +#endif closeCode = fclose((FILE *)filep); #if !defined(DJGPP) && !defined(AFS_WIN95_ENV) @@ -604,9 +607,11 @@ long cm_CloseCellFile(cm_configFile_t *filep) void cm_GetConfigDir(char *dir) { char wdir[256]; - char *afsconf_path; - int code; - int tlen; + int code; + int tlen; +#ifdef AFS_WIN95_ENV + char *afsconf_path; +#endif #if !defined(DJGPP) && !defined(AFS_WIN95_ENV) code = GetWindowsDirectory(wdir, sizeof(wdir)); diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 4d35c0668..33e8daff0 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -222,7 +222,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, /* special codes: missing volumes */ if (errorCode == VNOVOL || errorCode == VMOVED || errorCode == VOFFLINE || errorCode == VSALVAGE || errorCode == VNOSERVICE) { - long oldSum, newSum; + long newSum; int same; /* Log server being offline for this volume */ diff --git a/src/WINNT/afsd/cm_dns.c b/src/WINNT/afsd/cm_dns.c index b0e1da0e2..5f62d90e1 100644 --- a/src/WINNT/afsd/cm_dns.c +++ b/src/WINNT/afsd/cm_dns.c @@ -41,7 +41,6 @@ int cm_InitDNS(int enabled) char configpath[100]; int len; int code; - char *path; char *addr; if (!enabled) { fprintf(stderr, "DNS support disabled\n"); cm_dnsEnabled = 0; return 0; } @@ -55,7 +54,7 @@ int cm_InitDNS(int enabled) #ifdef DJGPP strcpy(configpath, cm_confDir); #elif defined(AFS_WIN95_ENV) - path = getenv("AFSCONF"); + char *path = getenv("AFSCONF"); if (path) strcpy(configpath, path); else strcpy(configpath, "c:\\afscli"); #else /* nt */ @@ -250,7 +249,6 @@ PDNS_HDR get_DNS_Response(SOCKET commSock, SOCKADDR_IN sockAddr, char *buffer) /*static char buffer[BUFSIZE];*/ int addrLen = sizeof(SOCKADDR_IN); - int res; int size; #ifndef WIN32_LEAN_AND_MEAN @@ -548,7 +546,6 @@ u_char * processReplyBuffer_Addr(PDNS_HDR replyBuff) { u_char *ptr = (u_char *) replyBuff; int answerCount = ntohs((replyBuff)->rr_count); - u_char i; PDNS_A_RR_HDR rrPtr; @@ -655,8 +652,6 @@ int DNSgetAddr(SOCKET commSock, char *hostName, struct in_addr *iNet) SOCKADDR_IN sockAddr; char buffer[BUFSIZE]; - - int i; u_char *addr; u_long *aPtr; int rc; diff --git a/src/WINNT/afsd/cm_freelance.c b/src/WINNT/afsd/cm_freelance.c index 9f82b1cde..efa168562 100644 --- a/src/WINNT/afsd/cm_freelance.c +++ b/src/WINNT/afsd/cm_freelance.c @@ -49,11 +49,9 @@ void cm_InitFreelance() { /* to be called while holding freelance lock unless during init. */ void cm_InitFakeRootDir() { - int i, j, t1, t2; + int i, t1, t2; char* currentPos; int noChunks; - char mask; - // allocate space for the fake info cm_dirHeader_t fakeDirHeader; @@ -255,7 +253,7 @@ int cm_noteLocalMountPointChange() { int cm_reInitLocalMountPoints() { cm_fid_t aFid; - int i, j, hash; + int i, hash; cm_scache_t *scp, **lscpp, *tscp; @@ -343,7 +341,7 @@ long cm_InitLocalMountPoints() { FILE *fp; char line[200]; - int n, i; + int i; char* t; cm_localMountPoint_t* aLocalMountPoint; char hdir[120]; @@ -484,13 +482,12 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, cm_fid_t long cm_FreelanceRemoveMount(char *toremove) { - int i, n, t1, t2; + int i, n; char* cp; char line[200]; char shortname[200]; char hfile[120], hfile2[120]; FILE *fp1, *fp2; - char cmd[200]; int found=0; lock_ObtainMutex(&cm_Freelance_Lock); diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index 70b7d116f..23c5f78c1 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -112,16 +112,18 @@ void cm_ResetACLCache(cm_user_t *userp) */ void TranslateExtendedChars(char *str) { - char *p; - - if (!str || !*str) - return; +#ifdef DJGPP + char *p; +#endif + + if (!str || !*str) + return; #ifndef DJGPP - CharToOem(str, str); + CharToOem(str, str); #else - p = str; - while (*p) *p++ &= 0x7f; /* turn off high bit; probably not right */ + p = str; + while (*p) *p++ &= 0x7f; /* turn off high bit; probably not right */ #endif } @@ -1320,8 +1322,6 @@ long cm_IoctlIslink(struct smb_ioctl *ioctlp, struct cm_user *userp) cm_scache_t *dscp; cm_scache_t *scp; char *cp; - cm_space_t *spacep; - cm_scache_t *newRootScp; cm_req_t req; cm_InitReq(&req); diff --git a/src/WINNT/afsd/smb.c b/src/WINNT/afsd/smb.c index d85cbf5db..3d6cfbe73 100644 --- a/src/WINNT/afsd/smb.c +++ b/src/WINNT/afsd/smb.c @@ -1095,9 +1095,9 @@ int smb_ListShares() smb_localNamep, this_share, (print_afs ? cm_mountRoot : "\0"), pathName); num_shares++; - while (*this_share != NULL) this_share++; /* find next NULL */ - this_share++; /* skip past the NULL */ - } while (*this_share != NULL); /* stop at final NULL */ + while (*this_share != 0) this_share++; /* find next NUL */ + this_share++; /* skip past the NUL */ + } while (*this_share != 0); /* stop at final NUL */ return num_shares; } @@ -6177,7 +6177,6 @@ void smb_NetbiosInit() } #endif /* !DJGPP */ - try_addname: /* and declare our name so we can receive connections */ memset(ncbp, 0, sizeof(*ncbp)); len=lstrlen(smb_localNamep); @@ -6293,11 +6292,8 @@ void smb_Init(osi_log_t *logp, char *snamep, int useV3, int LANadapt, thread_t phandle; int lpid; int i; - long code; int len; - NCB *ncbp; struct tm myTime; - char s[100]; #ifdef DJGPP int npar, seg, sel; dos_ptr rawBuf; diff --git a/src/WINNT/afsd/smb.h b/src/WINNT/afsd/smb.h index 8afe8d459..ac677e1ae 100644 --- a/src/WINNT/afsd/smb.h +++ b/src/WINNT/afsd/smb.h @@ -334,7 +334,7 @@ extern void smb_DosUTimeFromUnixTime(long *dosUTimep, long unixTime); extern void smb_UnixTimeFromDosUTime(long *unixTimep, long dosUTime); -extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana); +extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana); extern void smb_ReleaseVC(smb_vc_t *vcp); @@ -344,6 +344,10 @@ extern void smb_ReleaseTID(smb_tid_t *tidp); extern smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int flags); +extern smb_username_t *smb_FindUserByName(char *usern, char *machine, int flags); + +extern smb_user_t *smb_FindUserByNameThisSession(smb_vc_t *vcp, char *usern); + extern void smb_ReleaseUID(smb_user_t *uidp); extern cm_user_t *smb_GetUser(smb_vc_t *vcp, smb_packet_t *inp); @@ -423,6 +427,8 @@ extern unsigned long smb_LogoffTransferTimeout; extern void smb_FormatResponsePacket(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *op); +extern char *myCrt_2Dispatch(int i); + extern unsigned int smb_Attributes(cm_scache_t *scp); extern int smb_ChainFID(int fid, smb_packet_t *inp); @@ -453,7 +459,7 @@ extern BOOL smb_IsLegalFilename(char *filename); #include "smb3.h" #include "smb_ioctl.h" #include "smb_iocons.h" - -cm_user_t *smb_FindOrCreateUser(smb_vc_t *vcp, char *usern); + +cm_user_t *smb_FindOrCreateUser(smb_vc_t *vcp, char *usern); #endif /* whole file */ diff --git a/src/WINNT/afsd/smb3.c b/src/WINNT/afsd/smb3.c index 9e08a5d1c..3d08c3a3f 100644 --- a/src/WINNT/afsd/smb3.c +++ b/src/WINNT/afsd/smb3.c @@ -113,7 +113,7 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * { char *tp; char *usern, *pwd, *pwdx; - smb_user_t *uidp, *dead_uidp; + smb_user_t *uidp; unsigned short newUid; unsigned long caps; cm_user_t *userp; diff --git a/src/WINNT/client_exp/afs_shl_ext.cpp b/src/WINNT/client_exp/afs_shl_ext.cpp index d1eebfa89..6c4d9c811 100644 --- a/src/WINNT/client_exp/afs_shl_ext.cpp +++ b/src/WINNT/client_exp/afs_shl_ext.cpp @@ -119,14 +119,13 @@ LRESULT DoRegCLSID(HKEY hKey,PTCHAR szSubKey,PTCHAR szData,PTCHAR szValue=NULL) // by exporting DllRegisterServer, you can use regsvr.exe STDAPI DllRegisterServer(void) { - int i; HKEY hKey; LRESULT lResult; DWORD dwDisp; TCHAR szSubKey[MAX_PATH]; TCHAR szCLSID[MAX_PATH]; - TCHAR szModule[MAX_PATH]; - LPWSTR pwsz; + TCHAR szModule[MAX_PATH]; + LPWSTR pwsz; AFX_MANAGE_STATE(AfxGetStaticModuleState()); COleObjectFactory::UpdateRegistryAll(); diff --git a/src/WINNT/client_osi/osilog.c b/src/WINNT/client_osi/osilog.c index 13a76ab30..09298cf88 100644 --- a/src/WINNT/client_osi/osilog.c +++ b/src/WINNT/client_osi/osilog.c @@ -355,7 +355,8 @@ void osi_InitTraceOption() #define MAXBUF_ 131 void osi_LogEvent0(char *a,char *b) { - HANDLE h; char *ptbuf[1],buf[MAXBUF_+1]; + HANDLE h; + char *ptbuf[1]; if (!ISLOGONTRACE(osi_TraceOption)) return; h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); diff --git a/src/WINNT/pthread/test/native.cpp b/src/WINNT/pthread/test/native.cpp index 377b5f922..5d82dac06 100644 --- a/src/WINNT/pthread/test/native.cpp +++ b/src/WINNT/pthread/test/native.cpp @@ -1,400 +1,400 @@ -/* - * 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 - */ - -/* - * Test pthread interaction with native Win32 threads - * - */ - - -#include -#include - -#include -#include -#include - -extern "C" { -#include -#include -#include -} - - -#define nTESTS 3 -#define nPASSES_MAX 256 - - -/* - * Test1 - Tests the main thread calling pthread_self() - * - */ - -BOOL Test1 (void) -{ - BOOL rc = TRUE; - printf ("Begin Test1:\n"); - - PVOID hSelf; - if ((hSelf = pthread_self()) == NULL) - rc = FALSE; - - printf (" 1: pthread_self() on main thread returned 0x%08lX\n", hSelf); - - printf ("--> Test1 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED")); - return rc; -} - - -/* - * Test2 - Tests a Win32 thread's ability to join onto a pthread - * - */ -#define TEST2_RETURNVALUE 'Test' - -DWORD WINAPI Test2_Thread1 (LPVOID lp) -{ - printf (" 1-1: waiting for thread 2 to begin\n"); - - while (!*(volatile DWORD*)lp) - ; - - printf (" 1-1: calling pthread_join (0x%08lX)\n", *(DWORD*)lp); - - DWORD status; - int rc; - if ((rc = pthread_join ((pthread_t)(*(DWORD*)lp), (void**)&status)) != 0) - { - printf (" 1-1: pthread_join failed; rc=%lu\n", rc); - return 0; - } - - if (status != TEST2_RETURNVALUE) - { - printf (" 1-1: pthread_join succeeded with wrong status (rc=%lu)\n", status); - return 0; - } - - printf (" 1-1: pthread_join succeeded; terminating\n"); - return 1; -} - -extern "C" void *Test2_Thread2 (void *pdwCommonParam) -{ - printf (" 1-2: signalling that thread 2 began\n"); - *(volatile DWORD*)pdwCommonParam = (DWORD)pthread_self(); - Sleep (1500); - - printf (" 1-2: terminating\n"); - return (void*)TEST2_RETURNVALUE; -} - -BOOL Test2 (void) -{ - BOOL rc = TRUE; - printf ("Begin Test2:\n"); - - DWORD dwCommonParam = 0; - DWORD idThread; - - printf (" 1: creating win32 thread\n"); - HANDLE hThread1 = CreateThread (0, 0, Test2_Thread1, (LPVOID)&dwCommonParam, 0, &idThread); - Sleep(500); - - printf (" 1: creating pthread thread\n"); - pthread_t hThread2; - pthread_create (&hThread2, NULL, Test2_Thread2, (void *)&dwCommonParam); - Sleep(500); - - printf (" 1: blocking until win32 thread (thread1) terminates...\n"); - - WaitForSingleObject (hThread1, INFINITE); - GetExitCodeThread (hThread1, (ULONG*)&rc); - - printf (" 1: detected thread1 termination\n"); - - printf ("--> Test2 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED")); - return rc; -} - - -/* - * Test3 - Makes sure the pthread library recognizes when native threads die - * - */ - -DWORD WINAPI Test3_Thread1 (LPVOID lp) -{ - LONG *pdw = (LONG*)lp; - - // We're awake. Do something pthready. - // - pthread_t pMe; - if ((pMe = pthread_self()) == NULL) - printf (" 3-1: could not get a pthread_self!\n"); - else - printf (" 3-1: ready\n"); - - InterlockedIncrement (pdw); - - // Now wait until we see the signal to die. - // - while (*(volatile LONG*)pdw != 5) - ; - - printf (" 3-1: terminating\n"); - InterlockedIncrement (pdw); - return 1; -} - - -DWORD WINAPI Test3_Thread2 (LPVOID lp) -{ - LONG *pdw = (LONG*)lp; - - // We're awake. Do something pthready. - // - pthread_t pMe; - if ((pMe = pthread_self()) == NULL) - printf (" 3-2: could not get a pthread_self!\n"); - else - printf (" 3-2: ready\n"); - - InterlockedIncrement (pdw); - - // Now wait until we see the signal to die. - // - while (*(volatile LONG*)pdw != 7) - ; - - printf (" 3-2: terminating\n"); - InterlockedIncrement (pdw); - return 1; -} - - -extern "C" void *Test3_Thread3 (void *pdwParam) -{ - LONG *pdw = (LONG*)pdwParam; - - // We're awake. - // - printf (" 3-3: ready\n"); - InterlockedIncrement (pdw); - - // Now wait until we see the signal to die. - // - while (*(volatile LONG*)pdw != 9) - ; - - printf (" 3-3: terminating\n"); - InterlockedIncrement (pdw); - return (void*)1; -} - - -extern "C" void *Test3_Thread4 (void *pdwParam) -{ - LONG *pdw = (LONG*)pdwParam; - - // We're awake. - // - printf (" 3-4: ready\n"); - InterlockedIncrement (pdw); - - // Now wait until we see the signal to die. - // - while (*(volatile LONG*)pdw != 11) - ; - - printf (" 3-4: terminating\n"); - InterlockedIncrement (pdw); - return (void*)1; -} - - -extern "C" void *Test3_ThreadCount (void *pdwParam) -{ - volatile LONG *pdw = (LONG*)pdwParam; - - pthread_t pMe; - if ((pMe = pthread_self()) == NULL) - return (void*)0; - - try { - struct rx_queue *pNow = (rx_queue*)pMe; - - for (struct rx_queue *pWalk = pNow->next; pWalk != pNow; pWalk = pWalk->next) - ++(*pdw); - - } catch(...) { - *pdw = 0; - } - - return (void*)*pdw; -} - -size_t Test3_CountActiveQueue (void) -{ - DWORD dwArg = 0; - pthread_t pThread; - pthread_create (&pThread, NULL, Test3_ThreadCount, (void *)&dwArg); - - DWORD status; - int rc; - if ((rc = pthread_join (pThread, (void**)&status)) != 0) - { - printf (" 3: counter: pthread_join failed; rc=%lu\n", rc); - return 0; - } - - return dwArg; -} - -BOOL Test3 (void) -{ - BOOL rc = TRUE; - printf ("Begin Test3:\n"); - - // Find the size of the active queue - // - size_t cInitialQueueSize; - if ((cInitialQueueSize = Test3_CountActiveQueue()) == 0) - { - printf (" 3: unable to determine active queue size\n"); - rc = FALSE; - } - else - { - // Start two Win32 threads and two pthreads. We'll use a single, common - // parameter for each thread: dwSignal. Each thread will increment the - // signal param when it's ready for us to go; once that's done, a - // thread will kill itself and inc the signal *again* each die we - // increment the signal: - // - // starts at 0 - // thread 1 wakes up and incs signal to 1 - // thread 2 wakes up and incs signal to 2 - // thread 3 wakes up and incs signal to 3 - // thread 4 wakes up and incs signal to 4 - // we notice signal is 4, and we increment signal to 5 - // thread 1 notices signal is 5, incs to 6 and dies - // we notice signal is 6, and we increment signal to 7 - // thread 1 notices signal is 7, incs to 8 and dies - // we notice signal is 8, and we increment signal to 9 - // thread 1 notices signal is 9, incs to 10 and dies - // we notice signal is 10, and we increment signal to 11 - // thread 1 notices signal is 11, incs to 12 and dies - // we notice signal is 12 and finish our tests - // - volatile LONG dwSignal = 0; - printf (" 3: creating test threads\n"); - - DWORD idThread; - CreateThread (0, 0, Test3_Thread1, (LPVOID)&dwSignal, 0, &idThread); - Sleep (500); - - CreateThread (0, 0, Test3_Thread2, (LPVOID)&dwSignal, 0, &idThread); - Sleep (500); - - pthread_attr_t attr; - attr.is_joinable = PTHREAD_CREATE_DETACHED; - - pthread_t hThread; - pthread_create (&hThread, &attr, Test3_Thread3, (void *)&dwSignal); - Sleep (500); - - pthread_create (&hThread, &attr, Test3_Thread4, (void *)&dwSignal); - Sleep (500); - - // Count the active queue again as soon as we're sure all the threads - // are ready for us to do so. - // - while (dwSignal != 4) - ; - - size_t cQueueSize; - if ((cQueueSize = Test3_CountActiveQueue()) == 0) - { - printf (" 3: unable to determine active queue size\n"); - rc = FALSE; - } - else if (cQueueSize != cInitialQueueSize+4) - { - printf (" 3: error: active queue wasn't increased by 4\n"); - rc = FALSE; - } - else while (rc && (dwSignal < 12)) - { - LONG dwTarget = dwSignal +2; - InterlockedIncrement ((LONG*)&dwSignal); - - // wait for a thread to notice the change and kill itself - while (dwSignal != dwTarget) - ; - Sleep (500); // give a little time for cleanup after thread incremented - - if ((cQueueSize = Test3_CountActiveQueue()) == 0) - { - printf (" 3: unable to determine active queue size (dwSignal=%ld)\n", dwSignal); - rc = FALSE; - } - else if (cQueueSize != (cInitialQueueSize + 4 - ((dwTarget -4) /2))) - { - printf (" 3: active queue size did not diminish (dwSignal=%ld)\n", dwSignal); - rc = FALSE; - } - } - } - - printf ("--> Test3 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED")); - return rc; -} - - -/* - * main - Runs all tests (unless the command-line says otherwise) - * - */ -int main(int argc, char **argv) -{ - DWORD iRunTest[nPASSES_MAX]; - for (size_t ii = 0; ii < nPASSES_MAX; ++ii) - iRunTest[ii] = (ii < nTESTS) ? (ii+1) : 0; - - ii = 0; - for (--argc,++argv; argc; --argc,++argv) - { - DWORD iTest; - if ( ((iTest = (size_t)atol (*argv)) > 0) && (iTest <= nTESTS) ) - { - if (ii == 0) - memset (iRunTest, 0x00, sizeof(iRunTest)); - if (ii < nPASSES_MAX) - iRunTest[ ii++ ] = iTest; - } - } - - BOOL rc = TRUE; - - for (ii = 0; ii < nPASSES_MAX; ++ii) - { - if (iRunTest[ ii ] == 0) - break; - else switch (iRunTest[ ii ]) - { - case 1: if (!Test1()) rc = FALSE; break; - case 2: if (!Test2()) rc = FALSE; break; - case 3: if (!Test3()) rc = FALSE; break; - } - } - - return rc; -} - +/* + * 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 + */ + +/* + * Test pthread interaction with native Win32 threads + * + */ + + +#include +#include + +#include +#include +#include + +extern "C" { +#include +#include +#include +} + + +#define nTESTS 3 +#define nPASSES_MAX 256 + + +/* + * Test1 - Tests the main thread calling pthread_self() + * + */ + +BOOL Test1 (void) +{ + BOOL rc = TRUE; + printf ("Begin Test1:\n"); + + PVOID hSelf; + if ((hSelf = pthread_self()) == NULL) + rc = FALSE; + + printf (" 1: pthread_self() on main thread returned 0x%08lX\n", hSelf); + + printf ("--> Test1 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED")); + return rc; +} + + +/* + * Test2 - Tests a Win32 thread's ability to join onto a pthread + * + */ +#define TEST2_RETURNVALUE 'Test' + +DWORD WINAPI Test2_Thread1 (LPVOID lp) +{ + printf (" 1-1: waiting for thread 2 to begin\n"); + + while (!*(volatile DWORD*)lp) + ; + + printf (" 1-1: calling pthread_join (0x%08lX)\n", *(DWORD*)lp); + + DWORD status; + int rc; + if ((rc = pthread_join ((pthread_t)(*(DWORD*)lp), (void**)&status)) != 0) + { + printf (" 1-1: pthread_join failed; rc=%lu\n", rc); + return 0; + } + + if (status != TEST2_RETURNVALUE) + { + printf (" 1-1: pthread_join succeeded with wrong status (rc=%lu)\n", status); + return 0; + } + + printf (" 1-1: pthread_join succeeded; terminating\n"); + return 1; +} + +extern "C" void *Test2_Thread2 (void *pdwCommonParam) +{ + printf (" 1-2: signalling that thread 2 began\n"); + *(volatile DWORD*)pdwCommonParam = (DWORD)pthread_self(); + Sleep (1500); + + printf (" 1-2: terminating\n"); + return (void*)TEST2_RETURNVALUE; +} + +BOOL Test2 (void) +{ + BOOL rc = TRUE; + printf ("Begin Test2:\n"); + + DWORD dwCommonParam = 0; + DWORD idThread; + + printf (" 1: creating win32 thread\n"); + HANDLE hThread1 = CreateThread (0, 0, Test2_Thread1, (LPVOID)&dwCommonParam, 0, &idThread); + Sleep(500); + + printf (" 1: creating pthread thread\n"); + pthread_t hThread2; + pthread_create (&hThread2, NULL, Test2_Thread2, (void *)&dwCommonParam); + Sleep(500); + + printf (" 1: blocking until win32 thread (thread1) terminates...\n"); + + WaitForSingleObject (hThread1, INFINITE); + GetExitCodeThread (hThread1, (ULONG*)&rc); + + printf (" 1: detected thread1 termination\n"); + + printf ("--> Test2 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED")); + return rc; +} + + +/* + * Test3 - Makes sure the pthread library recognizes when native threads die + * + */ + +DWORD WINAPI Test3_Thread1 (LPVOID lp) +{ + LONG *pdw = (LONG*)lp; + + // We're awake. Do something pthready. + // + pthread_t pMe; + if ((pMe = pthread_self()) == NULL) + printf (" 3-1: could not get a pthread_self!\n"); + else + printf (" 3-1: ready\n"); + + InterlockedIncrement (pdw); + + // Now wait until we see the signal to die. + // + while (*(volatile LONG*)pdw != 5) + ; + + printf (" 3-1: terminating\n"); + InterlockedIncrement (pdw); + return 1; +} + + +DWORD WINAPI Test3_Thread2 (LPVOID lp) +{ + LONG *pdw = (LONG*)lp; + + // We're awake. Do something pthready. + // + pthread_t pMe; + if ((pMe = pthread_self()) == NULL) + printf (" 3-2: could not get a pthread_self!\n"); + else + printf (" 3-2: ready\n"); + + InterlockedIncrement (pdw); + + // Now wait until we see the signal to die. + // + while (*(volatile LONG*)pdw != 7) + ; + + printf (" 3-2: terminating\n"); + InterlockedIncrement (pdw); + return 1; +} + + +extern "C" void *Test3_Thread3 (void *pdwParam) +{ + LONG *pdw = (LONG*)pdwParam; + + // We're awake. + // + printf (" 3-3: ready\n"); + InterlockedIncrement (pdw); + + // Now wait until we see the signal to die. + // + while (*(volatile LONG*)pdw != 9) + ; + + printf (" 3-3: terminating\n"); + InterlockedIncrement (pdw); + return (void*)1; +} + + +extern "C" void *Test3_Thread4 (void *pdwParam) +{ + LONG *pdw = (LONG*)pdwParam; + + // We're awake. + // + printf (" 3-4: ready\n"); + InterlockedIncrement (pdw); + + // Now wait until we see the signal to die. + // + while (*(volatile LONG*)pdw != 11) + ; + + printf (" 3-4: terminating\n"); + InterlockedIncrement (pdw); + return (void*)1; +} + + +extern "C" void *Test3_ThreadCount (void *pdwParam) +{ + volatile LONG *pdw = (LONG*)pdwParam; + + pthread_t pMe; + if ((pMe = pthread_self()) == NULL) + return (void*)0; + + try { + struct rx_queue *pNow = (rx_queue*)pMe; + + for (struct rx_queue *pWalk = pNow->next; pWalk != pNow; pWalk = pWalk->next) + ++(*pdw); + + } catch(...) { + *pdw = 0; + } + + return (void*)*pdw; +} + +size_t Test3_CountActiveQueue (void) +{ + DWORD dwArg = 0; + pthread_t pThread; + pthread_create (&pThread, NULL, Test3_ThreadCount, (void *)&dwArg); + + DWORD status; + int rc; + if ((rc = pthread_join (pThread, (void**)&status)) != 0) + { + printf (" 3: counter: pthread_join failed; rc=%lu\n", rc); + return 0; + } + + return dwArg; +} + +BOOL Test3 (void) +{ + BOOL rc = TRUE; + printf ("Begin Test3:\n"); + + // Find the size of the active queue + // + size_t cInitialQueueSize; + if ((cInitialQueueSize = Test3_CountActiveQueue()) == 0) + { + printf (" 3: unable to determine active queue size\n"); + rc = FALSE; + } + else + { + // Start two Win32 threads and two pthreads. We'll use a single, common + // parameter for each thread: dwSignal. Each thread will increment the + // signal param when it's ready for us to go; once that's done, a + // thread will kill itself and inc the signal *again* each die we + // increment the signal: + // + // starts at 0 + // thread 1 wakes up and incs signal to 1 + // thread 2 wakes up and incs signal to 2 + // thread 3 wakes up and incs signal to 3 + // thread 4 wakes up and incs signal to 4 + // we notice signal is 4, and we increment signal to 5 + // thread 1 notices signal is 5, incs to 6 and dies + // we notice signal is 6, and we increment signal to 7 + // thread 1 notices signal is 7, incs to 8 and dies + // we notice signal is 8, and we increment signal to 9 + // thread 1 notices signal is 9, incs to 10 and dies + // we notice signal is 10, and we increment signal to 11 + // thread 1 notices signal is 11, incs to 12 and dies + // we notice signal is 12 and finish our tests + // + volatile LONG dwSignal = 0; + printf (" 3: creating test threads\n"); + + DWORD idThread; + CreateThread (0, 0, Test3_Thread1, (LPVOID)&dwSignal, 0, &idThread); + Sleep (500); + + CreateThread (0, 0, Test3_Thread2, (LPVOID)&dwSignal, 0, &idThread); + Sleep (500); + + pthread_attr_t attr; + attr.is_joinable = PTHREAD_CREATE_DETACHED; + + pthread_t hThread; + pthread_create (&hThread, &attr, Test3_Thread3, (void *)&dwSignal); + Sleep (500); + + pthread_create (&hThread, &attr, Test3_Thread4, (void *)&dwSignal); + Sleep (500); + + // Count the active queue again as soon as we're sure all the threads + // are ready for us to do so. + // + while (dwSignal != 4) + ; + + size_t cQueueSize; + if ((cQueueSize = Test3_CountActiveQueue()) == 0) + { + printf (" 3: unable to determine active queue size\n"); + rc = FALSE; + } + else if (cQueueSize != cInitialQueueSize+4) + { + printf (" 3: error: active queue wasn't increased by 4\n"); + rc = FALSE; + } + else while (rc && (dwSignal < 12)) + { + LONG dwTarget = dwSignal +2; + InterlockedIncrement ((LONG*)&dwSignal); + + // wait for a thread to notice the change and kill itself + while (dwSignal != dwTarget) + ; + Sleep (500); // give a little time for cleanup after thread incremented + + if ((cQueueSize = Test3_CountActiveQueue()) == 0) + { + printf (" 3: unable to determine active queue size (dwSignal=%ld)\n", dwSignal); + rc = FALSE; + } + else if (cQueueSize != (cInitialQueueSize + 4 - ((dwTarget -4) /2))) + { + printf (" 3: active queue size did not diminish (dwSignal=%ld)\n", dwSignal); + rc = FALSE; + } + } + } + + printf ("--> Test3 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED")); + return rc; +} + + +/* + * main - Runs all tests (unless the command-line says otherwise) + * + */ +int main(int argc, char **argv) +{ + DWORD iRunTest[nPASSES_MAX]; + for (size_t ii = 0; ii < nPASSES_MAX; ++ii) + iRunTest[ii] = (ii < nTESTS) ? (ii+1) : 0; + + ii = 0; + for (--argc,++argv; argc; --argc,++argv) + { + DWORD iTest; + if ( ((iTest = (size_t)atol (*argv)) > 0) && (iTest <= nTESTS) ) + { + if (ii == 0) + memset (iRunTest, 0x00, sizeof(iRunTest)); + if (ii < nPASSES_MAX) + iRunTest[ ii++ ] = iTest; + } + } + + BOOL rc = TRUE; + + for (ii = 0; ii < nPASSES_MAX; ++ii) + { + if (iRunTest[ ii ] == 0) + break; + else switch (iRunTest[ ii ]) + { + case 1: if (!Test1()) rc = FALSE; break; + case 2: if (!Test2()) rc = FALSE; break; + case 3: if (!Test3()) rc = FALSE; break; + } + } + + return rc; +} + diff --git a/src/auth/cellconfig.c b/src/auth/cellconfig.c index e277325cb..c02a77067 100644 --- a/src/auth/cellconfig.c +++ b/src/auth/cellconfig.c @@ -786,12 +786,10 @@ afsconf_GetAfsdbInfo(char *acellName, char *aservice, register afs_int32 i; int tservice; struct afsconf_entry DNSce; - char *DNStmpStrp; /* a temp string pointer */ - struct hostent *thp; afs_int32 cellHosts[AFSMAXCELLHOSTS]; int numServers; int rc; - int *ttl; + int ttl; DNSce.cellInfo.numServers = 0; DNSce.next = NULL; diff --git a/src/bozo/bos.c b/src/bozo/bos.c index 412510fd1..086c68d52 100644 --- a/src/bozo/bos.c +++ b/src/bozo/bos.c @@ -1500,7 +1500,7 @@ SalvageCmd(as) /* 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; + tp = &tname[0]; if (code = BOZO_GetInstanceParm(tconn, "fs", 3, &tp) == 0) mrafs = 1; diff --git a/src/bozo/bosoprocs.c b/src/bozo/bosoprocs.c index c62869320..3d1181ca0 100644 --- a/src/bozo/bosoprocs.c +++ b/src/bozo/bosoprocs.c @@ -774,7 +774,7 @@ SBOZO_ListSUsers(acall, an, aname) *tp = 0; /* in case getnthuser doesn't null-terminate the string */ code = afsconf_GetNthUser(bozo_confdir, an, tp, 256); - fail: + /* fail: */ osi_auditU(acall, BOS_ListSUserEvent, code, AUD_END); return code; } diff --git a/src/bucoord/bc_status.c b/src/bucoord/bc_status.c index 476b40e79..8cf694b47 100644 --- a/src/bucoord/bc_status.c +++ b/src/bucoord/bc_status.c @@ -103,6 +103,7 @@ nextItem(linkPtr) char *cmdLine; +int cmdDispatch() { #define MAXV 100 @@ -127,6 +128,7 @@ cmdDispatch() */ doDispatch(targc, targv, 1); cmd_FreeArgv(targv); + return(0); } statusWatcher() diff --git a/src/bucoord/commands.c b/src/bucoord/commands.c index ea34da5bf..cadd17307 100644 --- a/src/bucoord/commands.c +++ b/src/bucoord/commands.c @@ -80,7 +80,6 @@ bc_EvalVolumeSet(aconfig, avs, avols, uclient) struct ubik_client *uclient; { /*bc_EvalVolumeSet */ int code; - int a, b, c; static afs_int32 use = 2; if (use == 2) { /* Use EvalVolumeSet2() */ @@ -166,7 +165,7 @@ randSPEntries(serverlist, avols) struct serversort *serverlist; struct bc_volumeDump **avols; { - struct serversort *ss, **pss, *tss; + struct serversort *ss, **pss; struct partitionsort *ps, **pps; afs_int32 r; afs_int32 scount, pcount; @@ -220,8 +219,8 @@ EvalVolumeSet2(aconfig, avs, avols, uclient) struct bc_volumeDump *tvd; afs_int32 code = 0, tcode; afs_int32 count = 0; - struct serversort *servers = 0, *lastserver = 0, *ss = 0, *nss; - struct partitionsort *ps = 0, *nps; + struct serversort *servers = 0, *lastserver = 0, *ss = 0; + struct partitionsort *ps = 0; *avols = (struct bc_volumeDump *)0; bulkentries.nbulkentries_len = 0; @@ -833,7 +832,6 @@ bc_GetTapeStatusCmd(as, arock) char *arock; { afs_int32 code; - afs_int32 index, dumpID; struct rx_connection *tconn; afs_int32 portOffset = 0; @@ -902,8 +900,6 @@ bc_WaitForNoJobs() int usefulJobRunning = 1; extern dlqlinkT statusHead; - statusP ptr; - dlqlinkP dptr; com_err(whoami, 0, "waiting for job termination"); @@ -933,9 +929,7 @@ bc_JobsCmd(as, arock) struct cmd_syndesc *as; char *arock; { - int i; afs_int32 prevTime; - struct bc_dumpTask *td; dlqlinkP ptr; statusP statusPtr; char ds[50]; @@ -1056,7 +1050,6 @@ bc_KillCmd(as, arock) struct bc_dumpTask *td; char *tp; char tbuffer[256]; - afs_int32 code; dlqlinkP ptr; statusP statusPtr; @@ -1151,7 +1144,7 @@ bc_VolRestoreCmd(as, arock) int oldFlag; afs_int32 fromDate; char *newExt, *timeString; - afs_int32 i, portRemain; + afs_int32 i; afs_int32 *ports = NULL; afs_int32 portCount = 0; int dontExecute; @@ -1618,7 +1611,6 @@ bc_DumpCmd(as, arock) struct bc_volumeSet *tvs; /*Ptr to list of generated volume info */ struct bc_dumpSchedule *tds, *baseds; /*Ptr to dump schedule node */ struct bc_volumeDump *tve, *volsToDump; /*Ptr to individual vols to be dumped */ - struct bc_volumeDump *ntve, *tves, *ptves, *rtves; struct budb_dumpEntry dumpEntry, de, fde; /* dump entry */ afs_uint32 d; @@ -1635,11 +1627,7 @@ bc_DumpCmd(as, arock) afs_int32 code; /* Return code */ int loadfile; /* whether to load a file or not */ - struct bc_dumpTask *dumpTaskPtr; /* for dump thread */ - afs_int32 dumpTaskSlot; - char *junk; statusP statusPtr; - int r, nservers, ns, serverfound; extern struct bc_dumpTask bc_dumpTasks[]; extern afs_int32 bcdb_FindLastVolClone(); @@ -2443,7 +2431,6 @@ bc_deleteDumpCmd(as, arock) budb_dumpsList dumps, flags; int i; afs_int32 port = -1, dbonly = 0, force; - afs_uint32 taskid; /* Must specify at least one of -dumpid, -from, or -to */ if (!as->parms[0].items && !as->parms[1].items && !as->parms[2].items @@ -2885,7 +2872,6 @@ dumpInfo(dumpid, detailFlag) budb_volumeList vl; afs_int32 last, next, dbTime; afs_int32 tapedumpid; - afs_int32 numTapes; int tapeNumber; int i; diff --git a/src/bucoord/config.c b/src/bucoord/config.c index f2addf9b6..43883aebb 100644 --- a/src/bucoord/config.c +++ b/src/bucoord/config.c @@ -71,7 +71,6 @@ bc_InitConfig(apath) char *apath; { register struct bc_config *tb; - register struct bc_hostEntry *the; /* initialize global config structure */ tb = (struct bc_config *)malloc(sizeof(struct bc_config)); diff --git a/src/bucoord/dlq.c b/src/bucoord/dlq.c index e7d647878..1e526a633 100644 --- a/src/bucoord/dlq.c +++ b/src/bucoord/dlq.c @@ -114,6 +114,7 @@ dlqMoveb(fromptr, toptr) fromptr->dlq_next = fromptr; fromptr->dlq_prev = fromptr; + return (0); } /* dlqUnlinkb diff --git a/src/bucoord/dsvs.c b/src/bucoord/dsvs.c index 736621635..aa954dac5 100644 --- a/src/bucoord/dsvs.c +++ b/src/bucoord/dsvs.c @@ -390,7 +390,7 @@ bc_CreateDumpSchedule(aconfig, adumpName, expDate, expType) afs_int32 expDate; afs_int32 expType; { - register struct bc_dumpSchedule **tlast, *tdump; + register struct bc_dumpSchedule *tdump; struct bc_dumpSchedule *parent, *node; afs_int32 code; @@ -517,7 +517,7 @@ bc_DeleteDumpSchedule(aconfig, adumpName) bc_ProcessDumpSchedule(aconfig) register struct bc_config *aconfig; { - register struct bc_dumpSchedule *tds, *uds; + register struct bc_dumpSchedule *tds; struct bc_dumpSchedule *parentptr, *nodeptr; int retval; diff --git a/src/bucoord/dump.c b/src/bucoord/dump.c index 6c7deac42..2682bd965 100644 --- a/src/bucoord/dump.c +++ b/src/bucoord/dump.c @@ -68,10 +68,8 @@ extern afs_int32 lastTaskCode; bc_Dumper(aindex) { struct rx_connection *tconn; - struct tc_dumpStat dumpStat; register struct bc_volumeDump *tde; afs_int32 count, port; - struct timeval tv; struct tc_dumpDesc *volDesc = 0; struct tc_dumpArray volArray; char *baseNamePtr; @@ -268,8 +266,6 @@ bc_StartDmpRst(aconfig, adname, avname, avolsToDump, adestServer, register int i; register afs_int32 code; char *junk; - int doit; - struct bc_volumeDump *tvol, *temp; for (i = 0; i < BC_MAXSIMDUMPS; i++) if (!(bc_dumpTasks[i].flags & BC_DI_INUSE)) diff --git a/src/bucoord/dump_sched.c b/src/bucoord/dump_sched.c index 6327a04e5..fcf76f7b0 100644 --- a/src/bucoord/dump_sched.c +++ b/src/bucoord/dump_sched.c @@ -64,10 +64,9 @@ bc_AddDumpCmd(as, arock) char *arock; { register char *dname; /* dump schedule name */ - char *dateString; /* expiration date */ register afs_int32 code; afs_int32 expType, expDate; - register struct cmd_item *ti, *expItem; + register struct cmd_item *ti; udbClientTextP ctPtr; afs_int32 bc_ParseExpiration(); diff --git a/src/bucoord/main.c b/src/bucoord/main.c index adfffeaee..3424f7af7 100644 --- a/src/bucoord/main.c +++ b/src/bucoord/main.c @@ -333,7 +333,6 @@ static int MyBeforeProc(as) register struct cmd_syndesc *as; { - char *rock; afs_int32 code; /* Handling the command line opcode */ @@ -391,11 +390,11 @@ struct Lock dispatchLock; /* lock on the Dispatch call */ afs_int32 doDispatch(targc, targv, dispatchCount) - char **targv[MAXV]; + char *targv[MAXV]; afs_int32 targc; afs_int32 dispatchCount; /* to prevent infinite recursion */ { - char **sargv[MAXV]; + char *sargv[MAXV]; afs_int32 sargc; afs_int32 code, c; FILE *fd; @@ -489,10 +488,9 @@ main(argc, argv) int argc; char **argv; { /*main */ - char **targv[MAXV]; /*Ptr to parsed argv stuff */ + char *targv[MAXV]; /*Ptr to parsed argv stuff */ afs_int32 targc; /*Num parsed arguments */ afs_int32 code; /*Return code */ - char *tp; /*Result of gets() */ register struct cmd_syndesc *ts; /*Ptr to parsed command line */ int i; diff --git a/src/bucoord/status.c b/src/bucoord/status.c index 61570ecc0..d57e49853 100644 --- a/src/bucoord/status.c +++ b/src/bucoord/status.c @@ -71,6 +71,7 @@ unlock_cmdLine() /* general */ +void clearStatus(taskId, flags) afs_uint32 taskId; afs_uint32 flags; @@ -141,6 +142,7 @@ findStatus(taskId) return (ptr); } +void setStatus(taskId, flags) afs_uint32 taskId; afs_uint32 flags; diff --git a/src/bucoord/ubik_db_if.c b/src/bucoord/ubik_db_if.c index a572cd3a8..20deb4cf1 100644 --- a/src/bucoord/ubik_db_if.c +++ b/src/bucoord/ubik_db_if.c @@ -511,7 +511,7 @@ bcdb_UseTape(teptr, newFlag) bcdb_GetTextFile(register udbClientTextP ctPtr) { afs_int32 bufferSize; - afs_int32 offset, nextOffset, chunkSize; + afs_int32 offset, nextOffset; charListT charList; afs_int32 code = 0; @@ -965,8 +965,6 @@ udbClientInit(noAuthFlag, localauth, cellName) int localauth; char *cellName; { - afs_int32 serverList[MAXSERVERS]; - char hostname[256]; struct ktc_principal principal; struct ktc_token token; struct afsconf_cell info; @@ -1357,7 +1355,7 @@ udbLocalInit() return (code); } - abort: + /* abort: */ return (0); } diff --git a/src/bucoord/vol_sets.c b/src/bucoord/vol_sets.c index 10332fff5..f9f66cf71 100644 --- a/src/bucoord/vol_sets.c +++ b/src/bucoord/vol_sets.c @@ -65,7 +65,6 @@ bc_AddVolEntryCmd(as, arock) char *volSetName, *serverName, *partitionName, *volRegExp; udbClientTextP ctPtr; struct bc_volumeSet *tset; - afs_int32 flags; volSetName = as->parms[0].items->data; serverName = as->parms[1].items->data; @@ -396,11 +395,8 @@ bc_ListVolSetCmd(as, arock) bc_ClearVolumeSets() { - udbClientTextP ctPtr; struct udbHandleS *uhptr = &udbHandle; struct bc_volumeSet *vsPtr, *vsNextPtr, **vsPrev; - struct bc_volumeEntry *vePtr, *veNextPtr; - afs_int32 code; extern struct bc_config *bc_globalConfig; @@ -673,7 +669,6 @@ bc_SaveVolumeSet() afs_int32 bc_UpdateVolumeSet() { - struct bc_dumpSchedule *dumpPtr, *nextDumpPtr; struct udbHandleS *uhptr = &udbHandle; udbClientTextP ctPtr; afs_int32 code; diff --git a/src/budb/db_hash.c b/src/budb/db_hash.c index 3dc0dbbd6..3ebdd7f2c 100644 --- a/src/budb/db_hash.c +++ b/src/budb/db_hash.c @@ -671,6 +671,8 @@ ht_KeyMatch(type, key, e) default: db_panic("illegal hash function"); } + /* not reached */ + return 0; } /* ht_LookupEntry @@ -1217,7 +1219,6 @@ scanHashTable(ut, mhtPtr, selectFn, operationFn, rockPtr) int tableLength; /* # entries */ int blockLength; /* # blocks */ int hashIndex; - int blockIndex, entryIndex; int old; int i; afs_int32 code = 0; diff --git a/src/budb/db_text.c b/src/budb/db_text.c index 66378561b..a9cabc817 100644 --- a/src/budb/db_text.c +++ b/src/budb/db_text.c @@ -544,7 +544,6 @@ mkstemp(st) retval = open(mktemp(st), O_RDWR | O_CREAT | O_EXCL, 0600); #endif - error_exit: return (retval); } #endif diff --git a/src/budb/ol_verify.c b/src/budb/ol_verify.c index dac5d5964..9787c3d67 100644 --- a/src/budb/ol_verify.c +++ b/src/budb/ol_verify.c @@ -561,9 +561,8 @@ verifyVolInfoEntry(ut, volInfoAddr, ai, ao, volInfo) struct volInfo *volInfo; { int volCount = 0, ccheck = 1; - int nFrags; afs_int32 volFragAddr; - int blockIndex, entryIndex, bindex, eindex; + int blockIndex, entryIndex; struct volFragment volFragment; afs_int32 code = 0, tcode; @@ -1268,7 +1267,7 @@ verifyDatabase(ut, recreateFile) FILE *recreateFile; /* not used */ { afs_int32 eof; - int j, bmsize; + int bmsize; afs_int32 code = 0, tcode; extern int nBlocks; /* no. blocks in database */ diff --git a/src/budb/procs.c b/src/budb/procs.c index d7c17da70..e702314fd 100644 --- a/src/budb/procs.c +++ b/src/budb/procs.c @@ -3654,7 +3654,6 @@ T_DumpDatabase(call, filename) char *path = 0; dbadr dbAddr; int type, old, length, hash; - int block = 0, index = 0; struct memoryHashTable *mht; afs_int32 eval, code = 0; @@ -3704,8 +3703,8 @@ T_DumpDatabase(call, filename) ERROR(eval); fprintf(dumpfid, - "\ndumpId hash %d, entry at %u: block %d, index %d\n", - hash, dbAddr, block, index); + "\ndumpId hash %d, entry at %u\n", + hash, dbAddr); fprintf(dumpfid, "----------------------------\n"); dump_ntoh(&diskDump, &hostDump); @@ -3725,8 +3724,8 @@ T_DumpDatabase(call, filename) ERROR(eval); fprintf(dumpfid, - "\ndumpname hash %d, entry at %u: block %d, index %d\n", - hash, dbAddr, block, index); + "\ndumpname hash %d, entry at %u\n", + hash, dbAddr); fprintf(dumpfid, "----------------------------\n"); dump_ntoh(&diskDump, &hostDump); @@ -3746,8 +3745,8 @@ T_DumpDatabase(call, filename) ERROR(eval); fprintf(dumpfid, - "\ntapename hash %d, entry at %u: block %d, index %d\n", - hash, dbAddr, block, index); + "\ntapename hash %d, entry at %u\n", + hash, dbAddr); fprintf(dumpfid, "----------------------------\n"); tape_ntoh(&diskTape, &hostTape); @@ -3767,8 +3766,8 @@ T_DumpDatabase(call, filename) ERROR(eval); fprintf(dumpfid, - "\nvolname hash %d, entry at %u: block %d, index %d\n", - hash, dbAddr, block, index); + "\nvolname hash %d, entry at %u\n", + hash, dbAddr); fprintf(dumpfid, "----------------------------\n"); volInfo_ntoh(&diskVolInfo, &hostVolInfo); @@ -3817,8 +3816,7 @@ volFragsDump(ut, dumpfid, dbAddr) return (0); } - fprintf(dumpfid, "\nvolfragment entry at %u: block %d, index %d\n", - dbAddr, 0, 0); + fprintf(dumpfid, "\nvolfragment entry at %u\n", dbAddr); fprintf(dumpfid, "----------------------------\n"); volFragment_ntoh(&diskVolFragment, &hostVolFragment); printVolFragment(dumpfid, &hostVolFragment); diff --git a/src/butc/dump.c b/src/butc/dump.c index 595df24b0..f67fb833d 100644 --- a/src/butc/dump.c +++ b/src/butc/dump.c @@ -1130,7 +1130,6 @@ Dumper(struct dumpNode *nodePtr) afs_int32 code = 0; /* for volume setup */ - struct tc_dumpDesc *dumpDescPtr; int i; int failedvolumes = 0; int dumpedvolumes = 0; @@ -1520,11 +1519,10 @@ getDumpTape(struct dumpRock *dparamsPtr, int interactiveFlag, struct budb_dumpEntry dumpEntry; struct budb_tapeEntry tapeEntry; struct budb_volumeEntry volEntry; - Date oldTapeExpiration, expir; - afs_int32 curTime; + Date expir; afs_int32 doAppend; afs_int32 code = 0; - int askForTape, opcode; + int askForTape; int tapecount = 1; char strlevel[5]; afs_int32 tapepos, lastpos; @@ -1644,10 +1642,9 @@ getDumpTape(struct dumpRock *dparamsPtr, int interactiveFlag, } else { /* not appending */ afs_uint32 tapeid; - afs_uint32 dmp, parent; + afs_uint32 dmp; struct budb_dumpEntry de, de2; - /* Check if tape name is not what expected - null tapes are acceptable * Don't do check if the tape has a user defined label. */ @@ -1877,7 +1874,7 @@ makeVolumeHeader(struct volumeHeader *vhptr, struct dumpRock *dparamsPtr, strcpy(vhptr->dumpSetName, nodePtr->dumpSetName); strcpy(vhptr->preamble, "H++NAME#"); strcpy(vhptr->postamble, "T--NAME#"); - error_exit: + return (code); } diff --git a/src/butc/lwps.c b/src/butc/lwps.c index 41ec5d595..83b2233c5 100644 --- a/src/butc/lwps.c +++ b/src/butc/lwps.c @@ -402,6 +402,7 @@ GetResponseKey(int seconds, char *key) * * notes: * * only external clients are in recoverDb.c. Was static. PA */ +void FFlushInput() { int w; @@ -436,8 +437,6 @@ callOutRoutine(taskId, tapePath, flag, name, dbDumpId, tapecount) afs_uint32 dbDumpId; int tapecount; { - afs_int32 count; - afs_int32 code = 0; int pid; @@ -551,7 +550,6 @@ unmountTape(taskId, tapeInfoPtr) struct butm_tapeInfo *tapeInfoPtr; { afs_int32 code; - afs_int32 wcode; int cpid, status, rcpid; code = butm_Dismount(tapeInfoPtr); @@ -741,8 +739,7 @@ PromptForTape(flag, name, dbDumpId, taskId, tapecount) com_err(whoami, errno, "Error waiting for callout script to terminate."); TLog(taskId, - "Can't get exit status from callout script. will prompt\n", - wcode); + "Can't get exit status from callout script. will prompt\n"); CallOut = 0; break; } @@ -1245,8 +1242,7 @@ restoreVolumeData(call, rparamsPtr) { afs_int32 curChunk; afs_uint32 totalWritten = 0; - afs_uint32 tapeID; - afs_int32 code, tcode; + afs_int32 code; afs_int32 headBytes, tailBytes, w; afs_int32 taskId; afs_int32 nbytes; /* # bytes data in last tape block read */ @@ -1478,8 +1474,9 @@ xbsaRestoreVolume(taskId, restoreInfo, rparamsPtr) struct tc_restoreDesc *restoreInfo; struct restoreParams *rparamsPtr; { - afs_int32 code = 0, rc; + afs_int32 code = 0; #ifdef xbsa + afs_int32 rc; afs_int32 newServer, newPart, newVolId; char *newVolName; int restoreflags, havetrans = 0, startread = 0; @@ -1675,7 +1672,6 @@ restoreVolume(taskId, restoreInfo, rparamsPtr) int restoreflags; afs_uint32 tapeID; struct butm_tapeInfo *tapeInfoPtr = rparamsPtr->tapeInfoPtr; - struct budb_dumpEntry dumpEntry; /* Check if we need a tape and prompt for one if so */ tapeID = @@ -1745,15 +1741,13 @@ restoreVolume(taskId, restoreInfo, rparamsPtr) Restorer(newNode) struct dumpNode *newNode; { - afs_int32 code = 0, tcode, rc; + afs_int32 code = 0, tcode; afs_uint32 taskId; - afs_uint32 dumpID; char *newVolName; struct butm_tapeInfo tapeInfo; struct tc_restoreDesc *Restore; struct tc_restoreDesc *RestoreDesc; struct restoreParams rparams; - int restoreflags; afs_int32 allocbufferSize; time_t startTime, endTime; afs_int32 goodrestore = 0; @@ -1870,7 +1864,7 @@ Restorer(newNode) unmountTape(taskId, &tapeInfo); } else { #ifdef xbsa - rc = InitToServer(taskId, &butxInfo, 0); /* Return to original server */ + code = InitToServer(taskId, &butxInfo, 0); /* Return to original server */ #endif } @@ -2001,7 +1995,6 @@ FindVolTrailer(buffer, size, dSize, volTrailerPtr) afs_int32 *dSize; /* dataSize */ { afs_int32 offset, s; - afs_int32 code; int found; *dSize = size; diff --git a/src/butc/recoverDb.c b/src/butc/recoverDb.c index bf9b11b0f..8186135f7 100644 --- a/src/butc/recoverDb.c +++ b/src/butc/recoverDb.c @@ -533,13 +533,10 @@ readDump(taskId, tapeInfoPtr, scanInfoPtr) int moreTapes = 1; afs_int32 nbytes, flags, seq; int newDump = 1, newTape = 1; - afs_int32 tapePosition, c; + afs_int32 tapePosition; afs_int32 code = 0, tcode; - int interactiveFlag, badscan; - + int badscan; struct volumeHeader volHeader, volTrailer; - - int good; struct budb_tapeEntry tapeEntry; struct budb_volumeEntry volEntry; diff --git a/src/butc/tcmain.c b/src/butc/tcmain.c index d5a26a004..ed4d44b3e 100644 --- a/src/butc/tcmain.c +++ b/src/butc/tcmain.c @@ -268,7 +268,6 @@ stringReplace(name) char *name; { char *pos; - int i; char buffer[256]; pos = strrchr(name, '/'); @@ -855,7 +854,6 @@ WorkerBee(as, arock) struct cmd_syndesc *as; char *arock; { - char *pid; register afs_int32 code; struct rx_securityClass *(securityObjects[3]); struct rx_service *service; @@ -864,7 +862,6 @@ WorkerBee(as, arock) int localauth; /*process arguments */ afs_int32 portOffset = 0; - afs_int32 logIOName; #ifdef AFS_PTHREAD_ENV pthread_t dbWatcherPid; pthread_attr_t tattr; @@ -978,8 +975,9 @@ WorkerBee(as, arock) if (centralLogFile) { struct stat sbuf; afs_int32 statcode; +#ifdef AFS_NT40_ENV char path[AFSDIR_PATH_MAX]; - +#endif statcode = stat(centralLogFile, &sbuf); centralLogIO = fopen(centralLogFile, "a"); if (!centralLogIO) { diff --git a/src/butc/tcprocs.c b/src/butc/tcprocs.c index 299cdc400..dcb54bdf1 100644 --- a/src/butc/tcprocs.c +++ b/src/butc/tcprocs.c @@ -46,19 +46,6 @@ extern afs_int32 xbsaType; callPermitted(call) struct rx_call *call; { - afs_int32 code; - - struct rx_connection *tconn; - rxkad_level level; - Date expiration; - char name[MAXKTCNAMELEN]; - char inst[MAXKTCNAMELEN]; - char celn[MAXKTCREALMLEN]; - afs_int32 kvno; - - char *cell; - afs_int32 flag; - /* before this code can be used, the rx connection, on the bucoord side, must */ /* be changed so that it will set up for token passing instead of using a */ /* simple rx connection that, below, returns a value of 0 from rx_SecurityClassOf */ @@ -83,7 +70,6 @@ STC_LabelTape(acid, label, taskId) #else PROCESS pid; #endif - struct tc_tapeLabel *mylabel; struct labelTapeIf *ptr; statusP statusPtr; afs_int32 code; @@ -627,12 +613,14 @@ STC_DeleteDump(acid, dumpID, taskId) struct deleteDumpIf *ptr = 0; statusP statusPtr = 0; afs_int32 code = TC_BADTASK; /* If not compiled -Dxbsa then fail */ +#ifdef xbsa #ifdef AFS_PTHREAD_ENV pthread_t pid; pthread_attr_t tattr; AFS_SIGSET_DECL; #else PROCESS pid; +#endif #endif extern afs_int32 DeleteDump(); extern statusP createStatusNode(); diff --git a/src/butc/tcudbprocs.c b/src/butc/tcudbprocs.c index 452a4b82f..42f8a672e 100644 --- a/src/butc/tcudbprocs.c +++ b/src/butc/tcudbprocs.c @@ -110,7 +110,6 @@ GetDBTape(taskId, expires, tapeInfoPtr, dumpid, sequence, queryFlag, int interactiveFlag; char tapeName[BU_MAXTAPELEN]; char strlevel[5]; - afs_int32 i; struct timeval tp; struct timezone tzp; afs_int32 curTime; @@ -377,14 +376,11 @@ saveDbToTape(saveDbIfPtr) afs_int32 code = 0; afs_int32 i; int wroteLabel; - afs_int32 new; afs_uint32 taskId; Date expires; struct butm_tapeInfo tapeInfo; struct budb_dumpEntry dumpEntry; - struct tapeEntryList *next; - struct budb_dumpEntry de; extern struct deviceSyncNode *deviceLatch; extern struct tapeConfig globalTapeConfig; @@ -512,8 +508,6 @@ makeDbDumpEntry(tapeEntPtr, dumpEntryPtr) struct budb_tapeEntry *tapeEntPtr; struct budb_dumpEntry *dumpEntryPtr; { - afs_int32 code; - memset(dumpEntryPtr, 0, sizeof(struct budb_dumpEntry)); dumpEntryPtr->id = tapeEntPtr->dump; @@ -548,7 +542,7 @@ readDbTape(tapeInfoPtr, rstTapeInfoPtr, query) { afs_int32 code = 0; int interactiveFlag; - afs_int32 taskId, i; + afs_int32 taskId; struct butm_tapeLabel oldTapeLabel; char AFStapeName[BU_MAXTAPELEN], tapeName[BU_MAXTAPELEN]; struct tapeEntryList *endList; @@ -667,8 +661,7 @@ restoreDbFromTape(taskId) afs_uint32 taskId; { afs_int32 code = 0; - afs_int32 new, i; - struct dumpNode *node; + afs_int32 i; struct butm_tapeInfo tapeInfo; struct rstTapeInfo rstTapeInfo; struct budb_dumpEntry dumpEntry; @@ -820,7 +813,7 @@ writeDbDump(tapeInfoPtr, taskId, expires, dumpid) afs_int32 chunksize = 0; afs_int32 tc_EndMargin, tc_KEndMargin, kRemaining; int sequence; - int wroteLabel, new; + int wroteLabel; int firstcall; #ifdef AFS_PTHREAD_ENV pthread_t alivePid; @@ -1208,9 +1201,9 @@ restoreDbDump(tapeInfo, rstTapeInfoPtr, nextHeader) struct budb_tapeEntry netTapeEntry, hostTapeEntry; struct budb_volumeEntry netVolumeEntry, hostVolumeEntry; struct structDumpHeader netItemHeader; - afs_int32 newTape, taskId; + afs_int32 taskId; int restoreThisDump = 1; - afs_int32 code = 0, tcode; + afs_int32 code = 0; extern struct udbHandleS udbHandle; diff --git a/src/butm/file_tm.c b/src/butm/file_tm.c index 0b2193cda..2b3cac7bb 100644 --- a/src/butm/file_tm.c +++ b/src/butm/file_tm.c @@ -652,8 +652,6 @@ incPosition(info, fid, dataSize) usd_handle_t fid; afs_uint32 dataSize; { - afs_hyper_t off; - /* Add this to the amount of data written to the tape */ incSize(info, dataSize); @@ -663,6 +661,7 @@ incPosition(info, fid, dataSize) info->posCount = 0; #if (defined(AFS_SUN_ENV) || defined(AFS_DEC_ENV) || defined(AFS_LINUX24_ENV)) if (!isafile) { + afs_hyper_t off; hset64(off, 0, 0); USD_IOCTL(fid, USD_IOCTL_SETSIZE, &off); } @@ -728,8 +727,6 @@ SeekFile(info, count) int count; { afs_int32 code = 0; - afs_int32 fcode; - int cpid, status, rcpid, stat; struct progress *p; afs_int32 error = 0; @@ -972,9 +969,7 @@ rewindFile(info) struct butm_tapeInfo *info; { struct progress *p; - int cpid, status, rcpid, stat; afs_int32 code = 0; - afs_int32 rwcode; afs_int32 error; p = (struct progress *)info->tmRock; @@ -1013,7 +1008,7 @@ file_Mount(info, tape) struct progress *p; char filename[64]; usd_handle_t fid; - int cpid, status, rcpid, xflags; + int xflags; afs_int32 code = 0, error = 0, rc = 0; if (info->debug) @@ -1096,11 +1091,7 @@ file_Dismount(info) struct butm_tapeInfo *info; { struct progress *p; - int cpid, status, rcpid, stat; - afs_int32 code = 0, error = 0, cd; - afs_int32 clcode; - int fd[2]; - char c; + afs_int32 code = 0, error = 0; if (info->debug) printf("butm: Unmount tape drive\n"); @@ -1356,7 +1347,6 @@ static afs_int32 file_ReadFileBegin(info) struct butm_tapeInfo *info; { - struct fileMark mark; afs_int32 code = 0; afs_int32 blockType; @@ -1539,7 +1529,6 @@ static afs_int32 file_ReadFileEnd(info) struct butm_tapeInfo *info; { - struct fileMark mark; afs_int32 code = 0; afs_int32 blockType; @@ -1666,7 +1655,6 @@ file_SeekEODump(info, position) struct butm_tapeInfo *info; afs_int32 position; { - struct fileMark mark; afs_int32 code = 0; afs_int32 blockType; afs_int32 w; diff --git a/src/butm/test_ftm.c b/src/butm/test_ftm.c index 271bcc8e2..f361fd7c6 100644 --- a/src/butm/test_ftm.c +++ b/src/butm/test_ftm.c @@ -414,7 +414,6 @@ PerformDumpTest(TestInfo * tip) if ((info.status & BUTM_STATUS_EOD) == 0) { code = butm_ReadFileBegin(&info); if (code && (code != BUTM_EOD)) { - should_eot: com_err(whoami, code, "Should have encountered an 'End Of Tape'"); ERROR_EXIT(8); } diff --git a/src/config/util_cr.c b/src/config/util_cr.c index 74eada800..39d156195 100644 --- a/src/config/util_cr.c +++ b/src/config/util_cr.c @@ -308,7 +308,6 @@ gencurdir(char *val) int isequal(char *msg1, char *msg2, char *disp) { - int x; strlwr(msg1); strlwr(msg2); if (strcmp(msg1, msg2) != 0) @@ -320,7 +319,6 @@ isequal(char *msg1, char *msg2, char *disp) int SetSysEnv(int argc, char *argv[]) { - long ret; DWORD dwResult; printf("assignment %s %s\n", argv[2], argv[3]); Addkey("HKEY_LOCAL_MACHINE", diff --git a/src/des/NTMakefile b/src/des/NTMakefile index 3cb0151cb..2f7b0f5ed 100644 --- a/src/des/NTMakefile +++ b/src/des/NTMakefile @@ -72,6 +72,7 @@ $(LIBFILE): $(LIBOBJS) ##################### GENERATED_FILES = \ + $(VERSFILE).c \ key_perm.h \ p_table.h \ s_table.h \ diff --git a/src/kauth/admin_tools.c b/src/kauth/admin_tools.c index a6d996a77..263ed229a 100644 --- a/src/kauth/admin_tools.c +++ b/src/kauth/admin_tools.c @@ -1257,7 +1257,7 @@ int MyAfterProc(struct cmd_syndesc *as) { if (!strcmp(as->name, "help")) - return; + return 0; /* Determine if we need to destory the ubik connection. * Closing it avoids resends of packets. @@ -1287,7 +1287,6 @@ static int MyBeforeProc(struct cmd_syndesc *as, char *arock) { extern struct passwd *getpwuid(); - struct passwd *pw; struct ktc_encryptionKey key; struct ktc_principal auth_server, auth_token, client; char realm[MAXKTCREALMLEN]; @@ -1349,7 +1348,7 @@ MyBeforeProc(struct cmd_syndesc *as, char *arock) } #else /* No explicit name provided: use Unix uid. */ - pw = getpwuid(getuid()); + struct passwd pw = getpwuid(getuid()); if (pw == 0) { printf("Can't figure out your name from your user id.\n"); return KABADCMD; diff --git a/src/kauth/kaauxdb.c b/src/kauth/kaauxdb.c index 6b2b72bd4..aef045dfe 100644 --- a/src/kauth/kaauxdb.c +++ b/src/kauth/kaauxdb.c @@ -130,7 +130,7 @@ kaux_write(afs_int32 to, unsigned int nfailures, afs_uint32 lasttime) if ((write(fd, &nfailures, sizeof(int)) != sizeof(int)) || (write(fd, &lasttime, sizeof(afs_int32)) != sizeof(afs_int32))) perror("kaux_write()"); - + return 0; } diff --git a/src/kauth/kadatabase.c b/src/kauth/kadatabase.c index be0a8a115..3f6f8f354 100644 --- a/src/kauth/kadatabase.c +++ b/src/kauth/kadatabase.c @@ -611,7 +611,7 @@ ka_DelKey(tt, tentryaddr, tentry) afs_int32 tentryaddr; struct kaentry *tentry; { - int code, i; + int code; struct kaOldKeys okeys; /* old keys block */ afs_int32 okeysaddr, nextaddr; /* offset of old keys block */ afs_int32 prevptr = 0; @@ -682,7 +682,6 @@ ka_debugKeyCache(info) if (keyCache[i].used) { if (info->kcUsed < KADEBUGKCINFOSIZE) { int j = info->kcUsed; - int k; char principal[sizeof(keyCache[0].name) + sizeof(keyCache[0].inst)]; @@ -692,8 +691,11 @@ ka_debugKeyCache(info) (keyCache[i].superseded == NEVERDATE); info->kcInfo[j].keycksum = 0; #if DEBUG_KEY_CACHE + { + int k; for (k = 0; k < sizeof(struct ktc_encryptionKey); k++) info->kcInfo[j].keycksum += ((char *)&keyCache[i].key)[k]; + } #endif strcpy(principal, keyCache[i].name); strcat(principal, "."); @@ -708,6 +710,7 @@ ka_debugKeyCache(info) /* Add a key to the key cache, expanding it if necessary. */ +void ka_Encache(name, inst, kvno, key, superseded) char *name; char *inst; diff --git a/src/kauth/kaprocs.c b/src/kauth/kaprocs.c index b56834368..01f4bdc17 100644 --- a/src/kauth/kaprocs.c +++ b/src/kauth/kaprocs.c @@ -1114,7 +1114,6 @@ Authenticate(version, call, aname, ainstance, start, end, arequest, oanswer) struct ktc_encryptionKey tgskey; /* service key for encrypting ticket */ Date now; afs_uint32 pwexpires; - afs_uint32 lasttime; COUNT_REQ(Authenticate); if (!name_instance_legal(aname, ainstance)) diff --git a/src/kauth/kaserver.c b/src/kauth/kaserver.c index d332cf0c9..26f707d7b 100644 --- a/src/kauth/kaserver.c +++ b/src/kauth/kaserver.c @@ -427,4 +427,5 @@ main(argc, argv) ViceLog(0, ("Starting to process AuthServer requests\n")); rx_ServerProc(); /* donate this LWP */ + return 0; } diff --git a/src/libadmin/pts/afs_ptsAdmin.c b/src/libadmin/pts/afs_ptsAdmin.c index 965fc64a3..8d5cd9f0c 100644 --- a/src/libadmin/pts/afs_ptsAdmin.c +++ b/src/libadmin/pts/afs_ptsAdmin.c @@ -2257,8 +2257,6 @@ SetUserAccess(const pts_UserUpdateEntry_p userP, afs_int32 * flags, } rc = 1; - fail_SetUserAccess: - if (st != NULL) { *st = tst; } diff --git a/src/lwp/iomgr.c b/src/lwp/iomgr.c index 8d9ffc762..84655882b 100644 --- a/src/lwp/iomgr.c +++ b/src/lwp/iomgr.c @@ -292,7 +292,7 @@ static int FDSetCmp(int nfds, fd_set *fd_set1, fd_set *fd_set2) */ static void FDSetSet(int nfds, fd_set *fd_set1, fd_set *fd_set2) { - unsigned int i, n; + unsigned int i; if (fd_set1 == (fd_set*)0 || fd_set2 == (fd_set*)0) return; @@ -307,8 +307,7 @@ static void FDSetSet(int nfds, fd_set *fd_set1, fd_set *fd_set2) if (nfds == 0) return; - n = INTS_PER_FDS(nfds); - for (i=0; iFDS_BITS[i] |= fd_set2->FDS_BITS[i]; } #endif diff --git a/src/ptserver/ptprocs.c b/src/ptserver/ptprocs.c index a4725c907..4cf7369ae 100644 --- a/src/ptserver/ptprocs.c +++ b/src/ptserver/ptprocs.c @@ -952,8 +952,8 @@ SPR_UpdateEntry(call, aid, name, uentry) struct ubik_trans *tt; afs_int32 cid; struct prentry tentry; - afs_int32 loc, nptr; - int count, id = 0; + afs_int32 loc; + int id = 0; code = Initdb(); if (code) diff --git a/src/ptserver/pts.c b/src/ptserver/pts.c index 546492990..ef9927ac9 100644 --- a/src/ptserver/pts.c +++ b/src/ptserver/pts.c @@ -195,7 +195,7 @@ CleanUp(as) { #if defined(SUPERGROUPS) if (as && !strcmp(as->name, "help")) - return; + return 0; if (pruclient) { /* Need to shutdown the ubik_client & other connections */ pr_End(); @@ -203,7 +203,7 @@ CleanUp(as) } #else if (!strcmp(as->name, "help")) - return; + return 0; /* Need to shutdown the ubik_client & other connections */ pr_End(); rx_Finalize(); @@ -718,7 +718,6 @@ CheckEntry(as) printf(".\n"); } - done: if (lnames.namelist_val) free(lnames.namelist_val); if (lids.idlist_val) diff --git a/src/ptserver/testpt.c b/src/ptserver/testpt.c index ec8fb54b7..eb8f51a9c 100644 --- a/src/ptserver/testpt.c +++ b/src/ptserver/testpt.c @@ -191,12 +191,13 @@ IdCmp(a, b) afs_int32 *a; afs_int32 *b; { - if (*a > *b) + if (*a > *b) { return 1; - if (*a == *b) + } else if (*a == *b) { return 0; - if (*a < *b) + } else /* (*a < *b) */ { return -1; + } } static int @@ -240,6 +241,7 @@ GetGroupLimit(N, x) return y; } +void CreateUser(u) int u; { @@ -276,9 +278,9 @@ CreateUser(u) ownerUser = id; strcpy(ownerUserName, name); } - return; } +void CreateGroup(g) int g; { @@ -345,7 +347,6 @@ CreateGroup(g) lastGroup = id; lastGroupPrefix = ownerName; } - return; } int @@ -377,6 +378,7 @@ DeleteRandomId(list) return -1; /* none left */ } +void AddUser(u, g) int u, g; { @@ -398,9 +400,9 @@ AddUser(u, g) printf("Adding user (%di) to group (%di)\n", ui, gi); population[u * number + g]++; nAdds++; - return; } +void RemUser(u, g) int u, g; { @@ -418,7 +420,6 @@ RemUser(u, g) printf("Removing user (%di) from group (%di)\n", ui, gi); population[u * number + g]--; nRems++; - return; } TestManyMembers(as, arock) @@ -599,7 +600,7 @@ TestManyMembers(as, arock) for (u = 0; u < number; u++) { afs_int32 ui = users[u]; if (ui) { - int i, j; + int i; int ng; /* number groups */ int (*proc) (); /* membership listing procedure */ int over; @@ -765,6 +766,7 @@ ka_ConvertBytes(ascii, alen, bs, bl) } } *ascii = 0; /* terminate string */ + return 0; } /* This runs various tests on the server. It creates, then deletes, a bunch of @@ -931,7 +933,6 @@ MyAfterProc(as, arock) struct cmd_syndesc *as; char *arock; { - afs_int32 code; if (strlen(tmp_conf_file)) unlink(tmp_conf_file); if (strlen(tmp_cell_file)) diff --git a/src/ptserver/utils.c b/src/ptserver/utils.c index 4999c1175..7877d2e80 100644 --- a/src/ptserver/utils.c +++ b/src/ptserver/utils.c @@ -482,12 +482,13 @@ IDCmp(a, b) afs_int32 *b; { /* used to sort CPS's so that comparison with acl's is easier */ - if (*a > *b) + if (*a > *b) { return 1; - if (*a == *b) + } else if (*a == *b) { return 0; - if (*a < *b) + } else /* (*a < *b) */ { return -1; + } } afs_int32 diff --git a/src/rx/NTMakefile b/src/rx/NTMakefile index e77bc14fa..5a7cfb65b 100644 --- a/src/rx/NTMakefile +++ b/src/rx/NTMakefile @@ -82,7 +82,7 @@ RXDLIBS = $(LIBDIR)\afs\afscmd.lib \ $(LIBDIR)\afs\afsutil.lib \ $(LIBDIR)\afs\afsreg.lib -$(OUT)\rxdebug.res: rxdebug.rc AFS_component_version_number.h +$(OUT)\rxdebug.res: rxdebug.rc $(VERSFILE).h $(RC) /Fo$*.RES $(*F).rc $(OUT)\rxdebug.obj: rxdebug.c diff --git a/src/rx/rxdebug.rc b/src/rx/rxdebug.rc index 3192c8abe..85a260075 100644 --- a/src/rx/rxdebug.rc +++ b/src/rx/rxdebug.rc @@ -13,5 +13,5 @@ #define AFS_VERINFO_NAME "rxdebug" #define AFS_VERINFO_FILENAME "rxdebug.exe" -#include "AFS_component_version_number.h" +#include "RX_component_version_number.h" #include "..\config\NTVersioninfo.rc" diff --git a/src/ubik/lock.c b/src/ubik/lock.c index 23d41eb5a..68709e3db 100644 --- a/src/ubik/lock.c +++ b/src/ubik/lock.c @@ -164,6 +164,7 @@ ulock_relLock(atrans) */ atrans->locktype = 0; + return 0; } /* debugging hooks */ @@ -177,4 +178,5 @@ ulock_Debug(aparm) aparm->anyReadLocks = rwlock.readers_reading; aparm->anyWriteLocks = ((rwlock.excl_locked == WRITE_LOCK) ? 1 : 0); } + return 0; } diff --git a/src/util/pthread_nosigs.h b/src/util/pthread_nosigs.h index ea595c670..65acee0b1 100644 --- a/src/util/pthread_nosigs.h +++ b/src/util/pthread_nosigs.h @@ -17,9 +17,9 @@ #ifdef AFS_NT40_ENV /* Compilers complain about empty declaration unless at end of decl's */ -#define AFS_SIGSET_DECL int i_junk -#define AFS_SIGSET_CLEAR() -#define AFS_SIGSET_RESTORE() +#define AFS_SIGSET_DECL int i_junk=0 +#define AFS_SIGSET_CLEAR() ++i_junk +#define AFS_SIGSET_RESTORE() --i_junk #else #define AFS_SIGSET_DECL sigset_t i_tset, i_oset #ifdef AFS_AIX42_ENV diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 1e6e57e82..7da4edfca 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -574,7 +574,9 @@ GetRights(struct client *client, struct acl_accessList *ACL, { extern prlist SystemAnyUserCPS; afs_int32 hrights = 0; +#ifndef AFS_PTHREAD_ENV int code; +#endif if (acl_CheckRights(ACL, &SystemAnyUserCPS, anyrights) != 0) { @@ -1035,7 +1037,6 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr) int wrlen; register afs_fsize_t size; register int length; - int ifd, ofd; char *buff; int rc; /* return code */ IHandle_t *newH; /* Use until finished copying, then cp to vnode. */ @@ -4202,7 +4203,7 @@ SAFSS_Symlink(struct rx_call *acall, struct AFSFid *DirFid, char *Name, DirHandle dir; /* Handle for dir package I/O */ Volume *volptr = 0; /* pointer to the volume header */ struct client *client; /* pointer to client structure */ - afs_int32 rights, anyrights, fd; /* rights for this and any user */ + afs_int32 rights, anyrights; /* rights for this and any user */ struct client *t_client; /* tmp ptr to client data */ struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ FdHandle_t *fdP; @@ -5896,7 +5897,6 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray, FS_UNLOCK; } #endif /* FS_STATS_DETAILED */ - out: return errorCode; } /*common_GiveUpCallBacks */ @@ -5946,7 +5946,6 @@ afs_int32 SRXAFS_GetCapabilities(struct rx_call * acall, Capabilities * capabilities) { afs_int32 *dataBuffP; - afs_int32 *dataP; afs_int32 dataBytes; dataBytes = 1 * sizeof(afs_int32); @@ -6391,15 +6390,20 @@ SRXAFS_SetVolumeStatus(struct rx_call * acall, afs_int32 avolid, afs_int32 SRXAFS_GetRootVolume(struct rx_call * acall, char **VolumeName) { +#ifdef notdef int fd; int len; char *temp; - int errorCode = 0; /* error code */ struct rx_connection *tcon; +#endif + int errorCode = 0; #if FS_STATS_DETAILED struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */ - struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */ + struct timeval opStartTime; /* Start time for RPC op */ +#ifdef notdef + struct timeval opStopTime; struct timeval elapsedTime; /* Transfer time */ +#endif /* * Set our stats pointer, remember when the RPC operation started, and @@ -6616,7 +6620,6 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr, { struct timeval StartTime, StopTime; /* used to calculate file transfer rates */ int errorCode = 0; /* Returned error code to caller */ - int code; IHandle_t *ihP; FdHandle_t *fdP; #ifdef AFS_NT40_ENV @@ -6627,10 +6630,6 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr, #endif /* AFS_NT40_ENV */ afs_sfsize_t tlen; afs_int32 optSize; - struct afs_stat tstat; -#ifdef AFS_AIX_ENV - struct statfs tstatfs; -#endif #if FS_STATS_DETAILED /* @@ -6845,7 +6844,6 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid, afs_fsize_t NewLength; /* size after this store completes */ afs_sfsize_t adjustSize; /* bytes to call VAdjust... with */ int linkCount; /* link count on inode */ - int code; FdHandle_t *fdP; struct in_addr logHostAddr; /* host ip holder for inet_ntoa */ diff --git a/src/viced/callback.c b/src/viced/callback.c index 83be9eb14..09ac9ff98 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -766,7 +766,6 @@ MultiBreakCallBack_r(struct cbstruct cba[], int ncbas, { int i, j; struct rx_connection *conns[MAX_CB_HOSTS]; - int opt_TO; /* secs, but internal adaptive parms are in ms */ static struct AFSCBs tc = { 0, 0 }; assert(ncbas <= MAX_CB_HOSTS); @@ -878,7 +877,6 @@ BreakCallBack(struct host *xhost, AFSFid * fid, int flag) struct CallBack *cb, *nextcb; struct cbstruct cba[MAX_CB_HOSTS]; int ncbas; - struct rx_connection *conns[MAX_CB_HOSTS]; struct AFSCBFids tf; int hostindex; char hoststr[16]; @@ -1073,7 +1071,6 @@ BreakDelayedCallBacks_r(struct host *host) u_byte thead[AFSCBMAX]; /* This should match thead in struct Callback */ int cbi, first, nfids; struct CallBack *cb; - struct interfaceAddr interf; int code; char hoststr[16]; @@ -1622,7 +1619,6 @@ GetSomeSpace_r(struct host *hostp, int locked) static int ClearHostCallbacks_r(struct host *hp, int locked) { - struct interfaceAddr interf; int code; int held = 0; char hoststr[16]; diff --git a/src/viced/host.c b/src/viced/host.c index 9da6af451..0fba00f29 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -87,6 +87,8 @@ struct CEBlock { /* block of CESPERBLOCK file entries */ struct client entry[CESPERBLOCK]; }; +static void h_TossStuff_r(register struct host *host); + /* * Make sure the subnet macros have been defined. */ @@ -532,7 +534,6 @@ h_flushhostcps(register afs_uint32 hostaddr, register afs_uint32 hport) struct host * h_Alloc_r(register struct rx_connection *r_con) { - register int code; struct servent *serverentry; register index = h_HashIndex(rxr_HostOf(r_con)); register struct host *host; @@ -691,7 +692,7 @@ h_LookupUuid_r(afsUUID * uuidp) * To be called, there must be no holds, and either host->deleted * or host->clientDeleted must be set. */ -int +static void h_TossStuff_r(register struct host *host) { register struct client **cp, *client; @@ -942,7 +943,6 @@ h_GetHost_r(struct rx_connection *tcon) struct Identity *identP = NULL; afs_int32 haddr; afs_int32 hport; - int i, j, count; char hoststr[16], hoststr2[16]; Capabilities caps; @@ -1830,7 +1830,6 @@ h_DumpHosts() void h_GetWorkStats(int *nump, int *activep, int *delp, afs_int32 cutofftime) { - register int i; register struct host *host; register int num = 0, active = 0, del = 0; @@ -1892,9 +1891,6 @@ h_ClassifyAddress(afs_uint32 a_targetAddr, afs_uint32 a_candAddr, afs_int32 * a_diffNetworkP) { /*h_ClassifyAddress */ - register int i; /*Iterator thru host hash table */ - register struct host *hostP; /*Ptr to current host entry */ - register afs_uint32 currHostAddr; /*Current host address */ afs_uint32 targetNet; afs_uint32 targetSubnet; afs_uint32 candNet; @@ -2321,7 +2317,6 @@ int hashDelete_r(afs_int32 addr, struct host *host) { int flag; - int index; register struct h_hashChain **hp, *th; for (hp = &hostHashTable[h_HashIndex(addr)]; (th = *hp);) { diff --git a/src/viced/viced.c b/src/viced/viced.c index f00d3e944..56903219e 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -640,7 +640,6 @@ void ShutDownAndCore(int dopanic) { time_t now = time(0); - char *tstr; char tbuffer[32]; ViceLog(0, @@ -1307,7 +1306,7 @@ ReadSysIdFile() afs_int32 WriteSysIdFile() { - afs_int32 fd, nentries, i; + afs_int32 fd, i; struct versionStamp vsn; struct afs_stat status; afsUUID uuid; @@ -1414,9 +1413,7 @@ Do_VLRegisterRPC() afs_int32 InitVL() { - int (*old) (); afs_int32 code; - afs_int32 cnt, i; extern int rxi_numNetAddrs; extern afs_uint32 rxi_NetAddrs[]; @@ -1477,14 +1474,12 @@ InitVL() int main(int argc, char *argv[]) { - int i; afs_int32 code; - FILE *file; char tbuffer[32]; struct rx_securityClass *sc[4]; struct rx_service *tservice; #ifdef AFS_PTHREAD_ENV - pthread_t parentPid, serverPid; + pthread_t serverPid; pthread_attr_t tattr; #else /* AFS_PTHREAD_ENV */ PROCESS parentPid, serverPid; diff --git a/src/vlserver/vldb_check.c b/src/vlserver/vldb_check.c index a0f2d6570..4869631c5 100644 --- a/src/vlserver/vldb_check.c +++ b/src/vlserver/vldb_check.c @@ -921,7 +921,7 @@ WorkerBee(as, arock) fd = open(dbfile, O_RDONLY, 0); if (fd < 0) { printf("can't open file '%s'. error = %d\n", dbfile, errno); - return; + return 0; } /* read the ubik header and the vldb database header */ @@ -929,7 +929,7 @@ WorkerBee(as, arock) readheader(&header); if (header.vital_header.vldbversion < 3) { printf("does not support vldb with version less than 3\n"); - return; + return 0; } maxentries = (header.vital_header.eofPtr / sizeof(vlentry)) + 1; @@ -1029,6 +1029,7 @@ WorkerBee(as, arock) record[i].type); } } + return 0; } main(argc, argv) diff --git a/src/vol/ihandle.c b/src/vol/ihandle.c index 6781f19bf..8b66e5717 100644 --- a/src/vol/ihandle.c +++ b/src/vol/ihandle.c @@ -350,7 +350,6 @@ ih_open(IHandle_t * ihP) int fd_close(FdHandle_t * fdP) { - FD_t closeFd; IHandle_t *ihP; if (!fdP) diff --git a/src/vol/nuke.c b/src/vol/nuke.c index dc1e21956..bd8687d0c 100644 --- a/src/vol/nuke.c +++ b/src/vol/nuke.c @@ -115,8 +115,7 @@ nuke(char *aname, afs_int32 avolid) struct afs_stat tstat; struct ilist *ti, *ni; register afs_int32 code; - char *tfile; - int i, j, forceSal; + int i, forceSal; char devName[64], wpath[100]; char *lastDevComp; #ifdef AFS_NAMEI_ENV @@ -144,12 +143,14 @@ nuke(char *aname, afs_int32 avolid) lastDevComp = &aname[strlen(aname) - 1]; *lastDevComp = toupper(*lastDevComp); #else - tfile = vol_DevName(tstat.st_dev, wpath); + { + char *tfile = vol_DevName(tstat.st_dev, wpath); if (!tfile) { printf("volnuke: can't find %s's device.\n", aname); return 1; } strcpy(devName, tfile); /* save this from the static buffer */ + } /* aim lastDevComp at the 'foo' of '/dev/foo' */ lastDevComp = strrchr(devName, '/'); /* either points at slash, or there is no slash; adjust appropriately */ @@ -200,9 +201,12 @@ nuke(char *aname, afs_int32 avolid) } #else /* AFS_NAMEI_ENV */ IH_INIT(fileH, (int)tstat.st_dev, avolid, ti->inode[i]); - for (j = 0; j < ti->count[i]; j++) { - code = IH_DEC(fileH, ti->inode[i], avolid); - } + { + int j; + for (j = 0; j < ti->count[i]; j++) { + code = IH_DEC(fileH, ti->inode[i], avolid); + } + } IH_RELEASE(fileH); #endif /* AFS_NAMEI_ENV */ } diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 5ed6cbb8a..2f46a07bc 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -507,7 +507,7 @@ handleit(struct cmd_syndesc *as) { register struct cmd_item *ti; char pname[100], *temp; - afs_int32 seenpart = 0, seenvol = 0, vid = 0, seenany = 0, i; + afs_int32 seenpart = 0, seenvol = 0, vid = 0, seenany = 0; struct DiskPartition *partP; #ifdef AFS_SGI_VNODE_GLUE @@ -519,12 +519,15 @@ handleit(struct cmd_syndesc *as) #endif #ifdef FAST_RESTART + { + afs_int32 i; for (i = 0; i < CMD_MAXPARMS; i++) { if (as->parms[i].items) { seenany = 1; break; } } + } if (!seenany) { char *msg = "Exiting immediately without salvage. Look into the FileLog to find volumes which really need to be salvaged!"; diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index 4a5217e59..33099c112 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -927,8 +927,9 @@ ProcessIndex(Volume * vp, VnodeClass class, afs_int32 ** Bufp, int *sizep, if (vnode->type != vNull && VNDISK_GET_INO(vnode)) { cnt1++; if (DoLogging) { - afs_fsize_t vnodeLength; - Log("RestoreVolume %u Cleanup: Removing old vnode=%u inode=%llu size=%llu\n", V_id(vp), bitNumberToVnodeNumber(i, class), (afs_uintmax_t) VNDISK_GET_INO(vnode), (afs_uintmax_t) vnodeLength); + Log("RestoreVolume %u Cleanup: Removing old vnode=%u inode=%llu size=unknown\n", + V_id(vp), bitNumberToVnodeNumber(i, class), + (afs_uintmax_t) VNDISK_GET_INO(vnode)); } IH_DEC(V_linkHandle(vp), VNDISK_GET_INO(vnode), V_parentId(vp)); @@ -1467,7 +1468,6 @@ SizeDumpVolume(register struct rx_call *call, register Volume * vp, afs_int32 fromtime, int dumpAllDirs, register struct volintSize *v_size) { - struct iod iod; int code = 0; register struct iod *iodp = (struct iod *)0; /* iod_Init(iodp, call); */ @@ -1488,7 +1488,7 @@ SizeDumpDumpHeader(register struct iod *iodp, register Volume * vp, { int code = 0; int UseLatestReadOnlyClone = 1; - afs_int32 dumpTimes[2]; +/* afs_int32 dumpTimes[2]; */ afs_uint64 addvar; /* iodp->device = vp->device; */ /* iodp->parentId = V_parentId(vp); */ diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 5742ed24f..ca87c678c 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -1177,7 +1177,7 @@ SAFSVolForwardMultiple(struct rx_call *acid, afs_int32 fromTrans, afs_int32 struct rx_connection **tcons; struct rx_call **tcalls; struct Volume *vp; - int i, nconns, is_incremental; + int i, is_incremental; if (results) memset(results, 0, sizeof(manyResults)); @@ -1625,7 +1625,6 @@ afs_int32 VolListPartitions(struct rx_call *acid, struct pIDs *partIds) { char namehead[9]; - int code; char i; strcpy(namehead, "/vicep"); /*7 including null terminator */ diff --git a/src/volser/vos.c b/src/volser/vos.c index a50d8f626..104a29874 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -1149,7 +1149,6 @@ VolumeStats(pntr, entry, server, part, voltype) afs_int32 server, part; { int totalOK, totalNotOK, totalBusy; - afs_int32 vcode, vcode2; DisplayFormat(pntr, server, part, &totalOK, &totalNotOK, &totalBusy, 0, 1, 1); @@ -2084,9 +2083,6 @@ BackupVolume(as) afs_int32 buvolid, buserver, bupart, butype; struct nvldbentry buentry; - struct rx_connection *conn; - volEntries volInfo; - struct nvldbentry store; avolid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err); if (avolid == 0) { @@ -3452,6 +3448,10 @@ GetVolumeInfo(volid, server, part, voltype, rentry) *part = rentry->serverPartition[index]; return 0; } + fprintf(STDERR, + "unexpected volume type for volume %lu\n", + (unsigned long)volid); + return -1; } static @@ -3868,7 +3868,6 @@ BackSys(as) afs_int32 totalFail = 0; int previdx = -1, error, same; int comp = 0; - char compstr[50]; struct cmd_item *ti; char *ccode; int match; @@ -4416,7 +4415,6 @@ print_addrs(const bulkaddrs * addrs, const afsUUID * m_uuid, int nentries, { afs_int32 vcode; afs_int32 i, j; - struct VLCallBack unused; afs_int32 *addrp; bulkaddrs m_addrs; ListAddrByAttributes m_attrs; @@ -4501,14 +4499,12 @@ ListAddrs(as) register struct cmd_syndesc *as; { afs_int32 vcode; - afs_int32 i, j, noresolve = 0, printuuid = 0; - struct VLCallBack unused; - afs_int32 nentries, *addrp; - bulkaddrs addrs, m_addrs; + afs_int32 i, noresolve = 0, printuuid = 0; + afs_int32 nentries; + bulkaddrs m_addrs; ListAddrByAttributes m_attrs; afsUUID m_uuid, askuuid; - afs_int32 m_unique, m_nentries, *m_addrp; - afs_int32 base, index; + afs_int32 m_unique, m_nentries; memset(&m_attrs, 0, sizeof(struct ListAddrByAttributes)); m_attrs.Mask = VLADDR_INDEX; diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 1c8f3cb10..568f90053 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -1977,10 +1977,8 @@ UV_CopyVolume(afs_int32 afromvol, afs_int32 afromserver, afs_int32 afrompart, struct destServer destination; struct nvldbentry entry, newentry, storeEntry; - int i, islocked, pntg; + int islocked, pntg; afs_int32 error; - char in, lf; /* for test code */ - int same; int justclone = 0; islocked = 0; @@ -4473,7 +4471,8 @@ UV_ListPartitions(afs_int32 aserver, struct partList *ptrPartList, } free(partEnts.partEntries_val); } - out: + + /* out: */ if (code) fprintf(STDERR, "Could not fetch the list of partitions from the server\n"); -- 2.39.5