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
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
if (!hWnd)
return (FALSE);
-
/* lookup text dimensions */
hDC = GetDC(hWnd);
GetTextMetrics(hDC, &textmetric);
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;
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;
#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
{
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);
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);
#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
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)
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));
/* 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 */
char configpath[100];
int len;
int code;
- char *path;
char *addr;
if (!enabled) { fprintf(stderr, "DNS support disabled\n"); cm_dnsEnabled = 0; return 0; }
#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 */
/*static char buffer[BUFSIZE];*/
int addrLen = sizeof(SOCKADDR_IN);
- int res;
int size;
#ifndef WIN32_LEAN_AND_MEAN
{
u_char *ptr = (u_char *) replyBuff;
int answerCount = ntohs((replyBuff)->rr_count);
- u_char i;
PDNS_A_RR_HDR
rrPtr;
SOCKADDR_IN sockAddr;
char buffer[BUFSIZE];
-
- int i;
u_char *addr;
u_long *aPtr;
int rc;
/* 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;
int cm_reInitLocalMountPoints() {
cm_fid_t aFid;
- int i, j, hash;
+ int i, hash;
cm_scache_t *scp, **lscpp, *tscp;
FILE *fp;
char line[200];
- int n, i;
+ int i;
char* t;
cm_localMountPoint_t* aLocalMountPoint;
char hdir[120];
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);
*/
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
}
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);
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;
}
}
#endif /* !DJGPP */
- try_addname:
/* and declare our name so we can receive connections */
memset(ncbp, 0, sizeof(*ncbp));
len=lstrlen(smb_localNamep);
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;
extern void smb_UnixTimeFromDosUTime(long *unixTimep, long dosUTime);
-extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana);\r
+extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana);
extern void smb_ReleaseVC(smb_vc_t *vcp);
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);
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);
#include "smb3.h"
#include "smb_ioctl.h"
#include "smb_iocons.h"
-\r
-cm_user_t *smb_FindOrCreateUser(smb_vc_t *vcp, char *usern);\r
+
+cm_user_t *smb_FindOrCreateUser(smb_vc_t *vcp, char *usern);
#endif /* whole file */
{
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;
// 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();
#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);
-/*\r
- * Copyright 2000, International Business Machines Corporation and others.\r
- * All Rights Reserved.\r
- * \r
- * This software has been released under the terms of the IBM Public\r
- * License. For details, see the LICENSE file in the top-level source\r
- * directory or online at http://www.openafs.org/dl/license10.html\r
- */\r
-\r
-/*\r
- * Test pthread interaction with native Win32 threads\r
- *\r
- */\r
-\r
-\r
-#include <afs/param.h>\r
-#include <afs/stds.h>\r
-\r
-#include <windows.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-\r
-extern "C" {\r
-#include <pthread.h>\r
-#include <assert.h>\r
-#include <rx/rx_queue.h>\r
-}\r
-\r
-\r
-#define nTESTS 3\r
-#define nPASSES_MAX 256\r
-\r
-\r
-/*\r
- * Test1 - Tests the main thread calling pthread_self()\r
- *\r
- */\r
-\r
-BOOL Test1 (void)\r
-{\r
- BOOL rc = TRUE;\r
- printf ("Begin Test1:\n");\r
-\r
- PVOID hSelf;\r
- if ((hSelf = pthread_self()) == NULL)\r
- rc = FALSE;\r
-\r
- printf (" 1: pthread_self() on main thread returned 0x%08lX\n", hSelf);\r
-\r
- printf ("--> Test1 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED\a\a\a"));\r
- return rc;\r
-}\r
-\r
-\r
-/*\r
- * Test2 - Tests a Win32 thread's ability to join onto a pthread\r
- *\r
- */\r
-#define TEST2_RETURNVALUE 'Test'\r
-\r
-DWORD WINAPI Test2_Thread1 (LPVOID lp)\r
-{\r
- printf (" 1-1: waiting for thread 2 to begin\n");\r
-\r
- while (!*(volatile DWORD*)lp)\r
- ;\r
-\r
- printf (" 1-1: calling pthread_join (0x%08lX)\n", *(DWORD*)lp);\r
-\r
- DWORD status;\r
- int rc;\r
- if ((rc = pthread_join ((pthread_t)(*(DWORD*)lp), (void**)&status)) != 0)\r
- {\r
- printf (" 1-1: pthread_join failed; rc=%lu\n", rc);\r
- return 0;\r
- }\r
-\r
- if (status != TEST2_RETURNVALUE)\r
- {\r
- printf (" 1-1: pthread_join succeeded with wrong status (rc=%lu)\n", status);\r
- return 0;\r
- }\r
-\r
- printf (" 1-1: pthread_join succeeded; terminating\n");\r
- return 1;\r
-}\r
-\r
-extern "C" void *Test2_Thread2 (void *pdwCommonParam)\r
-{\r
- printf (" 1-2: signalling that thread 2 began\n");\r
- *(volatile DWORD*)pdwCommonParam = (DWORD)pthread_self();\r
- Sleep (1500);\r
-\r
- printf (" 1-2: terminating\n");\r
- return (void*)TEST2_RETURNVALUE;\r
-}\r
-\r
-BOOL Test2 (void)\r
-{\r
- BOOL rc = TRUE;\r
- printf ("Begin Test2:\n");\r
-\r
- DWORD dwCommonParam = 0;\r
- DWORD idThread;\r
-\r
- printf (" 1: creating win32 thread\n");\r
- HANDLE hThread1 = CreateThread (0, 0, Test2_Thread1, (LPVOID)&dwCommonParam, 0, &idThread);\r
- Sleep(500);\r
-\r
- printf (" 1: creating pthread thread\n");\r
- pthread_t hThread2;\r
- pthread_create (&hThread2, NULL, Test2_Thread2, (void *)&dwCommonParam);\r
- Sleep(500);\r
-\r
- printf (" 1: blocking until win32 thread (thread1) terminates...\n");\r
-\r
- WaitForSingleObject (hThread1, INFINITE);\r
- GetExitCodeThread (hThread1, (ULONG*)&rc);\r
-\r
- printf (" 1: detected thread1 termination\n");\r
-\r
- printf ("--> Test2 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED\a\a\a"));\r
- return rc;\r
-}\r
-\r
-\r
-/*\r
- * Test3 - Makes sure the pthread library recognizes when native threads die\r
- *\r
- */\r
-\r
-DWORD WINAPI Test3_Thread1 (LPVOID lp)\r
-{\r
- LONG *pdw = (LONG*)lp;\r
-\r
- // We're awake. Do something pthready.\r
- //\r
- pthread_t pMe;\r
- if ((pMe = pthread_self()) == NULL)\r
- printf (" 3-1: could not get a pthread_self!\n");\r
- else\r
- printf (" 3-1: ready\n");\r
-\r
- InterlockedIncrement (pdw);\r
-\r
- // Now wait until we see the signal to die.\r
- //\r
- while (*(volatile LONG*)pdw != 5)\r
- ;\r
-\r
- printf (" 3-1: terminating\n");\r
- InterlockedIncrement (pdw);\r
- return 1;\r
-}\r
-\r
-\r
-DWORD WINAPI Test3_Thread2 (LPVOID lp)\r
-{\r
- LONG *pdw = (LONG*)lp;\r
-\r
- // We're awake. Do something pthready.\r
- //\r
- pthread_t pMe;\r
- if ((pMe = pthread_self()) == NULL)\r
- printf (" 3-2: could not get a pthread_self!\n");\r
- else\r
- printf (" 3-2: ready\n");\r
-\r
- InterlockedIncrement (pdw);\r
-\r
- // Now wait until we see the signal to die.\r
- //\r
- while (*(volatile LONG*)pdw != 7)\r
- ;\r
-\r
- printf (" 3-2: terminating\n");\r
- InterlockedIncrement (pdw);\r
- return 1;\r
-}\r
-\r
-\r
-extern "C" void *Test3_Thread3 (void *pdwParam)\r
-{\r
- LONG *pdw = (LONG*)pdwParam;\r
-\r
- // We're awake.\r
- //\r
- printf (" 3-3: ready\n");\r
- InterlockedIncrement (pdw);\r
-\r
- // Now wait until we see the signal to die.\r
- //\r
- while (*(volatile LONG*)pdw != 9)\r
- ;\r
-\r
- printf (" 3-3: terminating\n");\r
- InterlockedIncrement (pdw);\r
- return (void*)1;\r
-}\r
-\r
-\r
-extern "C" void *Test3_Thread4 (void *pdwParam)\r
-{\r
- LONG *pdw = (LONG*)pdwParam;\r
-\r
- // We're awake.\r
- //\r
- printf (" 3-4: ready\n");\r
- InterlockedIncrement (pdw);\r
-\r
- // Now wait until we see the signal to die.\r
- //\r
- while (*(volatile LONG*)pdw != 11)\r
- ;\r
-\r
- printf (" 3-4: terminating\n");\r
- InterlockedIncrement (pdw);\r
- return (void*)1;\r
-}\r
-\r
-\r
-extern "C" void *Test3_ThreadCount (void *pdwParam)\r
-{\r
- volatile LONG *pdw = (LONG*)pdwParam;\r
-\r
- pthread_t pMe;\r
- if ((pMe = pthread_self()) == NULL)\r
- return (void*)0;\r
-\r
- try {\r
- struct rx_queue *pNow = (rx_queue*)pMe;\r
-\r
- for (struct rx_queue *pWalk = pNow->next; pWalk != pNow; pWalk = pWalk->next)\r
- ++(*pdw);\r
-\r
- } catch(...) {\r
- *pdw = 0;\r
- }\r
-\r
- return (void*)*pdw;\r
-}\r
-\r
-size_t Test3_CountActiveQueue (void)\r
-{\r
- DWORD dwArg = 0;\r
- pthread_t pThread;\r
- pthread_create (&pThread, NULL, Test3_ThreadCount, (void *)&dwArg);\r
-\r
- DWORD status;\r
- int rc;\r
- if ((rc = pthread_join (pThread, (void**)&status)) != 0)\r
- {\r
- printf (" 3: counter: pthread_join failed; rc=%lu\n", rc);\r
- return 0;\r
- }\r
-\r
- return dwArg;\r
-}\r
-\r
-BOOL Test3 (void)\r
-{\r
- BOOL rc = TRUE;\r
- printf ("Begin Test3:\n");\r
-\r
- // Find the size of the active queue\r
- //\r
- size_t cInitialQueueSize;\r
- if ((cInitialQueueSize = Test3_CountActiveQueue()) == 0)\r
- {\r
- printf (" 3: unable to determine active queue size\n");\r
- rc = FALSE;\r
- }\r
- else\r
- {\r
- // Start two Win32 threads and two pthreads. We'll use a single, common\r
- // parameter for each thread: dwSignal. Each thread will increment the\r
- // signal param when it's ready for us to go; once that's done, a\r
- // thread will kill itself and inc the signal *again* each die we\r
- // increment the signal:\r
- //\r
- // starts at 0\r
- // thread 1 wakes up and incs signal to 1\r
- // thread 2 wakes up and incs signal to 2\r
- // thread 3 wakes up and incs signal to 3\r
- // thread 4 wakes up and incs signal to 4\r
- // we notice signal is 4, and we increment signal to 5\r
- // thread 1 notices signal is 5, incs to 6 and dies\r
- // we notice signal is 6, and we increment signal to 7\r
- // thread 1 notices signal is 7, incs to 8 and dies\r
- // we notice signal is 8, and we increment signal to 9\r
- // thread 1 notices signal is 9, incs to 10 and dies\r
- // we notice signal is 10, and we increment signal to 11\r
- // thread 1 notices signal is 11, incs to 12 and dies\r
- // we notice signal is 12 and finish our tests\r
- //\r
- volatile LONG dwSignal = 0;\r
- printf (" 3: creating test threads\n");\r
-\r
- DWORD idThread;\r
- CreateThread (0, 0, Test3_Thread1, (LPVOID)&dwSignal, 0, &idThread);\r
- Sleep (500);\r
-\r
- CreateThread (0, 0, Test3_Thread2, (LPVOID)&dwSignal, 0, &idThread);\r
- Sleep (500);\r
-\r
- pthread_attr_t attr;\r
- attr.is_joinable = PTHREAD_CREATE_DETACHED;\r
-\r
- pthread_t hThread;\r
- pthread_create (&hThread, &attr, Test3_Thread3, (void *)&dwSignal);\r
- Sleep (500);\r
-\r
- pthread_create (&hThread, &attr, Test3_Thread4, (void *)&dwSignal);\r
- Sleep (500);\r
-\r
- // Count the active queue again as soon as we're sure all the threads\r
- // are ready for us to do so.\r
- //\r
- while (dwSignal != 4)\r
- ;\r
-\r
- size_t cQueueSize;\r
- if ((cQueueSize = Test3_CountActiveQueue()) == 0)\r
- {\r
- printf (" 3: unable to determine active queue size\n");\r
- rc = FALSE;\r
- }\r
- else if (cQueueSize != cInitialQueueSize+4)\r
- {\r
- printf (" 3: error: active queue wasn't increased by 4\n");\r
- rc = FALSE;\r
- }\r
- else while (rc && (dwSignal < 12))\r
- {\r
- LONG dwTarget = dwSignal +2;\r
- InterlockedIncrement ((LONG*)&dwSignal);\r
-\r
- // wait for a thread to notice the change and kill itself\r
- while (dwSignal != dwTarget)\r
- ;\r
- Sleep (500); // give a little time for cleanup after thread incremented\r
-\r
- if ((cQueueSize = Test3_CountActiveQueue()) == 0)\r
- {\r
- printf (" 3: unable to determine active queue size (dwSignal=%ld)\n", dwSignal);\r
- rc = FALSE;\r
- }\r
- else if (cQueueSize != (cInitialQueueSize + 4 - ((dwTarget -4) /2)))\r
- {\r
- printf (" 3: active queue size did not diminish (dwSignal=%ld)\n", dwSignal);\r
- rc = FALSE;\r
- }\r
- }\r
- }\r
-\r
- printf ("--> Test3 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED\a\a\a"));\r
- return rc;\r
-}\r
-\r
-\r
-/*\r
- * main - Runs all tests (unless the command-line says otherwise)\r
- *\r
- */\r
-int main(int argc, char **argv)\r
-{\r
- DWORD iRunTest[nPASSES_MAX];\r
- for (size_t ii = 0; ii < nPASSES_MAX; ++ii)\r
- iRunTest[ii] = (ii < nTESTS) ? (ii+1) : 0;\r
-\r
- ii = 0;\r
- for (--argc,++argv; argc; --argc,++argv)\r
- {\r
- DWORD iTest;\r
- if ( ((iTest = (size_t)atol (*argv)) > 0) && (iTest <= nTESTS) )\r
- {\r
- if (ii == 0)\r
- memset (iRunTest, 0x00, sizeof(iRunTest));\r
- if (ii < nPASSES_MAX)\r
- iRunTest[ ii++ ] = iTest;\r
- }\r
- }\r
-\r
- BOOL rc = TRUE;\r
-\r
- for (ii = 0; ii < nPASSES_MAX; ++ii)\r
- {\r
- if (iRunTest[ ii ] == 0)\r
- break;\r
- else switch (iRunTest[ ii ])\r
- {\r
- case 1: if (!Test1()) rc = FALSE; break;\r
- case 2: if (!Test2()) rc = FALSE; break;\r
- case 3: if (!Test3()) rc = FALSE; break;\r
- }\r
- }\r
-\r
- return rc;\r
-}\r
-\r
+/*\r\r
+ * Copyright 2000, International Business Machines Corporation and others.\r\r
+ * All Rights Reserved.\r\r
+ * \r\r
+ * This software has been released under the terms of the IBM Public\r\r
+ * License. For details, see the LICENSE file in the top-level source\r\r
+ * directory or online at http://www.openafs.org/dl/license10.html\r\r
+ */\r\r
+\r\r
+/*\r\r
+ * Test pthread interaction with native Win32 threads\r\r
+ *\r\r
+ */\r\r
+\r\r
+\r\r
+#include <afs/param.h>\r\r
+#include <afs/stds.h>\r\r
+\r\r
+#include <windows.h>\r\r
+#include <stdio.h>\r\r
+#include <stdlib.h>\r\r
+\r\r
+extern "C" {\r\r
+#include <pthread.h>\r\r
+#include <assert.h>\r\r
+#include <rx/rx_queue.h>\r\r
+}\r\r
+\r\r
+\r\r
+#define nTESTS 3\r\r
+#define nPASSES_MAX 256\r\r
+\r\r
+\r\r
+/*\r\r
+ * Test1 - Tests the main thread calling pthread_self()\r\r
+ *\r\r
+ */\r\r
+\r\r
+BOOL Test1 (void)\r\r
+{\r\r
+ BOOL rc = TRUE;\r\r
+ printf ("Begin Test1:\n");\r\r
+\r\r
+ PVOID hSelf;\r\r
+ if ((hSelf = pthread_self()) == NULL)\r\r
+ rc = FALSE;\r\r
+\r\r
+ printf (" 1: pthread_self() on main thread returned 0x%08lX\n", hSelf);\r\r
+\r\r
+ printf ("--> Test1 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED\a\a\a"));\r\r
+ return rc;\r\r
+}\r\r
+\r\r
+\r\r
+/*\r\r
+ * Test2 - Tests a Win32 thread's ability to join onto a pthread\r\r
+ *\r\r
+ */\r\r
+#define TEST2_RETURNVALUE 'Test'\r\r
+\r\r
+DWORD WINAPI Test2_Thread1 (LPVOID lp)\r\r
+{\r\r
+ printf (" 1-1: waiting for thread 2 to begin\n");\r\r
+\r\r
+ while (!*(volatile DWORD*)lp)\r\r
+ ;\r\r
+\r\r
+ printf (" 1-1: calling pthread_join (0x%08lX)\n", *(DWORD*)lp);\r\r
+\r\r
+ DWORD status;\r\r
+ int rc;\r\r
+ if ((rc = pthread_join ((pthread_t)(*(DWORD*)lp), (void**)&status)) != 0)\r\r
+ {\r\r
+ printf (" 1-1: pthread_join failed; rc=%lu\n", rc);\r\r
+ return 0;\r\r
+ }\r\r
+\r\r
+ if (status != TEST2_RETURNVALUE)\r\r
+ {\r\r
+ printf (" 1-1: pthread_join succeeded with wrong status (rc=%lu)\n", status);\r\r
+ return 0;\r\r
+ }\r\r
+\r\r
+ printf (" 1-1: pthread_join succeeded; terminating\n");\r\r
+ return 1;\r\r
+}\r\r
+\r\r
+extern "C" void *Test2_Thread2 (void *pdwCommonParam)\r\r
+{\r\r
+ printf (" 1-2: signalling that thread 2 began\n");\r\r
+ *(volatile DWORD*)pdwCommonParam = (DWORD)pthread_self();\r\r
+ Sleep (1500);\r\r
+\r\r
+ printf (" 1-2: terminating\n");\r\r
+ return (void*)TEST2_RETURNVALUE;\r\r
+}\r\r
+\r\r
+BOOL Test2 (void)\r\r
+{\r\r
+ BOOL rc = TRUE;\r\r
+ printf ("Begin Test2:\n");\r\r
+\r\r
+ DWORD dwCommonParam = 0;\r\r
+ DWORD idThread;\r\r
+\r\r
+ printf (" 1: creating win32 thread\n");\r\r
+ HANDLE hThread1 = CreateThread (0, 0, Test2_Thread1, (LPVOID)&dwCommonParam, 0, &idThread);\r\r
+ Sleep(500);\r\r
+\r\r
+ printf (" 1: creating pthread thread\n");\r\r
+ pthread_t hThread2;\r\r
+ pthread_create (&hThread2, NULL, Test2_Thread2, (void *)&dwCommonParam);\r\r
+ Sleep(500);\r\r
+\r\r
+ printf (" 1: blocking until win32 thread (thread1) terminates...\n");\r\r
+\r\r
+ WaitForSingleObject (hThread1, INFINITE);\r\r
+ GetExitCodeThread (hThread1, (ULONG*)&rc);\r\r
+\r\r
+ printf (" 1: detected thread1 termination\n");\r\r
+\r\r
+ printf ("--> Test2 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED\a\a\a"));\r\r
+ return rc;\r\r
+}\r\r
+\r\r
+\r\r
+/*\r\r
+ * Test3 - Makes sure the pthread library recognizes when native threads die\r\r
+ *\r\r
+ */\r\r
+\r\r
+DWORD WINAPI Test3_Thread1 (LPVOID lp)\r\r
+{\r\r
+ LONG *pdw = (LONG*)lp;\r\r
+\r\r
+ // We're awake. Do something pthready.\r\r
+ //\r\r
+ pthread_t pMe;\r\r
+ if ((pMe = pthread_self()) == NULL)\r\r
+ printf (" 3-1: could not get a pthread_self!\n");\r\r
+ else\r\r
+ printf (" 3-1: ready\n");\r\r
+\r\r
+ InterlockedIncrement (pdw);\r\r
+\r\r
+ // Now wait until we see the signal to die.\r\r
+ //\r\r
+ while (*(volatile LONG*)pdw != 5)\r\r
+ ;\r\r
+\r\r
+ printf (" 3-1: terminating\n");\r\r
+ InterlockedIncrement (pdw);\r\r
+ return 1;\r\r
+}\r\r
+\r\r
+\r\r
+DWORD WINAPI Test3_Thread2 (LPVOID lp)\r\r
+{\r\r
+ LONG *pdw = (LONG*)lp;\r\r
+\r\r
+ // We're awake. Do something pthready.\r\r
+ //\r\r
+ pthread_t pMe;\r\r
+ if ((pMe = pthread_self()) == NULL)\r\r
+ printf (" 3-2: could not get a pthread_self!\n");\r\r
+ else\r\r
+ printf (" 3-2: ready\n");\r\r
+\r\r
+ InterlockedIncrement (pdw);\r\r
+\r\r
+ // Now wait until we see the signal to die.\r\r
+ //\r\r
+ while (*(volatile LONG*)pdw != 7)\r\r
+ ;\r\r
+\r\r
+ printf (" 3-2: terminating\n");\r\r
+ InterlockedIncrement (pdw);\r\r
+ return 1;\r\r
+}\r\r
+\r\r
+\r\r
+extern "C" void *Test3_Thread3 (void *pdwParam)\r\r
+{\r\r
+ LONG *pdw = (LONG*)pdwParam;\r\r
+\r\r
+ // We're awake.\r\r
+ //\r\r
+ printf (" 3-3: ready\n");\r\r
+ InterlockedIncrement (pdw);\r\r
+\r\r
+ // Now wait until we see the signal to die.\r\r
+ //\r\r
+ while (*(volatile LONG*)pdw != 9)\r\r
+ ;\r\r
+\r\r
+ printf (" 3-3: terminating\n");\r\r
+ InterlockedIncrement (pdw);\r\r
+ return (void*)1;\r\r
+}\r\r
+\r\r
+\r\r
+extern "C" void *Test3_Thread4 (void *pdwParam)\r\r
+{\r\r
+ LONG *pdw = (LONG*)pdwParam;\r\r
+\r\r
+ // We're awake.\r\r
+ //\r\r
+ printf (" 3-4: ready\n");\r\r
+ InterlockedIncrement (pdw);\r\r
+\r\r
+ // Now wait until we see the signal to die.\r\r
+ //\r\r
+ while (*(volatile LONG*)pdw != 11)\r\r
+ ;\r\r
+\r\r
+ printf (" 3-4: terminating\n");\r\r
+ InterlockedIncrement (pdw);\r\r
+ return (void*)1;\r\r
+}\r\r
+\r\r
+\r\r
+extern "C" void *Test3_ThreadCount (void *pdwParam)\r\r
+{\r\r
+ volatile LONG *pdw = (LONG*)pdwParam;\r\r
+\r\r
+ pthread_t pMe;\r\r
+ if ((pMe = pthread_self()) == NULL)\r\r
+ return (void*)0;\r\r
+\r\r
+ try {\r\r
+ struct rx_queue *pNow = (rx_queue*)pMe;\r\r
+\r\r
+ for (struct rx_queue *pWalk = pNow->next; pWalk != pNow; pWalk = pWalk->next)\r\r
+ ++(*pdw);\r\r
+\r\r
+ } catch(...) {\r\r
+ *pdw = 0;\r\r
+ }\r\r
+\r\r
+ return (void*)*pdw;\r\r
+}\r\r
+\r\r
+size_t Test3_CountActiveQueue (void)\r\r
+{\r\r
+ DWORD dwArg = 0;\r\r
+ pthread_t pThread;\r\r
+ pthread_create (&pThread, NULL, Test3_ThreadCount, (void *)&dwArg);\r\r
+\r\r
+ DWORD status;\r\r
+ int rc;\r\r
+ if ((rc = pthread_join (pThread, (void**)&status)) != 0)\r\r
+ {\r\r
+ printf (" 3: counter: pthread_join failed; rc=%lu\n", rc);\r\r
+ return 0;\r\r
+ }\r\r
+\r\r
+ return dwArg;\r\r
+}\r\r
+\r\r
+BOOL Test3 (void)\r\r
+{\r\r
+ BOOL rc = TRUE;\r\r
+ printf ("Begin Test3:\n");\r\r
+\r\r
+ // Find the size of the active queue\r\r
+ //\r\r
+ size_t cInitialQueueSize;\r\r
+ if ((cInitialQueueSize = Test3_CountActiveQueue()) == 0)\r\r
+ {\r\r
+ printf (" 3: unable to determine active queue size\n");\r\r
+ rc = FALSE;\r\r
+ }\r\r
+ else\r\r
+ {\r\r
+ // Start two Win32 threads and two pthreads. We'll use a single, common\r\r
+ // parameter for each thread: dwSignal. Each thread will increment the\r\r
+ // signal param when it's ready for us to go; once that's done, a\r\r
+ // thread will kill itself and inc the signal *again* each die we\r\r
+ // increment the signal:\r\r
+ //\r\r
+ // starts at 0\r\r
+ // thread 1 wakes up and incs signal to 1\r\r
+ // thread 2 wakes up and incs signal to 2\r\r
+ // thread 3 wakes up and incs signal to 3\r\r
+ // thread 4 wakes up and incs signal to 4\r\r
+ // we notice signal is 4, and we increment signal to 5\r\r
+ // thread 1 notices signal is 5, incs to 6 and dies\r\r
+ // we notice signal is 6, and we increment signal to 7\r\r
+ // thread 1 notices signal is 7, incs to 8 and dies\r\r
+ // we notice signal is 8, and we increment signal to 9\r\r
+ // thread 1 notices signal is 9, incs to 10 and dies\r\r
+ // we notice signal is 10, and we increment signal to 11\r\r
+ // thread 1 notices signal is 11, incs to 12 and dies\r\r
+ // we notice signal is 12 and finish our tests\r\r
+ //\r\r
+ volatile LONG dwSignal = 0;\r\r
+ printf (" 3: creating test threads\n");\r\r
+\r\r
+ DWORD idThread;\r\r
+ CreateThread (0, 0, Test3_Thread1, (LPVOID)&dwSignal, 0, &idThread);\r\r
+ Sleep (500);\r\r
+\r\r
+ CreateThread (0, 0, Test3_Thread2, (LPVOID)&dwSignal, 0, &idThread);\r\r
+ Sleep (500);\r\r
+\r\r
+ pthread_attr_t attr;\r\r
+ attr.is_joinable = PTHREAD_CREATE_DETACHED;\r\r
+\r\r
+ pthread_t hThread;\r\r
+ pthread_create (&hThread, &attr, Test3_Thread3, (void *)&dwSignal);\r\r
+ Sleep (500);\r\r
+\r\r
+ pthread_create (&hThread, &attr, Test3_Thread4, (void *)&dwSignal);\r\r
+ Sleep (500);\r\r
+\r\r
+ // Count the active queue again as soon as we're sure all the threads\r\r
+ // are ready for us to do so.\r\r
+ //\r\r
+ while (dwSignal != 4)\r\r
+ ;\r\r
+\r\r
+ size_t cQueueSize;\r\r
+ if ((cQueueSize = Test3_CountActiveQueue()) == 0)\r\r
+ {\r\r
+ printf (" 3: unable to determine active queue size\n");\r\r
+ rc = FALSE;\r\r
+ }\r\r
+ else if (cQueueSize != cInitialQueueSize+4)\r\r
+ {\r\r
+ printf (" 3: error: active queue wasn't increased by 4\n");\r\r
+ rc = FALSE;\r\r
+ }\r\r
+ else while (rc && (dwSignal < 12))\r\r
+ {\r\r
+ LONG dwTarget = dwSignal +2;\r\r
+ InterlockedIncrement ((LONG*)&dwSignal);\r\r
+\r\r
+ // wait for a thread to notice the change and kill itself\r\r
+ while (dwSignal != dwTarget)\r\r
+ ;\r\r
+ Sleep (500); // give a little time for cleanup after thread incremented\r\r
+\r\r
+ if ((cQueueSize = Test3_CountActiveQueue()) == 0)\r\r
+ {\r\r
+ printf (" 3: unable to determine active queue size (dwSignal=%ld)\n", dwSignal);\r\r
+ rc = FALSE;\r\r
+ }\r\r
+ else if (cQueueSize != (cInitialQueueSize + 4 - ((dwTarget -4) /2)))\r\r
+ {\r\r
+ printf (" 3: active queue size did not diminish (dwSignal=%ld)\n", dwSignal);\r\r
+ rc = FALSE;\r\r
+ }\r\r
+ }\r\r
+ }\r\r
+\r\r
+ printf ("--> Test3 %s\n", (rc) ? TEXT("succeeded") : TEXT("FAILED\a\a\a"));\r\r
+ return rc;\r\r
+}\r\r
+\r\r
+\r\r
+/*\r\r
+ * main - Runs all tests (unless the command-line says otherwise)\r\r
+ *\r\r
+ */\r\r
+int main(int argc, char **argv)\r\r
+{\r\r
+ DWORD iRunTest[nPASSES_MAX];\r\r
+ for (size_t ii = 0; ii < nPASSES_MAX; ++ii)\r\r
+ iRunTest[ii] = (ii < nTESTS) ? (ii+1) : 0;\r\r
+\r\r
+ ii = 0;\r\r
+ for (--argc,++argv; argc; --argc,++argv)\r\r
+ {\r\r
+ DWORD iTest;\r\r
+ if ( ((iTest = (size_t)atol (*argv)) > 0) && (iTest <= nTESTS) )\r\r
+ {\r\r
+ if (ii == 0)\r\r
+ memset (iRunTest, 0x00, sizeof(iRunTest));\r\r
+ if (ii < nPASSES_MAX)\r\r
+ iRunTest[ ii++ ] = iTest;\r\r
+ }\r\r
+ }\r\r
+\r\r
+ BOOL rc = TRUE;\r\r
+\r\r
+ for (ii = 0; ii < nPASSES_MAX; ++ii)\r\r
+ {\r\r
+ if (iRunTest[ ii ] == 0)\r\r
+ break;\r\r
+ else switch (iRunTest[ ii ])\r\r
+ {\r\r
+ case 1: if (!Test1()) rc = FALSE; break;\r\r
+ case 2: if (!Test2()) rc = FALSE; break;\r\r
+ case 3: if (!Test3()) rc = FALSE; break;\r\r
+ }\r\r
+ }\r\r
+\r\r
+ return rc;\r\r
+}\r\r
+\r\r
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;
/* 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;
*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;
}
char *cmdLine;
+int
cmdDispatch()
{
#define MAXV 100
*/
doDispatch(targc, targv, 1);
cmd_FreeArgv(targv);
+ return(0);
}
statusWatcher()
struct ubik_client *uclient;
{ /*bc_EvalVolumeSet */
int code;
- int a, b, c;
static afs_int32 use = 2;
if (use == 2) { /* Use EvalVolumeSet2() */
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;
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;
char *arock;
{
afs_int32 code;
- afs_int32 index, dumpID;
struct rx_connection *tconn;
afs_int32 portOffset = 0;
int usefulJobRunning = 1;
extern dlqlinkT statusHead;
- statusP ptr;
- dlqlinkP dptr;
com_err(whoami, 0, "waiting for job termination");
struct cmd_syndesc *as;
char *arock;
{
- int i;
afs_int32 prevTime;
- struct bc_dumpTask *td;
dlqlinkP ptr;
statusP statusPtr;
char ds[50];
struct bc_dumpTask *td;
char *tp;
char tbuffer[256];
- afs_int32 code;
dlqlinkP ptr;
statusP statusPtr;
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;
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;
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();
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
budb_volumeList vl;
afs_int32 last, next, dbTime;
afs_int32 tapedumpid;
- afs_int32 numTapes;
int tapeNumber;
int i;
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));
fromptr->dlq_next = fromptr;
fromptr->dlq_prev = fromptr;
+ return (0);
}
/* dlqUnlinkb
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;
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;
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;
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))
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();
MyBeforeProc(as)
register struct cmd_syndesc *as;
{
- char *rock;
afs_int32 code;
/* Handling the command line opcode */
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;
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;
/* general */
+void
clearStatus(taskId, flags)
afs_uint32 taskId;
afs_uint32 flags;
return (ptr);
}
+void
setStatus(taskId, flags)
afs_uint32 taskId;
afs_uint32 flags;
bcdb_GetTextFile(register udbClientTextP ctPtr)
{
afs_int32 bufferSize;
- afs_int32 offset, nextOffset, chunkSize;
+ afs_int32 offset, nextOffset;
charListT charList;
afs_int32 code = 0;
int localauth;
char *cellName;
{
- afs_int32 serverList[MAXSERVERS];
- char hostname[256];
struct ktc_principal principal;
struct ktc_token token;
struct afsconf_cell info;
return (code);
}
- abort:
+ /* abort: */
return (0);
}
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;
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;
afs_int32
bc_UpdateVolumeSet()
{
- struct bc_dumpSchedule *dumpPtr, *nextDumpPtr;
struct udbHandleS *uhptr = &udbHandle;
udbClientTextP ctPtr;
afs_int32 code;
default:
db_panic("illegal hash function");
}
+ /* not reached */
+ return 0;
}
/* ht_LookupEntry
int tableLength; /* # entries */
int blockLength; /* # blocks */
int hashIndex;
- int blockIndex, entryIndex;
int old;
int i;
afs_int32 code = 0;
retval = open(mktemp(st), O_RDWR | O_CREAT | O_EXCL, 0600);
#endif
- error_exit:
return (retval);
}
#endif
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;
FILE *recreateFile; /* not used */
{
afs_int32 eof;
- int j, bmsize;
+ int bmsize;
afs_int32 code = 0, tcode;
extern int nBlocks; /* no. blocks in database */
char *path = 0;
dbadr dbAddr;
int type, old, length, hash;
- int block = 0, index = 0;
struct memoryHashTable *mht;
afs_int32 eval, code = 0;
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);
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);
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);
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);
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);
afs_int32 code = 0;
/* for volume setup */
- struct tc_dumpDesc *dumpDescPtr;
int i;
int failedvolumes = 0;
int dumpedvolumes = 0;
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;
} 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.
*/
strcpy(vhptr->dumpSetName, nodePtr->dumpSetName);
strcpy(vhptr->preamble, "H++NAME#");
strcpy(vhptr->postamble, "T--NAME#");
- error_exit:
+
return (code);
}
* * notes:
* * only external clients are in recoverDb.c. Was static. PA
*/
+void
FFlushInput()
{
int w;
afs_uint32 dbDumpId;
int tapecount;
{
- afs_int32 count;
-
afs_int32 code = 0;
int pid;
struct butm_tapeInfo *tapeInfoPtr;
{
afs_int32 code;
- afs_int32 wcode;
int cpid, status, rcpid;
code = butm_Dismount(tapeInfoPtr);
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;
}
{
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 */
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;
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 =
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;
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
}
afs_int32 *dSize; /* dataSize */
{
afs_int32 offset, s;
- afs_int32 code;
int found;
*dSize = size;
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;
char *name;
{
char *pos;
- int i;
char buffer[256];
pos = strrchr(name, '/');
struct cmd_syndesc *as;
char *arock;
{
- char *pid;
register afs_int32 code;
struct rx_securityClass *(securityObjects[3]);
struct rx_service *service;
int localauth;
/*process arguments */
afs_int32 portOffset = 0;
- afs_int32 logIOName;
#ifdef AFS_PTHREAD_ENV
pthread_t dbWatcherPid;
pthread_attr_t tattr;
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) {
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 */
#else
PROCESS pid;
#endif
- struct tc_tapeLabel *mylabel;
struct labelTapeIf *ptr;
statusP statusPtr;
afs_int32 code;
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;
#else
PROCESS pid;
#endif
+#endif
extern afs_int32 DeleteDump();
extern statusP createStatusNode();
extern afs_int32 allocTaskId();
int interactiveFlag;
char tapeName[BU_MAXTAPELEN];
char strlevel[5];
- afs_int32 i;
struct timeval tp;
struct timezone tzp;
afs_int32 curTime;
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;
struct budb_tapeEntry *tapeEntPtr;
struct budb_dumpEntry *dumpEntryPtr;
{
- afs_int32 code;
-
memset(dumpEntryPtr, 0, sizeof(struct budb_dumpEntry));
dumpEntryPtr->id = tapeEntPtr->dump;
{
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;
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;
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;
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;
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);
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);
}
int count;
{
afs_int32 code = 0;
- afs_int32 fcode;
- int cpid, status, rcpid, stat;
struct progress *p;
afs_int32 error = 0;
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;
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)
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");
file_ReadFileBegin(info)
struct butm_tapeInfo *info;
{
- struct fileMark mark;
afs_int32 code = 0;
afs_int32 blockType;
file_ReadFileEnd(info)
struct butm_tapeInfo *info;
{
- struct fileMark mark;
afs_int32 code = 0;
afs_int32 blockType;
struct butm_tapeInfo *info;
afs_int32 position;
{
- struct fileMark mark;
afs_int32 code = 0;
afs_int32 blockType;
afs_int32 w;
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);
}
int
isequal(char *msg1, char *msg2, char *disp)
{
- int x;
strlwr(msg1);
strlwr(msg2);
if (strcmp(msg1, msg2) != 0)
int
SetSysEnv(int argc, char *argv[])
{
- long ret;
DWORD dwResult;
printf("assignment %s %s\n", argv[2], argv[3]);
Addkey("HKEY_LOCAL_MACHINE",
#####################
GENERATED_FILES = \
+ $(VERSFILE).c \
key_perm.h \
p_table.h \
s_table.h \
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.
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];
}
#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;
if ((write(fd, &nfailures, sizeof(int)) != sizeof(int))
|| (write(fd, &lasttime, sizeof(afs_int32)) != sizeof(afs_int32)))
perror("kaux_write()");
-
+ return 0;
}
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;
if (keyCache[i].used) {
if (info->kcUsed < KADEBUGKCINFOSIZE) {
int j = info->kcUsed;
- int k;
char principal[sizeof(keyCache[0].name) +
sizeof(keyCache[0].inst)];
(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, ".");
/* Add a key to the key cache, expanding it if necessary. */
+void
ka_Encache(name, inst, kvno, key, superseded)
char *name;
char *inst;
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))
ViceLog(0, ("Starting to process AuthServer requests\n"));
rx_ServerProc(); /* donate this LWP */
+ return 0;
}
}
rc = 1;
- fail_SetUserAccess:
-
if (st != NULL) {
*st = tst;
}
*/
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;
if (nfds == 0)
return;
- n = INTS_PER_FDS(nfds);
- for (i=0; i<n; i++) {
+ for (i=0,n = INTS_PER_FDS(nfds); i<n; i++) {
fd_set1->FDS_BITS[i] |= fd_set2->FDS_BITS[i];
}
#endif
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)
{
#if defined(SUPERGROUPS)
if (as && !strcmp(as->name, "help"))
- return;
+ return 0;
if (pruclient) {
/* Need to shutdown the ubik_client & other connections */
pr_End();
}
#else
if (!strcmp(as->name, "help"))
- return;
+ return 0;
/* Need to shutdown the ubik_client & other connections */
pr_End();
rx_Finalize();
printf(".\n");
}
- done:
if (lnames.namelist_val)
free(lnames.namelist_val);
if (lids.idlist_val)
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
return y;
}
+void
CreateUser(u)
int u;
{
ownerUser = id;
strcpy(ownerUserName, name);
}
- return;
}
+void
CreateGroup(g)
int g;
{
lastGroup = id;
lastGroupPrefix = ownerName;
}
- return;
}
int
return -1; /* none left */
}
+void
AddUser(u, g)
int 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;
{
printf("Removing user (%di) from group (%di)\n", ui, gi);
population[u * number + g]--;
nRems++;
- return;
}
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;
}
}
*ascii = 0; /* terminate string */
+ return 0;
}
/* This runs various tests on the server. It creates, then deletes, a bunch of
struct cmd_syndesc *as;
char *arock;
{
- afs_int32 code;
if (strlen(tmp_conf_file))
unlink(tmp_conf_file);
if (strlen(tmp_cell_file))
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
$(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
#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"
*/
atrans->locktype = 0;
+ return 0;
}
/* debugging hooks */
aparm->anyReadLocks = rwlock.readers_reading;
aparm->anyWriteLocks = ((rwlock.excl_locked == WRITE_LOCK) ? 1 : 0);
}
+ return 0;
}
#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
{
extern prlist SystemAnyUserCPS;
afs_int32 hrights = 0;
+#ifndef AFS_PTHREAD_ENV
int code;
+#endif
if (acl_CheckRights(ACL, &SystemAnyUserCPS, anyrights) != 0) {
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. */
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;
FS_UNLOCK;
}
#endif /* FS_STATS_DETAILED */
- out:
return errorCode;
} /*common_GiveUpCallBacks */
SRXAFS_GetCapabilities(struct rx_call * acall, Capabilities * capabilities)
{
afs_int32 *dataBuffP;
- afs_int32 *dataP;
afs_int32 dataBytes;
dataBytes = 1 * sizeof(afs_int32);
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
{
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
#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
/*
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 */
{
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);
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];
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];
static int
ClearHostCallbacks_r(struct host *hp, int locked)
{
- struct interfaceAddr interf;
int code;
int held = 0;
char hoststr[16];
struct client entry[CESPERBLOCK];
};
+static void h_TossStuff_r(register struct host *host);
+
/*
* Make sure the subnet macros have been defined.
*/
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;
* 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;
struct Identity *identP = NULL;
afs_int32 haddr;
afs_int32 hport;
- int i, j, count;
char hoststr[16], hoststr2[16];
Capabilities caps;
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;
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;
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);) {
ShutDownAndCore(int dopanic)
{
time_t now = time(0);
- char *tstr;
char tbuffer[32];
ViceLog(0,
afs_int32
WriteSysIdFile()
{
- afs_int32 fd, nentries, i;
+ afs_int32 fd, i;
struct versionStamp vsn;
struct afs_stat status;
afsUUID uuid;
afs_int32
InitVL()
{
- int (*old) ();
afs_int32 code;
- afs_int32 cnt, i;
extern int rxi_numNetAddrs;
extern afs_uint32 rxi_NetAddrs[];
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;
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 */
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;
record[i].type);
}
}
+ return 0;
}
main(argc, argv)
int
fd_close(FdHandle_t * fdP)
{
- FD_t closeFd;
IHandle_t *ihP;
if (!fdP)
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
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 */
}
#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 */
}
{
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
#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!";
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));
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); */
{
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); */
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));
VolListPartitions(struct rx_call *acid, struct pIDs *partIds)
{
char namehead[9];
- int code;
char i;
strcpy(namehead, "/vicep"); /*7 including null terminator */
afs_int32 server, part;
{
int totalOK, totalNotOK, totalBusy;
- afs_int32 vcode, vcode2;
DisplayFormat(pntr, server, part, &totalOK, &totalNotOK, &totalBusy, 0, 1,
1);
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) {
*part = rentry->serverPartition[index];
return 0;
}
+ fprintf(STDERR,
+ "unexpected volume type for volume %lu\n",
+ (unsigned long)volid);
+ return -1;
}
static
afs_int32 totalFail = 0;
int previdx = -1, error, same;
int comp = 0;
- char compstr[50];
struct cmd_item *ti;
char *ccode;
int match;
{
afs_int32 vcode;
afs_int32 i, j;
- struct VLCallBack unused;
afs_int32 *addrp;
bulkaddrs m_addrs;
ListAddrByAttributes m_attrs;
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;
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;
}
free(partEnts.partEntries_val);
}
- out:
+
+ /* out: */
if (code)
fprintf(STDERR,
"Could not fetch the list of partitions from the server\n");