]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
This commit was generated by cvs2svn to compensate for changes in r570,
authorSam Hartman <hartmans@debian.org>
Sun, 13 Apr 2003 19:08:27 +0000 (19:08 +0000)
committerSam Hartman <hartmans@debian.org>
Sun, 13 Apr 2003 19:08:27 +0000 (19:08 +0000)
which included commits to RCS files with non-trunk default branches.

94 files changed:
acconfig.h
acinclude.m4
configure-libafs.in
src/WINNT/afsd/afsd.c
src/WINNT/afsd/cm_callback.c
src/WINNT/afsd/cm_conn.c
src/WINNT/afsd/cm_ioctl.c
src/WINNT/afsd/cm_rpc.c
src/WINNT/afsd/smb3.c
src/WINNT/client_creds/shortcut.cpp
src/WINNT/client_exp/shell_ext.cpp
src/afs/DARWIN/osi_vnodeops.c
src/afs/IRIX/osi_vfsops.c
src/afs/LINUX/osi_groups.c
src/afs/LINUX/osi_sleep.c
src/afs/UKERNEL/afs_usrops.c
src/afs/afs_analyze.c
src/afs/afs_callback.c
src/afs/afs_cell.c
src/afs/afs_dcache.c
src/afs/afs_dynroot.c
src/afs/afs_init.c
src/afs/afs_nfsdisp.c
src/afs/afs_osi.c
src/afs/afs_osi_pag.c
src/afs/afs_osi_vget.c
src/afs/afs_prototypes.h
src/afs/afs_server.c
src/afs/afs_stats.h
src/afs/afs_util.c
src/afs/afs_vcache.c
src/afs/afs_volume.c
src/afsd/Makefile.in
src/afsd/afsd.c
src/butc/Makefile.in
src/cf/linux-test4.m4
src/cmd/cmd.c
src/config/afs_args.h
src/config/afs_sysnames.h
src/config/param.s390_linux22.h
src/config/param.sunx86_57_usr.h
src/config/param.sunx86_58_usr.h
src/fsint/afscbint.xg
src/fsprobe/fsprobe_callback.c
src/inetd/Makefile.in
src/kauth/kaprocs.c
src/kauth/kaserver.c
src/kauth/kaserver.h
src/kauth/krb_udp.c
src/libacl/aclprocs.c
src/libacl/netprocs.c
src/libafs/MakefileProto.SOLARIS.in
src/libafsrpc/afsrpc.def
src/lwp/test/selclient.c
src/lwp/test/selserver.c
src/lwp/test/selsubs.c
src/rx/DARWIN/rx_knet.c
src/rx/FBSD/rx_knet.c
src/rx/LINUX/rx_kmutex.h
src/rx/LINUX/rx_knet.c
src/rx/SOLARIS/rx_knet.c
src/rx/rx_globals.h
src/rx/rx_kcommon.c
src/rx/rx_kcommon.h
src/rx/rx_pthread.c
src/rx/rx_rdwr.c
src/rx/xdr_mem.c
src/rxkad/rxkad_server.c
src/rxkad/ticket.c
src/rxkad/ticket5.c
src/rxkad/v5der.c
src/shlibafsrpc/Makefile.in
src/shlibafsrpc/mapfile
src/tviced/Makefile.in
src/ubik/beacon.c
src/util/assert.h
src/util/pthread_nosigs.h
src/util/secutil_nt.c
src/venus/cmdebug.c
src/venus/test/owntest.c
src/vfsck/setup.c
src/viced/Makefile.in
src/viced/callback.c
src/viced/host.c
src/viced/viced.c
src/viced/viced.h
src/vol/clone.c
src/vol/fssync.c
src/vol/nuke.c
src/vol/vnode.c
src/vol/vol-salvage.c
src/vol/volume.c
src/volser/dumpstuff.c
src/xstat/xstat_fs_callback.c

index 6244b45a98dd0a7efa9a105a6739e2759dbeb8dc..679dd81add25a8df0ad01591dc1b409bc2ca87ce 100644 (file)
@@ -29,17 +29,26 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
 #undef FAST_RESTART
 #undef FULL_LISTVOL_SWITCH
 
+#undef COMPLETION_H_EXISTS
+#undef DEFINED_FOR_EACH_PROCESS
+#undef DEFINED_PREV_TASK
+#undef EXPORTED_KALLSYMS_ADDRESS
+#undef EXPORTED_KALLSYMS_SYMBOL
+#undef EXPORTED_SYS_CALL_TABLE
+#undef EXPORTED_TASKLIST_LOCK
 #undef INODE_SETATTR_NOT_VOID
+#undef RECALC_SIGPENDING_TAKES_VOID
 #undef STRUCT_ADDRESS_SPACE_HAS_GFP_MASK
 #undef STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
-#undef STRUCT_INODE_HAS_I_TRUNCATE_SEM
-#undef STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS
+#undef STRUCT_FS_HAS_FS_ROLLED
 #undef STRUCT_INODE_HAS_I_DEVICES
-#undef EXPORTED_TASKLIST_LOCK
-#undef EXPORTED_SYS_CALL_TABLE
-#undef EXPORTED_KALLSYMS_SYMBOL
-#undef EXPORTED_KALLSYMS_ADDRESS
-#undef COMPLETION_H_EXISTS
+#undef STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS
+#undef STRUCT_INODE_HAS_I_TRUNCATE_SEM
+#undef STRUCT_TASK_STRUCT_HAS_PARENT
+#undef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
+#undef STRUCT_TASK_STRUCT_HAS_SIG
+#undef STRUCT_TASK_STRUCT_HAS_SIGHAND
+#undef STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK
 #undef ssize_t
 
 /* glue for RedHat kernel bug */
index 5f0f7436351e101fc6cf39ab8fd442c9f85c3721..abbbaf8af9b242768fdb200734afe304c52d86b8 100644 (file)
@@ -87,7 +87,10 @@ case $system in
                 if test "x$with_linux_kernel_headers" != "x"; then
                   LINUX_KERNEL_PATH="$with_linux_kernel_headers"
                 else
-                  LINUX_KERNEL_PATH="/usr/src/linux"
+                  LINUX_KERNEL_PATH="/usr/src/linux-2.4"
+                  if test ! -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
+                    LINUX_KERNEL_PATH="/usr/src/linux"
+                  fi
                 fi
                 if test -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
                  linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -1`
@@ -140,24 +143,34 @@ case $system in
                   [LINUX_BUILD_VNODE_FROM_INODE(config,afs)],
                   [LINUX_BUILD_VNODE_FROM_INODE(src/config,src/afs/LINUX)]
                 )
+                LINUX_COMPLETION_H_EXISTS
+                LINUX_DEFINES_FOR_EACH_PROCESS
+                LINUX_DEFINES_PREV_TASK
+                LINUX_EXPORTS_TASKLIST_LOCK
                 LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
                 LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_GFP_MASK
                 LINUX_FS_STRUCT_INODE_HAS_I_TRUNCATE_SEM
                 LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS
                 LINUX_FS_STRUCT_INODE_HAS_I_DEVICES
                 LINUX_INODE_SETATTR_RETURN_TYPE
-                LINUX_COMPLETION_H_EXISTS
-                LINUX_EXPORTS_TASKLIST_LOCK
                 LINUX_NEED_RHCONFIG
+                LINUX_RECALC_SIGPENDING_ARG_TYPE
+                LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_PARENT
+                LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_REAL_PARENT
+                LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIG
+                LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGHAND
+                LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK
                 LINUX_WHICH_MODULES
                  if test "x$ac_cv_linux_config_modversions" = "xno"; then
                    AC_MSG_WARN([Cannot determine sys_call_table status. assuming it's exported])
                    ac_cv_linux_exports_sys_call_table=yes
                  else
-                   LINUX_EXPORTS_SYS_CALL_TABLE
-                   LINUX_EXPORTS_KALLSYMS_SYMBOL
-                   LINUX_EXPORTS_KALLSYMS_ADDRESS
                    LINUX_EXPORTS_INIT_MM
+                   LINUX_EXPORTS_KALLSYMS_ADDRESS
+                   LINUX_EXPORTS_KALLSYMS_SYMBOL
+                   LINUX_EXPORTS_SYS_CALL_TABLE
+                   LINUX_EXPORTS_SYS_CHDIR
+                   LINUX_EXPORTS_SYS_CLOSE
                    if test "x$ac_cv_linux_exports_sys_call_table" = "xno"; then
                          linux_syscall_method=none
                          if test "x$ac_cv_linux_exports_init_mm" = "xyes"; then
@@ -172,6 +185,12 @@ case $system in
                          if test "x$linux_syscall_method" = "xnone"; then
                         AC_MSG_ERROR([no available sys_call_table access method])
                          fi
+                        if test "x$ac_cv_linux_exports_sys_chdir" = "xyes" ; then
+                         AC_DEFINE(EXPORTED_SYS_CHDIR, 1, [define if your linux kernel exports sys_chdir])
+                        fi
+                        if test "x$ac_cv_linux_exports_sys_close" = "xyes" ; then
+                         AC_DEFINE(EXPORTED_SYS_CLOSE, 1, [define if your linux kernel exports sys_close])
+                        fi
                    fi
                  fi
                 if test "x$ac_cv_linux_exports_tasklist_lock" = "xyes" ; then
@@ -187,7 +206,13 @@ case $system in
                   AC_DEFINE(EXPORTED_KALLSYMS_ADDRESS)
                  fi
                 if test "x$ac_cv_linux_completion_h_exists" = "xyes" ; then
-                 AC_DEFINE(COMPLETION_H_EXISTS, 1, [define if your h_exists exists])
+                 AC_DEFINE(COMPLETION_H_EXISTS, 1, [define if completion_h exists])
+                fi
+                if test "x$ac_cv_linux_defines_for_each_process" = "xyes" ; then
+                 AC_DEFINE(DEFINED_FOR_EACH_PROCESS, 1, [define if for_each_process defined])
+                fi
+                if test "x$ac_cv_linux_defines_prev_task" = "xyes" ; then
+                 AC_DEFINE(DEFINED_PREV_TASK, 1, [define if prev_task defined])
                 fi
                 if test "x$ac_cv_linux_func_inode_setattr_returns_int" = "xyes" ; then
                  AC_DEFINE(INODE_SETATTR_NOT_VOID, 1, [define if your setattr return return non-void])
@@ -205,7 +230,25 @@ case $system in
                  AC_DEFINE(STRUCT_INODE_HAS_I_DEVICES, 1, [define if you struct inode has i_devices])
                 fi
                 if test "x$ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers" = "xyes"; then 
-                 AC_DEFINE(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, 1, [define if you struct inode has data_buffers])
+                 AC_DEFINE(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, 1, [define if your struct inode has data_buffers])
+                fi
+                if test "x$ac_cv_linux_func_recalc_sigpending_takes_void" = "xyes"; then 
+                 AC_DEFINE(RECALC_SIGPENDING_TAKES_VOID, 1, [define if your recalc_sigpending takes void])
+                fi
+                if test "x$ac_cv_linux_sched_struct_task_struct_has_parent" = "xyes"; then 
+                 AC_DEFINE(STRUCT_TASK_STRUCT_HAS_PARENT, 1, [define if your struct task_struct has parent])
+                fi
+                if test "x$ac_cv_linux_sched_struct_task_struct_has_real_parent" = "xyes"; then 
+                 AC_DEFINE(STRUCT_TASK_STRUCT_HAS_REAL_PARENT, 1, [define if your struct task_struct has real_parent])
+                fi
+                if test "x$ac_cv_linux_sched_struct_task_struct_has_sigmask_lock" = "xyes"; then 
+                 AC_DEFINE(STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK, 1, [define if your struct task_struct has sigmask_lock])
+                fi
+                if test "x$ac_cv_linux_sched_struct_task_struct_has_sighand" = "xyes"; then 
+                 AC_DEFINE(STRUCT_TASK_STRUCT_HAS_SIGHAND, 1, [define if your struct task_struct has sighand])
+                fi
+                if test "x$ac_cv_linux_sched_struct_task_struct_has_sig" = "xyes"; then 
+                 AC_DEFINE(STRUCT_TASK_STRUCT_HAS_SIG, 1, [define if your struct task_struct has sig])
                 fi
                 :
                fi
@@ -215,6 +258,7 @@ case $system in
                 AC_MSG_RESULT(sun4)
                SOLARIS_UFSVFS_HAS_DQRWLOCK
                SOLARIS_PROC_HAS_P_COREFILE
+               SOLARIS_FS_HAS_FS_ROLLED
                 ;;
         *-sunos*)
                MKAFS_OSTYPE=SUNOS
@@ -328,6 +372,15 @@ else
                powerpc-apple-darwin6.2*)
                        AFS_SYSNAME="ppc_darwin_60"
                        ;;
+               powerpc-apple-darwin6.3*)
+                       AFS_SYSNAME="ppc_darwin_60"
+                       ;;
+               powerpc-apple-darwin6.4*)
+                       AFS_SYSNAME="ppc_darwin_60"
+                       ;;
+               powerpc-apple-darwin6.5*)
+                       AFS_SYSNAME="ppc_darwin_60"
+                       ;;
                sparc-sun-solaris2.5*)
                        AFS_SYSNAME="sun4x_55"
                        ;;
@@ -361,6 +414,9 @@ else
                alpha*-dec-osf5.0*)
                        AFS_SYSNAME="alpha_dux50"
                        ;;
+               alpha*-dec-osf5.1*)
+                       AFS_SYSNAME="alpha_dux51"
+                       ;;
                mips-sgi-irix6.5)
                        AFS_SYSNAME="sgi_65"
                        ;;
index ddcde4c1c7486be3a8e991c5cd0df212de5959e2..7777c8e5f1bf6512026318278b333dcf6574c49c 100644 (file)
@@ -1,5 +1,5 @@
 AC_INIT(Makefile.common)
-AM_INIT_AUTOMAKE(openafs-libafs,1.2.8)
+AM_INIT_AUTOMAKE(openafs-libafs,1.2.9)
 AC_CONFIG_HEADER(config/afsconfig.h)
 define(OPENAFS_CONFIGURE_LIBAFS)
 
index a481f2e7d41f3304a8aa2a664f16a0f1c2f0c200..cbcea84536e65f2c7463b2bbe01716d5dc114d41 100644 (file)
@@ -148,7 +148,7 @@ BOOL InitInstance(
        main_rect.right  = GetDeviceCaps(hDC, HORZRES);
        main_rect.top    = GetDeviceCaps(hDC, LOGPIXELSY) / 4;   /* 1/4 inch */
        ReleaseDC(hWnd, hDC);
-       main_rect.bottom = rect.top + nLineHeight;
+       main_rect.bottom = main_rect.top + nLineHeight;
 
        osi_InitPanic(afsd_notifier);
 
index c01099cc2e0a102cdf26f18425b359853de27e76..5862c12925e17d5070bd822af981e670446f3842 100644 (file)
@@ -112,6 +112,7 @@ void cm_CallbackNotifyChange(cm_scache_t *scp)
                        smb_NotifyChange(0,
                         FILE_NOTIFY_GENERIC_FILE_FILTER,
                         dscp, NULL, NULL, TRUE);
+               if (dscp) cm_ReleaseSCache(dscp);
        }
 }
 
@@ -856,3 +857,11 @@ void cm_CheckCBExpiration(void)
         }
         lock_ReleaseWrite(&cm_scacheLock);
 }
+
+/* debug interface: not implemented */
+int SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum,
+                         char **a_name, serverList *a_hosts)
+{
+    /* XXXX */
+    return RXGEN_OPCODE;
+}
index 3b326022e3c4942775cc74755394ece94fd4ae55..f38d6f6f8f72189c931e2cd437cd36d6933c73fb 100644 (file)
@@ -18,7 +18,7 @@
 #include <osi.h>
 #include <rx/rx.h>
 #ifndef DJGPP
-#include <rxkad.h>
+#include <rx/rxkad.h>
 #else
 #include <rx/rxkad.h>
 #endif
index 8ae076640db1bdb86f307f3e326e9524e694406d..f2016fbe876b84a4ebe4097af8b6d855f77cbd50 100644 (file)
@@ -30,7 +30,7 @@
 #include "smb.h"
 
 #ifndef DJGPP
-#include <rxkad.h>
+#include <rx/rxkad.h>
 #include "afsrpc.h"
 #else
 #include <rx/rxkad.h>
@@ -1735,7 +1735,9 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp)
                         * leading "/afs" when writing out the submount.
                         */
                        WritePrivateProfileString("AFS Submounts",
-                                       submountreqp, &afspath[strlen("/afs")],
+                                       submountreqp, 
+                                       (strlen(&afspath[strlen("/afs")])) ?
+                                                 &afspath[strlen("/afs")]:"/",
                                        "afsdsbmt.ini");
 
                        strcpy(ioctlp->outDatap, submountreqp);
@@ -1848,8 +1850,9 @@ long cm_IoctlMakeSubmount(smb_ioctl_t *ioctlp, cm_user_t *userp)
        sprintf(ioctlp->outDatap, "auto%ld", nextAutoSubmount);
 
        WritePrivateProfileString("AFS Submounts", ioctlp->outDatap,
-                                       &afspath[lstrlen("/afs")],
-                                       "afsdsbmt.ini");
+                                 (strlen(&afspath[lstrlen("/afs")])) ? 
+                                 &afspath[lstrlen("/afs")]:"/",
+                                 "afsdsbmt.ini");
 
        ioctlp->outDatap += strlen(ioctlp->outDatap) +1;
        lock_ReleaseMutex(&cm_Afsdsbmt_Lock);
index 33f4c8ee4806b26e0673ad62ff498e4f6608ccb0..882e056a6fdec389284bb41bffe344c32c895b93 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "smb.h"
 
-#include <rxkad.h>
+#include <rx/rxkad.h>
 
 /*
  * The motivation for this whole module is that in transmitting tokens
@@ -81,15 +81,16 @@ BOOL cm_FindTokenEvent(afs_uuid_t uuid, char sessionKey[8])
        te = tokenEvents;
        ltep = &tokenEvents;
        while (te) {
-               if (UuidEqual((UUID *)&uuid, (UUID *)&te->uuid, &status))
+           if (UuidEqual((UUID *)&uuid, (UUID *)&te->uuid, &status)) {
                        *ltep = te->next;
                        lock_ReleaseMutex(&tokenEventLock);
                        memcpy(sessionKey, te->sessionKey,
                                sizeof(te->sessionKey));
                        free(te);
                        return TRUE;
-               ltep = &te->next;
-               te = te->next;
+           }
+           ltep = &te->next;
+           te = te->next;
        }
        lock_ReleaseMutex(&tokenEventLock);
        return FALSE;
index 0fa49bc845fcc67c6683c0bb05dfd908ff4161ca..b6de8c3b70f2121752a99aaeb8acdb350db375ff 100644 (file)
@@ -2363,8 +2363,9 @@ nextEntry:
          * or if something went wrong, close the search.
          */
         /* ((searchFlags & 1) || ((searchFlags & 2) && eos) */
-       if ((searchFlags & 1) || (returnedNames == 0)
-               || code != 0) smb_DeleteDirSearch(dsp);
+       if ((searchFlags & 1) || (returnedNames == 0) || ((searchFlags & 2) &&
+                                                         eos) || code != 0)
+           smb_DeleteDirSearch(dsp);
        if (code)
                smb_SendTran2Error(vcp, p, opx, code);
        else {
@@ -3136,7 +3137,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp)
            || (fidflags & (SMB_FID_OPENDELETE | SMB_FID_OPENWRITE))) {
                /* look up parent directory */
                code = cm_NameI(baseDirp, spacep->data,
-                               CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD,
+                               CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD | CM_FLAG_CHECKPATH,
                                userp, tidPathp, &req, &dscp);
 
                if (baseFid != 0) smb_ReleaseFID(baseFidp);
index b6c4adef7422d60d4182d948f9fdec1c6cb0db92..2b83e70cd9a18551d403b168e636e27a9ccdf9e6 100644 (file)
@@ -13,7 +13,6 @@ extern "C" {
 }
 
 #include <objbase.h>
-#include <initguid.h>
 #include <windows.h>
 #include <windowsx.h>
 #undef INITGUID
index 37e0f11027ecf5797caf33e752f943e93d0b6925..304cd779685cf811fc8faa82746e5cec4c6f498e 100644 (file)
@@ -14,6 +14,7 @@ extern "C" {
 
 #include <afxpriv.h>
 #include "stdafx.h"
+#include <atlconv.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include "afs_shl_ext.h"
index 153c49536a55b04c33d7dc1c7ab835c380d238ee..084c26f13a79eb88a33e777a484691fc5af2348b 100644 (file)
@@ -1,7 +1,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.1.1.7 2002/09/26 18:58:05 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/DARWIN/osi_vnodeops.c,v 1.1.1.8 2003/04/13 19:02:42 hartmans Exp $");
 
 #include <afs/sysincludes.h>            /* Standard vendor system headers */
 #include <afs/afsincludes.h>            /* Afs-based standard headers */
@@ -283,7 +283,7 @@ afs_vop_open(ap)
        panic("AFS open changed vnode!");
 #endif
     afs_BozonLock(&vc->pvnLock, vc);
-    osi_FlushPages(vc);
+    osi_FlushPages(vc, ap->a_cred);
     afs_BozonUnlock(&vc->pvnLock, vc);
     AFS_GUNLOCK();
     return error;
@@ -306,7 +306,7 @@ afs_vop_close(ap)
     else
         code=afs_close(avc, ap->a_fflag, &afs_osi_cred, ap->a_p);
     afs_BozonLock(&avc->pvnLock, avc);
-    osi_FlushPages(avc);        /* hold bozon lock, but not basic vnode lock */
+    osi_FlushPages(avc, ap->a_cred);        /* hold bozon lock, but not basic vnode lock */
     afs_BozonUnlock(&avc->pvnLock, avc);
     AFS_GUNLOCK();
 #ifdef AFS_DARWIN14_ENV
@@ -381,7 +381,7 @@ afs_vop_read(ap)
     struct vcache *avc=VTOAFS(ap->a_vp);
     AFS_GLOCK();
     afs_BozonLock(&avc->pvnLock, avc);
-    osi_FlushPages(avc);        /* hold bozon lock, but not basic vnode lock */
+    osi_FlushPages(avc, ap->a_cred);        /* hold bozon lock, but not basic vnode lock */
     code=afs_read(avc, ap->a_uio, ap->a_cred, 0, 0, 0);
     afs_BozonUnlock(&avc->pvnLock, avc);
     AFS_GUNLOCK();
@@ -458,7 +458,7 @@ afs_vop_pagein(ap)
     aiov.iov_base = (caddr_t)ioaddr;
     AFS_GLOCK();
     afs_BozonLock(&tvc->pvnLock, tvc);
-    osi_FlushPages(tvc);        /* hold bozon lock, but not basic vnode lock */
+    osi_FlushPages(tvc, ap->a_cred);        /* hold bozon lock, but not basic vnode lock */
     code=afs_read(tvc, uio, cred, 0, 0, 0);
     if (code == 0) {
       ObtainWriteLock(&tvc->lock, 2);
@@ -467,6 +467,11 @@ afs_vop_pagein(ap)
     }
     afs_BozonUnlock(&tvc->pvnLock, tvc);
     AFS_GUNLOCK();
+
+    /* Zero out rest of last page if there wasn't enough data in the file */
+    if (code == 0 && auio.uio_resid > 0)
+       memset(aiov.iov_base, 0, auio.uio_resid);
+
     kernel_upl_unmap(kernel_map, pl);
     if (!nocommit) {
       if (code)
@@ -494,7 +499,7 @@ afs_vop_write(ap)
     void *object;
     AFS_GLOCK();
     afs_BozonLock(&avc->pvnLock, avc);
-    osi_FlushPages(avc);        /* hold bozon lock, but not basic vnode lock */
+    osi_FlushPages(avc, ap->a_cred);        /* hold bozon lock, but not basic vnode lock */
     if (UBCINFOEXISTS(ap->a_vp))
        ubc_clean(ap->a_vp, 1);
     if (UBCINFOEXISTS(ap->a_vp))
@@ -622,7 +627,7 @@ afs_vop_pageout(ap)
 
     AFS_GLOCK();
     afs_BozonLock(&tvc->pvnLock, tvc);
-    osi_FlushPages(tvc);        /* hold bozon lock, but not basic vnode lock */
+    osi_FlushPages(tvc, ap->a_cred);        /* hold bozon lock, but not basic vnode lock */
     ObtainWriteLock(&tvc->lock, 1);
     afs_FakeOpen(tvc);
     ReleaseWriteLock(&tvc->lock);
index 0fec7f045ed85db668b6f5fa50004a36bf2dcaf9..0b8b596d8531a4707f3f0174be89b53530903eb5 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vfsops.c,v 1.1.1.6 2002/05/10 23:43:59 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/IRIX/osi_vfsops.c,v 1.1.1.7 2003/04/13 19:02:45 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -518,7 +518,6 @@ afs_vget(OSI_VFS_DECL(afsp), vnode_t **avcp, struct fid *fidp)
 {
     struct VenusFid vfid;
     struct vrequest treq;
-    extern struct cell *afs_GetCellByIndex();
     register struct cell *tcell;
     register afs_int32 code = 0;
     afs_int32 ret;
@@ -537,13 +536,13 @@ afs_vget(OSI_VFS_DECL(afsp), vnode_t **avcp, struct fid *fidp)
     afid2 = (afs_fid2_t*)fidp;
     if (afid2->af_len == sizeof(afs_fid2_t) - sizeof(afid2->af_len)) {
        /* It's a checkpoint restart fid. */
-       tcell = afs_GetCellByIndex(afid2->af_cell, READ_LOCK, 0 /* !refresh */);
+       tcell = afs_GetCellByIndex(afid2->af_cell, READ_LOCK);
        if (!tcell) {
            code = ENOENT;
            goto out;
-        }
-       vfid.Cell = tcell->cell;
-       afs_PutCell(tcell, WRITE_LOCK);
+       }
+       vfid.Cell = tcell->cellNum;
+       afs_PutCell(tcell, READ_LOCK);
        vfid.Fid.Volume = afid2->af_volid;
        vfid.Fid.Vnode = afid2->af_vno;
        vfid.Fid.Unique = afid2->af_uniq;
index d6a8fc5ae93668e882f6d3b36f0efe5ffd36277f..ff97f1953af897f75649a2227f843432184d7088 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_groups.c,v 1.1.1.10 2002/12/11 02:36:15 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_groups.c,v 1.1.1.11 2003/04/13 19:02:45 hartmans Exp $");
 
 #include "../afs/sysincludes.h"
 #include "../afs/afsincludes.h"
@@ -33,14 +33,20 @@ static int afs_setgroups(cred_t **cr, int ngroups, gid_t *gidset, int change_par
  */
 int set_pag_in_parent(int pag, int g0, int g1)
 {
+#ifdef STRUCT_TASK_STRUCT_HAS_PARENT
+    gid_t *gp = current->parent->groups;
+#else
     gid_t *gp = current->p_pptr->groups;
+#endif
     int ngroups;
     int i;
 
     
+#ifdef STRUCT_TASK_STRUCT_HAS_PARENT
+    ngroups = current->parent->ngroups;
+#else
     ngroups = current->p_pptr->ngroups;
-    gp = current->p_pptr->groups;
-
+#endif
 
     if ((ngroups < 2) || (afs_get_pag_from_groups(gp[0], gp[1]) == NOPAG)) {
        /* We will have to shift grouplist to make room for pag */
@@ -57,7 +63,11 @@ int set_pag_in_parent(int pag, int g0, int g1)
     if (ngroups < NGROUPS)
        gp[ngroups] = NOGROUP;
 
+#ifdef STRUCT_TASK_STRUCT_HAS_PARENT
+    current->parent->ngroups = ngroups;
+#else
     current->p_pptr->ngroups = ngroups;
+#endif
     return 0;
 }
 
index edf1e6dfaa4bf40b45058da2fe1deea5f9c85410..91dde0e29d2a84d6d4035461358b4e16e1a92f92 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_sleep.c,v 1.1.1.9 2002/08/02 04:28:56 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/LINUX/osi_sleep.c,v 1.1.1.10 2003/04/13 19:02:46 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -192,18 +192,19 @@ void afs_osi_Sleep(char *event)
        set_current_state(TASK_INTERRUPTIBLE);
        AFS_ASSERT_GLOCK();
        AFS_GUNLOCK();
-       spin_lock_irq(&current->sigmask_lock);
+
+       SIG_LOCK(current);
        saved_set = current->blocked;
        sigfillset(&current->blocked);
-       recalc_sigpending(current);
-       spin_unlock_irq(&current->sigmask_lock);
+       RECALC_SIGPENDING(current);
+       SIG_UNLOCK(current);
 
        schedule();
 
-       spin_lock_irq(&current->sigmask_lock);
+       SIG_LOCK(current);
        current->blocked = saved_set;
-       recalc_sigpending(current);
-       spin_unlock_irq(&current->sigmask_lock);
+       RECALC_SIGPENDING(current);
+       SIG_UNLOCK(current);
        AFS_GLOCK();
     }
     remove_wait_queue(&evp->cond, &wait);
index 43a0182b07194028713b8a629094425485db0e0c..966b52074dded8a0616807484561e8bc976353bc 100644 (file)
@@ -14,7 +14,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.1.1.9 2002/12/11 02:36:21 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/UKERNEL/afs_usrops.c,v 1.1.1.10 2003/04/13 19:02:48 hartmans Exp $");
 
 
 #ifdef UKERNEL
@@ -932,6 +932,11 @@ void afs_osi_Free(void *ptr, size_t size)
     free(ptr);
 }
 
+void afs_osi_FreeStr(char *ptr)
+{
+    free(ptr);
+}
+
 void *osi_AllocLargeSpace(size_t size)
 {
     AFS_STATCNT(osi_AllocLargeSpace);
index 35c94e23cfd416b84ba98de02665b6d9707ce2b3..3f54ac6990a46c9d431805512d8ef33e0edc6f9d 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_analyze.c,v 1.1.1.9 2002/09/26 18:57:48 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_analyze.c,v 1.1.1.10 2003/04/13 19:02:33 hartmans Exp $");
 
 #include "../afs/stds.h"
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
@@ -179,7 +179,7 @@ static int VLDB_Same (afid, areq)
     do {
         VSleep(2);     /* Better safe than sorry. */
        tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport,
-                                tcell->cell, &treq, SHARED_LOCK);
+                                tcell->cellNum, &treq, SHARED_LOCK);
        if (tconn) {
            if (tconn->srvr->server->flags & SNO_LHOSTS) {
                type = 0;
@@ -392,8 +392,8 @@ int afs_Analyze(aconn, acode, afid, areq, op, locktype, cellp)
            if (aerrP)
                (aerrP->err_Network)++;
            if (hm_retry_int && !(areq->flags & O_NONBLOCK) &&  /* "hard" mount */
-               ((afid && afid->Cell == LOCALCELL) || 
-                (cellp && cellp->cell == LOCALCELL))) { 
+               ((afid && afs_IsPrimaryCellNum(afid->Cell)) || 
+                (cellp && afs_IsPrimaryCell(cellp)))) { 
                if (!afid) {
                    afs_warnuser("afs: hard-mount waiting for a vlserver to return to service\n");
                    VSleep(hm_retry_int);
@@ -492,7 +492,7 @@ int afs_Analyze(aconn, acode, afid, areq, op, locktype, cellp)
        if (aerrP)
            (aerrP->err_Protection)++;
 
-       tu = afs_FindUser(areq->uid, tsp->cell->cell, READ_LOCK);
+       tu = afs_FindUser(areq->uid, tsp->cell->cellNum, READ_LOCK);
        if (tu) {
            if ((acode == VICETOKENDEAD) || (acode == RXKADEXPIRED))
                afs_warnuser("afs: Tokens for user of AFS id %d for cell %s have expired\n", 
index 6eb2d4e0d0ebad69c8f0a610eb53c4cdfaee4d23..9608523c6693acaec570a11380869c3645457fc3 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_callback.c,v 1.1.1.9 2002/06/10 11:39:52 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_callback.c,v 1.1.1.10 2003/04/13 19:02:34 hartmans Exp $");
 
 #include "../afs/sysincludes.h" /*Standard vendor system headers*/
 #include "../afs/afsincludes.h" /*AFS-based standard headers*/
@@ -1137,7 +1137,7 @@ int SRXAFSCB_GetCellServDB(
 #endif /* RX_ENABLE_LOCKS */
     AFS_STATCNT(SRXAFSCB_GetCellServDB);
 
-    tcell = afs_GetCellByIndex(a_index, READ_LOCK, 0);
+    tcell = afs_GetCellByIndex(a_index, READ_LOCK);
 
     if (!tcell) {
       i = 0;
@@ -1203,7 +1203,6 @@ int SRXAFSCB_GetLocalCell(
 {
     int plen;
     struct cell *tcell;
-    struct afs_q *cq, *tq;
     char *t_name, *p_name = NULL;
 
 #ifdef RX_ENABLE_LOCKS
@@ -1214,27 +1213,16 @@ int SRXAFSCB_GetLocalCell(
     /* Search the list for the primary cell. Cell number 1 is only
      * the primary cell is when no other cell is explicitly marked as
      * the primary cell.  */
-    ObtainReadLock(&afs_xcell);
-
-    for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
-        tq = QNext(cq);
-       tcell = QTOC(cq);
-       if (tcell->states & CPrimary) {
-           p_name = tcell->cellName;
-           break;
-       }
-        if (tcell->cell == 1) {
-           p_name = tcell->cellName;
-       }
-    }
-
+    tcell = afs_GetPrimaryCell(READ_LOCK);
+    if (tcell)
+       p_name = tcell->cellName;
     if (p_name)
        plen = strlen(p_name);
     else
        plen = 0;
     t_name = (char *)afs_osi_Alloc(plen+1);
     if (t_name == NULL) {
-        ReleaseReadLock(&afs_xcell);
+       if (tcell) afs_PutCell(tcell, READ_LOCK);
 #ifdef RX_ENABLE_LOCKS
        AFS_GUNLOCK();
 #endif /* RX_ENABLE_LOCKS */
@@ -1245,13 +1233,12 @@ int SRXAFSCB_GetLocalCell(
     if (p_name)
        memcpy(t_name, p_name, plen);
 
-    ReleaseReadLock(&afs_xcell);
-
 #ifdef RX_ENABLE_LOCKS
     AFS_GUNLOCK();
 #endif /* RX_ENABLE_LOCKS */
 
     *a_name = t_name;
+    if (tcell) afs_PutCell(tcell, READ_LOCK);
     return 0;
 }
 
@@ -1369,3 +1356,69 @@ int SRXAFSCB_GetCacheConfig(
 
     return 0;
 }
+
+/*------------------------------------------------------------------------
+ * EXPORTED SRXAFSCB_GetCellByNum
+ *
+ * Description:
+ *     Routine to get information about a cell specified by its
+ *     cell number (returned by GetCE/GetCE64).
+ *
+ * Arguments:
+ *     a_call    : Ptr to Rx call on which this request came in.
+ *     a_cellnum : Input cell number
+ *     a_name    : Output cell name (one zero byte when no such cell).
+ *     a_hosts   : Output cell database servers in host byte order.
+ *
+ * Returns:
+ *     0 on success
+ *
+ * Environment:
+ *     Nothing interesting.
+ *
+ * Side Effects:
+ *     As advertised.
+ *------------------------------------------------------------------------*/
+
+int SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum,
+    char **a_name, serverList *a_hosts)
+{
+    afs_int32 i, sn;
+    struct cell *tcell;
+
+#ifdef RX_ENABLE_LOCKS
+    AFS_GLOCK();
+#endif /* RX_ENABLE_LOCKS */
+    AFS_STATCNT(SRXAFSCB_GetCellByNum);
+
+    a_hosts->serverList_val = 0;
+    a_hosts->serverList_len = 0;
+
+    tcell = afs_GetCellStale(a_cellnum, READ_LOCK);
+    if (!tcell) {
+       *a_name = afs_strdup("");
+#ifdef RX_ENABLE_LOCKS
+       AFS_GUNLOCK();
+#endif /* RX_ENABLE_LOCKS */
+       return 0;
+    }
+
+    ObtainReadLock(&tcell->lock);
+    *a_name = afs_strdup(tcell->cellName);
+
+    for (sn = 0; sn < AFSMAXCELLHOSTS && tcell->cellHosts[sn]; sn++) 
+       ;
+    a_hosts->serverList_len = sn;
+    a_hosts->serverList_val = (afs_int32 *) afs_osi_Alloc(sn*sizeof(afs_int32));
+
+    for (i = 0; i < sn; i++)
+       a_hosts->serverList_val[i] = ntohl(tcell->cellHosts[i]->addr->sa_ip);
+    ReleaseReadLock(&tcell->lock);
+    afs_PutCell(tcell, READ_LOCK);
+
+#ifdef RX_ENABLE_LOCKS
+    AFS_GUNLOCK();
+#endif /* RX_ENABLE_LOCKS */
+    return 0;
+}
index f514304e3c8009995c34e784b65ae14a6b401c0f..b6f72d864c3f9ac42be5d40b21ed98e407579b32 100644 (file)
  * Implements:
  */
 #include <afsconfig.h>
-#include "../afs/param.h"
+#include "afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_cell.c,v 1.1.1.11 2002/09/26 18:57:50 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_cell.c,v 1.1.1.12 2003/04/13 19:02:34 hartmans Exp $");
 
-#include "../afs/stds.h"
-#include "../afs/sysincludes.h"        /* Standard vendor system headers */
-
-#if !defined(UKERNEL)
-#include <net/if.h>
-#include <netinet/in.h>
-
-#ifdef AFS_SGI62_ENV
-#include "../h/hashing.h"
-#endif
-#if !defined(AFS_HPUX110_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN60_ENV)
-#include <netinet/in_var.h>
-#endif /* ! ASF_HPUX110_ENV */
-#endif /* !defined(UKERNEL) */
-
-#include "../afs/afsincludes.h"        /* Afs-based standard headers */
-#include "../afs/afs_stats.h"   /* afs statistics */
-
-#if    defined(AFS_SUN56_ENV)
-#include <inet/led.h>
-#include <inet/common.h>
-#if     defined(AFS_SUN58_ENV)
-#include <netinet/ip6.h>
-#endif
-#include <inet/ip.h>
-#endif
-
-/* Exported variables */
-afs_rwlock_t afs_xcell;                        /* allocation lock for cells */
-struct afs_q CellLRU;
-afs_int32 afs_cellindex=0;
-afs_int32 afs_realcellindex=0;
-afs_uint32 afs_nextCellNum = 0x100;
+#include "afs/stds.h"
+#include "afs/sysincludes.h"   /* Standard vendor system headers */
+#include "afsincludes.h"       /* Afs-based standard headers */
+#include "afs/afs_stats.h"   /* afs statistics */
+#include "afs/afs_osi.h"
 
 /* Local variables. */
-struct cell *afs_rootcell = 0;
-
-/* Handler waiting for request from client */
-static char afs_AfsdbHandlerWait;
-/* Client waiting for handler to become available or finish request */
-static char afs_AfsdbLookupWait;
-
-/* Set to 1 when we've seen the userspace AFSDB process at least once */
-char afs_AfsdbHandlerPresent = 0;
-/* Set to 1 when there is a client interacting with the AFSDB handler.
- * Protects the in and out variables below.  Protected by GLOCK. */
-char afs_AfsdbHandlerInuse = 0;
-/* Set to 1 when AFSDB has been shut down */
-char afs_AfsdbHandlerShutdown = 0;
-
-/* Input to handler from the client: cell name to look up */
-char *afs_AfsdbHandler_CellName;
-/* Outputs from handler to client: cell hosts, TTL, and real cell name */
-afs_int32 *afs_AfsdbHandler_CellHosts;
-int *afs_AfsdbHandler_Timeout;
-char **afs_AfsdbHandler_RealName;
-
-/* Client sets ReqPending to 1 whenever it queues a request for it */
-char afs_AfsdbHandler_ReqPending = 0;
-/* Handler sets Completed to 1 when it completes the client request */
-char afs_AfsdbHandler_Completed = 0;
-
-
-struct cell *afs_GetCellByName2();
-
-int afs_strcasecmp(s1, s2)
-    register char *s1, *s2;
-{
-    while (*s1 && *s2) {
-       register char c1, c2;
-
-       c1 = *s1++;
-       c2 = *s2++;
-       if (c1 >= 'A' && c1 <= 'Z') c1 += 0x20;
-       if (c2 >= 'A' && c2 <= 'Z') c2 += 0x20;
-       if (c1 != c2)
-           return c1-c2;
-    }
-
-    return *s1 - *s2;
-}
+afs_rwlock_t afs_xcell;                /* Export for cmdebug peeking at locks */
 
+/*
+ * AFSDB implementation:
+ *
+ * afs_StopAFSDB: terminate the AFSDB handler, used on shutdown
+ * afs_AFSDBHandler: entry point for user-space AFSDB request handler
+ * afs_GetCellHostsAFSDB: query the AFSDB handler and wait for response
+ * afs_LookupAFSDB: look up AFSDB for given cell name and create locally
+ */
 
 #ifdef AFS_AFSDB_ENV
-void afs_StopAfsdb()
+static afs_rwlock_t afsdb_client_lock; /* Serializes client requests */
+static char afsdb_handler_running;     /* Protected by GLOCK */
+static char afsdb_handler_shutdown;    /* Protected by GLOCK */
+
+static struct {
+    afs_rwlock_t lock;
+    char pending;
+    char complete;
+    char *cellname;
+    afs_int32 *cellhosts;
+    int *timeout;
+    char **realname;
+} afsdb_req;
+
+void afs_StopAFSDB()
 {
-    if (afs_AfsdbHandlerPresent) {
-       afs_osi_Wakeup(&afs_AfsdbHandlerWait);
+    if (afsdb_handler_running) {
+       afs_osi_Wakeup(&afsdb_req);
     } else {
-       afs_AfsdbHandlerShutdown = 1;
+       afsdb_handler_shutdown = 1;
        afs_termState = AFSOP_STOP_RXEVENT;
     }
 }
 
-int afs_AfsdbHandler(acellName, acellNameLen, kernelMsg)
-    char *acellName;
-    int acellNameLen;
-    afs_int32 *kernelMsg;
+int afs_AFSDBHandler(char *acellName, int acellNameLen, afs_int32 *kernelMsg)
 {
-    /* afs_syscall_call() has already grabbed the global lock */
-
-    if (afs_AfsdbHandlerShutdown) return -2;
-    afs_AfsdbHandlerPresent = 1;
+    if (afsdb_handler_shutdown) return -2;
+    afsdb_handler_running = 1;
 
-    if (afs_AfsdbHandler_ReqPending) {
+    ObtainSharedLock(&afsdb_req.lock, 683);
+    if (afsdb_req.pending) {
        int i, hostCount;
 
+       UpgradeSToWLock(&afsdb_req.lock, 684);
        hostCount = kernelMsg[0];
-       *afs_AfsdbHandler_Timeout = kernelMsg[1];
-       if (*afs_AfsdbHandler_Timeout) *afs_AfsdbHandler_Timeout += osi_Time();
-
-       *afs_AfsdbHandler_RealName = afs_osi_Alloc(strlen(acellName) + 1);
-       strcpy(*afs_AfsdbHandler_RealName, acellName);
+       *afsdb_req.timeout = kernelMsg[1];
+       if (*afsdb_req.timeout) *afsdb_req.timeout += osi_Time();
+       *afsdb_req.realname = afs_strdup(acellName);
 
        for (i=0; i<MAXCELLHOSTS; i++) {
            if (i >= hostCount)
-               afs_AfsdbHandler_CellHosts[i] = 0;
+               afsdb_req.cellhosts[i] = 0;
            else
-               afs_AfsdbHandler_CellHosts[i] = kernelMsg[2+i];
+               afsdb_req.cellhosts[i] = kernelMsg[2+i];
        }
 
        /* Request completed, wake up the relevant thread */
-       afs_AfsdbHandler_ReqPending = 0;
-       afs_AfsdbHandler_Completed = 1;
-       afs_osi_Wakeup(&afs_AfsdbLookupWait);
+       afsdb_req.pending = 0;
+       afsdb_req.complete = 1;
+       afs_osi_Wakeup(&afsdb_req);
+       ConvertWToSLock(&afsdb_req.lock);
     }
+    ConvertSToRLock(&afsdb_req.lock);
 
     /* Wait for a request */
-    while (afs_AfsdbHandler_ReqPending == 0 && afs_termState != AFSOP_STOP_AFSDB)
-       afs_osi_Sleep(&afs_AfsdbHandlerWait);
+    while (afsdb_req.pending == 0 && afs_termState != AFSOP_STOP_AFSDB) {
+       ReleaseReadLock(&afsdb_req.lock);
+       afs_osi_Sleep(&afsdb_req);
+       ObtainReadLock(&afsdb_req.lock);
+    }
 
     /* Check if we're shutting down */
     if (afs_termState == AFSOP_STOP_AFSDB) {
+       ReleaseReadLock(&afsdb_req.lock);
+
        /* Inform anyone waiting for us that we're going away */
-       afs_AfsdbHandlerShutdown = 1;
-       afs_AfsdbHandlerPresent = 0;
-       afs_osi_Wakeup(&afs_AfsdbLookupWait);
+       afsdb_handler_shutdown = 1;
+       afsdb_handler_running = 0;
+       afs_osi_Wakeup(&afsdb_req);
 
        afs_termState = AFSOP_STOP_RXEVENT;
        afs_osi_Wakeup(&afs_termState);
        return -2;
     }
 
-    /* Copy the requested cell name into the request buffer */
-    strncpy(acellName, afs_AfsdbHandler_CellName, acellNameLen);
-
     /* Return the lookup request to userspace */    
+    strncpy(acellName, afsdb_req.cellname, acellNameLen);
+    ReleaseReadLock(&afsdb_req.lock);
     return 0;
 }
-#endif
 
+static int afs_GetCellHostsAFSDB(char *acellName, afs_int32 *acellHosts,
+       int *timeout, char **realName)
+{
+    AFS_ASSERT_GLOCK();
+    if (!afsdb_handler_running) return ENOENT;
+
+    ObtainWriteLock(&afsdb_client_lock, 685);
+    ObtainWriteLock(&afsdb_req.lock, 686);
 
-int afs_GetCellHostsFromDns(acellName, acellHosts, timeout, realName)
-    char *acellName;
-    afs_int32 *acellHosts;
-    int *timeout;
-    char **realName;
+    *acellHosts = 0;
+    afsdb_req.cellname = acellName;
+    afsdb_req.cellhosts = acellHosts;
+    afsdb_req.timeout = timeout;
+    afsdb_req.realname = realName;
+
+    afsdb_req.complete = 0;
+    afsdb_req.pending = 1;
+    afs_osi_Wakeup(&afsdb_req);
+    ConvertWToRLock(&afsdb_req.lock);
+
+    while (afsdb_handler_running && !afsdb_req.complete) {
+       ReleaseReadLock(&afsdb_req.lock);
+       afs_osi_Sleep(&afsdb_req);
+       ObtainReadLock(&afsdb_req.lock);
+    };
+    ReleaseReadLock(&afsdb_req.lock);
+    ReleaseWriteLock(&afsdb_client_lock);
+
+    if (*acellHosts)
+       return 0;
+    else
+       return ENOENT;
+}
+#endif
+
+void afs_LookupAFSDB(char *acellName)
 {
 #ifdef AFS_AFSDB_ENV
-    char grab_glock = 0;
+    afs_int32 cellHosts[MAXCELLHOSTS];
+    char *realName = NULL;
+    int code, timeout;
+    
+    code = afs_GetCellHostsAFSDB(acellName, cellHosts, &timeout, &realName);
+    if (code) goto done;
+    code = afs_NewCell(realName, cellHosts, CNoSUID, NULL, 0, 0, timeout);
+    if (code) goto done;
 
-    if (!afs_AfsdbHandlerPresent) return ENOENT;
+    /* If we found an alias, create it */
+    if (afs_strcasecmp(acellName, realName))
+       afs_NewCellAlias(acellName, realName);
 
-    /* Initialize host list to empty in case the handler is gone */
-    *acellHosts = 0;
+done:
+    if (realName)
+       afs_osi_FreeStr(realName);
+#endif
+}
 
-    if (!ISAFS_GLOCK()) {
-       grab_glock = 1;
-       AFS_GLOCK();
-    }
+/*
+ * Cell name-to-ID mapping
+ *
+ * afs_cellname_new: create a new cell name, optional cell number
+ * afs_cellname_lookup_id: look up a cell name
+ * afs_cellname_lookup_name: look up a cell number
+ * afs_cellname_ref: note that this cell name was referenced somewhere
+ * afs_cellname_init: load the list of cells from given inode
+ * afs_cellname_write: write in-kernel list of cells to disk
+ */
 
-    /* Wait until the AFSDB handler is available, and grab it */
-    while (afs_AfsdbHandlerInuse)
-       afs_osi_Sleep(&afs_AfsdbLookupWait);
-    afs_AfsdbHandlerInuse = 1;
+struct cell_name *afs_cellname_head;   /* Export for kdump */
+static ino_t afs_cellname_inode;
+static int afs_cellname_inode_set;
+static int afs_cellname_dirty;
+static afs_int32 afs_cellnum_next;
 
-    /* Set up parameters for the handler */
-    afs_AfsdbHandler_CellName = acellName;
-    afs_AfsdbHandler_CellHosts = acellHosts;
-    afs_AfsdbHandler_Timeout = timeout;
-    afs_AfsdbHandler_RealName = realName;
+static struct cell_name *afs_cellname_new(char *name, afs_int32 cellnum)
+{
+    struct cell_name *cn;
 
-    /* Wake up the AFSDB handler */
-    afs_AfsdbHandler_Completed = 0;
-    afs_AfsdbHandler_ReqPending = 1;
-    afs_osi_Wakeup(&afs_AfsdbHandlerWait);
+    if (cellnum == 0)
+       cellnum = afs_cellnum_next;
 
-    /* Wait for the handler to get back to us with the reply */
-    while (afs_AfsdbHandlerPresent && !afs_AfsdbHandler_Completed)
-       afs_osi_Sleep(&afs_AfsdbLookupWait);
+    cn = (struct cell_name *) afs_osi_Alloc(sizeof(*cn));
+    cn->next = afs_cellname_head;
+    cn->cellnum = cellnum;
+    cn->cellname = afs_strdup(name);
+    cn->used = 0;
+    afs_cellname_head = cn;
 
-    /* Release the AFSDB handler and wake up others waiting for it */
-    afs_AfsdbHandlerInuse = 0;
-    afs_osi_Wakeup(&afs_AfsdbLookupWait);
+    if (cellnum >= afs_cellnum_next)
+       afs_cellnum_next = cellnum + 1;
 
-    if (grab_glock) AFS_GUNLOCK();
+    return cn;
+}
 
-    if (*acellHosts) return 0;
-    return ENOENT;
-#else
-    return ENOENT;
-#endif
+static struct cell_name *afs_cellname_lookup_id(afs_int32 cellnum)
+{
+    struct cell_name *cn;
+
+    for (cn = afs_cellname_head; cn; cn = cn->next)
+       if (cn->cellnum == cellnum)
+           return cn;
+
+    return NULL;
 }
 
+static struct cell_name *afs_cellname_lookup_name(char *name)
+{
+    struct cell_name *cn;
+
+    for (cn = afs_cellname_head; cn; cn = cn->next)
+       if (strcmp(cn->cellname, name) == 0)
+           return cn;
 
-void afs_RefreshCell(ac)
-    register struct cell *ac;
+    return NULL;
+}
+
+static void afs_cellname_ref(struct cell_name *cn)
 {
-    afs_int32 cellHosts[MAXCELLHOSTS];
-    char *realName = NULL;
-    struct cell *tc;
-    int timeout;
-
-    /* Don't need to do anything if no timeout or it's not expired */
-    if (!ac->timeout || ac->timeout > osi_Time()) return;
-
-    if (afs_GetCellHostsFromDns(ac->cellName, cellHosts, &timeout, &realName))
-       /* In case of lookup failure, keep old data */
-       goto done;
-
-    /* Refresh the DB servers for the real cell; other values stay the same. */
-    afs_NewCell(realName, cellHosts, 0, (char *) 0, 0, 0, timeout, (char *) 0);
-
-    /* If this is an alias, update the alias entry too */
-    if (afs_strcasecmp(ac->cellName, realName)) {
-       /*
-        * Look up the entry we just updated, to compensate for
-        * uppercase-vs-lowercase lossage with DNS.
-        */
-       tc = afs_GetCellByName2(realName, READ_LOCK, 0 /* no AFSDB */);
-
-       if (tc) {
-           afs_NewCell(ac->cellName, 0, CAlias, (char *) 0, 0, 0,
-                       timeout, tc->cellName);
-           afs_PutCell(tc, READ_LOCK);
+    if (!cn->used) {
+       cn->used = 1;
+       afs_cellname_dirty = 1;
+    }
+}
+
+int afs_cellname_init(ino_t inode, int lookupcode)
+{
+    struct osi_file *tfile;
+    int cc, off = 0;
+
+    ObtainWriteLock(&afs_xcell, 692);
+
+    afs_cellnum_next = 1;
+    afs_cellname_dirty = 0;
+
+    if (cacheDiskType == AFS_FCACHE_TYPE_MEM) {
+       ReleaseWriteLock(&afs_xcell);
+       return 0;
+    }
+    if (lookupcode) {
+       ReleaseWriteLock(&afs_xcell);
+       return lookupcode;
+    }
+
+    tfile = osi_UFSOpen(inode);
+    if (!tfile) {
+       ReleaseWriteLock(&afs_xcell);
+       return EIO;
+    }
+
+    afs_cellname_inode = inode;
+    afs_cellname_inode_set = 1;
+
+    while (1) {
+       afs_int32 cellnum, clen, magic;
+       struct cell_name *cn;
+       char *cellname;
+
+       cc = afs_osi_Read(tfile, off, &magic, sizeof(magic));
+       if (cc != sizeof(magic))
+           break;
+       if (magic != AFS_CELLINFO_MAGIC)
+           break;
+       off += cc;
+
+       cc = afs_osi_Read(tfile, off, &cellnum, sizeof(cellnum));
+       if (cc != sizeof(cellnum))
+           break;
+       off += cc;
+
+       cc = afs_osi_Read(tfile, off, &clen, sizeof(clen));
+       if (cc != sizeof(clen))
+           break;
+       off += cc;
+
+       cellname = afs_osi_Alloc(clen + 1);
+       if (!cellname)
+           break;
+
+       cc = afs_osi_Read(tfile, off, cellname, clen);
+       if (cc != clen) {
+           afs_osi_Free(cellname, clen + 1);
+           break;
+       }
+       off += cc;
+       cellname[clen] = '\0';
+
+       if (afs_cellname_lookup_name(cellname) ||
+           afs_cellname_lookup_id(cellnum)) {
+           afs_osi_Free(cellname, clen + 1);
+           break;
        }
+
+       cn = afs_cellname_new(cellname, cellnum);
+       afs_osi_Free(cellname, clen + 1);
     }
 
-done:
-    if (realName)
-       afs_osi_Free(realName, strlen(realName) + 1);
+    osi_UFSClose(tfile);
+    ReleaseWriteLock(&afs_xcell);
+    return 0;
 }
 
-
-struct cell *afs_GetCellByName_Dns(acellName, locktype)
-    register char *acellName;
-    afs_int32 locktype;
+int afs_cellname_write()
 {
-    afs_int32 cellHosts[MAXCELLHOSTS];
-    char *realName = NULL;
-    struct cell *tc;
-    int timeout;
+    struct osi_file *tfile;
+    struct cell_name *cn;
+    int off;
+
+    if (!afs_cellname_dirty || !afs_cellname_inode_set)
+       return 0;
+    if (afs_initState != 300)
+       return 0;
+
+    ObtainWriteLock(&afs_xcell, 693);
+    afs_cellname_dirty = 0;
+    off = 0;
+    tfile = osi_UFSOpen(afs_cellname_inode);
+    if (!tfile) {
+       ReleaseWriteLock(&afs_xcell);
+       return EIO;
+    }
 
-    if (afs_GetCellHostsFromDns(acellName, cellHosts, &timeout, &realName))
-       goto bad;
-    if (afs_NewCell(realName, cellHosts, CNoSUID, (char *) 0, 0, 0,
-                   timeout, (char *) 0))
-       goto bad;
+    for (cn = afs_cellname_head; cn; cn = cn->next) {
+       afs_int32 magic, cellnum, clen;
+       int cc;
 
-    /* If this is an alias, create an entry for it too */
-    if (afs_strcasecmp(acellName, realName)) {
-       /*
-        * Look up the entry we just updated, to compensate for
-        * uppercase-vs-lowercase lossage with DNS.
-        */
-       tc = afs_GetCellByName2(realName, READ_LOCK, 0 /* no AFSDB */);
-       if (!tc)
-           goto bad;
+       if (!cn->used)
+           continue;
 
-       if (afs_NewCell(acellName, 0, CAlias, (char *) 0, 0, 0,
-                       timeout, tc->cellName)) {
-           afs_PutCell(tc, READ_LOCK);
-           goto bad;
-       }
+       magic = AFS_CELLINFO_MAGIC;
+       cc = afs_osi_Write(tfile, off, &magic, sizeof(magic));
+       if (cc != sizeof(magic))
+           break;
+       off += cc;
 
-       afs_PutCell(tc, READ_LOCK);
+       cellnum = cn->cellnum;
+       cc = afs_osi_Write(tfile, off, &cellnum, sizeof(cellnum));
+       if (cc != sizeof(cellnum))
+           break;
+       off += cc;
+
+       clen = strlen(cn->cellname);
+       cc = afs_osi_Write(tfile, off, &clen, sizeof(clen));
+       if (cc != sizeof(clen))
+           break;
+       off += cc;
+
+       cc = afs_osi_Write(tfile, off, cn->cellname, clen);
+       if (cc != clen)
+           break;
+       off += clen;
     }
 
-    if (realName)
-       afs_osi_Free(realName, strlen(realName) + 1);
-    return afs_GetCellByName2(acellName, locktype, 0);
+    osi_UFSClose(tfile);
+    ReleaseWriteLock(&afs_xcell);
+    return 0;
+}
 
-bad:
-    if (realName)
-       afs_osi_Free(realName, strlen(realName) + 1);
-    return (struct cell *) 0;
+/*
+ * Cell alias implementation
+ *
+ * afs_FindCellAlias: look up cell alias by alias name
+ * afs_GetCellAlias: get cell alias by index (starting at 0)
+ * afs_PutCellAlias: put back a cell alias returned by Find or Get
+ * afs_NewCellAlias: create new cell alias entry
+ */
+
+struct cell_alias *afs_cellalias_head; /* Export for kdump */
+static afs_int32 afs_cellalias_index;
+static int afs_CellOrAliasExists_nl(char *aname);  /* Forward declaration */
+
+static struct cell_alias *afs_FindCellAlias(char *alias)
+{
+    struct cell_alias *tc;
+
+    for (tc = afs_cellalias_head; tc != NULL; tc = tc->next)
+       if (!strcmp(alias, tc->alias))
+           break;
+    return tc;
 }
 
+struct cell_alias *afs_GetCellAlias(int index)
+{
+    struct cell_alias *tc;
 
-struct cell *afs_GetCellByName2(acellName, locktype, trydns)
-    register char *acellName;
-    afs_int32 locktype;
-    char trydns;
+    ObtainReadLock(&afs_xcell);
+    for (tc = afs_cellalias_head; tc != NULL; tc = tc->next)
+       if (tc->index == index)
+           break;
+    ReleaseReadLock(&afs_xcell);
+
+    return tc;
+}
+
+void afs_PutCellAlias(struct cell_alias *a)
 {
-    register struct cell *tc;
-    register struct afs_q *cq, *tq;
-    int didAlias = 0;
+    return;
+}
 
-    AFS_STATCNT(afs_GetCellByName);
-retry:
-    ObtainWriteLock(&afs_xcell,100);
-    for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
-       tc = QTOC(cq); tq = QNext(cq);
-       if (!afs_strcasecmp(tc->cellName, acellName)) {
-           QRemove(&tc->lruq);
-           QAdd(&CellLRU, &tc->lruq);
-           ReleaseWriteLock(&afs_xcell);
-           afs_RefreshCell(tc);
-           if ((tc->states & CAlias) && (didAlias == 0)) {
-               acellName = tc->realName;
-               if (!acellName) return (struct cell *) 0;
-               didAlias = 1;
-               goto retry;
-           }
-           return tc;
-       }
+afs_int32 afs_NewCellAlias(char *alias, char *cell)
+{
+    struct cell_alias *tc;
+
+    ObtainSharedLock(&afs_xcell, 681);
+    if (afs_CellOrAliasExists_nl(alias)) {
+       ReleaseSharedLock(&afs_xcell);
+       return EEXIST;
     }
+
+    UpgradeSToWLock(&afs_xcell, 682);
+    tc = (struct cell_alias *) afs_osi_Alloc(sizeof(struct cell_alias));
+    tc->alias = afs_strdup(alias);
+    tc->cell = afs_strdup(cell);
+    tc->next = afs_cellalias_head;
+    tc->index = afs_cellalias_index++;
+    afs_cellalias_head = tc;
     ReleaseWriteLock(&afs_xcell);
-    return trydns ? afs_GetCellByName_Dns(acellName, locktype)
-                 : (struct cell *) 0;
 
-} /*afs_GetCellByName2*/
+    afs_DynrootInvalidate();
+    return 0;
+}
 
+/*
+ * Actual cell list implementation
+ *
+ * afs_UpdateCellLRU: bump given cell up to the front of the LRU queue
+ * afs_RefreshCell: look up cell information in AFSDB if timeout expired
+ *
+ * afs_TraverseCells: execute a callback for each existing cell
+ * afs_TraverseCells_nl: same as above except without locking afs_xcell
+ * afs_choose_cell_by_{name,num,index}: useful traversal callbacks
+ *
+ * afs_FindCellByName: return a cell with a given name, if it exists
+ * afs_FindCellByName_nl: same as above, without locking afs_xcell
+ * afs_GetCellByName: same as FindCellByName but tries AFSDB if not found
+ * afs_GetCell: return a cell with a given cell number
+ * afs_GetCellStale: same as GetCell, but does not try to refresh the data
+ * afs_GetCellByIndex: return a cell with a given index number (starting at 0)
+ *
+ * afs_GetPrimaryCell: return the primary cell, if any
+ * afs_IsPrimaryCell: returns true iff the given cell is the primary cell
+ * afs_IsPrimaryCellNum: returns afs_IsPrimaryCell(afs_GetCell(cellnum))
+ * afs_SetPrimaryCell: set the primary cell name to the given cell name
+ *
+ * afs_NewCell: create or update a cell entry
+ */
 
-struct cell *afs_GetCellByName(acellName, locktype)
-    register char *acellName;
-    afs_int32 locktype;
+struct afs_q CellLRU;          /* Export for kdump */
+static char *afs_thiscell;
+static afs_int32 afs_cellindex;
+
+static void afs_UpdateCellLRU(struct cell *c)
 {
-    return afs_GetCellByName2(acellName, locktype, 1);
+    ObtainWriteLock(&afs_xcell, 100);
+    QRemove(&c->lruq);
+    QAdd(&CellLRU, &c->lruq);
+    ReleaseWriteLock(&afs_xcell);
+}
 
-} /*afs_GetCellByName*/
+static void afs_RefreshCell(struct cell *ac)
+{
+    if (ac->states & CNoAFSDB)
+       return;
+    if (!ac->cellHosts[0] || (ac->timeout && ac->timeout <= osi_Time()))
+       afs_LookupAFSDB(ac->cellName);
+}
 
-static struct cell *afs_GetCellInternal(acell, locktype, holdxcell)
-    register afs_int32 acell;
-    afs_int32 locktype;
-    int holdxcell;
+static void *afs_TraverseCells_nl(void *(*cb)(struct cell *, void *), void *arg)
 {
-    register struct cell *tc;
-    register struct afs_q *cq, *tq;
+    struct afs_q *cq, *tq;
+    struct cell *tc;
+    void *ret = NULL;
 
-    AFS_STATCNT(afs_GetCell);
-    if (acell == 1 && afs_rootcell) return afs_rootcell;
-    if (holdxcell)
-       ObtainWriteLock(&afs_xcell,101);
     for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
        tc = QTOC(cq); tq = QNext(cq);
-       if (tc->cell == acell) {
-           QRemove(&tc->lruq);
-           QAdd(&CellLRU, &tc->lruq);
-           if (holdxcell)
-               ReleaseWriteLock(&afs_xcell);
-           afs_RefreshCell(tc);
-           return tc;
-       }
+       ret = cb(tc, arg);
+       if (ret) break;
     }
-    if (holdxcell)
-       ReleaseWriteLock(&afs_xcell);
-    return (struct cell *) 0;
 
-} /*afs_GetCell*/
+    return ret;
+}
+
+void *afs_TraverseCells(void *(*cb)(struct cell *, void *), void *arg)
+{
+    void *ret;
+
+    ObtainReadLock(&afs_xcell);
+    ret = afs_TraverseCells_nl(cb, arg);
+    ReleaseReadLock(&afs_xcell);
+
+    return ret;
+}
 
-struct cell *afs_GetCell(acell, locktype)
-    register afs_int32 acell;
-    afs_int32 locktype;
+static void *afs_choose_cell_by_name(struct cell *cell, void *arg)
 {
-    return afs_GetCellInternal(acell, locktype, 1);
+    return strcmp(cell->cellName, (char *) arg) ? NULL : cell;
 }
 
-/* This is only to be called if the caller is already holding afs_xcell */
-struct cell *afs_GetCellNoLock(acell, locktype)
-    register afs_int32 acell;
-    afs_int32 locktype;
+static void *afs_choose_cell_by_num(struct cell *cell, void *arg)
 {
-    return afs_GetCellInternal(acell, locktype, 0);
+    return (cell->cellNum == *((afs_int32 *) arg)) ? cell : NULL;
 }
 
-struct cell *afs_GetCellByIndex(cellindex, locktype, refresh)
-    register afs_int32 cellindex;
-    afs_int32 locktype;
-    afs_int32 refresh;
+static void *afs_choose_cell_by_index(struct cell *cell, void *arg)
 {
-    register struct cell *tc;
-    register struct afs_q *cq, *tq;
+    return (cell->cellIndex == *((afs_int32 *) arg)) ? cell : NULL;
+}
 
-    AFS_STATCNT(afs_GetCellByIndex);
-    ObtainWriteLock(&afs_xcell,102);
-    for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
-       tc = QTOC(cq); tq = QNext(cq);
-       if (tc->cellIndex == cellindex) {
-           QRemove(&tc->lruq);
-           QAdd(&CellLRU, &tc->lruq);
-           ReleaseWriteLock(&afs_xcell);
-           if (refresh) afs_RefreshCell(tc);
-           return tc;
-       }
+static struct cell *afs_FindCellByName_nl(char *acellName, afs_int32 locktype)
+{
+    return afs_TraverseCells_nl(&afs_choose_cell_by_name, acellName);
+}
+
+static struct cell *afs_FindCellByName(char *acellName, afs_int32 locktype)
+{
+    return afs_TraverseCells(&afs_choose_cell_by_name, acellName);
+}
+
+struct cell *afs_GetCellByName(char *acellName, afs_int32 locktype)
+{
+    struct cell *tc;
+
+    tc = afs_FindCellByName(acellName, locktype);
+    if (!tc) {
+       afs_LookupAFSDB(acellName);
+       tc = afs_FindCellByName(acellName, locktype);
     }
-    ReleaseWriteLock(&afs_xcell);
-    return (struct cell *) 0;
+    if (tc) {
+       afs_cellname_ref(tc->cnamep);
+       afs_UpdateCellLRU(tc);
+       afs_RefreshCell(tc);
+    }
+
+    return tc;
+}
 
-} /*afs_GetCellByIndex*/
+struct cell *afs_GetCell(afs_int32 cellnum, afs_int32 locktype)
+{
+    struct cell *tc;
+    struct cell_name *cn;
 
+    tc = afs_GetCellStale(cellnum, locktype);
+    if (tc) {
+       afs_RefreshCell(tc);
+    } else {
+       ObtainReadLock(&afs_xcell);
+       cn = afs_cellname_lookup_id(cellnum);
+       ReleaseReadLock(&afs_xcell);
+       if (cn)
+           tc = afs_GetCellByName(cn->cellname, locktype);
+    }
+    return tc;
+}
 
-struct cell *afs_GetRealCellByIndex(cellindex, locktype, refresh)
-    register afs_int32 cellindex;
-    afs_int32 locktype;
-    afs_int32 refresh;
+struct cell *afs_GetCellStale(afs_int32 cellnum, afs_int32 locktype)
 {
-    register struct cell *tc;
-    register struct afs_q *cq, *tq;
+    struct cell *tc;
 
-    AFS_STATCNT(afs_GetCellByIndex);
-    ObtainWriteLock(&afs_xcell,102);
-    for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
-       tc = QTOC(cq); tq = QNext(cq);
-       if (tc->realcellIndex == cellindex) {
-           QRemove(&tc->lruq);
-           QAdd(&CellLRU, &tc->lruq);
-           ReleaseWriteLock(&afs_xcell);
-           if (refresh) afs_RefreshCell(tc);
-           return tc;
-       }
+    tc = afs_TraverseCells(&afs_choose_cell_by_num, &cellnum);
+    if (tc) {
+       afs_cellname_ref(tc->cnamep);
+       afs_UpdateCellLRU(tc);
     }
-    ReleaseWriteLock(&afs_xcell);
-    return (struct cell *) 0;
-} /*afs_GetRealCellByIndex*/
+    return tc;
+}
+
+struct cell *afs_GetCellByIndex(afs_int32 index, afs_int32 locktype)
+{
+    struct cell *tc;
 
+    tc = afs_TraverseCells(&afs_choose_cell_by_index, &index);
+    if (tc)
+       afs_UpdateCellLRU(tc);
+    return tc;
+}
 
-afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport, timeout, aliasFor)
-    int aflags;
-    char *acellName;
-    register afs_int32 *acellHosts;
-    char *linkedcname;
-    u_short fsport, vlport;
-    int timeout;
-    char *aliasFor;
+struct cell *afs_GetPrimaryCell(afs_int32 locktype)
 {
-    register struct cell *tc, *tcl=0;
-    register afs_int32 i, newc=0, code=0;
-    register struct afs_q *cq, *tq;
+    return afs_GetCellByName(afs_thiscell, locktype);
+}
 
-    AFS_STATCNT(afs_NewCell);
-    if (!(aflags & CAlias) && *acellHosts == 0)
-       /* need >= one host to gen cell # */
-       return EINVAL;
+int afs_IsPrimaryCell(struct cell *cell)
+{
+    return strcmp(cell->cellName, afs_thiscell) ? 0 : 1;
+}
 
-    ObtainWriteLock(&afs_xcell,103);
+int afs_IsPrimaryCellNum(afs_int32 cellnum)
+{
+    struct cell *tc;
+    int primary = 0;
 
-    /* Find the cell and mark its servers as not down but gone */
-    for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
-       tc = QTOC(cq); tq = QNext(cq);
-       if (afs_strcasecmp(tc->cellName, acellName) == 0) {
-           /* if the cell we've found has the correct name but no timeout,
-            * and we're called with a non-zero timeout, bail out:  never
-            * override static configuration entries with AFSDB ones. */
-           if (timeout && !tc->timeout) {
-               ReleaseWriteLock(&afs_xcell);
-               return 0;
-           }
-           /* we don't want to keep pinging old vlservers which were down,
-            * since they don't matter any more.  It's easier to do this than
-            * to remove the server from its various hash tables. */
-           for (i=0; i<MAXCELLHOSTS; i++) {
-               if (!tc->cellHosts[i]) break;
-               tc->cellHosts[i]->flags &= ~SRVR_ISDOWN;
-               tc->cellHosts[i]->flags |= SRVR_ISGONE;
-           }
-           break;
-       }
+    tc = afs_GetCellStale(cellnum, READ_LOCK);
+    if (tc) {
+       primary = afs_IsPrimaryCell(tc);
+       afs_PutCell(tc, READ_LOCK);
     }
 
-    if (cq != &CellLRU) {
+    return primary;
+}
+
+afs_int32 afs_SetPrimaryCell(char *acellName)
+{
+    ObtainWriteLock(&afs_xcell, 691);
+    if (afs_thiscell)
+       afs_osi_FreeStr(afs_thiscell);
+    afs_thiscell = afs_strdup(acellName);
+    ReleaseWriteLock(&afs_xcell);
+    return 0;
+}
+
+afs_int32 afs_NewCell(char *acellName, afs_int32 *acellHosts, int aflags,
+       char *linkedcname, u_short fsport, u_short vlport, int timeout)
+{
+    struct cell *tc, *tcl=0;
+    afs_int32 i, newc=0, code=0;
+
+    AFS_STATCNT(afs_NewCell);
+
+    ObtainWriteLock(&afs_xcell, 103);
+
+    tc = afs_FindCellByName_nl(acellName, READ_LOCK);
+    if (tc) {
        aflags &= ~CNoSUID;
-    }
-    else {
+    } else {
        tc = (struct cell *) afs_osi_Alloc(sizeof(struct cell));
-       memset((char *)tc, 0, sizeof(*tc));
-       QAdd(&CellLRU, &tc->lruq);                      /* put in lruq */
-       tc->cellName = (char *) afs_osi_Alloc(strlen(acellName)+1);
-       strcpy(tc->cellName, acellName);
-       tc->cellIndex = afs_cellindex++;
-       if (aflags & CPrimary) {
-           extern int afs_rootCellIndex;
-           tc->cell = 1;       /* primary cell is always 1 */
-           afs_rootcell = tc;
-           afs_rootCellIndex = tc->cellIndex;
-       } else {
-           tc->cell = afs_nextCellNum++;
-       }
-       tc->states = 0;
-       tc->lcellp = (struct cell *)0;
-       tc->fsport = (fsport ? fsport : AFS_FSPORT);
-       tc->vlport = (vlport ? vlport : AFS_VLPORT);
-       afs_stats_cmperf.numCellsVisible++;
-       newc++;
-       if (!(aflags & CAlias)) {
-           tc->realcellIndex = afs_realcellindex++;
-       } else {
-           tc->realcellIndex = -1;
-       }
+       memset((char *) tc, 0, sizeof(*tc));
+       tc->cellName = afs_strdup(acellName);
+       tc->fsport = AFS_FSPORT;
+       tc->vlport = AFS_VLPORT;
+       RWLOCK_INIT(&tc->lock, "cell lock");
+       newc = 1;
+       if (afs_thiscell && !strcmp(acellName, afs_thiscell))
+           aflags &= ~CNoSUID;
+    }
+    ObtainWriteLock(&tc->lock, 688);
+
+    /* If the cell we've found has the correct name but no timeout,
+     * and we're called with a non-zero timeout, bail out:  never
+     * override static configuration entries with AFSDB ones.
+     * One exception: if the original cell entry had no servers,
+     * it must get servers from AFSDB.
+     */
+    if (timeout && !tc->timeout && tc->cellHosts[0]) {
+       code = EINVAL;
+       goto bad;
+    }
+
+    /* we don't want to keep pinging old vlservers which were down,
+     * since they don't matter any more.  It's easier to do this than
+     * to remove the server from its various hash tables. */
+    for (i=0; i<MAXCELLHOSTS; i++) {
+       if (!tc->cellHosts[i]) break;
+       tc->cellHosts[i]->flags &= ~SRVR_ISDOWN;
+       tc->cellHosts[i]->flags |= SRVR_ISGONE;
     }
 
+    if (fsport) tc->fsport = fsport;
+    if (vlport) tc->vlport = vlport;
+
     if (aflags & CLinkedCell) {
        if (!linkedcname) {
            code = EINVAL;
            goto bad;
        }
-       for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
-           tcl = QTOC(cq); tq = QNext(cq);
-           if (!afs_strcasecmp(tcl->cellName, linkedcname)) {
-               break;
-           }
-           tcl = 0;
-       }
+       tcl = afs_FindCellByName_nl(linkedcname, READ_LOCK);
        if (!tcl) {
            code = ENOENT;
            goto bad;
@@ -542,71 +693,154 @@ afs_int32 afs_NewCell(acellName, acellHosts, aflags, linkedcname, fsport, vlport
     tc->states |= aflags;
     tc->timeout = timeout;
 
-    /* Allow converting an alias into a real cell */
-    if ((!(aflags & CAlias)) && (tc->states & CAlias)) {
-       tc->states &= ~CAlias;
-       tc->realcellIndex = afs_realcellindex++;
-    }
     memset((char *)tc->cellHosts, 0, sizeof(tc->cellHosts));
-    if (aflags & CAlias) {
-       if (!aliasFor) {
-           code = EINVAL;
-           goto bad;
-       }
-       if (tc->realName) afs_osi_Free(tc->realName, strlen(tc->realName)+1);
-       tc->realName = (char *) afs_osi_Alloc(strlen(aliasFor)+1);
-       strcpy(tc->realName, aliasFor);
-       goto done;
-    }
-
     for (i=0; i<MAXCELLHOSTS; i++) {
-        struct server *ts;
+       struct server *ts;
        afs_uint32 temp = acellHosts[i];
        if (!temp) break;
-       ts = afs_GetServer(&temp, 1, 0, tc->vlport, WRITE_LOCK, (afsUUID *)0, 0);
-        ts->cell = tc;
+       ts = afs_GetServer(&temp, 1, 0, tc->vlport, WRITE_LOCK, NULL, 0);
+       ts->cell = tc;
        ts->flags &= ~SRVR_ISGONE;
        tc->cellHosts[i] = ts;
        afs_PutServer(ts, WRITE_LOCK);
     }
     afs_SortServers(tc->cellHosts, MAXCELLHOSTS);      /* randomize servers */
-done:
+
+    if (newc) {
+       struct cell_name *cn;
+
+       cn = afs_cellname_lookup_name(acellName);
+       if (!cn)
+           cn = afs_cellname_new(acellName, 0);
+
+       tc->cnamep = cn;
+       tc->cellNum = cn->cellnum;
+       tc->cellIndex = afs_cellindex++;
+       afs_stats_cmperf.numCellsVisible++;
+       QAdd(&CellLRU, &tc->lruq);
+    }
+
+    ReleaseWriteLock(&tc->lock);
     ReleaseWriteLock(&afs_xcell);
+    afs_PutCell(tc, 0);
+    afs_DynrootInvalidate();
     return 0;
+
 bad:
     if (newc) {
-       QRemove(&tc->lruq);
-       afs_osi_Free(tc->cellName, strlen(tc->cellName)+1);
-       afs_osi_Free((char *)tc, sizeof(struct cell));
+       afs_osi_FreeStr(tc->cellName);
+       afs_osi_Free(tc, sizeof(struct cell));
     }
+    ReleaseWriteLock(&tc->lock);
     ReleaseWriteLock(&afs_xcell);
     return code;
+}
 
-} /*afs_NewCell*/
+/*
+ * Miscellaneous stuff
+ *
+ * afs_CellInit: perform whatever initialization is necessary
+ * shutdown_cell: called on shutdown, should deallocate memory, etc
+ * afs_RemoveCellEntry: remove a server from a cell's server list
+ * afs_CellOrAliasExists: check if the given name exists as a cell or alias
+ * afs_CellOrAliasExists_nl: same as above without locking afs_xcell
+ * afs_CellNumValid: check if a cell number is valid (also set the used flag)
+ */
 
-afs_RemoveCellEntry(struct server *srvp)
+void afs_CellInit()
 {
-  struct cell *tc;
-  afs_int32 j, k;
+    RWLOCK_INIT(&afs_xcell, "afs_xcell");
+#ifdef AFS_AFSDB_ENV
+    RWLOCK_INIT(&afsdb_req.lock, "afsdb_req.lock");
+#endif
+    QInit(&CellLRU);
 
-  tc = srvp->cell;
-  if (!tc) return;
+    afs_cellindex = 0;
+    afs_cellalias_index = 0;
+}
 
-  /* Remove the server structure from the cell list - if there */
-  ObtainWriteLock(&afs_xcell,200);
-  for (j=k=0; j<MAXCELLHOSTS; j++) {
-     if (!tc->cellHosts[j]) break;
-     if (tc->cellHosts[j] != srvp) {
-        tc->cellHosts[k++] = tc->cellHosts[j];
-     }
-  }
-  if (k == 0) {
-     /* What do we do if we remove the last one? */
-  }
-  for (; k<MAXCELLHOSTS; k++) {
-     tc->cellHosts[k] = 0;
-  }
-  ReleaseWriteLock(&afs_xcell);
+void shutdown_cell()
+{
+    struct afs_q *cq, *tq;
+    struct cell *tc;
+
+    RWLOCK_INIT(&afs_xcell, "afs_xcell");
+
+    for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
+       tc = QTOC(cq); tq = QNext(cq);
+       if (tc->cellName) afs_osi_FreeStr(tc->cellName);
+       afs_osi_Free(tc, sizeof(struct cell));
+    }
+    QInit(&CellLRU);
+}
+
+void afs_RemoveCellEntry(struct server *srvp)
+{
+    struct cell *tc;
+    afs_int32 j, k;
+
+    tc = srvp->cell;
+    if (!tc) return;
+
+    /* Remove the server structure from the cell list - if there */
+    ObtainWriteLock(&tc->lock, 200);
+    for (j=k=0; j<MAXCELLHOSTS; j++) {
+       if (!tc->cellHosts[j]) break;
+       if (tc->cellHosts[j] != srvp) {
+           tc->cellHosts[k++] = tc->cellHosts[j];
+       }
+    }
+    if (k == 0) {
+       /* What do we do if we remove the last one? */
+    }
+    for (; k<MAXCELLHOSTS; k++) {
+       tc->cellHosts[k] = 0;
+    }
+    ReleaseWriteLock(&tc->lock);
+}
+
+static int afs_CellOrAliasExists_nl(char *aname)
+{
+    struct cell *c;
+    struct cell_alias *ca;
+
+    c = afs_FindCellByName_nl(aname, READ_LOCK);
+    if (c) {
+       afs_PutCell(c, READ_LOCK);
+       return 1;
+    }
+
+    ca = afs_FindCellAlias(aname);
+    if (ca) {
+       afs_PutCellAlias(ca);
+       return 1;
+    }
+
+    return 0;
 }
 
+int afs_CellOrAliasExists(char *aname)
+{
+    int ret;
+
+    ObtainReadLock(&afs_xcell);
+    ret = afs_CellOrAliasExists_nl(aname);
+    ReleaseReadLock(&afs_xcell);
+
+    return ret;
+}
+
+int afs_CellNumValid(afs_int32 cellnum)
+{
+    struct cell_name *cn;
+
+    ObtainReadLock(&afs_xcell);
+    cn = afs_cellname_lookup_id(cellnum);
+    ReleaseReadLock(&afs_xcell);
+    if (cn) {
+       cn->used = 1;
+       return 1;
+    } else {
+       return 0;
+    }
+}
index 94fa47325c116eddcf112d48b228c38e81ab9440..3e145e632c3b3cbb524351630187ba1d15852180 100644 (file)
@@ -13,7 +13,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_dcache.c,v 1.1.1.8 2002/05/10 23:43:12 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_dcache.c,v 1.1.1.9 2003/04/13 19:02:35 hartmans Exp $");
 
 #include "../afs/sysincludes.h" /*Standard vendor system headers*/
 #include "../afs/afsincludes.h" /*AFS-based standard headers*/
@@ -2128,7 +2128,7 @@ done:
     /*
      * See if this was a reference to a file in the local cell.
      */
-    if (avc->fid.Cell == LOCALCELL)
+    if (afs_IsPrimaryCellNum(avc->fid.Cell))
        afs_stats_cmperf.dlocalAccesses++;
     else
        afs_stats_cmperf.dremoteAccesses++;
@@ -2297,6 +2297,7 @@ struct dcache *afs_UFSGetDSlot(aslot, tmpdc)
 
     register afs_int32 code;
     register struct dcache *tdc;
+    int entryok;
 
     AFS_STATCNT(afs_UFSGetDSlot);
     if (CheckLock(&afs_xdcache) != -1) osi_Panic("getdslot nolock");
@@ -2345,9 +2346,16 @@ struct dcache *afs_UFSGetDSlot(aslot, tmpdc)
     /*
       * Seek to the aslot'th entry and read it in.
       */
-    code = afs_osi_Read(afs_cacheInodep, sizeof(struct fcache) * aslot + sizeof(struct afs_fheader),
-                   (char *)(&tdc->f), sizeof(struct fcache));
-    if (code != sizeof(struct fcache)) {
+    code = afs_osi_Read(afs_cacheInodep, sizeof(struct fcache) * aslot +
+                                        sizeof(struct afs_fheader),
+                       (char *)(&tdc->f), sizeof(struct fcache));
+    entryok = 1;
+    if (code != sizeof(struct fcache))
+       entryok = 0;
+    if (!afs_CellNumValid(tdc->f.fid.Cell))
+       entryok = 0;
+
+    if (!entryok) {
        tdc->f.fid.Cell = 0;
        tdc->f.fid.Fid.Volume = 0;
        tdc->f.chunk = -1;
@@ -2406,8 +2414,10 @@ afs_WriteDCache(adc, atime)
     /*
      * Seek to the right dcache slot and write the in-memory image out to disk.
      */
-    code = afs_osi_Write(afs_cacheInodep, sizeof(struct fcache) * adc->index + sizeof(struct afs_fheader), 
-                    (char *)(&adc->f), sizeof(struct fcache));
+    afs_cellname_write();
+    code = afs_osi_Write(afs_cacheInodep, sizeof(struct fcache) * adc->index +
+                                         sizeof(struct afs_fheader), 
+                        (char *)(&adc->f), sizeof(struct fcache));
     if (code != sizeof(struct fcache)) return EIO;
     return 0;
 
index 107b3a8bd3810adee82b4e1c02a0e19a539ffadf..7241166258dc7ae6265fecf384016e2f188cd712 100644 (file)
@@ -14,7 +14,7 @@
  * afs_IsDynrootFid
  * afs_GetDynrootFid
  * afs_IsDynroot
- * afs_RefreshDynroot
+ * afs_DynrootInvalidate
  * afs_GetDynroot
  * afs_PutDynroot
  * afs_DynrootNewVnode
@@ -38,7 +38,7 @@
 #include "../afs/prs_fs.h"
 #include "../afs/dir.h"
 
-#define AFS_DYNROOT_CELL       1
+#define AFS_DYNROOT_CELLNAME   "dynroot"
 #define AFS_DYNROOT_VOLUME     1
 #define AFS_DYNROOT_VNODE      1
 #define AFS_DYNROOT_UNIQUE     1
@@ -48,7 +48,8 @@
  * and a type-specific identifier in the lower 24 bits.
  */
 #define VN_TYPE_CELL           0x01    /* Corresponds to a struct cell */
-#define VN_TYPE_SYMLINK                0x02    /* User-created symlink in /afs */
+#define VN_TYPE_ALIAS          0x02    /* Corresponds to a struct cell_alias */
+#define VN_TYPE_SYMLINK                0x03    /* User-created symlink in /afs */
 
 #define VNUM_TO_VNTYPE(vnum)   ((vnum) >> 24)
 #define VNUM_TO_VNID(vnum)     ((vnum) & 0x00ffffff)
 #define VNUM_FROM_CIDX_RW(cidx, rw) \
                                VNUM_FROM_TYPEID(VN_TYPE_CELL, \
                                                 ((cidx) << 2 | (rw) << 1))
+#define VNUM_FROM_CAIDX_RW(caidx, rw) \
+                               VNUM_FROM_TYPEID(VN_TYPE_ALIAS, \
+                                                ((caidx) << 2 | (rw) << 1))
 
 static int afs_dynrootEnable = 0;
+static int afs_dynrootCell = 0;
 
 static afs_rwlock_t afs_dynrootDirLock;
 /* Start of variables protected by afs_dynrootDirLock */
 static char *afs_dynrootDir = NULL;
 static int afs_dynrootDirLen;
 static int afs_dynrootDirLinkcnt;
-static int afs_dynrootCellCount;
+static int afs_dynrootDirVersion;
 static int afs_dynrootVersion = 1;
 static int afs_dynrootVersionHigh = 1;
 /* End of variables protected by afs_dynrootDirLock */
@@ -89,6 +94,30 @@ static int afs_dynSymlinkIndex = 0;
 extern afs_int32 afs_cellindex;
 extern afs_rwlock_t afs_xvcache;
 
+/*
+ * Set up a cell for dynroot if it's not there yet.
+ */
+static int afs_dynrootCellInit()
+{
+    if (afs_dynrootEnable && !afs_dynrootCell) {
+       afs_int32 cellHosts[MAXCELLHOSTS];
+       struct cell *tc;
+       int code;
+       memset(cellHosts, 0, sizeof(cellHosts));
+       code = afs_NewCell(AFS_DYNROOT_CELLNAME, cellHosts, CNoSUID | CNoAFSDB,
+                          NULL, 0, 0, 0);
+       if (code)
+           return code;
+       tc = afs_GetCellByName(AFS_DYNROOT_CELLNAME, READ_LOCK);
+       if (!tc)
+           return ENODEV;
+       afs_dynrootCell = tc->cellNum;
+       afs_PutCell(tc, READ_LOCK);
+    }
+    return 0;
+}
+
 /*
  * Returns non-zero iff fid corresponds to the top of the dynroot volume.
  */
@@ -97,7 +126,7 @@ afs_IsDynrootFid(struct VenusFid *fid)
 {
     return
        (afs_dynrootEnable &&
-        fid->Cell       == AFS_DYNROOT_CELL   &&
+        fid->Cell       == afs_dynrootCell   &&
         fid->Fid.Volume == AFS_DYNROOT_VOLUME &&
         fid->Fid.Vnode  == AFS_DYNROOT_VNODE  &&
         fid->Fid.Unique == AFS_DYNROOT_UNIQUE);
@@ -109,7 +138,7 @@ afs_IsDynrootFid(struct VenusFid *fid)
 void
 afs_GetDynrootFid(struct VenusFid *fid) 
 {
-    fid->Cell       = AFS_DYNROOT_CELL;
+    fid->Cell       = afs_dynrootCell;
     fid->Fid.Volume = AFS_DYNROOT_VOLUME;
     fid->Fid.Vnode  = AFS_DYNROOT_VNODE;
     fid->Fid.Unique = AFS_DYNROOT_UNIQUE;
@@ -213,32 +242,61 @@ afs_dynroot_addDirEnt(dirHeader, curPageP, curChunkP, name, vnode)
     *curChunkP = curChunk;
 }
 
+/*
+ * Invalidate the /afs vnode for dynroot; called when the underlying
+ * directory has changed and needs to be re-read.
+ */
+void afs_DynrootInvalidate(void)
+{
+    afs_int32 retry;
+    struct vcache *tvc;
+    struct VenusFid tfid;
+    if (!afs_dynrootEnable)
+       return;
+    ObtainWriteLock(&afs_dynrootDirLock, 687);
+    afs_dynrootVersion++;
+    afs_dynrootVersionHigh = osi_Time();
+    ReleaseWriteLock(&afs_dynrootDirLock);
+    afs_GetDynrootFid(&tfid);
+    do {
+       retry = 0;
+       ObtainReadLock(&afs_xvcache);
+       tvc = afs_FindVCache(&tfid, 0, 0, &retry, 0);
+       ReleaseReadLock(&afs_xvcache);
+    } while (retry);
+    if (tvc) {
+       tvc->states &= ~(CStatd | CUnique);
+       osi_dnlc_purgedp(tvc);
+       afs_PutVCache(tvc);
+    }
+}
+
 /*
  * Regenerates the dynroot contents from the current list of
  * cells.  Useful when the list of cells has changed due to
  * an AFSDB lookup, for instance.
  */
-void
-afs_RefreshDynroot()
+static void afs_RebuildDynroot(void)
 {
     int cellidx, maxcellidx, i;
+    int aliasidx, maxaliasidx;
     struct cell *c;
+    struct cell_alias *ca;
     int curChunk, curPage;
     int dirSize, sizeOfCurEntry, dotLen;
     char *newDir, *dotCell;
     struct DirHeader *dirHeader;
-    struct PageHeader *pageHeader;
     struct DirEntry *dirEntry;
-    int doFlush = 0;
     int linkCount = 0;
     struct afs_dynSymlink *ts;
-    int newCellCount;
+    int newVersion;
 
-    /*
-     * Save afs_cellindex here, in case it changes between the
-     * two loops.
-     */
-    maxcellidx = afs_cellindex;
+    ObtainReadLock(&afs_dynrootDirLock);
+    newVersion = afs_dynrootVersion;
+    ReleaseReadLock(&afs_dynrootDirLock);
 
     /*
      * Compute the amount of space we need for the fake dir
@@ -249,9 +307,10 @@ afs_RefreshDynroot()
     /* Reserve space for "." and ".." */
     curChunk += 2;
 
-    for (cellidx = 0; cellidx < maxcellidx; cellidx++) {
-       c = afs_GetCellByIndex(cellidx, READ_LOCK, 0 /* don't refresh */);
-       if (!c) continue;
+    for (cellidx = 0; ; cellidx++) {
+       c = afs_GetCellByIndex(cellidx, READ_LOCK);
+       if (!c) break;
+       if (c->cellNum == afs_dynrootCell) continue;
 
        sizeOfCurEntry = afs_dir_NameBlobs(c->cellName);
        if (curChunk + sizeOfCurEntry > EPP) {
@@ -274,6 +333,32 @@ afs_RefreshDynroot()
        afs_osi_Free(dotCell, dotLen);
        afs_PutCell(c, READ_LOCK);
     }
+    maxcellidx = cellidx;
+
+    for (aliasidx = 0; ; aliasidx++) {
+       ca = afs_GetCellAlias(aliasidx);
+       if (!ca) break;
+
+       sizeOfCurEntry = afs_dir_NameBlobs(ca->alias);
+       if (curChunk + sizeOfCurEntry > EPP) {
+           curPage++;
+           curChunk = 1;
+       }
+       curChunk += sizeOfCurEntry;
+
+       dotCell = afs_osi_Alloc(strlen(ca->alias) + 2);
+       strcpy(dotCell, ".");
+       strcat(dotCell, ca->alias);
+       sizeOfCurEntry = afs_dir_NameBlobs(dotCell);
+       if (curChunk + sizeOfCurEntry > EPP) {
+           curPage++;
+           curChunk = 1;
+       }
+       curChunk += sizeOfCurEntry;
+
+       afs_PutCellAlias(ca);
+    }
+    maxaliasidx = aliasidx;
 
     ObtainReadLock(&afs_dynSymlinkLock);
     ts = afs_dynSymlinkBase;
@@ -317,8 +402,9 @@ afs_RefreshDynroot()
     linkCount += 2;
 
     for (cellidx = 0; cellidx < maxcellidx; cellidx++) {
-       c = afs_GetCellByIndex(cellidx, READ_LOCK, 0 /* don't refresh */);
+       c = afs_GetCellByIndex(cellidx, READ_LOCK);
        if (!c) continue;
+       if (c->cellNum == afs_dynrootCell) continue;
 
        dotLen = strlen(c->cellName) + 2;
        dotCell = afs_osi_Alloc(dotLen);
@@ -329,12 +415,26 @@ afs_RefreshDynroot()
        afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
                              dotCell, VNUM_FROM_CIDX_RW(cellidx, 1));
 
-       if (!(c->states & CAlias)) linkCount += 2;
+       linkCount += 2;
 
        afs_osi_Free(dotCell, dotLen);
        afs_PutCell(c, READ_LOCK);
     }
 
+    for (aliasidx = 0; aliasidx < maxaliasidx; aliasidx++) {
+       ca = afs_GetCellAlias(aliasidx);
+       if (!ca) continue;
+       
+       dotCell = afs_osi_Alloc(strlen(ca->alias) + 2);
+       strcpy(dotCell, ".");
+       strcat(dotCell, ca->alias);
+       afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
+                             ca->alias, VNUM_FROM_CAIDX_RW(aliasidx, 0));
+       afs_dynroot_addDirEnt(dirHeader, &curPage, &curChunk,
+                             dotCell, VNUM_FROM_CAIDX_RW(aliasidx, 1));
+       afs_PutCellAlias(ca);
+    }
+    
     ts = afs_dynSymlinkBase;
     while (ts) {
        int vnum = VNUM_FROM_TYPEID(VN_TYPE_SYMLINK, ts->index);
@@ -343,7 +443,6 @@ afs_RefreshDynroot()
        ts = ts->next;
     }
 
-    newCellCount = maxcellidx + afs_dynSymlinkIndex;
     ReleaseReadLock(&afs_dynSymlinkLock);
 
     ObtainWriteLock(&afs_dynrootDirLock, 549);
@@ -351,51 +450,21 @@ afs_RefreshDynroot()
     afs_dynrootDir = newDir;
     afs_dynrootDirLen = dirSize;
     afs_dynrootDirLinkcnt = linkCount;
-    if (afs_dynrootCellCount != newCellCount) {
-       /*
-        * New cells/symlinks added -- bump data version, invalidate vcache.
-        */
-       afs_dynrootCellCount = newCellCount;
-       afs_dynrootVersion++;
-       afs_dynrootVersionHigh = osi_Time();
-       doFlush = 1;
-    }
+    afs_dynrootVersion = newVersion;
     ReleaseWriteLock(&afs_dynrootDirLock);
-
-    if (doFlush) {
-       afs_int32 retry;
-       struct vcache *tvc;
-       struct VenusFid tfid;
-
-       afs_GetDynrootFid(&tfid);
-       do {
-           retry = 0;
-           ObtainReadLock(&afs_xvcache);
-           tvc = afs_FindVCache(&tfid, 0, 0, &retry, 0);
-           ReleaseReadLock(&afs_xvcache);
-       } while (retry);
-       if (tvc) {
-           tvc->states &= ~(CStatd | CUnique);
-           osi_dnlc_purgedp(tvc);
-           afs_PutVCache(tvc);
-       }
-    }
 }
 
 /*
  * Returns a pointer to the base of the dynroot directory in memory,
  * length thereof, and a FetchStatus.
  */
-void
-afs_GetDynroot(dynrootDir, dynrootLen, status)
-    char **dynrootDir;
-    int *dynrootLen;
-    struct AFSFetchStatus *status;
+void afs_GetDynroot(char **dynrootDir, int *dynrootLen, 
+                   struct AFSFetchStatus *status)
 {
     ObtainReadLock(&afs_dynrootDirLock);
-    if (!afs_dynrootDir) {
+    if (!afs_dynrootDir || afs_dynrootDirVersion != afs_dynrootVersion) {
        ReleaseReadLock(&afs_dynrootDirLock);
-       afs_RefreshDynroot();
+       afs_RebuildDynroot();
        ObtainReadLock(&afs_dynrootDirLock);
     }
 
@@ -447,10 +516,11 @@ afs_DynrootNewVnode(avc, status)
     /*
      * Check if this is an entry under /afs, e.g. /afs/cellname.
      */
-    if (avc->fid.Cell       == AFS_DYNROOT_CELL &&
+    if (avc->fid.Cell       == afs_dynrootCell &&
        avc->fid.Fid.Volume == AFS_DYNROOT_VOLUME) {
 
        struct cell *c;
+       struct cell_alias *ca;
        int namelen, linklen, cellidx, rw;
 
        memset(status, 0, sizeof(struct AFSFetchStatus));
@@ -487,7 +557,8 @@ afs_DynrootNewVnode(avc, status)
            return ts ? 1 : 0;
        }
 
-       if (VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) != VN_TYPE_CELL) {
+       if (VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) != VN_TYPE_CELL &&
+           VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) != VN_TYPE_ALIAS) {
            afs_warn("dynroot vnode inconsistency, unknown VNTYPE %d\n",
                     VNUM_TO_VNTYPE(avc->fid.Fid.Vnode));
            return 0;
@@ -496,26 +567,26 @@ afs_DynrootNewVnode(avc, status)
        cellidx = VNUM_TO_CIDX(avc->fid.Fid.Vnode);
        rw = VNUM_TO_RW(avc->fid.Fid.Vnode);
 
-       c = afs_GetCellByIndex(cellidx, READ_LOCK, 1 /* refresh */);
-       if (!c) {
-           afs_warn("dynroot vnode inconsistency, can't find cell %d\n",
-                    cellidx);
-           return 0;
-       }
+       if (VNUM_TO_VNTYPE(avc->fid.Fid.Vnode) == VN_TYPE_ALIAS) {
+           char *realName;
+
+           ca = afs_GetCellAlias(cellidx);
+           if (!ca) {
+               afs_warn("dynroot vnode inconsistency, can't find alias %d\n",
+                        cellidx);
+               return 0;
+           }
 
-       if (c->states & CAlias) {
            /*
             * linkData needs to contain the name of the cell
             * we're aliasing for.
             */
-           char *realName = c->realName;
-
+           realName = ca->cell;
            if (!realName) {
                afs_warn("dynroot: alias %s missing real cell name\n",
-                        c->cellName);
+                        ca->alias);
+               avc->linkData = afs_strdup("unknown");
                linklen = 7;
-               avc->linkData = afs_osi_Alloc(linklen + 1);
-               strcpy(avc->linkData, "unknown");
            } else {
                int namelen = strlen(realName);
                linklen = rw + namelen;
@@ -525,7 +596,15 @@ afs_DynrootNewVnode(avc, status)
            }
 
            status->UnixModeBits = 0755;
+           afs_PutCellAlias(ca);
        } else {
+           c = afs_GetCellByIndex(cellidx, READ_LOCK);
+           if (!c) {
+               afs_warn("dynroot vnode inconsistency, can't find cell %d\n",
+                        cellidx);
+               return 0;
+           }
+
            /*
             * linkData needs to contain "#cell:root.cell" or "%cell:root.cell"
             */
@@ -537,10 +616,10 @@ afs_DynrootNewVnode(avc, status)
            strcat(avc->linkData, ":root.cell");
 
            status->UnixModeBits = 0644;
+           afs_PutCell(c, READ_LOCK);
        }
 
        status->Length = linklen;
-       afs_PutCell(c, READ_LOCK);
        return 1;
     }
 
@@ -555,7 +634,7 @@ afs_SetDynrootEnable(enable)
     int enable;
 {
     afs_dynrootEnable = enable;
-    return 0;
+    return afs_dynrootCellInit();
 }
 
 /*
@@ -571,14 +650,11 @@ afs_GetDynrootEnable()
  * Remove a temporary symlink entry from /afs.
  */
 int
-afs_DynrootVOPRemove(avc, acred, aname)
-    struct vcache *avc;
-    struct AFS_UCRED *acred;
-    char *aname;
+afs_DynrootVOPRemove(struct vcache *avc, struct AFS_UCRED *acred,
+                    char *aname)
 {
     struct afs_dynSymlink **tpps;
     struct afs_dynSymlink *tps;
-    struct cell *c;
     int found = 0;
 
     if (acred->cr_uid)
@@ -601,18 +677,14 @@ afs_DynrootVOPRemove(avc, acred, aname)
     }
     ReleaseWriteLock(&afs_dynSymlinkLock);
     if (found) {
-       afs_RefreshDynroot();
+       afs_DynrootInvalidate();
        return 0;
     }
 
-    /* Check if this is an actual cell? */
-    c = afs_GetCellByName2(aname, READ_LOCK, 0 /* no AFSDB */);
-    if (c) {
-       afs_PutCell(c, READ_LOCK);
+    if (afs_CellOrAliasExists(aname))
        return EROFS;
-    } else {
+    else 
        return ENOENT;
-    }
 }
 
 /*
@@ -626,17 +698,12 @@ afs_DynrootVOPSymlink(avc, acred, aname, atargetName)
     char *atargetName;
 {
     struct afs_dynSymlink *tps;
-    struct cell *c;
 
     if (acred->cr_uid)
        return EPERM;
 
-    /* Check if it's already a cell */
-    c = afs_GetCellByName2(aname, READ_LOCK, 0 /* no AFSDB */);
-    if (c) {
-       afs_PutCell(c, READ_LOCK);
-       return EEXIST;
-    }
+    if (afs_CellOrAliasExists(aname))
+        return EEXIST;
 
     /* Check if it's already a symlink */
     ObtainWriteLock(&afs_dynSymlinkLock, 91);
@@ -660,6 +727,6 @@ afs_DynrootVOPSymlink(avc, acred, aname, atargetName)
     afs_dynSymlinkBase = tps;
     ReleaseWriteLock(&afs_dynSymlinkLock);
 
-    afs_RefreshDynroot();
+    afs_DynrootInvalidate();
     return 0;
 }
index e5eebf188c9b6084eeac39781f3cac02958c7d34..aa4a3458e953f30b81c85a088f6b32226ec36663 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_init.c,v 1.1.1.9 2002/12/11 02:35:59 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_init.c,v 1.1.1.10 2003/04/13 19:02:36 hartmans Exp $");
 
 #include "../afs/stds.h"
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
@@ -312,36 +312,50 @@ afs_ComputeCacheParms()
  *     WARNING: Data will be written to this file over time by AFS.
  */
 
-afs_InitVolumeInfo(afile)
-    register char *afile;
-
-{ /*afs_InitVolumeInfo*/
-
+static int LookupInodeByPath(char *filename, ino_t *inode)
+{
     afs_int32 code;
-    struct osi_file *tfile;
-    struct vnode *filevp;
-    struct fcache fce;
-
-    AFS_STATCNT(afs_InitVolumeInfo);
+  
 #ifdef AFS_LINUX22_ENV
-    {
-       struct dentry *dp;
-       code = gop_lookupname(afile, AFS_UIOSYS, 0, (struct vnode **) 0, &dp);
-       if (code) return ENOENT;
-       fce.inode = volumeInode = dp->d_inode->i_ino;
-       dput(dp);
-    }
+    struct dentry *dp;
+    code = gop_lookupname(filename, AFS_UIOSYS, 0, NULL, &dp);
+    if (code) return code;
+    *inode = dp->d_inode->i_ino;
+    dput(dp);
 #else
-    code = gop_lookupname(afile, AFS_UIOSYS, 0, (struct vnode **) 0, &filevp);
-    if (code) return ENOENT;
-    fce.inode = volumeInode = afs_vnodeToInumber(filevp);
+    struct vnode *filevp;
+    code = gop_lookupname(filename, AFS_UIOSYS, 0, NULL, &filevp);
+    if (code) return code;
+    *inode = afs_vnodeToInumber(filevp);
 #ifdef AFS_DEC_ENV
     grele(filevp);
 #else
     AFS_RELE((struct vnode *)filevp);
 #endif
 #endif /* AFS_LINUX22_ENV */
-    tfile = afs_CFileOpen(fce.inode);
+    return 0;
+ }
+int afs_InitCellInfo(char *afile)
+{
+    ino_t inode;
+    int code;
+    
+    code = LookupInodeByPath(afile, &inode);
+    return afs_cellname_init(inode, code);
+}
+int afs_InitVolumeInfo(char *afile)
+{
+    int code;
+    struct osi_file *tfile;
+    struct vnode *filevp;
+    
+    AFS_STATCNT(afs_InitVolumeInfo);
+    code = LookupInodeByPath(afile, &volumeInode);
+    if (code) return code;
+    tfile = afs_CFileOpen(volumeInode);
     afs_CFileTruncate(tfile, 0);
     afs_CFileClose(tfile);
     return 0;
@@ -521,7 +535,6 @@ afs_ResourceInit(preallocs)
     AFS_STATCNT(afs_ResourceInit);
     RWLOCK_INIT(&afs_xuser, "afs_xuser");
     RWLOCK_INIT(&afs_xvolume, "afs_xvolume");
-    RWLOCK_INIT(&afs_xcell, "afs_xcell");
     RWLOCK_INIT(&afs_xserver, "afs_xserver");
     RWLOCK_INIT(&afs_xsrvAddr, "afs_xsrvAddr");
     RWLOCK_INIT(&afs_icl_lock, "afs_icl_lock");
@@ -533,6 +546,7 @@ afs_ResourceInit(preallocs)
     LOCK_INIT(&osi_flplock, "osi_flplock");
     RWLOCK_INIT(&afs_xconn, "afs_xconn");
 
+    afs_CellInit();
     afs_InitCBQueue(1);  /* initialize callback queues */
 
     if (afs_resourceinit_flag == 0) {
@@ -544,7 +558,6 @@ afs_ResourceInit(preallocs)
        afs_sysname = afs_sysnamelist[0];
        strcpy(afs_sysname, SYS_NAME);
        afs_sysnamecount = 1;
-       QInit(&CellLRU);        
 #if    defined(AFS_AIX32_ENV) || defined(AFS_HPUX_ENV)
     {  extern afs_int32 afs_preallocs;
 
@@ -750,19 +763,6 @@ void shutdown_AFS()
     AFS_STATCNT(shutdown_AFS);
     if (afs_cold_shutdown) {
       afs_resourceinit_flag = 0; 
-      /* 
-       * Free Cells table allocations 
-       */
-      { 
-       struct cell *tc;
-       register struct afs_q *cq, *tq;
-       for (cq = CellLRU.next; cq != &CellLRU; cq = tq) {
-           tc = QTOC(cq); tq = QNext(cq);
-           if (tc->cellName)
-               afs_osi_Free(tc->cellName, strlen(tc->cellName)+1);
-           afs_osi_Free(tc, sizeof(struct cell));
-       }
-      }
       /* 
        * Free Volumes table allocations 
        */
@@ -859,19 +859,16 @@ void shutdown_AFS()
       afs_sysname = 0;
       afs_sysnamecount = 0;
       afs_marinerHost = 0;
-      QInit(&CellLRU);      
       afs_setTimeHost = (struct server *)0;
       afs_volCounter = 1;
       afs_waitForever = afs_waitForeverCount = 0;
-      afs_cellindex = 0;
-      afs_nextCellNum = 0x100;
       afs_FVIndex = -1;
       afs_server = (struct rx_service *)0;
       RWLOCK_INIT(&afs_xconn, "afs_xconn");
       memset((char *)&afs_rootFid, 0, sizeof(struct VenusFid));
       RWLOCK_INIT(&afs_xuser, "afs_xuser");
       RWLOCK_INIT(&afs_xvolume, "afs_xvolume"), RWLOCK_INIT(&afs_xcell, "afs_xcell");
-      RWLOCK_INIT(&afs_xserver, "afs_xserver"), LOCK_INIT(&afs_puttofileLock, "afs_puttofileLock");
+      shutdown_cell();
     }
     
 } /*shutdown_AFS*/
index c0c5c3706d75d521e4329078d07033954b7b2427..5dcbee60c9e5eab0ec0a8ddd46bd8451d90569e4 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_nfsdisp.c,v 1.1.1.5 2002/12/11 02:36:00 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_nfsdisp.c,v 1.1.1.6 2003/04/13 19:02:36 hartmans Exp $");
 
 /* Ugly Ugly Ugly  but precludes conflicting XDR macros; We want kernel xdr */
 #define __XDR_INCLUDE__
@@ -677,7 +677,7 @@ nfs3_to_afs_call(int which, caddr_t *args, nfs_fh3 **fhpp, nfs_fh3 **fh2pp)
     case NFSPROC3_LOOKUP:
     {
        LOOKUP3args *arg = (LOOKUP3args *)args;
-#ifdef AFS_SUN57_ENV
+#ifdef AFS_SUN58_ENV
        fhp1 = (nfs_fh3 *) &arg->what.dirp;
 #else
        fhp1 = (nfs_fh3 *) &arg->what.dir;
index f8babf1b25997f0d3be698c015318f43ecf66137..f96ad25fdfa05aeb3bd20ad20ffcc0eed7478b74 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi.c,v 1.1.1.12 2002/09/26 18:57:53 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi.c,v 1.1.1.13 2003/04/13 19:02:36 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -289,9 +289,6 @@ void afs_osi_MaskSignals(){
     
 /* unmask signals in rxk listener */
 void afs_osi_UnmaskRxkSignals(){
-#ifdef AFS_LINUX22_ENV
-    osi_linux_unmask();
-#endif
 }
     
 /* register rxk listener proc info */
@@ -494,6 +491,10 @@ void afs_osi_Free(void *x, size_t asize)
 #endif
 }
 
+void afs_osi_FreeStr(char *x)
+{
+    afs_osi_Free(x, strlen(x) + 1);
+}
 
 /* ? is it moderately likely that there are dirty VM pages associated with 
  * this vnode?
@@ -807,11 +808,19 @@ void afs_osi_TraverseProcTable()
 #ifdef EXPORTED_TASKLIST_LOCK
     read_lock(&tasklist_lock);
 #endif
+#ifdef DEFINED_FOR_EACH_PROCESS
+    for_each_process(p) if (p->pid) {
+        if (p->state & TASK_ZOMBIE)
+            continue;
+       afs_GCPAGs_perproc_func(p);
+    }
+#else
     for_each_task(p) if (p->pid) {
         if (p->state & TASK_ZOMBIE)
             continue;
        afs_GCPAGs_perproc_func(p);
     }
+#endif
 #ifdef EXPORTED_TASKLIST_LOCK
     read_unlock(&tasklist_lock);
 #endif
index dd4ce144a2681daddf5c0e810418f6ee98deaee9..ed80eef36f66e599f3cbc959582394149e4cc9b0 100644 (file)
@@ -22,7 +22,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi_pag.c,v 1.1.1.6 2001/07/14 22:19:25 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi_pag.c,v 1.1.1.7 2003/04/13 19:02:37 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -441,7 +441,7 @@ afs_int32 PagInCred(const struct AFS_UCRED *cred)
        return NOPAG;
     }
 #else
-#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DUX40_ENV) || defined(AFS_LINUX_ENV) || defined(AFS_FBSD_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_DUX40_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV)
     if (cred->cr_ngroups < 2) return NOPAG;
 #endif
 #endif
index 766a5bab3e780af91fdc33c6bb90bc6532705942..d099028faf5d1edb254fa7fc3750d958f2d991fd 100644 (file)
@@ -14,7 +14,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi_vget.c,v 1.1.1.6 2002/01/22 19:47:59 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi_vget.c,v 1.1.1.7 2003/04/13 19:02:37 hartmans Exp $");
 
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
 #include "../afs/afsincludes.h"        /* Afs-based standard headers */
@@ -22,8 +22,6 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_osi_vget.c,v 1.1.1.6 2002/01/22
 
 
 
-extern int afs_NFSRootOnly;
-int afs_rootCellIndex = 0;
 #if !defined(AFS_LINUX20_ENV)
 /* This is the common part of the vget VFS call. */
 int afs_osi_vget(struct vcache **avcpp, struct fid *afidp,
@@ -31,7 +29,6 @@ int afs_osi_vget(struct vcache **avcpp, struct fid *afidp,
 {
     struct VenusFid vfid;
     struct SmallFid Sfid;
-    extern struct cell *afs_GetCellByIndex();
     register struct cell *tcell;
     struct vrequest treq;
     register afs_int32 code = 0, cellindex;
@@ -41,31 +38,19 @@ int afs_osi_vget(struct vcache **avcpp, struct fid *afidp,
 #ifdef AFS_OSF_ENV
     Sfid.Vnode = afidp->fid_reserved;
 #endif
-    if (afs_NFSRootOnly &&
-       Sfid.Volume == afs_rootFid.Fid.Volume &&
-       Sfid.Vnode == afs_rootFid.Fid.Vnode &&
-       (Sfid.CellAndUnique & 0xffffff) ==
-       (afs_rootFid.Fid.Unique & 0xffffff) &&
-       ((Sfid.CellAndUnique >> 24) & 0xff) == afs_rootCellIndex) {
-       vfid = afs_rootFid;
-    }
-    else {
-       /* Need to extract fid from SmallFid. Will need a wild card option for
-        * finding the right vcache entry.
-        */
-       struct cell *tcell;
-       cellindex = (Sfid.CellAndUnique >> 24) & 0xff;
-       tcell = afs_GetCellByIndex(cellindex, READ_LOCK, 0 /* don't refresh */);
-       if (!tcell) {
-           return ENOENT;
-        }
-       vfid.Cell = tcell->cell;
-       afs_PutCell(tcell, WRITE_LOCK);
-       vfid.Fid.Volume = Sfid.Volume;
-       vfid.Fid.Vnode = Sfid.Vnode;
-       vfid.Fid.Unique = Sfid.CellAndUnique & 0xffffff;
-    }
 
+    /* Need to extract fid from SmallFid. Will need a wild card option for
+     * finding the right vcache entry.
+     */
+    cellindex = (Sfid.CellAndUnique >> 24) & 0xff;
+    tcell = afs_GetCellByIndex(cellindex, READ_LOCK);
+    if (!tcell)
+       return ENOENT;
+    vfid.Cell = tcell->cellNum;
+    afs_PutCell(tcell, WRITE_LOCK);
+    vfid.Fid.Volume = Sfid.Volume;
+    vfid.Fid.Vnode = Sfid.Vnode;
+    vfid.Fid.Unique = Sfid.CellAndUnique & 0xffffff;
 
     /* First attempt to find in cache using wildcard. If that fails,
      * try the usual route to try to get the vcache from the server.
index 2bbfc9eb8c3fbae8e7b132efa3481664e15d6521..a10062325249b58ab5018d67041e93e0306481d3 100644 (file)
@@ -18,9 +18,32 @@ extern int afs_Analyze(struct conn *aconn, afs_int32 acode, struct VenusFid *afi
                        struct cell *cellp);
 
 /* afs_cell.c */
-extern struct cell *afs_GetRealCellByIndex(register afs_int32 cellindex,
-                                          afs_int32 locktype,
-                                          afs_int32 refresh);
+extern afs_rwlock_t afs_xcell;
+extern void afs_CellInit(void);
+extern void shutdown_cell(void);
+extern int afs_cellname_init(ino_t inode, int lookupcode);
+extern int afs_cellname_write();
+extern afs_int32 afs_NewCell(char *acellName, afs_int32 *acellHosts,
+                            int aflags, char *linkedcname, u_short fsport, 
+                            u_short vlport, int timeout);
+extern afs_int32 afs_SetPrimaryCell(char *acellName);
+extern struct cell *afs_GetCell(afs_int32 acell, afs_int32 locktype);
+extern struct cell *afs_GetCellStale(afs_int32 acell, afs_int32 locktype);
+extern struct cell *afs_GetCellByIndex(afs_int32 cellidx, afs_int32 locktype);
+extern struct cell *afs_GetCellByName(char *acellName, afs_int32 locktype);
+extern struct cell *afs_GetPrimaryCell(afs_int32 locktype);
+extern int afs_IsPrimaryCellNum(afs_int32 cellnum);
+extern int afs_IsPrimaryCell(struct cell *cell);
+extern void *afs_TraverseCells(void *(*cb)(struct cell *, void *), void *arg);
+extern int afs_CellOrAliasExists(char *aname);
+extern int afs_CellNumValid(afs_int32 cellnum);
+extern afs_int32 afs_NewCellAlias(char *alias, char *cell);
+extern struct cell_alias *afs_GetCellAlias(int index);
+extern int afs_AFSDBHandler(char *acellName, int acellNameLen,
+                           afs_int32 *kernelMsg);
+extern void afs_LookupAFSDB(char *acellName);
+extern void afs_StopAFSDB(void);
+extern void afs_RemoveCellEntry(struct server *srvp);
 
 /* afs_conn.c */
 extern struct conn *afs_ConnBySA(struct srvAddr *sap, unsigned short aport,
@@ -28,6 +51,7 @@ extern struct conn *afs_ConnBySA(struct srvAddr *sap, unsigned short aport,
                          int force_if_down, afs_int32 create, afs_int32 locktype);
 
 /* afs_dcache.c */
+extern int cacheDiskType;
 extern void afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk,
                           int aflags);
 
@@ -84,7 +108,9 @@ extern void afs_GCPAGs_perproc_func(AFS_PROC *pproc);
 
 /* afs_util.c */
 extern char *afs_cv2string(char *ttp, afs_uint32 aval);
+extern int afs_strcasecmp(char *s1, char *s2);
 extern char *afs_strchr(char *s, int c);
+extern char *afs_strdup(char *s);
 extern void print_internet_address(char *preamble, struct srvAddr *sa,
                            char *postamble, int flag);
 extern afs_int32 afs_data_pointer_to_int32(const void *p);
index 65313c7c128fbbaa4bcec24af4b25851259cf9b8..bab5973aae9b95eeedf48b4783237da6901aaeb9 100644 (file)
@@ -32,7 +32,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_server.c,v 1.1.1.13 2002/09/26 18:57:56 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_server.c,v 1.1.1.14 2003/04/13 19:02:38 hartmans Exp $");
 
 #include "../afs/stds.h"
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
@@ -90,6 +90,26 @@ int afs_totalSrvAddrs = 0;
 
 
 
+static struct afs_stats_SrvUpDownInfo *
+GetUpDownStats(struct server *srv)
+{
+    struct afs_stats_SrvUpDownInfo *upDownP;
+    u_short fsport = AFS_FSPORT;
+
+    if (srv->cell)
+       fsport = srv->cell->fsport;
+
+    if (srv->addr->sa_portal == fsport)
+       upDownP = afs_stats_cmperf.fs_UpDown;
+    else
+       upDownP = afs_stats_cmperf.vl_UpDown;
+
+    if (srv->cell && afs_IsPrimaryCell(srv->cell))
+       return &upDownP[AFS_STATS_UPDOWN_IDX_SAME_CELL];
+    else
+       return &upDownP[AFS_STATS_UPDOWN_IDX_DIFF_CELL];
+}
+
 
 /*------------------------------------------------------------------------
  * afs_MarkServerUpOrDown
@@ -165,16 +185,7 @@ void afs_MarkServerUpOrDown(struct srvAddr *sa, int a_isDown)
     currTimeP = &currTime;
     osi_GetuTime(currTimeP);
 
-    if (sa->sa_portal == AFS_FSPORT) {
-       upDownP = (a_serverP->cell->cell == 1) ?
-           &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
-           &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
-    } /*File Server record*/
-    else {
-       upDownP = (a_serverP->cell->cell == 1) ?
-           &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
-           &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
-    } /*VL Server record*/
+    upDownP = GetUpDownStats(a_serverP);
 
     if (a_isDown) {
        /*
@@ -295,7 +306,7 @@ static void CheckVLServer(sa, areq)
        return; /* can't do much */
 
     tc = afs_ConnByHost(aserver, aserver->cell->vlport, 
-                       aserver->cell->cell, areq, 1, SHARED_LOCK);
+                       aserver->cell->cellNum, areq, 1, SHARED_LOCK);
     if (!tc)
        return;
     rx_SetConnDeadTime(tc->id, 3);
@@ -429,17 +440,7 @@ void afs_CountServers()
                 * in the appropriate places.
                 */
                srvRecordAge = currTime.tv_sec - currSrvP->activationTime;
-               if (currSrvP->addr->sa_portal == AFS_FSPORT) {
-                   upDownP = (currSrvP->cell->cell == 1) ?
-                       &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]):
-                       &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
-               } /*File Server record*/
-               else {
-                   upDownP = (currSrvP->cell->cell == 1) ?
-                       &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]):
-                       &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
-               } /*VL Server record*/
-
+               upDownP = GetUpDownStats(currSrvP);
                upDownP->sumOfRecordAges += srvRecordAge;
                if ((upDownP->ageOfYoungestRecord == 0) ||
                    (srvRecordAge < upDownP->ageOfYoungestRecord))
@@ -568,8 +569,8 @@ void afs_CheckServers(adown, acellp)
            continue;  /* have just been added by setsprefs */ 
 
        /* get a connection, even if host is down; bumps conn ref count */
-       tu = afs_GetUser(treq.uid, ts->cell->cell, SHARED_LOCK);
-       tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cell, tu,
+       tu = afs_GetUser(treq.uid, ts->cell->cellNum, SHARED_LOCK);
+       tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cellNum, tu,
                          1/*force*/, 1/*create*/, SHARED_LOCK);
        afs_PutUser(tu, SHARED_LOCK);
        if (!tc) continue;
@@ -602,12 +603,9 @@ void afs_CheckServers(adown, acellp)
             */
            if (code == 0 && start == end && afs_setTime != 0 &&
                (tc->srvr->server == afs_setTimeHost ||
-               /*
-                * Sync only to a server in the local cell: cell(id)==1
-                * or CPrimary.
-                */
+               /* Sync only to a server in the local cell */
                (afs_setTimeHost == (struct server *)0 &&
-                (ts->cell->cell == 1 || (ts->cell->states&CPrimary))))) {
+                afs_IsPrimaryCell(ts->cell)))) {
 
                char msgbuf[90];  /* strlen("afs: setting clock...") + slop */
                /* set the time */
@@ -1605,16 +1603,8 @@ struct server *afs_GetServer(afs_uint32 *aserverp, afs_int32 nservers,
        /* With the introduction of this new record, we need to adjust the
        * proper individual & global server up/down info.
        */
-       if (aport == fsport) {   /* File Server record */
-         upDownP = (acell == 1) ?
-           &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
-           &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
-       } else {                   /* VL Server record */
-         upDownP = (acell == 1) ?
-           &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
-           &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
-       } 
-       (upDownP->numTtlRecords)    += srvcount;
+       upDownP = GetUpDownStats(newts);
+       upDownP->numTtlRecords      += srvcount;
        afs_stats_cmperf.srvRecords += srvcount;
        if (afs_stats_cmperf.srvRecords > afs_stats_cmperf.srvRecordsHWM)
          afs_stats_cmperf.srvRecordsHWM = afs_stats_cmperf.srvRecords;
@@ -1642,21 +1632,12 @@ void afs_ActivateServer(sap)
       currTimeP = &currTime;
       osi_GetuTime(currTimeP);
       aserver->activationTime = currTime.tv_sec;
-      if (sap->sa_portal == AFS_FSPORT) {
-        upDownP = (aserver->cell->cell == 1) ?
-             &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
-                  &(afs_stats_cmperf.fs_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
-      } /*File Server record*/
-      else {
-        upDownP = (aserver->cell->cell == 1) ?
-             &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_SAME_CELL]) :
-                  &(afs_stats_cmperf.vl_UpDown[AFS_STATS_UPDOWN_IDX_DIFF_CELL]);
-      } /*VL Server record*/
-      if (aserver->flags & SRVR_ISDOWN)
-          (upDownP->numDownRecords)++;
-      else {
-        (upDownP->numUpRecords)++;
-        (upDownP->numRecordsNeverDown)++;
+      upDownP = GetUpDownStats(aserver);
+      if (aserver->flags & SRVR_ISDOWN) {
+        upDownP->numDownRecords++;
+      } else {
+        upDownP->numUpRecords++;
+        upDownP->numRecordsNeverDown++;
       }
    }
 }
index d595c0c203cd1603414e95a793a8ab6b134e8f5a..39dfcd0d030272f148e1df2a4e1c16f646cca60e 100644 (file)
@@ -637,6 +637,8 @@ struct afs_CMCallStats {
     afs_int32 C_SRXAFSCB_GetLocalCell; /* afs_callback.c*/
     afs_int32 C_afs_MarshallCacheConfig;       /* afs_callback.c*/
     afs_int32 C_SRXAFSCB_GetCacheConfig;       /* afs_callback.c*/
+    afs_int32 C_SRXAFSCB_GetCE64;     /* afs_callback.c*/
+    afs_int32 C_SRXAFSCB_GetCellByNum;        /* afs_callback.c*/
 };
 
 struct afs_CMMeanStats {
index c3d807c0c96f3b63a02fdde060f2efde8fd2babe..84b3145092fad45dac9ef4ce8f038648ce3e11e7 100644 (file)
@@ -15,7 +15,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_util.c,v 1.1.1.8 2002/12/11 02:36:03 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_util.c,v 1.1.1.9 2003/04/13 19:02:39 hartmans Exp $");
 
 #include "../afs/stds.h"
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
@@ -81,6 +81,35 @@ char *afs_strchr(char *s, int c)
     return NULL;
 }
 
+int afs_strcasecmp(char *s1, char *s2)
+{
+    while (*s1 && *s2) {
+       char c1, c2;
+
+       c1 = *s1++;
+       c2 = *s2++;
+       if (c1 >= 'A' && c1 <= 'Z') c1 += 0x20;
+       if (c2 >= 'A' && c2 <= 'Z') c2 += 0x20;
+       if (c1 != c2)
+           return c1-c2;
+    }
+
+    return *s1 - *s2;
+}
+
+char *afs_strdup(char *s)
+{
+    char *n;
+    int cc;
+
+    cc = strlen(s) + 1;
+    n = (char *) afs_osi_Alloc(cc);
+    if (n)
+       memcpy(n, s, cc);
+
+    return n;
+}
+
 void print_internet_address(char *preamble, struct srvAddr *sa,
                            char *postamble, int flag)
 {
index e1c270f78cf061585a9b490b0f2cb1a936ec317e..48374871db348058a9a654ac7b1eb9086dc4310f 100644 (file)
@@ -38,7 +38,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_vcache.c,v 1.1.1.15 2002/12/11 02:36:03 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_vcache.c,v 1.1.1.16 2003/04/13 19:02:39 hartmans Exp $");
 
 #include "../afs/sysincludes.h" /*Standard vendor system headers*/
 #include "../afs/afsincludes.h" /*AFS-based standard headers*/
@@ -374,7 +374,7 @@ afs_int32 afs_FlushVCBs (afs_int32 lockit)
                    callBacks[0].CallBackType = CB_EXCLUSIVE;
                    for (safety3 = 0; safety3 < MAXHOSTS*2; safety3++) {
                        tc = afs_ConnByHost(tsp, tsp->cell->fsport,
-                                           tsp->cell->cell, &treq, 0,
+                                           tsp->cell->cellNum, &treq, 0,
                                            SHARED_LOCK);
                        if (tc) {
                          XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS);
@@ -632,9 +632,7 @@ restart:
  *     entries locked.
  */
 
-afs_RemoveVCB(afid)
-    register struct VenusFid *afid;
-
+afs_RemoveVCB(struct VenusFid *afid)
 { /*afs_RemoveVCB*/
 
     register int i, j;
@@ -648,7 +646,7 @@ afs_RemoveVCB(afid)
     for(i=0;i<NSERVERS;i++) {
        for(tsp=afs_servers[i]; tsp; tsp=tsp->next) {
            /* if cell is known, and is wrong, then skip this server */
-           if (tsp->cell && tsp->cell->cell != afid->Cell) continue;
+           if (tsp->cell && tsp->cell->cellNum != afid->Cell) continue;
 
            /*
             * Otherwise, iterate through file IDs we're sending to the
@@ -2530,7 +2528,7 @@ struct vcache *afs_FindVCache(struct VenusFid *afid, afs_int32 lockit,
     if (flag & DO_STATS) {
       if (tvc)         afs_stats_cmperf.vcacheHits++;
       else     afs_stats_cmperf.vcacheMisses++;
-      if (afid->Cell == LOCALCELL)
+      if (afs_IsPrimaryCellNum(afid->Cell))
         afs_stats_cmperf.vlocalAccesses++;
       else
         afs_stats_cmperf.vremoteAccesses++;
@@ -2672,7 +2670,7 @@ afs_int32 afs_NFSFindVCache(avcp, afid, lockit)
 
     if (tvc)   afs_stats_cmperf.vcacheHits++;
     else       afs_stats_cmperf.vcacheMisses++;
-    if (afid->Cell == LOCALCELL)
+    if (afs_IsPrimaryCellNum(afid->Cell))
         afs_stats_cmperf.vlocalAccesses++;
     else
         afs_stats_cmperf.vremoteAccesses++;
index dbf9ca5bbfde2ac9378c95c7dbd34926e4d02b12..6bc8d910a218db7918b22dad0cc2e736f70ac90e 100644 (file)
@@ -18,7 +18,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_volume.c,v 1.1.1.11 2002/09/26 18:57:58 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afs/afs_volume.c,v 1.1.1.12 2003/04/13 19:02:39 hartmans Exp $");
 
 #include "../afs/stds.h"
 #include "../afs/sysincludes.h"        /* Standard vendor system headers */
@@ -112,7 +112,7 @@ struct volume *afs_UFSGetVolSlot()
 
 {
     register struct volume *tv, **lv;
-    register char *tfile;
+    struct osi_file *tfile;
     register afs_int32 i, code;
     afs_int32 bestTime;
     struct volume *bestVp, **bestLp;
@@ -461,7 +461,7 @@ static struct volume *afs_SetupVolume(volid, aname, ve, tcell, agood, type, areq
     ObtainWriteLock(&afs_xvolume,108);
     i = VHash(volid);
     for (tv = afs_volumes[i]; tv; tv=tv->next) {
-       if (tv->volume == volid && tv->cell == tcell->cell) {
+       if (tv->volume == volid && tv->cell == tcell->cellNum) {
            break;
        }
     }
@@ -470,14 +470,14 @@ static struct volume *afs_SetupVolume(volid, aname, ve, tcell, agood, type, areq
 
        tv = afs_GetVolSlot();
        memset((char *)tv, 0, sizeof(struct volume));
-       tv->cell = tcell->cell;
+       tv->cell = tcell->cellNum;
        RWLOCK_INIT(&tv->lock, "volume lock");
        tv->next = afs_volumes[i];      /* thread into list */
        afs_volumes[i] = tv;
        tv->volume = volid;
        for (j=fvTable[FVHash(tv->cell,volid)]; j!=0; j=tf->next) {
            if (afs_FVIndex != j) {
-               char *tfile;
+               struct osi_file *tfile;
                tfile = osi_UFSOpen(volumeInode);
                err = afs_osi_Read(tfile, sizeof(struct fvolume) * j, &staticFVolume, sizeof(struct fvolume));
                if (err != sizeof(struct fvolume))
@@ -506,12 +506,12 @@ static struct volume *afs_SetupVolume(volid, aname, ve, tcell, agood, type, areq
     ReleaseWriteLock(&afs_xvolume);
     ObtainWriteLock(&tv->lock,111);
     if (type == 2) {
-       InstallUVolumeEntry(tv, uve, tcell->cell, tcell, areq);
+       InstallUVolumeEntry(tv, uve, tcell->cellNum, tcell, areq);
     }
     else if (type == 1)
-       InstallNVolumeEntry(tv, nve, tcell->cell);
+       InstallNVolumeEntry(tv, nve, tcell->cellNum);
     else
-       InstallVolumeEntry(tv, ove, tcell->cell);
+       InstallVolumeEntry(tv, ove, tcell->cellNum);
     if (agood) {
        if (!tv->name) {
            tv->name = afs_osi_Alloc(strlen(aname) + 1);
@@ -573,7 +573,7 @@ static struct volume *afs_NewDynrootVolume(struct VenusFid *fid) {
     tve.volumeId[ROVOL] = fid->Fid.Volume;
     tve.flags = VLF_ROEXISTS;
 
-    tv = afs_SetupVolume(0, bp, &tve, tcell, 0, 0, 0);
+    tv = afs_SetupVolume(0, bp, (char *) &tve, tcell, 0, 0, 0);
     afs_PutCell(tcell, READ_LOCK);
     return tv;
 }
@@ -614,7 +614,7 @@ static struct volume *afs_NewVolumeByName(char *aname, afs_int32 acell, int agoo
     afs_InitReq(&treq, &afs_osi_cred); /* *must* be unauth for vldb */
     do {
        tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport,
-                                tcell->cell, &treq, SHARED_LOCK);
+                                tcell->cellNum, &treq, SHARED_LOCK);
        if (tconn) {
            if (tconn->srvr->server->flags & SNO_LHOSTS) {
                type = 0;
@@ -947,7 +947,7 @@ void InstallUVolumeEntry(struct volume *av, struct uvldbentry *ve,
                memset((char *)&addrs, 0, sizeof(addrs));
                do {
                    tconn = afs_ConnByMHosts(tcell->cellHosts, tcell->vlport,
-                                            tcell->cell, areq, SHARED_LOCK);
+                                            tcell->cellNum, areq, SHARED_LOCK);
                    if (tconn) {
 #ifdef RX_ENABLE_LOCKS
                        AFS_GUNLOCK();
index 67bf2fee0a65b349a89e0332ad7af87f380b9113..9d4ab45422da6a5aa47bbd2f07838a63250532cb 100644 (file)
@@ -99,13 +99,13 @@ dest: ${DEST}/root.client/usr/vice/etc/afsd ${DEST}/etc/vsys
                        esac;; \
                sun4_52 | sun4_53 | sun4c_52 | sun4c_53 | sun4m_52 | sun4m_53 | sun4m_54 | sun4_54 | sun4c_54 | sunx86_54) \
                        ${INSTALL} -f afs.rc.solaris ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
-               sun4x_57 ) \
+               sun*_57 ) \
                        ${INSTALL} -f afs.rc.solaris.2.7 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
-               sun4x_58 ) \
+               sun*_58 ) \
                        ${INSTALL} -f afs.rc.solaris.2.8 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
-               sun4x_59 ) \
+               sun*_59 ) \
                        ${INSTALL} -f afs.rc.solaris.2.9 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
-                sun4x_5? ) \
+                sun*_5? ) \
                         ${INSTALL} -f afs.rc.solaris.2_5 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\
                alpha_osf* ) \
                        ${INSTALL} -f afs.rc.alpha ${DEST}/root.client/usr/vice/etc/dkload/afs.rc ;;\
index b14446b7dde664f4eea0ace4e15f2db765b6593d..2abe4a8990c8ecc67c9439b32a60f665ba1b85ed 100644 (file)
@@ -55,7 +55,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/afsd/afsd.c,v 1.1.1.16 2002/12/11 02:41:43 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/afsd/afsd.c,v 1.1.1.17 2003/04/13 19:05:54 hartmans Exp $");
 
 #define VFS 1
 
@@ -170,6 +170,7 @@ void set_staticaddrs(void);
 #define        AFSLOGFILE      "AFSLog"
 #define        DCACHEFILE      "CacheItems"
 #define        VOLINFOFILE     "VolumeItems"
+#define CELLINFOFILE   "CellItems"
 
 #define MAXIPADDRS 1024
 
@@ -211,6 +212,7 @@ char cacheBaseDir[1024];            /*Where the workstation AFS cache lives*/
 char confDir[1024];                    /*Where the workstation AFS configuration lives*/
 char fullpn_DCacheFile[1024];          /*Full pathname of DCACHEFILE*/
 char fullpn_VolInfoFile[1024];         /*Full pathname of VOLINFOFILE*/
+char fullpn_CellInfoFile[1024];                /*Full pathanem of CELLINFOFILE*/
 char fullpn_AFSLogFile[1024];          /*Full pathname of AFSLOGFILE*/
 char fullpn_CacheInfo[1024];           /*Full pathname of CACHEINFO*/
 char fullpn_VFile[1024];               /*Full pathname of data cache files*/
@@ -224,7 +226,6 @@ char cacheMountDir[1024];           /*Mount directory for AFS*/
 char rootVolume[64] = "root.afs";      /*AFS root volume name*/
 afs_int32 cacheSetTime = 1;                    /*Keep checking time to avoid drift?*/
 afs_int32 isHomeCell;                  /*Is current cell info for the home cell?*/
-afs_int32 lookingForHomeCell;          /*Are we still looking for the home cell?*/
 int createAndTrunc = O_CREAT | O_TRUNC; /*Create & truncate on open*/
 int ownerRWmode        = 0600;                 /*Read/write OK by owner*/
 static int filesSet = 0;               /*True if number of files explicitly set*/
@@ -270,10 +271,11 @@ int *dir_for_V = NULL;                    /* Array: dir of each cache file.
                                         */
 AFSD_INO_T *inode_for_V;               /* Array of inodes for desired
                                         * cache files */
-int missing_DCacheFile = 1;            /*Is the DCACHEFILE missing?*/
-int missing_VolInfoFile        = 1;            /*Is the VOLINFOFILE missing?*/
-int afsd_rmtsys = 0;                           /* Default: don't support rmtsys */
-struct afs_cacheParams cparams;          /* params passed to cache manager */
+int missing_DCacheFile  = 1;           /*Is the DCACHEFILE missing?*/
+int missing_VolInfoFile  = 1;          /*Is the VOLINFOFILE missing?*/
+int missing_CellInfoFile = 1;          /*Is the CELLINFOFILE missing?*/
+int afsd_rmtsys = 0;                   /* Default: don't support rmtsys */
+struct afs_cacheParams cparams;         /* params passed to cache manager */
 
 static int HandleMTab();
 
@@ -626,6 +628,16 @@ int CreateCacheFile(fname, statp)
     return(0);
 }
 
+static void CreateFileIfMissing(char *fullpn, int missing)
+{
+    if (missing) {
+       if (afsd_verbose)
+           printf("CreateFileIfMissing: Creating '%s'\n", fullpn);
+       if (CreateCacheFile(fullpn, NULL))
+           printf("CreateFileIfMissing: Can't create '%s'\n", fullpn);
+    }
+}
+
 /*-----------------------------------------------------------------------------
   * SweepAFSCache
   *
@@ -802,6 +814,12 @@ static int doSweepAFSCache(vFilesFound,directory,dirNum,maxDir)
             */
            missing_VolInfoFile = 0;
        }
+       else if (dirNum < 0 && strcmp(currp->d_name, CELLINFOFILE) == 0) {
+           /*
+            * Found the file holding the cell info.
+            */
+           missing_CellInfoFile = 0;
+       }
        else  if ((strcmp(currp->d_name,          ".") == 0) ||
                  (strcmp(currp->d_name,         "..") == 0) ||
 #ifdef AFS_DECOSF_ENV
@@ -842,25 +860,12 @@ static int doSweepAFSCache(vFilesFound,directory,dirNum,maxDir)
 
     if (dirNum < 0) {
 
-        /*
+       /*
         * Create all the cache files that are missing.
         */
-        if (missing_DCacheFile) {
-           if (afsd_verbose)
-               printf("%s: Creating '%s'\n",
-                      rn, fullpn_DCacheFile);
-           if (CreateCacheFile(fullpn_DCacheFile, NULL))
-               printf("%s: Can't create '%s'\n",
-                      rn, fullpn_DCacheFile);
-       }
-       if (missing_VolInfoFile) {
-           if (afsd_verbose)
-               printf("%s: Creating '%s'\n",
-                      rn, fullpn_VolInfoFile);
-           if (CreateCacheFile(fullpn_VolInfoFile, NULL))
-               printf("%s: Can't create '%s'\n",
-                      rn, fullpn_VolInfoFile);
-       }
+       CreateFileIfMissing(fullpn_DCacheFile, missing_DCacheFile);
+       CreateFileIfMissing(fullpn_VolInfoFile, missing_VolInfoFile);
+       CreateFileIfMissing(fullpn_CellInfoFile, missing_CellInfoFile);
 
        /* ADJUST CACHE FILES */
 
@@ -1035,19 +1040,14 @@ register struct afsconf_cell *aci;
 char *arock;
 struct afsconf_dir *adir; {
     register int isHomeCell;
-    register int i;
-    afs_int32 cellFlags;
+    register int i, code;
+    afs_int32 cellFlags = 0;
     afs_int32 hosts[MAXHOSTSPERCELL];
     
     /* figure out if this is the home cell */
     isHomeCell = (strcmp(aci->name, LclCellName) == 0);
-    if (isHomeCell) {
-       lookingForHomeCell = 0;
-       cellFlags = 1;      /* home cell, suid is ok */
-    }
-    else {
+    if (!isHomeCell)
        cellFlags = 2;      /* not home, suid is forbidden */
-    }
     
     /* build address list */
     for(i=0;i<MAXHOSTSPERCELL;i++)
@@ -1057,11 +1057,13 @@ struct afsconf_dir *adir; {
                                            for upwards compatibility */
 
     /* configure one cell */
-    call_syscall(AFSOP_ADDCELL2,
+    code = call_syscall(AFSOP_ADDCELL2,
             hosts,                     /* server addresses */
             aci->name,                 /* cell name */
             cellFlags,                 /* is this the home cell? */
             aci->linkedCell);          /* Linked cell, if any */
+    if (code)
+       printf("Adding cell '%s': error %d\n", aci->name, code);
     return 0;
 }
 
@@ -1472,8 +1474,9 @@ mainproc(as, arock)
     /*
      * Set up all the pathnames we'll need for later.
      */
-    sprintf(fullpn_DCacheFile,  "%s/%s", cacheBaseDir, DCACHEFILE);
-    sprintf(fullpn_VolInfoFile, "%s/%s", cacheBaseDir, VOLINFOFILE);
+    sprintf(fullpn_DCacheFile,   "%s/%s", cacheBaseDir, DCACHEFILE);
+    sprintf(fullpn_VolInfoFile,  "%s/%s", cacheBaseDir, VOLINFOFILE);
+    sprintf(fullpn_CellInfoFile, "%s/%s", cacheBaseDir, CELLINFOFILE);
     sprintf(fullpn_VFile,       "%s/",  cacheBaseDir);
     vFilePtr = fullpn_VFile + strlen(fullpn_VFile);
 
@@ -1572,6 +1575,83 @@ mainproc(as, arock)
     }
 #endif
 
+    code = call_syscall(AFSOP_BASIC_INIT, 1);
+    if (code)
+       printf("%s: Error %d in basic initialization.\n", rn, code);
+
+    /*
+     * Tell the kernel some basic information about the workstation's cache.
+     */
+    if (afsd_verbose)
+       printf("%s: Calling AFSOP_CACHEINIT: %d stat cache entries, %d optimum cache files, %d blocks in the cache, flags = 0x%x, dcache entries %d\n",
+              rn, cacheStatEntries, cacheFiles, cacheBlocks, cacheFlags,
+              dCacheSize);
+    memset(&cparams, '\0', sizeof(cparams));
+    cparams.cacheScaches = cacheStatEntries;
+    cparams.cacheFiles = cacheFiles;
+    cparams.cacheBlocks = cacheBlocks;
+    cparams.cacheDcaches = dCacheSize;
+    cparams.cacheVolumes = vCacheSize;
+    cparams.chunkSize = chunkSize;
+    cparams.setTimeFlag = cacheSetTime;
+    cparams.memCacheFlag = cacheFlags;
+#ifdef notdef
+    cparams.inodes       = inodes;
+#endif
+    call_syscall(AFSOP_CACHEINIT, &cparams);
+    if (afsd_CloseSynch) 
+       call_syscall(AFSOP_CLOSEWAIT);
+
+    /*
+     * Sweep the workstation AFS cache directory, remembering the inodes of
+     * valid files and deleting extraneous files.  Keep sweeping until we
+     * have the right number of data cache files or we've swept too many
+     * times.
+     *
+     * This also creates files in the cache directory like VolumeItems and
+     * CellItems, and thus must be ran before those are sent to the kernel.
+     */
+    if (afsd_verbose)
+       printf("%s: Sweeping workstation's AFS cache directory.\n",
+              rn);
+    cacheIteration = 0;
+    /* Memory-cache based system doesn't need any of this */
+    if(!(cacheFlags & AFSCALL_INIT_MEMCACHE)) {
+       do {
+           cacheIteration++;
+           if (SweepAFSCache(&vFilesFound)) {
+               printf("%s: Error on sweep %d of workstation AFS cache \
+                       directory.\n", rn, cacheIteration);
+               exit(1);
+           }
+           if (afsd_verbose)
+               printf("%s: %d out of %d data cache files found in sweep %d.\n",
+                      rn, vFilesFound, cacheFiles, cacheIteration);
+       } while ((vFilesFound < cacheFiles) &&
+                (cacheIteration < MAX_CACHE_LOOPS));
+    } else if(afsd_verbose)
+       printf("%s: Using memory cache, not swept\n", rn);
+
+    /*
+     * Pass the kernel the name of the workstation cache file holding the 
+     * dcache entries.
+     */
+    if (afsd_debug)
+       printf("%s: Calling AFSOP_CACHEINFO: dcache file is '%s'\n",
+              rn, fullpn_DCacheFile);
+    /* once again, meaningless for a memory-based cache. */
+    if(!(cacheFlags & AFSCALL_INIT_MEMCACHE))
+       call_syscall(AFSOP_CACHEINFO, fullpn_DCacheFile);
+
+    /*
+     * Pass the kernel the name of the workstation cache file holding the
+     * cell information.
+     */
+    if (afsd_debug)
+       printf("%s: Calling AFSOP_CELLINFO: cell info file is '%s'\n",
+              rn, fullpn_CellInfoFile);
+    call_syscall(AFSOP_CELLINFO, fullpn_CellInfoFile);
+
     if (enable_dynroot) {
        if (afsd_verbose)
            printf("%s: Enabling dynroot support in kernel.\n", rn);
@@ -1588,6 +1668,17 @@ mainproc(as, arock)
            printf("%s: Error enabling fakestat support.\n", rn);
     }
 
+    /*
+     * Tell the kernel about each cell in the configuration.
+     */
+    afsconf_CellApply(cdir, ConfigCell, NULL);
+    afsconf_CellAliasApply(cdir, ConfigCellAlias, NULL);
+
+    /*
+     * Set the primary cell name.
+     */
+    call_syscall(AFSOP_SET_THISCELL, LclCellName);
+
     /* Initialize AFS daemon threads. */
     if (afsd_verbose)
        printf("%s: Forking AFS daemon.\n", rn);
@@ -1643,23 +1734,6 @@ mainproc(as, arock)
     }
 #endif
 
-    /*
-     * Tell the kernel about each cell in the configuration.
-     */
-    lookingForHomeCell = 1;
-
-    afsconf_CellApply(cdir, ConfigCell, (char *) 0);
-    afsconf_CellAliasApply(cdir, ConfigCellAlias, (char *) 0);
-
-    /*
-     * If we're still looking for the home cell after the whole cell configuration database
-     * has been parsed, there's something wrong.
-     */
-    if (lookingForHomeCell) {
-       printf("%s: Can't find information for home cell '%s' in cell database!\n",
-              rn, LclCellName);
-    }
-
     /*
      * If the root volume has been explicitly set, tell the kernel.
      */
@@ -1670,67 +1744,6 @@ mainproc(as, arock)
        call_syscall(AFSOP_ROOTVOLUME, rootVolume);
     }
 
-    /*
-     * Tell the kernel some basic information about the workstation's cache.
-     */
-    if (afsd_verbose)
-       printf("%s: Calling AFSOP_CACHEINIT: %d stat cache entries, %d optimum cache files, %d blocks in the cache, flags = 0x%x, dcache entries %d\n",
-              rn, cacheStatEntries, cacheFiles, cacheBlocks, cacheFlags,
-              dCacheSize);
-    memset(&cparams, '\0', sizeof(cparams));
-    cparams.cacheScaches = cacheStatEntries;
-    cparams.cacheFiles = cacheFiles;
-    cparams.cacheBlocks = cacheBlocks;
-    cparams.cacheDcaches = dCacheSize;
-    cparams.cacheVolumes = vCacheSize;
-    cparams.chunkSize = chunkSize;
-    cparams.setTimeFlag = cacheSetTime;
-    cparams.memCacheFlag = cacheFlags;
-#ifdef notdef
-    cparams.inodes       = inodes;
-#endif
-    call_syscall(AFSOP_CACHEINIT, &cparams);
-    if (afsd_CloseSynch) 
-      call_syscall(AFSOP_CLOSEWAIT);
-
-    /*
-     * Sweep the workstation AFS cache directory, remembering the inodes of
-     * valid files and deleting extraneous files.  Keep sweeping until we
-     * have the right number of data cache files or we've swept too many
-     * times.
-     */
-    if (afsd_verbose)
-       printf("%s: Sweeping workstation's AFS cache directory.\n",
-              rn);
-    cacheIteration = 0;
-    /* Memory-cache based system doesn't need any of this */
-    if(!(cacheFlags & AFSCALL_INIT_MEMCACHE)) {
-       do {
-           cacheIteration++;
-           if (SweepAFSCache(&vFilesFound)) {
-               printf("%s: Error on sweep %d of workstation AFS cache \
-                       directory.\n", rn, cacheIteration);
-               exit(1);
-           }
-           if (afsd_verbose)
-               printf("%s: %d out of %d data cache files found in sweep %d.\n",
-                      rn, vFilesFound, cacheFiles, cacheIteration);
-       } while ((vFilesFound < cacheFiles) &&
-                (cacheIteration < MAX_CACHE_LOOPS));
-    } else if(afsd_verbose)
-       printf("%s: Using memory cache, not swept\n", rn);
-
-    /*
-     * Pass the kernel the name of the workstation cache file holding the 
-     * dcache entries.
-     */
-    if (afsd_debug)
-       printf("%s: Calling AFSOP_CACHEINFO: dcache file is '%s'\n",
-              rn, fullpn_DCacheFile);
-    /* once again, meaningless for a memory-based cache. */
-    if(!(cacheFlags & AFSCALL_INIT_MEMCACHE))
-       call_syscall(AFSOP_CACHEINFO, fullpn_DCacheFile);
-
     /*
      * Pass the kernel the name of the workstation cache file holding the
      * volume information.
index 536ed1912c22f4da0ffc16761fa70fa4ca20d9ce..67afda267e5d0b21d6fddc1ce7072fc7b31b4c1c 100644 (file)
@@ -28,7 +28,7 @@ SHELL = /bin/sh
 
 include ../config/Makefile.${SYS_NAME}
 
-CFLAGS=-g -w ${INCDIRS} ${XCFLAGS}
+CFLAGS=-g -w ${INCDIRS} ${XCFLAGS} @XBSA_CFLAGS@
 
 INCDIRS=-I${TOP_SRCDIR}/config -I${TOP_INCDIR}/afs \
        -I${TOP_INCDIR}/rx -I${TOP_INCDIR}
@@ -107,7 +107,7 @@ clean:
 
 install:  
        @case ${SYS_NAME} in \
-       alpha_dux*|sgi_*|sun4x_*|rs_aix4*|*linux*|hp_ux*) \
+       alpha_dux*|sgi_*|sun*|rs_aix4*|*linux*|hp_ux*) \
                echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \
        *) \
                echo ${INSTALL} butc ${DESTDIR}${sbindir}/butc ; \
@@ -118,7 +118,7 @@ install:
 include ../config/Makefile.version
 dest:  
        @case ${SYS_NAME} in \
-       alpha_dux*|sgi_*|sun4x_*|rs_aix4*|*linux*|hp_ux*) \
+       alpha_dux*|sgi_*|sun*|rs_aix4*|*linux*|hp_ux*) \
                echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \
        *) \
                echo ${INSTALL} butc ${DEST}/etc/butc ; \
index ee2b143af5db6be06e8eb7fb3e56a4d22386c5e9..6b4386b18281347c7f174ffd0299ca5fb952a35a 100644 (file)
@@ -1,35 +1,57 @@
-AC_DEFUN(LINUX_EXPORTS_TASKLIST_LOCK, [
-AC_MSG_CHECKING(for exported tasklist_lock)
+AC_DEFUN(LINUX_COMPLETION_H_EXISTS, [
+AC_MSG_CHECKING(for linux/completion.h existance)
 save_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
-AC_CACHE_VAL(ac_cv_linux_exports_tasklist_lock,
+AC_CACHE_VAL(ac_cv_linux_completion_h_exists,
 [
 AC_TRY_COMPILE(
-[#include <linux/modversions.h>],
-[#ifndef __ver_tasklist_lock
-#error tasklist_lock not exported
+[#include <linux/completion.h>
+#include <linux/version.h>],
+[struct completion _c;
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,8)
+lose
+#endif
+],
+ac_cv_linux_completion_h_exists=yes,
+ac_cv_linux_completion_h_exists=no)])
+AC_MSG_RESULT($ac_cv_linux_completion_h_exists)
+CPPFLAGS="$save_CPPFLAGS"])
+
+
+AC_DEFUN(LINUX_DEFINES_FOR_EACH_PROCESS, [
+AC_MSG_CHECKING(for defined for_each_process)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_defines_for_each_process,
+[
+AC_TRY_COMPILE(
+[#include <linux/sched.h>],
+[#ifndef for_each_process(p)
+#error for_each_process not defined
 #endif],
-ac_cv_linux_exports_tasklist_lock=yes,
-ac_cv_linux_exports_tasklist_lock=no)])
-AC_MSG_RESULT($ac_cv_linux_exports_tasklist_lock)
+ac_cv_linux_defines_for_each_process=yes,
+ac_cv_linux_defines_for_each_process=no)])
+AC_MSG_RESULT($ac_cv_linux_defines_for_each_process)
 CPPFLAGS="$save_CPPFLAGS"])
 
-AC_DEFUN(LINUX_EXPORTS_SYS_CALL_TABLE, [
-AC_MSG_CHECKING(for exported sys_call_table)
+
+AC_DEFUN(LINUX_DEFINES_PREV_TASK, [
+AC_MSG_CHECKING(for defined prev_task)
 save_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
-AC_CACHE_VAL(ac_cv_linux_exports_sys_call_table,
+AC_CACHE_VAL(ac_cv_linux_defines_prev_task,
 [
 AC_TRY_COMPILE(
-[#include <linux/modversions.h>],
-[#ifndef __ver_sys_call_table
-#error sys_call_table not exported
+[#include <linux/sched.h>],
+[#ifndef prev_task(p)
+#error prev_task not defined
 #endif],
-ac_cv_linux_exports_sys_call_table=yes,
-ac_cv_linux_exports_sys_call_table=no)])
-AC_MSG_RESULT($ac_cv_linux_exports_sys_call_table)
+ac_cv_linux_defines_prev_task=yes,
+ac_cv_linux_defines_prev_task=no)])
+AC_MSG_RESULT($ac_cv_linux_defines_prev_task)
 CPPFLAGS="$save_CPPFLAGS"])
 
+
 AC_DEFUN(LINUX_EXPORTS_INIT_MM, [
 AC_MSG_CHECKING(for exported init_mm)
 save_CPPFLAGS="$CPPFLAGS"
@@ -46,6 +68,24 @@ ac_cv_linux_exports_init_mm=no)])
 AC_MSG_RESULT($ac_cv_linux_exports_init_mm)
 CPPFLAGS="$save_CPPFLAGS"])
 
+
+AC_DEFUN(LINUX_EXPORTS_KALLSYMS_ADDRESS, [
+AC_MSG_CHECKING(for exported kallsyms_address_to_symbol)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_exports_kallsyms_address,
+[
+AC_TRY_COMPILE(
+[#include <linux/modversions.h>],
+[#ifndef __ver_kallsyms_address_to_symbol
+#error kallsyms_address_to_symbol not exported
+#endif],
+ac_cv_linux_exports_kallsyms_address=yes,
+ac_cv_linux_exports_kallsyms_address=no)])
+AC_MSG_RESULT($ac_cv_linux_exports_kallsyms_address)
+CPPFLAGS="$save_CPPFLAGS"])
+
+
 AC_DEFUN(LINUX_EXPORTS_KALLSYMS_SYMBOL, [
 AC_MSG_CHECKING(for exported kallsyms_symbol_to_address)
 save_CPPFLAGS="$CPPFLAGS"
@@ -62,56 +102,107 @@ ac_cv_linux_exports_kallsyms_symbol=no)])
 AC_MSG_RESULT($ac_cv_linux_exports_kallsyms_symbol)
 CPPFLAGS="$save_CPPFLAGS"])
 
-AC_DEFUN(LINUX_EXPORTS_KALLSYMS_ADDRESS, [
-AC_MSG_CHECKING(for exported kallsyms_address_to_symbol)
+
+AC_DEFUN(LINUX_EXPORTS_SYS_CALL_TABLE, [
+AC_MSG_CHECKING(for exported sys_call_table)
 save_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
-AC_CACHE_VAL(ac_cv_linux_exports_kallsyms_address,
+AC_CACHE_VAL(ac_cv_linux_exports_sys_call_table,
 [
 AC_TRY_COMPILE(
 [#include <linux/modversions.h>],
-[#ifndef __ver_kallsyms_address_to_symbol
-#error kallsyms_address_to_symbol not exported
+[#ifndef __ver_sys_call_table
+#error sys_call_table not exported
 #endif],
-ac_cv_linux_exports_kallsyms_address=yes,
-ac_cv_linux_exports_kallsyms_address=no)])
-AC_MSG_RESULT($ac_cv_linux_exports_kallsyms_address)
+ac_cv_linux_exports_sys_call_table=yes,
+ac_cv_linux_exports_sys_call_table=no)])
+AC_MSG_RESULT($ac_cv_linux_exports_sys_call_table)
 CPPFLAGS="$save_CPPFLAGS"])
 
-AC_DEFUN(LINUX_COMPLETION_H_EXISTS, [
-AC_MSG_CHECKING(for linux/completion.h existance)
+
+AC_DEFUN(LINUX_EXPORTS_SYS_CHDIR, [
+AC_MSG_CHECKING(for exported sys_chdir)
 save_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
-AC_CACHE_VAL(ac_cv_linux_completion_h_exists,
+AC_CACHE_VAL(ac_cv_linux_exports_sys_chdir,
 [
 AC_TRY_COMPILE(
-[#include <linux/completion.h>
-#include <linux/version.h>],
-[struct completion _c;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,8)
-lose
-#endif
-],
-ac_cv_linux_completion_h_exists=yes,
-ac_cv_linux_completion_h_exists=no)])
-AC_MSG_RESULT($ac_cv_linux_completion_h_exists)
+[#include <linux/modversions.h>],
+[#ifndef __ver_sys_chdir
+#error sys_chdir not exported
+#endif],
+ac_cv_linux_exports_sys_chdir=yes,
+ac_cv_linux_exports_sys_chdir=no)])
+AC_MSG_RESULT($ac_cv_linux_exports_sys_chdir)
 CPPFLAGS="$save_CPPFLAGS"])
 
-AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_MMAP_SHARED, [
-AC_MSG_CHECKING(for i_mmap_shared in struct inode)
+
+AC_DEFUN(LINUX_EXPORTS_SYS_CLOSE, [
+AC_MSG_CHECKING(for exported sys_close)
 save_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
-AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_mmap_shared,
+AC_CACHE_VAL(ac_cv_linux_exports_sys_close,
+[
+AC_TRY_COMPILE(
+[#include <linux/modversions.h>],
+[#ifndef __ver_sys_close
+#error sys_close not exported
+#endif],
+ac_cv_linux_exports_sys_close=yes,
+ac_cv_linux_exports_sys_close=no)])
+AC_MSG_RESULT($ac_cv_linux_exports_sys_close)
+CPPFLAGS="$save_CPPFLAGS"])
+
+
+AC_DEFUN(LINUX_EXPORTS_TASKLIST_LOCK, [
+AC_MSG_CHECKING(for exported tasklist_lock)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_exports_tasklist_lock,
+[
+AC_TRY_COMPILE(
+[#include <linux/modversions.h>],
+[#ifndef __ver_tasklist_lock
+#error tasklist_lock not exported
+#endif],
+ac_cv_linux_exports_tasklist_lock=yes,
+ac_cv_linux_exports_tasklist_lock=no)])
+AC_MSG_RESULT($ac_cv_linux_exports_tasklist_lock)
+CPPFLAGS="$save_CPPFLAGS"])
+
+
+AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_CDEV, [
+AC_MSG_CHECKING(for i_cdev in struct inode)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev, 
 [
 AC_TRY_COMPILE(
 [#include <linux/fs.h>],
 [struct inode _inode;
-printf("%d\n", _inode.i_mmap_shared);],
-ac_cv_linux_fs_struct_inode_has_i_mmap_shared=yes,
-ac_cv_linux_fs_struct_inode_has_i_mmap_shared=no)])
-AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_mmap_shared)
+printf("%d\n", _inode.i_cdev);], 
+ac_cv_linux_fs_struct_inode_has_i_cdev=yes,
+ac_cv_linux_fs_struct_inode_has_i_cdev=no)])
+AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_cdev)
+CPPFLAGS="$save_CPPFLAGS"])
+
+
+AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_DEVICES, [
+AC_MSG_CHECKING(for i_devices in struct inode)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev, 
+[
+AC_TRY_COMPILE(
+[#include <linux/fs.h>],
+[struct inode _inode;
+printf("%d\n", _inode.i_devices);], 
+ac_cv_linux_fs_struct_inode_has_i_devices=yes,
+ac_cv_linux_fs_struct_inode_has_i_devices=no)])
+AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_devices)
 CPPFLAGS="$save_CPPFLAGS"])
 
+
 AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, [
 AC_MSG_CHECKING(for i_dirty_data_buffers in struct inode)
 save_CPPFLAGS="$CPPFLAGS"
@@ -127,6 +218,7 @@ ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers=no)])
 AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers)
 CPPFLAGS="$save_CPPFLAGS"])
 
+
 AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_MAPPING_OVERLOAD, [
 AC_MSG_CHECKING(for i_mapping_overload in struct inode)
 save_CPPFLAGS="$CPPFLAGS"
@@ -142,33 +234,111 @@ ac_cv_linux_fs_struct_inode_has_i_mapping_overload=no)])
 AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_mapping_overload)
 CPPFLAGS="$save_CPPFLAGS"])
 
-AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_CDEV, [
-AC_MSG_CHECKING(for i_cdev in struct inode)
+
+AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_MMAP_SHARED, [
+AC_MSG_CHECKING(for i_mmap_shared in struct inode)
 save_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
-AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev, 
+AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_mmap_shared,
 [
 AC_TRY_COMPILE(
 [#include <linux/fs.h>],
 [struct inode _inode;
-printf("%d\n", _inode.i_cdev);], 
-ac_cv_linux_fs_struct_inode_has_i_cdev=yes,
-ac_cv_linux_fs_struct_inode_has_i_cdev=no)])
-AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_cdev)
+printf("%d\n", _inode.i_mmap_shared);],
+ac_cv_linux_fs_struct_inode_has_i_mmap_shared=yes,
+ac_cv_linux_fs_struct_inode_has_i_mmap_shared=no)])
+AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_mmap_shared)
 CPPFLAGS="$save_CPPFLAGS"])
 
-AC_DEFUN(LINUX_FS_STRUCT_INODE_HAS_I_DEVICES, [
-AC_MSG_CHECKING(for i_devices in struct inode)
+
+AC_DEFUN(LINUX_RECALC_SIGPENDING_ARG_TYPE,[
+AC_MSG_CHECKING(for recalc_sigpending arg type)
 save_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
-AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_cdev, 
+AC_CACHE_VAL(ac_cv_linux_func_recalc_sigpending_takes_void,
 [
 AC_TRY_COMPILE(
-[#include <linux/fs.h>],
-[struct inode _inode;
-printf("%d\n", _inode.i_devices);], 
-ac_cv_linux_fs_struct_inode_has_i_devices=yes,
-ac_cv_linux_fs_struct_inode_has_i_devices=no)])
-AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_devices)
+[#include <linux/sched.h>],
+[recalc_sigpending();],
+ac_cv_linux_func_recalc_sigpending_takes_void=yes,
+ac_cv_linux_func_recalc_sigpending_takes_void=no)])
+AC_MSG_RESULT($ac_cv_linux_func_recalc_sigpending_takes_void)
+CPPFLAGS="$save_CPPFLAGS"])
+
+
+AC_DEFUN(LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_PARENT, [
+AC_MSG_CHECKING(for parent in struct task_struct)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_parent,
+[
+AC_TRY_COMPILE(
+[#include <linux/sched.h>],
+[struct task_struct _tsk;
+printf("%d\n", _tsk.parent);],
+ac_cv_linux_sched_struct_task_struct_has_parent=yes,
+ac_cv_linux_sched_struct_task_struct_has_parent=no)])
+AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_parent)
 CPPFLAGS="$save_CPPFLAGS"])
 
+
+AC_DEFUN(LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_REAL_PARENT, [
+AC_MSG_CHECKING(for real_parent in struct task_struct)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_real_parent,
+[
+AC_TRY_COMPILE(
+[#include <linux/sched.h>],
+[struct task_struct _tsk;
+printf("%d\n", _tsk.real_parent);],
+ac_cv_linux_sched_struct_task_struct_has_real_parent=yes,
+ac_cv_linux_sched_struct_task_struct_has_real_parent=no)])
+AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_real_parent)
+CPPFLAGS="$save_CPPFLAGS"])
+
+
+AC_DEFUN(LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIG, [
+AC_MSG_CHECKING(for sig in struct task_struct)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_sig,
+[
+AC_TRY_COMPILE(
+[#include <linux/sched.h>],
+[struct task_struct _tsk;
+printf("%d\n", _tsk.sig);],
+ac_cv_linux_sched_struct_task_struct_has_sig=yes,
+ac_cv_linux_sched_struct_task_struct_has_sig=no)])
+AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_sig)
+CPPFLAGS="$save_CPPFLAGS"])
+
+AC_DEFUN(LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK, [
+AC_MSG_CHECKING(for sigmask_lock in struct task_struct)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_sigmask_lock,
+[
+AC_TRY_COMPILE(
+[#include <linux/sched.h>],
+[struct task_struct _tsk;
+printf("%d\n", _tsk.sigmask_lock);],
+ac_cv_linux_sched_struct_task_struct_has_sigmask_lock=yes,
+ac_cv_linux_sched_struct_task_struct_has_sigmask_lock=no)])
+AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_sigmask_lock)
+CPPFLAGS="$save_CPPFLAGS"])
+
+AC_DEFUN(LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGHAND, [
+AC_MSG_CHECKING(for sighand in struct task_struct)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_sighand,
+[
+AC_TRY_COMPILE(
+[#include <linux/sched.h>],
+[struct task_struct _tsk;
+printf("%d\n", _tsk.sighand);],
+ac_cv_linux_sched_struct_task_struct_has_sighand=yes,
+ac_cv_linux_sched_struct_task_struct_has_sighand=no)])
+AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_sighand)
+CPPFLAGS="$save_CPPFLAGS"])
index bb40f4afbeb519dbdc2f612ee9f154629534ee47..07c4a75b7b6bbf902f36fcba6d763aaa27d08730 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/cmd/cmd.c,v 1.1.1.8 2001/10/14 18:04:23 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/cmd/cmd.c,v 1.1.1.9 2003/04/13 19:06:20 hartmans Exp $");
 
 #include <sys/types.h>
 #include <ctype.h>
@@ -784,6 +784,9 @@ char **argv;
        otherwise it is a real nuisance */
     if (ts->parms[CMD_HELPPARM].items) {
        PrintSyntax(ts);
+       /* Display full help syntax if we don't have subcommands */
+       if (noOpcodes)
+           PrintFlagHelp(ts);
        ResetSyntax(ts);
        return 0;
     }
index ab8d095eed5b1c6d977a3744531774d8ab9ac6c9..688fa68d64d51a3aab1814b564c40b5bc95aab1d 100644 (file)
@@ -42,6 +42,9 @@
 #define        AFSOP_SET_DYNROOT        31     /* enable/disable dynroot support */
 #define        AFSOP_ADDCELLALIAS       32     /* create alias for existing cell */
 #define        AFSOP_SET_FAKESTAT       33     /* enable/disable fakestat support */
+#define        AFSOP_CELLINFO           34     /* set the cellinfo file name */
+#define        AFSOP_SET_THISCELL       35     /* set the primary cell */
+#define AFSOP_BASIC_INIT        36     /* used to be part of START_AFS */
 
 /* The range 20-30 is reserved for AFS system offsets in the afs_syscall */
 #define        AFSCALL_PIOCTL          20
index e55a01efb1c7e2249e7b9a0729a62319950a8684..576c8de4854624e0d1c0e3bf964c08a56664ae7b 100644 (file)
@@ -88,6 +88,7 @@
    they won't allocate sunx86 IDs at all. So leave a gap and pray. */
 #define SYS_NAME_ID_sunx86_57            950
 #define SYS_NAME_ID_sunx86_58            951
+#define SYS_NAME_ID_sunx86_59            952
 
 #define SYS_NAME_ID_vax_ul4            1003
 #define SYS_NAME_ID_vax_ul40           1004
 #define SYS_NAME_ID_alpha_osf32c       1204
 #define SYS_NAME_ID_alpha_dux40                1205
 #define SYS_NAME_ID_alpha_dux50                1206
+#define SYS_NAME_ID_alpha_dux51                1206
 
 #define SYS_NAME_ID_ncrx86_20          1300
 #define SYS_NAME_ID_ncrx86_30          1301
index 1dcb8fed4c324d25f76440920e93ae8355231665..4d44dc77730f63fd5cdb122a6a69921d9a801198 100644 (file)
@@ -33,7 +33,7 @@
 #ifdef AFS_SMP
 #define CONFIG_SMP 1
 #ifndef CONFIG_S390_LOCAL_APIC
-#define CONFIG_S390_LOCAL_APIC
+#define CONFIG_S390_LOCAL_APIC 1
 #endif
 #ifndef __SMP__
 #define __SMP__
index a15bb90041d66a704a6553975a0caa2a3c077b0e..ed4cc182ef1988e9a1a35a9d9a5734276e8886bf 100644 (file)
@@ -21,6 +21,7 @@
 #define AFS_ENV                        1
 #define AFS_USR_SUN5_ENV       1
 #define AFS_USR_SUN6_ENV       1
+#define AFS_USR_SUN7_ENV       1
 
 #include <afs/afs_sysnames.h>
 
@@ -33,9 +34,9 @@
 #define AFS_MOUNT_AFS   1
 
 /* Machine / Operating system information */
-#define sys_sun4x_55   1
-#define SYS_NAME       "sun4x_55"
-#define SYS_NAME_ID    SYS_NAME_ID_sun4x_55
+#define sys_sunx86_57  1
+#define SYS_NAME       "sunx86_57"
+#define SYS_NAME_ID    SYS_NAME_ID_sunx86_57
 #define AFSLITTLE_ENDIAN       1
 #define AFS_HAVE_FFS            1       /* Use system's ffs. */
 #define AFS_HAVE_STATVFS      0       /* System doesn't support statvfs */
index bc9657c8d215aa58dd856a937c0a5b8099a87e46..543a7389cdb31fe96bac29b5f071b72b37b0f88b 100644 (file)
@@ -21,6 +21,8 @@
 #define AFS_ENV                        1
 #define AFS_USR_SUN5_ENV       1
 #define AFS_USR_SUN6_ENV       1
+#define AFS_USR_SUN7_ENV       1
+#define AFS_USR_SUN8_ENV       1
 
 #include <afs/afs_sysnames.h>
 
@@ -33,9 +35,9 @@
 #define AFS_MOUNT_AFS   1
 
 /* Machine / Operating system information */
-#define sys_sun4x_55   1
-#define SYS_NAME       "sun4x_55"
-#define SYS_NAME_ID    SYS_NAME_ID_sun4x_55
+#define sys_sunx86_58  1
+#define SYS_NAME       "sunx86_58"
+#define SYS_NAME_ID    SYS_NAME_ID_sunx86_58
 #define AFSLITTLE_ENDIAN       1
 #define AFS_HAVE_FFS            1       /* Use system's ffs. */
 #define AFS_HAVE_STATVFS      0       /* System doesn't support statvfs */
index a8ce0c153236e20f6dc9f82e963b23642bf79138..c1bae1c50a79e6d1e5b0471555a7d41ad3777c6b 100644 (file)
@@ -96,3 +96,9 @@ proc GetCacheConfig(
   OUT cacheConfig *config
 ) = 218;
 
+proc GetCellByNum(
+  IN  afs_int32 cellNumber,
+  OUT string cellName<AFSNAMEMAX>,
+  OUT serverList *cellHosts
+) = 65537;
+
index 4230c3b810c4e513e81639eb1f38b4c9643a56bd..e4a2582b12f35eacea2e67e2e52b9fd9061711ed 100644 (file)
@@ -24,7 +24,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/fsprobe/fsprobe_callback.c,v 1.1.1.5 2002/05/10 23:58:47 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/fsprobe/fsprobe_callback.c,v 1.1.1.6 2003/04/13 19:06:39 hartmans Exp $");
 
 #include <errno.h>
 #include <stdio.h>                     /*Standard I/O stuff*/
@@ -646,6 +646,15 @@ int SRXAFSCB_GetCellServDB(
     return RXGEN_OPCODE;
 }
 
+afs_int32 SRXAFSCB_GetCellByNum(
+    struct rx_call *a_call,
+    afs_int32 a_cellnum,
+    char **a_name,
+    serverList *a_hosts)
+{
+    return RXGEN_OPCODE;
+}
+
 /*------------------------------------------------------------------------
  * EXPORTED SRXAFSCB_GetLocalCell
  *
index b1d3f963f93ca0ef747ef09eb3277b3d0f5ee793..438286a80587b46c8ef1aca8ace67f16f94c91c0 100644 (file)
@@ -63,7 +63,7 @@ install: ${DESTDIR}${sbindir}/inetd
 dest: ${DEST}/etc/inetd
        set -x; \
        case "${SYS_NAME}" in \
-       sun4* ) \
+       sun* ) \
                ${INSTALL} -m 644 -f inetd.conf.solaris ${DEST}/etc/inetd.conf ;; \
        sgi_* ) \
                ${INSTALL} -m 644 -f inetd.conf.sgi ${DEST}/etc/inetd.conf ;; \
index ffd91a67a198917f3fb6f94ad1f954f2c3dc1f0c..646ebb1fd48b4b87b6a5c4a8f91aeb940ed98dd4 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kaprocs.c,v 1.1.1.10 2002/05/10 23:59:04 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kaprocs.c,v 1.1.1.11 2003/04/13 19:06:44 hartmans Exp $");
 
 #include <afs/stds.h>
 #include <errno.h>
@@ -1707,6 +1707,11 @@ static afs_int32 GetTicket (version, call, kvno, authDomain, aticket,
     if (import && (celllen == 0)) {code = KABADTICKET; goto abort;}
     if (export && (celllen == 0)) strcpy (cell, lrealm);
 
+    if (!krb4_cross && celllen && strcmp(lrealm, cell) != 0) {
+      code = KABADUSER;
+      goto abort;
+    }
+
     des_ecb_encrypt (atimes->SeqBody, &times, schedule, DECRYPT);
     times.start = ntohl(times.start);
     times.end = ntohl(times.end);
index 00b12a577d22e695f118bb02b1bbcc9321a561d1..a6aeaecfdf9d9631521ebab74fbbac6e01debda6 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kaserver.c,v 1.1.1.10 2002/05/10 23:59:05 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/kaserver.c,v 1.1.1.11 2003/04/13 19:06:45 hartmans Exp $");
 
 #include <afs/stds.h>
 #include <sys/types.h>
@@ -56,6 +56,8 @@ struct kadstats dynamic_statistics;
 struct ubik_dbase *KA_dbase;
 afs_int32 myHost = 0;
 afs_int32 verbose_track = 1;
+afs_int32 krb4_cross = 0;
+
 struct afsconf_dir *KA_conf;           /* for getting cell info */
 
 extern afs_int32 ubik_lastYesTime;
@@ -194,6 +196,7 @@ main (argc, argv)
       usage:
         printf("Usage: kaserver [-noAuth] [-fastKeys] [-database <dbpath>] "
               "[-localfiles <lclpath>] [-minhours <n>] [-servers <serverlist>] "
+              "[-crossrealm]"
               /*" [-enable_peer_stats] [-enable_process_stats] " */
               "[-help]\n");
        exit(1);
@@ -251,6 +254,7 @@ main (argc, argv)
        else if (IsArg("-clear")) level = rxkad_clear;
        else if (IsArg("-sorry")) level = rxkad_clear;
        else if (IsArg("-debug")) verbose_track = 0;
+       else if (IsArg("-crossrealm")) krb4_cross = 1;
        else if (IsArg("-minhours")) {
              MinHours = atoi(argv[++a]);
         }
index dfc0e341590a34e8b680f2fc1d69f1085e01668a..ef7580545b8909c70a858f797b4e5a5947525a8c 100644 (file)
@@ -179,6 +179,7 @@ extern int kaux_islocked(
   u_int   locktime
 );
 
+extern afs_int32 krb4_cross;
 
 #define LOCKPW
 
index 43ddd1eac1425334e55745f260c1a8d1022c677a..472662e0e78285ae0034bdef472b373d3764752e 100644 (file)
@@ -15,7 +15,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/krb_udp.c,v 1.1.1.13 2002/09/26 19:06:20 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/kauth/krb_udp.c,v 1.1.1.14 2003/04/13 19:06:46 hartmans Exp $");
 
 #include <afs/stds.h>
 #include <sys/types.h>
@@ -462,6 +462,11 @@ afs_int32 UDP_GetTicket (ksoc, pkt, kvno, authDomain, ticket, ticketLen, auth, a
        cell[MAXKTCREALMLEN-1] = 0;
     };
 
+    if (!krb4_cross && strcmp(lrealm, cell) != 0) {
+       code = KERB_ERR_PRINCIPAL_UNKNOWN;
+       goto abort;
+    }
+
     if (krb_udp_debug) {
        printf ("UGetTicket: got ticket from '%s'.'%s'@'%s'\n",
                name, inst, cell);
index a84c4c7ddf2a6d95d9fb3abdd95d8f667dbac292..70cc9789c5ff9c00ee18d7415c7bfbcf73e2e1fb 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/libacl/aclprocs.c,v 1.1.1.8 2001/10/14 18:05:15 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/libacl/aclprocs.c,v 1.1.1.9 2003/04/13 19:06:48 hartmans Exp $");
 
 #include <sys/types.h>
 #ifdef AFS_NT40_ENV
@@ -29,7 +29,7 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/libacl/aclprocs.c,v 1.1.1.8 2001/10/14
 #endif
 #include <rx/xdr.h>
 #include <rx/rx.h>
-#include <ptclient.h>
+#include <afs/ptclient.h>
 #include "acl.h"
 
 #ifdef AFS_PTHREAD_ENV
index 223e188812e158a45bd781138c0098c085728de9..a0aeb38d9fbe95c71b474a9521e285c250c5bd4a 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/libacl/netprocs.c,v 1.1.1.4 2001/07/14 22:22:22 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/libacl/netprocs.c,v 1.1.1.5 2003/04/13 19:06:48 hartmans Exp $");
 
 #include <sys/types.h>
 #ifdef AFS_NT40_ENV
@@ -26,7 +26,7 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/libacl/netprocs.c,v 1.1.1.4 2001/07/14
 #endif
 #include <rx/xdr.h>
 #include <rx/rx.h>
-#include <ptclient.h>
+#include <afs/ptclient.h>
 #include "acl.h"
 
 int acl_HtonACL(acl)
index a5b7c574f30cff4f5777a1c2f643a64dc1e15f84..4d46579993204aa2aa3cd6f75ce306897b833719 100644 (file)
@@ -51,27 +51,30 @@ DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT
 KDEFS= -Dsun4c -DSUN4C_60 -DNFSCLIENT -DSYSACCT -DOLDSCSI -DVDDRV -D_KERNEL \
        -DSYSV -dn ${ARCH_DEFS}
 
-<sun4x_57 sun4x_58 sun4x_59>
+<sun4x_57 sun4x_58 sun4x_59 sunx86_57 sunx86_58 sunx86_59>
 KDEFS_32 = 
+<sun4x_57 sun4x_58 sun4x_59>
 KDEFS_64 = -xarch=v9
 
 <all>
 CFLAGS=-I. -I.. -I${TOP_SRCDIR}/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG}
 
 # Name of directory to hold object files and libraries.
-<all -sun4x_57 -sun4x_58 -sun4x_59>
+<all -sun4x_57 -sun4x_58 -sun4x_59 -sunx86_57 -sunx86_58 -sunx86_59>
 KOBJ = MODLOAD
 <sun4x_57 sun4x_58 sun4x_59>
 KOBJ = MODLOAD32 MODLOAD64
+<sunx86_57 sunx86_58 sunx86_59>
+KOBJ = MODLOAD32
 
 
 # This tells Makefile.common to use it's single directory build target.
-<all -sun4x_57 -sun4x_58 -sun4x_59>
+<all -sun4x_57 -sun4x_58 -sun4x_59 -sunx86_57 -sunx86_58 -sunx86_59>
 COMPDIRS = single_compdir
 INSTDIRS = single_instdir
 DESTDIRS = single_destdir
 
-<sun4x_57 sun4x_58 sun4x_59>
+<sun4x_57 sun4x_58 sun4x_59 sunx86_57 sunx86_58 sunx86_59>
 COMPDIRS = solaris_compdirs
 INSTDIRS = solaris_instdirs
 DESTDIRS = solaris_destdirs
@@ -103,7 +106,7 @@ setup:
 ## This is the target for a Solaris 7. Here we build both the 32 bit and
 ## the 64 bit libafs in MODLOAD32 and MODLOAD64 directories respectively
 
-<sun4x_57 sun4x_58 sun4x_59>
+<sun4x_57 sun4x_58 sun4x_59 sunx86_57 sunx86_58 sunx86_59>
 ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}:
        for t in ${KOBJ} ; do \
                echo Building directory: $$t ; \
@@ -132,13 +135,26 @@ solaris_destdirs_libafs: dest_libafs
 LIBAFS = libafs.o
 LIBAFSNONFS = libafs.nonfs.o
 
-<all -sun4x_57 -sun4x_58 -sun4x_59>
+<all -sun4x_57 -sun4x_58 -sun4x_59 -sunx86_57 -sunx86_58 -sunx86_59>
 INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS}
 INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS}
 
 DEST_LIBAFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFS}
 DEST_LIBAFSNONFS = ${DEST}/root.client/usr/vice/etc/modload/${LIBAFSNONFS}
 
+<sun4x_57 sun4x_58 sun4x_59 sunx86_57 sunx86_58 sunx86_59>
+
+libafs: ${LIBAFSNONFS} ${LIBAFS}
+
+install_libafs: ${LIBAFSNONFS} ${LIBAFS}
+       ${INSTALL} -f ${LIBAFSNONFS} ${DESTDIR}${afskerneldir}/libafs${BITS}.nonfs.o
+       ${INSTALL} -f ${LIBAFS} ${DESTDIR}${afskerneldir}/libafs${BITS}.o
+
+dest_libafs: ${LIBAFSNONFS} ${LIBAFS}
+       ${INSTALL} -f ${LIBAFSNONFS} ${DEST}/root.client/usr/vice/etc/modload/libafs${BITS}.nonfs.o
+       ${INSTALL} -f ${LIBAFS} ${DEST}/root.client/usr/vice/etc/modload/libafs${BITS}.o
+
+<all>
 # Without this line, gmake tries to build libafs.o
 .PHONY: libafs
 
@@ -159,7 +175,6 @@ $(DEST_LIBAFS): $(LIBAFS)
 $(DEST_LIBAFSNONFS): $(LIBAFSNONFS)
        ${INSTALL} -f $? $@
 
-<all>
 ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
        $(RM) -f $@
        $(LD) -r -o $@ $(AFSAOBJS) ${AFSNFSOBJS}
@@ -168,18 +183,6 @@ ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
        $(RM) -f $@
        $(LD) -r -o $@  $(AFSAOBJS) ${AFSNONFSOBJS}
 
-<sun4x_57 sun4x_58 sun4x_59>
-
-libafs: ${LIBAFSNONFS} ${LIBAFS}
-
-install_libafs: ${LIBAFSNONFS} ${LIBAFS}
-       ${INSTALL} -f ${LIBAFSNONFS} ${DESTDIR}${afskerneldir}/libafs${BITS}.nonfs.o
-       ${INSTALL} -f ${LIBAFS} ${DESTDIR}${afskerneldir}/libafs${BITS}.o
-
-dest_libafs: ${LIBAFSNONFS} ${LIBAFS}
-       ${INSTALL} -f ${LIBAFSNONFS} ${DEST}/root.client/usr/vice/etc/modload/libafs${BITS}.nonfs.o
-       ${INSTALL} -f ${LIBAFS} ${DEST}/root.client/usr/vice/etc/modload/libafs${BITS}.o
-
 <all>
 
 # Solaris specific objects
index 95ec3c9926b9e4816161991dc9245d53f0dbfc00..3227b7c2bc562c2b2eca7788be97eee7ea73d0a2 100644 (file)
@@ -198,3 +198,4 @@ EXPORTS
        rx_enable_hot_thread                    @203 DATA
        xdr_int64                               @204
        xdr_uint64                              @205
+       osi_AssertFailU                         @206
index a0d8f01c4c2ef95b6d88c0f78a5eba0be91b3682..ec17d0bb87a8f51e223d36e2f560f3a44a3c1622 100644 (file)
@@ -41,7 +41,7 @@
 #include <sys/select.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <bstring.h>
+#include <string.h>
 #include <sys/time.h>
 #include <netinet/in.h>
 #include <netdb.h>
@@ -53,7 +53,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/selclient.c,v 1.1.1.4 2001/07/14 22:22:58 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/selclient.c,v 1.1.1.5 2003/04/13 19:07:03 hartmans Exp $");
 
 
 #include "../lwp.h"
@@ -184,6 +184,11 @@ main(int ac, char **av)
        Usage();
     }
 
+    if (writeSize == 0 && doEnd ==0 && putOOB == 0) {
+       printf("%s: Missing action.\n", program);
+       Usage();
+    }
+
     if (!setFD) {
        setFD = 31;
        printf("%s: Using default socket of %d.\n", program, setFD);
index ffaf2e93582589c629d7181a6f1704a6f9735c77..9f199547984e47f8cb78d1c9527c03f235b2ab66 100644 (file)
@@ -42,7 +42,7 @@
 #include <sys/select.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <bstring.h>
+#include <string.h>
 #include <sys/time.h>
 #include <netinet/in.h>
 #include <netdb.h>
@@ -54,7 +54,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/selserver.c,v 1.1.1.4 2001/07/14 22:22:58 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/selserver.c,v 1.1.1.5 2003/04/13 19:07:04 hartmans Exp $");
 
 
 #include "../lwp.h"
index b29f03884e9c7a6ee317c86e1518b9194706696f..7295e305f6e9a0d12163a654c688aafb61f234d9 100644 (file)
@@ -16,7 +16,7 @@
 #include <sys/select.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <bstring.h>
+#include <string.h>
 #include <sys/time.h>
 #include <netinet/in.h>
 #include <netdb.h>
@@ -28,7 +28,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/selsubs.c,v 1.1.1.5 2001/09/11 14:33:42 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/lwp/test/selsubs.c,v 1.1.1.6 2003/04/13 19:07:04 hartmans Exp $");
 
 
 #include "../lwp.h"
@@ -141,12 +141,13 @@ void Log(char *fmt, ...)
 {
     va_list args;
     struct timeval now;
+    struct timezone tz;
     struct tm *ltime;
     int code;
     PROCESS pid;
     extern char *program;
     
-    code = gettimeofday(&now);
+    code = gettimeofday(&now,&tz);
     assert (code == 0);
 
     ltime = localtime((time_t*)&now.tv_sec);
index 92886b94b32e909d2efbd0362b5b9e61f1279f8f..3e747cd767b9b5e44b7553565f68b310a9704e5a 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/DARWIN/rx_knet.c,v 1.1.1.4 2001/09/11 14:34:30 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/DARWIN/rx_knet.c,v 1.1.1.5 2003/04/13 19:07:28 hartmans Exp $");
 
 #include "../rx/rx_kcommon.h"
 
@@ -24,7 +24,7 @@ int osi_NetReceive(asocket, addr, dvec, nvecs, alength)
     struct uio u;
     int i;
     struct iovec iov[RX_MAXIOVECS];
-    struct sockaddr *sa;
+    struct sockaddr *sa = NULL;
     int code;
 
     int haveGlock = ISAFS_GLOCK();
@@ -60,13 +60,16 @@ int osi_NetReceive(asocket, addr, dvec, nvecs, alength)
     if (haveGlock) {
         AFS_GLOCK();
     }
-    *alength=*alength-u.uio_resid;
+    if (code)
+       return code;
+    *alength -= u.uio_resid;
     if (sa) {
        if (sa->sa_family == AF_INET) {
           if (addr) *addr=*(struct sockaddr_in *)sa;
        } else {
           printf("Unknown socket family %d in NetReceive\n");
        }
+       FREE(sa, M_SONAME);
     }
     return code;
 }
index 4ed5f43b8da39c97dbc4bc0aad86ad06444998f6..21bb367a8346178625c588de44ae9b473a150f1a 100644 (file)
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/FBSD/rx_knet.c,v 1.1.1.5 2002/09/26 19:07:44 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/FBSD/rx_knet.c,v 1.1.1.6 2003/04/13 19:07:28 hartmans Exp $");
 
 #ifdef AFS_FBSD40_ENV
+#include <sys/malloc.h>
 #include "../rx/rx_kcommon.h"
 
 
@@ -37,7 +38,7 @@ int osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec,
     struct uio u;
     int i;
     struct iovec iov[RX_MAXIOVECS];
-    struct sockaddr *sa;
+    struct sockaddr *sa = NULL;
     int code;
 
     int haveGlock = ISAFS_GLOCK();
@@ -75,13 +76,16 @@ int osi_NetReceive(osi_socket so, struct sockaddr_in *addr, struct iovec *dvec,
     if (haveGlock) {
         AFS_GLOCK();
     }
-    *alength=*alength-u.uio_resid;
+    if (code)
+       return code;
+    *alength -= u.uio_resid;
     if (sa) {
        if (sa->sa_family == AF_INET) {
           if (addr) *addr=*(struct sockaddr_in *)sa;
        } else {
           printf("Unknown socket family %d in NetReceive\n", sa->sa_family);
        }
+       FREE(sa, M_SONAME);
     }
     return code;
 }
@@ -141,7 +145,8 @@ osi_NetSend(asocket, addr, dvec, nvecs, alength, istack)
 #if KNET_DEBUG
     printf("+");
 #endif
-    code = sosend(asocket, addr, &u, NULL, NULL, 0, curproc);
+    code = sosend(asocket, (struct sockaddr *)addr, &u, NULL, NULL, 0, 
+                 curproc);
 #if KNET_DEBUG
     if (code) {
         if (code == EINVAL)
index 22d52086566123d6ce348e661ce8d8cfd0570208..85155ae86742d85ea84f9254ffc7ba5869228b33 100644 (file)
@@ -17,6 +17,7 @@
 #define RX_KMUTEX_H_
 
 #include "../rx/rx_kernel.h"   /* for osi_Panic() */
+#include "linux/sched.h"
 
 /* AFS_GLOBAL_RXLOCK_KERNEL is defined so that the busy tq code paths are
  * used. The thread can sleep when sending packets.
@@ -32,7 +33,6 @@
 struct coda_inode_info {};
 #endif
 #include "linux/wait.h"
-#include "linux/sched.h"
 
 typedef struct afs_kmutex {
     struct semaphore sem;
@@ -125,19 +125,19 @@ static inline int CV_WAIT(afs_kcondvar_t *cv, afs_kmutex_t *l)
     if (isAFSGlocked) AFS_GUNLOCK();
     MUTEX_EXIT(l);
 
-    spin_lock_irq(&current->sigmask_lock);
+    SIG_LOCK(current);
     saved_set = current->blocked;
     sigfillset(&current->blocked);
-    recalc_sigpending(current);
-    spin_unlock_irq(&current->sigmask_lock);
+    RECALC_SIGPENDING(current);
+    SIG_UNLOCK(current);
 
     schedule();
     remove_wait_queue(cv, &wait);
 
-    spin_lock_irq(&current->sigmask_lock);
+    SIG_LOCK(current);
     current->blocked = saved_set;
-    recalc_sigpending(current);
-    spin_unlock_irq(&current->sigmask_lock);
+    RECALC_SIGPENDING(current);
+    SIG_UNLOCK(current);
 
     if (isAFSGlocked) AFS_GLOCK();
     MUTEX_ENTER(l);
@@ -162,19 +162,19 @@ static inline int CV_TIMEDWAIT(afs_kcondvar_t *cv, afs_kmutex_t *l, int waittime
     if (isAFSGlocked) AFS_GUNLOCK();
     MUTEX_EXIT(l);
     
-    spin_lock_irq(&current->sigmask_lock);
+    SIG_LOCK(current);
     saved_set = current->blocked;
     sigfillset(&current->blocked);
-    recalc_sigpending(current);
-    spin_unlock_irq(&current->sigmask_lock);
+    RECALC_SIGPENDING(current);
+    SIG_UNLOCK(current);
 
     t = schedule_timeout(t);
     remove_wait_queue(cv, &wait);
     
-    spin_lock_irq(&current->sigmask_lock);
+    SIG_LOCK(current);
     current->blocked = saved_set;
-    recalc_sigpending(current);
-    spin_unlock_irq(&current->sigmask_lock);
+    RECALC_SIGPENDING(current);
+    SIG_UNLOCK(current);
 
     if (isAFSGlocked) AFS_GLOCK();
     MUTEX_ENTER(l);
index 535d811f64ceeb6b6612d0353971795b08501c77..db0c51a596ac4e7968d09f78baaf0e15624f00ab 100644 (file)
@@ -15,8 +15,9 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/LINUX/rx_knet.c,v 1.1.1.9 2002/05/18 19:47:41 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/LINUX/rx_knet.c,v 1.1.1.10 2003/04/13 19:07:29 hartmans Exp $");
 
+#include <linux/version.h>
 #ifdef AFS_LINUX22_ENV
 #include "../rx/rx_kcommon.h"
 #if defined(AFS_LINUX24_ENV)
@@ -175,11 +176,18 @@ int osi_NetReceive(osi_socket so, struct sockaddr_in *from,
 
 void osi_StopListener(void)
 {
-    extern int (*sys_killp)();
+    struct task_struct *listener;
     extern int rxk_ListenerPid;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    read_lock(&tasklist_lock);
+#endif
+    listener =  find_task_by_pid(rxk_ListenerPid);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+                    read_unlock(&tasklist_lock);
+#endif
     while (rxk_ListenerPid) {
-       (void) (*sys_killp)(rxk_ListenerPid, SIGKILL);
+       force_sig(SIGKILL, listener);
        afs_osi_Sleep(&rxk_ListenerPid); 
     }
     sock_release(rx_socket);
index 3c690af1e9cf0aec3a28bb5f0cdffb65604eacf6..bdaf063128e8965e4e9305bed5eedb43c569bc85 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/SOLARIS/rx_knet.c,v 1.1.1.9 2002/05/11 00:01:39 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/SOLARIS/rx_knet.c,v 1.1.1.10 2003/04/13 19:07:29 hartmans Exp $");
 
 #ifdef AFS_SUN5_ENV
 #include "../rx/rx_kcommon.h"
@@ -292,11 +292,21 @@ int osi_FreeSocket(asocket)
 {
     extern int rxk_ListenerPid;
     struct sonode *so = (struct sonode *)asocket;
-    vnode_t *vp = SOTOV(so);
+    struct sockaddr_in taddr;
+    struct iovec dvec;
+    char c;
 
     AFS_STATCNT(osi_FreeSocket);
+
+    taddr.sin_family = AF_INET;
+    taddr.sin_port = htons(rx_port);
+    taddr.sin_addr.s_addr = htonl(0x7f000001);
+
+    dvec.iov_base = &c;
+    dvec.iov_len = 1;
+
     while (rxk_ListenerPid) {
-       kill(rxk_ListenerPid, SIGUSR1);
+       osi_NetSend(rx_socket, &taddr, &dvec, 1, 1, 0);
        afs_osi_Sleep(&rxk_ListenerPid);
     }
 
index bd467e37ffe474892c8443f31bb5d2c3e2bc62b0..f8d7580212e2a53f2abdc884608addb27733bfee 100644 (file)
@@ -32,7 +32,6 @@ EXT struct rx_service *rx_services[RX_MAX_SERVICES+1];
 #ifdef RX_ENABLE_LOCKS
 /* Protects nRequestsRunning as well as pool allocation variables. */
 EXT afs_kmutex_t rx_serverPool_lock;
-EXT afs_kcondvar_t rx_serverPool_cv;
 #endif /* RX_ENABLE_LOCKS */
 
 /* Incoming calls wait on this queue when there are no available server processes */
@@ -374,7 +373,13 @@ EXT int rxi_callAbortDelay INIT(3000);
  */
 
 #if defined(AFS_PTHREAD_ENV)
+EXT int rxi_fcfs_thread_num INIT(0);
 EXT pthread_key_t rx_thread_id_key;
+/* keep track of pthread numbers - protected by rx_stats_mutex, 
+   except in rx_Init() before mutex exists! */
+EXT int rxi_pthread_hinum INIT(0);
+#else
+#define rxi_fcfs_thread_num (0)
 #endif
 
 #if defined(RX_ENABLE_LOCKS)
index fbc32cb97ba63fd2b66795aabf29168eb7747163..a3ff587d8c114572dd353e2083b1ebfd180a17ee 100644 (file)
@@ -14,7 +14,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_kcommon.c,v 1.1.1.14 2002/12/11 02:44:30 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_kcommon.c,v 1.1.1.15 2003/04/13 19:07:24 hartmans Exp $");
 
 #include "../rx/rx_kcommon.h"
 
@@ -1024,14 +1024,15 @@ int rxk_ListenerPid; /* Used to signal process to wakeup at shutdown */
 
 #ifdef AFS_SUN5_ENV
 /*
- * Run the listener as a kernel process.
+ * Run the listener as a kernel thread.
  */
 void rxk_Listener(void)
 {
     extern id_t syscid;
     void rxk_ListenerProc(void);
-    if (newproc(rxk_ListenerProc, syscid, 59))
-       osi_Panic("rxk_Listener: failed to fork listener process!\n");
+    if (thread_create(NULL, DEFAULTSTKSZ, rxk_ListenerProc,
+       0, 0, &p0, TS_RUN, minclsyspri) == NULL)
+       osi_Panic("rxk_Listener: failed to start listener thread!\n");
 }
 
 void rxk_ListenerProc(void)
@@ -1047,7 +1048,7 @@ void rxk_Listener(void)
     rxk_ListenerPid = current->pid;
 #endif
 #ifdef AFS_SUN5_ENV
-    rxk_ListenerPid = ttoproc(curthread)->p_pidp->pid_id;
+    rxk_ListenerPid = 1;      /* No PID, just a flag that we're alive */
 #endif /* AFS_SUN5_ENV */
 #ifdef AFS_FBSD_ENV
     rxk_ListenerPid = curproc->p_pid;
@@ -1091,11 +1092,6 @@ void rxk_Listener(void)
 #endif
 #ifdef AFS_SUN5_ENV
     AFS_GUNLOCK();
-#ifdef HAVE_P_COREFILE
-    if (!curproc->p_corefile)  /* newproc doesn't set it, but exit frees it */
-       curproc->p_corefile = refstr_alloc("core");
-#endif
-    exit(CLD_EXITED, 0);
 #endif /* AFS_SUN5_ENV */
 }
 
index 4ac04c2c470dee286f59d9efc69438a792ae1a8f..0eacd8aaec83d5f03544807d8c3d9bd7e0cd3c6b 100644 (file)
@@ -30,6 +30,7 @@ typedef unsigned short                  etap_event_t;
 #include "../h/vfs.h"          /* stops SUN56 socketvar.h warnings */
 #include "../h/stropts.h"      /* stops SUN56 socketvar.h warnings */
 #include "../h/stream.h"       /* stops SUN56 socketvar.h errors */
+#include "../h/disp.h"
 #endif
 #include "../h/socket.h"
 #ifndef AFS_LINUX22_ENV
index c2709d2e2b151723456a2ef420bbb04a3b5288c0..e333ce296384948fa107c8f69e7d1f3b1bf7a7c2 100644 (file)
@@ -18,7 +18,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_pthread.c,v 1.1.1.9 2002/08/02 04:36:23 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_pthread.c,v 1.1.1.10 2003/04/13 19:07:25 hartmans Exp $");
 
 #include <sys/types.h>
 #include <errno.h>
@@ -33,8 +33,8 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_pthread.c,v 1.1.1.9 2002/08/02 04
 # include <sys/time.h>
 #endif
 #include <sys/stat.h>
-#include <rx.h>
-#include <rx_globals.h>
+#include <rx/rx.h>
+#include <rx/rx_globals.h>
 #include <assert.h>
 #include <rx/rx_pthread.h>
 
@@ -53,7 +53,7 @@ static long rx_pthread_n_event_wakeups;
  */
 static int rx_pthread_event_rescheduled = 0;
 
-static void rx_ListenerProc(void *);
+static void *rx_ListenerProc(void *);
 
 /*
  * We supply an event handling thread for Rx's event processing.
@@ -204,7 +204,7 @@ int sock;
 int *tnop;
 struct rx_call **newcallp;
 {
-    u_long host;
+    unsigned int host;
     u_short port;
     register struct rx_packet *p = (struct rx_packet *)0;
 
@@ -245,7 +245,7 @@ struct rx_call **newcallp;
 /* This is the listener process request loop. The listener process loop
  * becomes a server thread when rxi_ListenerProc returns, and stays
  * server thread until rxi_ServerProc returns. */
-static void rx_ListenerProc(void *argp)
+static void *rx_ListenerProc(void *argp)
 {
     int threadID;
     int sock = (int) argp;
@@ -279,7 +279,21 @@ void rx_ServerProc()
     rxi_dataQuota += rx_initSendWindow;        /* Reserve some pkts for hard times */
     /* threadID is used for making decisions in GetCall.  Get it by bumping
      * number of threads handling incoming calls */
-    threadID = rxi_availProcs++;
+       /* Unique thread ID: used for scheduling purposes *and* as index into
+               the host hold table (fileserver). 
+               The previously used rxi_availProcs is unsuitable as it
+               will already go up and down as packets arrive while the server
+               threads are still initialising! The recently introduced
+               rxi_pthread_hinum does not necessarily lead to a server
+               thread with id 0, which is not allowed to hop through the
+               incoming call queue.
+               So either introduce yet another counter or flag the FCFS
+               thread... chose the latter.
+       */
+       threadID = ++rxi_pthread_hinum;
+       if (rxi_fcfs_thread_num==0 && rxi_fcfs_thread_num!=threadID)
+               rxi_fcfs_thread_num=threadID;
+       ++rxi_availProcs;
     MUTEX_EXIT(&rx_stats_mutex);
 
     while(1) {
@@ -330,6 +344,9 @@ void rxi_StartListener() {
        printf("Unable to create Rx event handling thread\n");
        exit(1);
     }
+    MUTEX_ENTER(&rx_stats_mutex);
+    ++rxi_pthread_hinum;
+    MUTEX_EXIT(&rx_stats_mutex);
     AFS_SIGSET_RESTORE();
 
     assert(pthread_mutex_lock(&listener_mutex)==0);
@@ -371,6 +388,9 @@ rxi_Listen(sock)
        printf("Unable to create socket listener thread\n");
        exit(1);
     }
+    MUTEX_ENTER(&rx_stats_mutex);
+    ++rxi_pthread_hinum;
+    MUTEX_EXIT(&rx_stats_mutex);
     AFS_SIGSET_RESTORE();
     return 0;
 }
index 9fc416aede679e662625c67bbef4c02b9c4af0f6..7030c87036c2334320ce9c30e58f9161b9947eb9 100644 (file)
@@ -14,7 +14,7 @@
 #include <afs/param.h>
 #endif
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_rdwr.c,v 1.1.1.10 2001/10/14 18:06:23 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/rx_rdwr.c,v 1.1.1.11 2003/04/13 19:07:26 hartmans Exp $");
 
 #ifdef KERNEL
 #ifndef UKERNEL
index b65b0c38b258e2e89dcff70da572415f27d07702..b36eca9c6e85075f9e58ab7686fc7cdae2b240a2 100644 (file)
@@ -29,7 +29,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_mem.c,v 1.1.1.4 2001/09/11 14:34:27 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rx/xdr_mem.c,v 1.1.1.5 2003/04/13 19:07:27 hartmans Exp $");
 
 #ifndef        NeXT
 
@@ -84,7 +84,7 @@ xdrmem_create(xdrs, addr, size, op)
        xdrs->x_op = op;
        xdrs->x_ops = &xdrmem_ops;
        xdrs->x_private = xdrs->x_base = addr;
-       xdrs->x_handy = size;
+       xdrs->x_handy = (size > INT_MAX) ? INT_MAX : size; /* XXX */
 }
 
 static void
@@ -98,12 +98,14 @@ xdrmem_getint32(xdrs, lp)
        register XDR *xdrs;
        afs_int32 *lp;
 {
-
-       if ((xdrs->x_handy -= sizeof(afs_int32)) < 0)
-               return (FALSE);
-       *lp = ntohl(*((afs_int32 *)(xdrs->x_private)));
-       xdrs->x_private += sizeof(afs_int32);
-       return (TRUE);
+    if (xdrs->x_handy -= sizeof(afs_int32))
+       return (FALSE);
+    else
+       xdrs->x_handy -= sizeof(afs_int32);
+
+    *lp = ntohl(*((afs_int32 *)(xdrs->x_private)));
+    xdrs->x_private += sizeof(afs_int32);
+    return (TRUE);
 }
 
 static bool_t
@@ -111,12 +113,14 @@ xdrmem_putint32(xdrs, lp)
        register XDR *xdrs;
        afs_int32 *lp;
 {
-
-       if ((xdrs->x_handy -= sizeof(afs_int32)) < 0)
-               return (FALSE);
-       *(afs_int32 *)xdrs->x_private = htonl(*lp);
-       xdrs->x_private += sizeof(afs_int32);
-       return (TRUE);
+    if (xdrs->x_handy -= sizeof(afs_int32))
+       eturn (FALSE);
+    else
+       xdrs->x_handy -= sizeof(afs_int32);
+    
+    *(afs_int32 *)xdrs->x_private = htonl(*lp);
+    xdrs->x_private += sizeof(afs_int32);
+    return (TRUE);
 }
 
 static bool_t
@@ -125,12 +129,14 @@ xdrmem_getbytes(xdrs, addr, len)
        caddr_t addr;
        register u_int len;
 {
-
-       if ((xdrs->x_handy -= len) < 0)
-               return (FALSE);
-       memcpy(addr, xdrs->x_private, len);
-       xdrs->x_private += len;
-       return (TRUE);
+    if (xdrs->x_handy < len)
+       return (FALSE);
+    else
+       xdrs->x_handy -= len;
+
+    memcpy(addr, xdrs->x_private, len);
+    xdrs->x_private += len;
+    return (TRUE);
 }
 
 static bool_t
@@ -139,12 +145,14 @@ xdrmem_putbytes(xdrs, addr, len)
        caddr_t addr;
        register u_int len;
 {
-
-       if ((xdrs->x_handy -= len) < 0)
-               return (FALSE);
-       memcpy(xdrs->x_private, addr, len);
-       xdrs->x_private += len;
-       return (TRUE);
+    if (xdrs->x_handy < len)
+       return (FALSE);
+    else
+       xdrs->x_handy -= len;
+
+    memcpy(xdrs->x_private, addr, len);
+    xdrs->x_private += len;
+    return (TRUE);
 }
 
 static u_int
@@ -177,7 +185,7 @@ xdrmem_inline(xdrs, len)
 {
        afs_int32 *buf = 0;
 
-       if (xdrs->x_handy >= len) {
+       if (len >= 0 && xdrs->x_handy >= len) {
                xdrs->x_handy -= len;
                buf = (afs_int32 *) xdrs->x_private;
                xdrs->x_private += len;
index c30c8360f9fc804ef0f26ef81dfd8f784f3ad290..c5b1481f92f6fccd3da31004e826b5671049f21c 100644 (file)
@@ -14,7 +14,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_server.c,v 1.1.1.10 2002/12/11 02:44:47 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/rxkad_server.c,v 1.1.1.11 2003/04/13 19:07:35 hartmans Exp $");
 
 #include <afs/stds.h>
 #include <sys/types.h>
@@ -314,7 +314,7 @@ rxs_return_t rxkad_CheckResponse (aobj, aconn, apacket)
                                  kvno,
                                  client.name, client.instance, client.cell,
                                  &sessionkey, &host, &start, &end);
-       if (code) return RXKADBADTICKET;
+       if (code) return code;
     }
 
     /*
index 7988b948d7f4e1c37cb50b285ead9f116717bbf3..3f6027bd353aa88fd739d32f1d0be6ae4493b7c8 100644 (file)
@@ -14,7 +14,7 @@
 #include <afs/param.h>
 #endif
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/ticket.c,v 1.1.1.7 2001/10/14 18:06:36 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/ticket.c,v 1.1.1.8 2003/04/13 19:07:35 hartmans Exp $");
 
 #if defined(UKERNEL)
 #include "../afs/sysincludes.h"
@@ -65,6 +65,22 @@ static int assemble_athena_ticket();
    interpreting the ticket and the values of the output parameters are
    undefined. */
 
+/* This union is used to insure we allocate enough space for a key
+ * schedule even if we are linked against a library that uses OpenSSL's
+ * larger representation.  This is necessary so we don't lose if an
+ * application uses both rxkad and openssl.
+ */
+union Key_schedule_safe {
+  Key_schedule schedule;
+  struct {
+    union {
+      char cblock[8];
+      long deslong[2];
+    } ks;
+    int weak_key;
+  } openssl_schedule[16];
+};
+
 int tkt_DecodeTicket (asecret, ticketLen, key,
                      name, inst, cell, sessionKey, host, start, end)
   char         *asecret;
@@ -79,7 +95,7 @@ int tkt_DecodeTicket (asecret, ticketLen, key,
   afs_int32            *end;
 {   char          clear_ticket[MAXKTCTICKETLEN];
     char         *ticket;
-    Key_schedule   schedule;
+    union Key_schedule_safe   schedule;
     /* unsigned char  flags; */
     int                   code;
 
@@ -88,10 +104,10 @@ int tkt_DecodeTicket (asecret, ticketLen, key,
        ((ticketLen) % 8 != 0))         /* enc. part must be (0 mod 8) bytes */
        return RXKADBADTICKET;
 
-    if (key_sched (key, schedule)) return RXKADBADKEY;
+    if (key_sched (key, schedule.schedule)) return RXKADBADKEY;
 
     ticket = clear_ticket;
-    pcbc_encrypt (asecret, ticket, ticketLen, schedule, key, DECRYPT);
+    pcbc_encrypt (asecret, ticket, ticketLen, schedule.schedule, key, DECRYPT);
 
     /* flags = *ticket; */             /* get the first byte: the flags */
 #if 0
@@ -141,7 +157,7 @@ int tkt_MakeTicket (ticket, ticketLen, key, name, inst, cell,
   char         *sname;                 /* server */
   char         *sinst;
 {   int                 code;
-    Key_schedule schedule;
+    union Key_schedule_safe schedule;
 
     *ticketLen = 0;                    /* in case we return early */
     code = assemble_athena_ticket (ticket, ticketLen, name, inst, cell,
@@ -150,11 +166,11 @@ int tkt_MakeTicket (ticket, ticketLen, key, name, inst, cell,
     if (code) return -1;
 
     /* encrypt ticket */
-    if (code = key_sched (key, schedule)) {
+    if (code = key_sched (key, schedule.schedule)) {
        printf ("In tkt_MakeTicket: key_sched returned %d\n", code);
        return RXKADBADKEY;
     }
-    pcbc_encrypt (ticket, ticket, *ticketLen, schedule, key, ENCRYPT);
+    pcbc_encrypt (ticket, ticket, *ticketLen, schedule.schedule, key, ENCRYPT);
     return 0;
 }
 
index 03d6711faabc27ff8ddcc57b05efe02aa16142ed..931477fe8540e131f702897229c194064172a521 100644 (file)
@@ -61,7 +61,7 @@
 #include <afs/param.h>
 #endif
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/ticket5.c,v 1.2 2002/12/18 04:00:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/rxkad/ticket5.c,v 1.1.1.2 2003/04/13 19:07:35 hartmans Exp $");
 
 #if defined(UKERNEL)
 #include "../afs/sysincludes.h"
@@ -172,6 +172,14 @@ static const struct krb_convert sconv_list[] = {
     R("mandarin-agent"),
     R("write"),
     R("palladium"),
+    R("imap"),
+    R("smtp"),
+    R("lmtp"),
+    R("ldap"),
+    R("acap"),
+    R("argus"),
+    R("mupdate"),
+    R("argus"),
     {0, 0, 0, 0},
 #undef R
 #undef RC
@@ -228,10 +236,13 @@ int tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
            goto cleanup;
     }
 
-    /* Find the real service key version number */
-    if (t5.enc_part.kvno == NULL)
-       goto bad_ticket;
-    v5_serv_kvno = *t5.enc_part.kvno;
+    /* If kvno is null, it's probably not included because it was kvno==0 
+       in the ticket */
+    if (t5.enc_part.kvno == NULL ) { 
+       v5_serv_kvno = 0;
+    } else { 
+       v5_serv_kvno = *t5.enc_part.kvno;
+    }
     
 
     code = (*get_key)(get_key_rock, v5_serv_kvno, &serv_key);
index f149d30794f277734f5c476e53c9ad2c621851f5..25448f23014c842316c578f8ed6da08011d7460b 100644 (file)
@@ -1,3 +1,4 @@
+#include <stddef.h>
 #include "asn1_err.h"
 #include <errno.h>
 /*
index 626a82458eee185fc924a4af0f2cbc641a8ab75f..8de760e9c83027d84855af3002a21adc0747510c 100644 (file)
@@ -276,7 +276,7 @@ xdr_afsuuid.o: ${RX}/xdr_afsuuid.c
 #
 #   $ what /opt/langtools/bin/pxdb32
 #   /opt/langtools/bin/pxdb32:
-#           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.1.1.2 $
+#           HP92453-02 A.10.0A HP-UX SYMBOLIC DEBUGGER (PXDB) $Revision: 1.1.1.3 $
 #
 # The problem occurs when -g and -O are both used when compiling des.c.
 # The simplest way to work around the problem is to leave out either -g or -O.
@@ -351,7 +351,7 @@ base64.o: ${UTIL}/base64.c
 
 syscall.o: ${SYS}/syscall.s
        case "$(SYS_NAME)" in \
-            sun4x_5* | sunx86_5*) \
+            sun*_5* ) \
                /usr/ccs/lib/cpp  ${SFLAGS} ${SYS}/syscall.s syscall.ss; \
                as -o syscall.o syscall.ss;             \
                $(RM) syscall.ss;;                              \
index 87efe93aa7b37660c5c3ac46aa743453cdb25b06..b152edf0c842cff37c643914c5959c9a7afe25ba 100644 (file)
@@ -14,6 +14,9 @@
        des_key_sched;
        des_random_key;
        des_string_to_key;
+       des_cbc_cksum;
+       des_ecb_encrypt;
+       des_pcbc_encrypt;
        ktohl;
        life_to_time;
        rx_DestroyConnection;
index eb3035824f3d1699aca98f34b06fb487d73be442..3b624ad50fd30179fe4d2026514c783e79ccb8e4 100644 (file)
@@ -50,7 +50,7 @@ LWPOBJS=lock.o fasttime.o threadname.o
 
 LIBACLOBJS=aclprocs.o netprocs.o
 
-UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o volparse.o flipbase64.o
+UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o volparse.o flipbase64.o softsig.o
 
 DIROBJS=buffer.o dir.o salvage.o
 
@@ -107,6 +107,9 @@ netutils.o: ${UTIL}/netutils.c
 dirpath.o: ${UTIL}/dirpath.c
        ${COMPILE}
 
+softsig.o: ${UTIL}/softsig.c
+       ${COMPILE}
+
 lock.o: ${LWP}/lock.c
        ${COMPILE}
 
index 740befa2fc11fbd3fa80cb1f38a2588267f4a99d..6aacd4d6bb961a14a239fade701841165a8d697c 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/beacon.c,v 1.1.1.10 2001/10/14 18:06:44 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/ubik/beacon.c,v 1.1.1.11 2003/04/13 19:07:58 hartmans Exp $");
 
 #include <sys/types.h>
 #ifdef AFS_NT40_ENV
@@ -455,7 +455,8 @@ static verifyInterfaceAddress(ame, info, aservers)
     afs_uint32 aservers[];     /* list of all possible server addresses */
 {
     afs_uint32 myAddr[UBIK_MAX_INTERFACE_ADDR], *servList, tmpAddr;
-    int        count, found, i, j, totalServers, start, end;
+    afs_uint32  myAddr2[UBIK_MAX_INTERFACE_ADDR];
+    int        count, found, i, j, totalServers, start, end, usednetfiles = 0;
 
     if (info)
         totalServers = info->numServers;
@@ -484,6 +485,7 @@ static verifyInterfaceAddress(ame, info, aservers)
        ubik_print("Aborting..\n");
        return UBADHOST;
       }
+      usednetfiles++;
     }
     else {
       /* get all my interface addresses in net byte order */
@@ -511,7 +513,32 @@ static verifyInterfaceAddress(ame, info, aservers)
     {
        ubik_print("ubik: primary address %s does not exist\n",
                        afs_inet_ntoa(*ame));
-       return UBADHOST;
+       /* if we had the result of rx_getAllAddr already, avoid subverting
+          the "is gethostbyname(gethostname()) us" check. If we're
+          using NetInfo/NetRestrict, we assume they have enough clue
+          to avoid that big hole in their foot from the loaded gun. */
+       if (usednetfiles) {
+           /* take the address we did get, then see if ame was masked */
+           *ame=myAddr[0];
+           count = rx_getAllAddr(myAddr2, UBIK_MAX_INTERFACE_ADDR); 
+           if ( count <= 0 )           /* no address found */
+           {
+               ubik_print("ubik: No network addresses found, aborting..");
+               return UBADHOST;
+           }
+           
+           /* verify that the My-address passed in by ubik is correct */
+           for ( j=0, found = 0; j < count; j++)
+           {
+               if ( *ame == myAddr2[j] ) /* both in net byte order */
+               {
+                   found = 1;
+                   break;
+               }
+           }
+       }
+       if ( !found )
+           return UBADHOST;
     }
 
     /* if any of my addresses are there in serverList, then
index ec0933d5f14e16df9d8c3f50c85f221c49d65fca..a8c2555a2eee07d19520104441a2e59afb673bcb 100644 (file)
@@ -12,4 +12,4 @@
 
 void AssertionFailed(char *file, int line);
 
-# define assert(ex) {if (!(ex)) AssertionFailed(__FILE__, __LINE__);}
+#define assert(ex) do{if (!(ex)) AssertionFailed(__FILE__, __LINE__);}while(0)
index 8f84fc2cb51bc0dd925a24999b1d2e6076ac8084..fe747725701c37568073d7b839a01e210bdacfc6 100644 (file)
 #else
 #define AFS_SET_SIGMASK pthread_sigmask
 #endif
+#ifdef SIGSEGV 
+#define _SETSEGV sigdelset(&i_tset, SIGSEGV); 
+#else
+#define _SETSEGV ;
+#endif 
+#ifdef SIGBUS 
+#define _SETBUS sigdelset(&i_tset, SIGBUS); 
+#else 
+#define _SETBUS ;
+#endif 
+#ifdef SIGILL 
+#define _SETILL sigdelset(&i_tset, SIGILL); 
+#else
+#define _SETILL ;
+#endif 
+#ifdef SIGTRAP 
+#define _SETTRAP sigdelset(&i_tset, SIGTRAP); 
+#else
+#define _SETTRAP ;
+#endif 
+#ifdef SIGABRT 
+#define _SETABRT sigdelset(&i_tset, SIGABRT); 
+#else
+#define _SETABRT ;
+#endif 
+#ifdef SIGFPE 
+#define _SETFPE sigdelset(&i_tset, SIGFPE); 
+#else
+#define _SETFPE ;
+#endif 
 #define AFS_SIGSET_CLEAR() \
 do { \
         sigfillset(&i_tset); \
+         _SETSEGV \
+         _SETBUS \
+         _SETILL \
+         _SETTRAP \
+         _SETABRT \
+         _SETFPE \
         assert(AFS_SET_SIGMASK(SIG_BLOCK, &i_tset, &i_oset) == 0); \
 } while (0)
 
index 7ce868abaa95d43b37ded0a929e1a3454892ca16..f512bcbd36b0c84a9c4ff8f3a68f915fb7544bf8 100644 (file)
@@ -9,12 +9,12 @@
 
 /* Security related utilities for the Windows platform */
 
-#include <param.h>
+#include <afs/param.h>
 #include <afsconfig.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/util/secutil_nt.c,v 1.1.1.3 2001/07/11 03:11:48 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/util/secutil_nt.c,v 1.1.1.4 2003/04/13 19:08:06 hartmans Exp $");
 
-#include <stds.h>
+#include <afs/stds.h>
 
 #include <stddef.h>
 #include <stdlib.h>
index ccca38df7989370a7bbe5028fc0294c9303492c5..8e07d8c4b9ff41c21420bcd5f931d3bc3813a770 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/venus/cmdebug.c,v 1.1.1.5 2001/09/11 14:35:22 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/venus/cmdebug.c,v 1.1.1.6 2003/04/13 19:08:08 hartmans Exp $");
 
 
 #include <sys/types.h>
@@ -89,12 +89,55 @@ register struct rx_connection *aconn; {
     return 0;
 }
 
-static PrintCacheEntries(aconn, aint32)
-int aint32;
-register struct rx_connection *aconn; {
+struct cell_cache {
+    afs_int32 cellnum;
+    char *cellname;
+    struct cell_cache *next;
+};
+
+static char *GetCellName(struct rx_connection *aconn, afs_int32 cellnum)
+{
+    static int no_getcellbynum;
+    static struct cell_cache *cache;
+    struct cell_cache *tcp;
+    int code;
+    char *cellname;
+    serverList sl;
+
+    if (no_getcellbynum)
+       return NULL;
+
+    for (tcp = cache; tcp; tcp = tcp->next)
+       if (tcp->cellnum == cellnum)
+           return tcp->cellname;
+
+    cellname = NULL;
+    sl.serverList_len = 0;
+    sl.serverList_val = NULL;
+    code = RXAFSCB_GetCellByNum(aconn, cellnum, &cellname, &sl);
+    if (code) {
+       if (code == RXGEN_OPCODE)
+           no_getcellbynum = 1;
+       return NULL;
+    }
+
+    if (sl.serverList_val)
+       free (sl.serverList_val);
+    tcp = malloc(sizeof(struct cell_cache));
+    tcp->next = cache;
+    tcp->cellnum = cellnum;
+    tcp->cellname = cellname;
+    cache = tcp;
+
+    return cellname;
+}
+
+static PrintCacheEntries(struct rx_connection *aconn, int aint32)
+{
     register int i;
     register afs_int32 code;
     struct AFSDBCacheEntry centry;
+    char *cellname;
 
     for(i=0;i<10000;i++) {
        code = RXAFSCB_GetCE(aconn, i, &centry);
@@ -115,8 +158,16 @@ register struct rx_connection *aconn; {
        if (!aint32 && !IsLocked(&centry.lock)) continue;
 
        /* otherwise print this entry */
-       printf("** Cache entry @ 0x%08x for %d.%d.%d.%d\n", centry.addr, centry.cell,
-              centry.netFid.Volume, centry.netFid.Vnode, centry.netFid.Unique);
+       printf("** Cache entry @ 0x%08x for %d.%d.%d.%d", centry.addr,
+              centry.cell, centry.netFid.Volume, centry.netFid.Vnode,
+              centry.netFid.Unique);
+
+       cellname = GetCellName(aconn, centry.cell);
+       if (cellname)
+           printf(" [%s]\n", cellname);
+       else
+           printf("\n");
+
        if (IsLocked(&centry.lock)) {
            printf("    locks: ");
            PrintLock(&centry.lock);
index 1a642eff542f1e67e1a4eb569c3bee6b779c2a30..ceb2486e8ad5aa1547e904b47a9675c8b3a0294f 100644 (file)
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/venus/test/owntest.c,v 1.1.1.4 2001/07/14 22:24:39 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/venus/test/owntest.c,v 1.1.1.5 2003/04/13 19:08:10 hartmans Exp $");
 
 #include <sys/types.h>
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#include <errno.h>
 
 extern int errno;
 
@@ -35,11 +36,15 @@ char **argv; {
     pn = argv[1];
     printf("Starting tests on %s.\n", pn);
     code = chmod(pn, 0444);
-    if (code<0)
-       return perror("chmod to RO");
+    if (code<0) {
+        perror("chmod to RO");
+       return 1;
+    }
     code = chmod(pn, 0666);
-    if (code<0)
-       return perror("chmod back to RW");
+    if (code<0) {
+        perror("chmod back to RW");
+        return 1;
+    }
     gettimeofday(&tv[0], (char *) 0);
     gettimeofday(&tv[1], (char *) 0);
     tv[0].tv_sec -= 10000;
@@ -47,11 +52,15 @@ char **argv; {
     tv[1].tv_sec -= 20000;
     tv[1].tv_usec = 0;
     code = utimes(pn, tv);
-    if (code<0)
-       return perror("utimes");
+    if (code<0) {
+        perror("utimes");
+        return 1;
+    }
     code = stat(pn, &tstat);
-    if (code<0)
-       return perror("stat");
+    if (code<0) {
+        perror("stat");
+       return 1;
+    }
     if (tstat.st_mtime != tv[1].tv_sec) {
        printf("modtime didn't stick\n");
        exit(1);
index 890ab890fafc540dce5e6f949188fb1dd3153a27..7087665d5c6eeb1c7850cf7a563985684d3fb6bd 100644 (file)
@@ -18,7 +18,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/setup.c,v 1.1.1.6 2001/10/14 18:07:11 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/vfsck/setup.c,v 1.1.1.7 2003/04/13 19:08:11 hartmans Exp $");
 
 #include <stdio.h>
 #define VICE
@@ -673,7 +673,11 @@ readsb(listerr)
                return (1);
        }
        altsblock.fs_link = sblock.fs_link;
+#ifdef STRUCT_FS_HAS_FS_ROLLED
+       altsblock.fs_rolled = sblock.fs_rolled;
+#else
        altsblock.fs_rlink = sblock.fs_rlink;
+#endif
        altsblock.fs_time = sblock.fs_time;
        altsblock.fs_cstotal = sblock.fs_cstotal;
        altsblock.fs_cgrotor = sblock.fs_cgrotor;
index 287d9f2d1c6321e3cf61c366f614ee67d64d34bd..b14a84256bf50f95eddcc47999d3b6d5eb293983 100644 (file)
@@ -107,7 +107,7 @@ cbd: cbd.o
 
 ${DEST}/root.server/usr/afs/bin/fileserver: fileserver
        @case ${SYS_NAME} in \
-       alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun4x*) \
+       alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun*) \
        echo "Don't install fileserver for ${SYS_NAME}" ;; \
        *) \
        echo ${INSTALL} -ns $? $@ ; \
@@ -125,7 +125,7 @@ clean:
 include ../config/Makefile.version
 ${DESTDIR}${afssrvlibexecdir}/fileserver: fileserver
        @case ${SYS_NAME} in \
-       alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun4x*) \
+       alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun*) \
        echo "Don't install fileserver for ${SYS_NAME}" ;; \
        *) \
        echo ${INSTALL} -ns $? $@ ; \
index 679166315fd7ca80efad5b44c348fd25c4684e7c..2bc8b5f4ae997ae588a92f9efb8e927c82ee7360 100644 (file)
@@ -82,7 +82,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/viced/callback.c,v 1.1.1.10 2002/12/11 02:46:08 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/viced/callback.c,v 1.1.1.11 2003/04/13 19:08:13 hartmans Exp $");
 
 #include <stdio.h> 
 #include <stdlib.h>      /* for malloc() */
@@ -819,7 +819,7 @@ static void MultiBreakCallBack_r(cba, ncbas, afidp, xhost)
                ViceLog(7, 
                  ("BCB: Failed on file %u.%d.%d, host %x.%d is down\n",
                   afidp->AFSCBFids_val->Volume, afidp->AFSCBFids_val->Vnode,
-                  afidp->AFSCBFids_val->Unique, hp->host, hp->port));
+                  afidp->AFSCBFids_val->Unique, hp->host, ntohs(hp->port)));
                }
 
                H_LOCK
@@ -872,7 +872,7 @@ BreakCallBack(xhost, fid, flag)
     int hostindex;
 
     ViceLog(7,("BCB: BreakCallBack(all but %x.%d, (%u,%d,%d))\n",
-              xhost->host, xhost->port, fid->Volume, fid->Vnode, 
+              xhost->host, ntohs(xhost->port), fid->Volume, fid->Vnode, 
               fid->Unique));
 
     H_LOCK
@@ -903,7 +903,7 @@ BreakCallBack(xhost, fid, flag)
          }
          else if (thishost->hostFlags & VENUSDOWN) {
            ViceLog(7,("BCB: %x.%d is down; delaying break call back\n",
-                      thishost->host, thishost->port));
+                      thishost->host, ntohs(thishost->port)));
            cb->status = CB_DELAYED;
          }
          else {
@@ -964,7 +964,7 @@ DeleteCallBack(host, fid)
     pcb = FindCBPtr(fe, host);
     if (!*pcb) {
        ViceLog(8,("DCB: No call back for host %x.%d, (%u, %d, %d)\n",
-           host->host, host->port, fid->Volume, fid->Vnode, fid->Unique));
+           host->host, ntohs(host->port), fid->Volume, fid->Vnode, fid->Unique));
        h_Unlock_r(host);
        H_UNLOCK
        return;
@@ -1094,7 +1094,7 @@ int BreakDelayedCallBacks_r(host)
            if (ShowProblems) {
                ViceLog(0,
           ("CB: Call back connect back failed (in break delayed) for %x.%d\n",
-                       host->host, host->port));
+                       host->host, ntohs(host->port)));
              }
            host->hostFlags |= VENUSDOWN;
        }
@@ -1139,13 +1139,13 @@ int BreakDelayedCallBacks_r(host)
            if (ShowProblems) {
                ViceLog(0,
             ("CB: XCallBackBulk failed, host=%x.%d; callback list follows:\n",
-                   host->host, host->port));
+                   host->host, ntohs(host->port)));
            }
            for (i = 0; i<nfids; i++) {
                if (ShowProblems) {
                    ViceLog(0,
                    ("CB: Host %x.%d, file %u.%u.%u (part of bulk callback)\n",
-                              host->host, host->port
+                              host->host, ntohs(host->port)
                               fids[i].Volume, fids[i].Vnode, fids[i].Unique));
                }
                /* used to do this:
@@ -1196,10 +1196,10 @@ static int MultiBreakVolumeCallBack_r (host, isheld, parms)
            return 0;      /* Release hold */
        }
        ViceLog(8,("BVCB: volume call back for host %x.%d failed\n",
-                host->host,host->port));
+                host->host,ntohs(host->port)));
        if (ShowProblems) {
            ViceLog(0, ("CB: volume callback for host %x.%d failed\n",
-                   host->host, host->port));
+                   host->host, ntohs(host->port)));
        }
        DeleteAllCallBacks_r(host); /* Delete all callback state rather than
                                     attempting to selectively remember to
@@ -1689,7 +1689,7 @@ main(argc, argv)
     }
     if (err || argc != 1) {
        fprintf(stderr,
-               "Usage: cbd [-host cbid] [-fid volume vnode] [-stats] callbackdumpfile\n");
+               "Usage: cbd [-host cbid] [-fid volume vnode] [-stats] [-all] callbackdumpfile\n");
        fprintf(stderr, "[cbid is shown for each host in the hosts.dump file]\n");
        exit(1);
     }
@@ -1812,7 +1812,9 @@ struct AFSCBFids* afidp;
 
        i = host->interface->numberOfInterfaces;
        addr = malloc(i * sizeof(afs_int32));
+       if (!addr) return 1;
        conns = malloc(i * sizeof(struct rx_connection *));
+       if (!conns) { free(addr); return 1; }
 
        /* initialize alternate rx connections */
        for ( i=0,j=0; i < host->interface->numberOfInterfaces; i++)
@@ -1897,7 +1899,9 @@ struct host*              host;
 
        i = host->interface->numberOfInterfaces;
        addr = malloc(i * sizeof(afs_int32));
+       if (!addr) return 1;
        conns = malloc(i * sizeof(struct rx_connection *));
+       if (!conns) { free(addr); return 1; }
 
        /* initialize alternate rx connections */
        for ( i=0,j=0; i < host->interface->numberOfInterfaces; i++)
index 7f0babb2586f00b7a16c76d7d3264446fd4271c9..cd64a68143d20ae731b8bb0058682dd98fbca390 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/viced/host.c,v 1.1.1.12 2002/12/11 02:46:09 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/viced/host.c,v 1.1.1.13 2003/04/13 19:08:13 hartmans Exp $");
 
 #include <stdio.h>
 #include <errno.h>
@@ -534,15 +534,15 @@ void h_flushhostcps(hostaddr, hport)
     register afs_uint32  hostaddr, hport;  /* net byte order */
 {
     register struct host *host;
-    int held;
+    int held = 0;
     
     H_LOCK
     host = h_Lookup_r(hostaddr, hport, &held);
     if (host) {
-      host->hcpsfailed = 1;
+       host->hcpsfailed = 1;
+       if (!held)
+           h_Release_r(host);
     }
-    if (!held)
-      h_Release_r(host);
     H_UNLOCK
 
 return;
@@ -600,7 +600,7 @@ struct host *h_Alloc_r(r_con)
        if (serverentry)
            consolePort = serverentry->s_port;
        else
-           consolePort = DEF_ROPCONS;  /* Use a default */
+           consolePort = htons(DEF_ROPCONS);   /* Use a default */
     }
     if (host->port == consolePort) host->Console = 1;
     /* Make a callback channel even for the console, on the off chance that it
@@ -622,6 +622,8 @@ struct host *h_Alloc_r(r_con)
     /*host->hcpsfailed = 0;    /* save cycles */
     /* h_gethostcps(host);      do this under host lock */
     host->FirstClient = 0;      
+    h_Hold_r(host);
+    h_Lock_r(host);
     h_InsertList_r(host);      /* update global host List */
 #if FS_STATS_DETAILED
     /*
@@ -966,8 +968,8 @@ struct host *h_GetHost_r(tcon)
     hport = rxr_PortOf(tcon);
 retry:
     code = 0;
-    identP = (struct Identity *)rx_GetSpecific(tcon, rxcon_ident_key);
     host = h_Lookup_r(haddr, hport, &held);
+    identP = (struct Identity *)rx_GetSpecific(tcon, rxcon_ident_key);
     if (host && !identP && !(host->Console&1)) {
        /* This is a new connection, and we already have a host
         * structure for this address. Verify that the identity
@@ -980,7 +982,7 @@ retry:
                h_Unlock_r(host);
                if ( !held) h_Release_r(host);
                ViceLog(125, ("Host %s:%d starting h_Lookup again\n",
-                            afs_inet_ntoa_r(host->host, hoststr), host->port));
+                            afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
                goto retry;
        }
        host->hostFlags &= ~ALTADDR;
@@ -998,7 +1000,7 @@ retry:
                if (host->interface) {
                    ViceLog(0,
                            ("Host %s:%d used to support WhoAreYou, deleting.\n",
-                           afs_inet_ntoa_r(host->host, hoststr), host->port));
+                           afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
                    host->hostFlags |= HOSTDELETED;
                    h_Unlock_r(host);
                    if (!held) h_Release_r(host);
@@ -1038,12 +1040,12 @@ retry:
        {
                /* another thread is doing the initialisation */
                ViceLog(125, ("Host %s:%d waiting for host-init to complete\n",
-                            afs_inet_ntoa_r(host->host, hoststr), host->port));
+                            afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
                h_Lock_r(host);
                h_Unlock_r(host);
                if ( !held) h_Release_r(host);
                ViceLog(125, ("Host %s:%d starting h_Lookup again\n",
-                            afs_inet_ntoa_r(host->host, hoststr), host->port));
+                            afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
                goto retry;
        }
        /* We need to check whether the identity in the host structure
@@ -1053,42 +1055,59 @@ retry:
          && ( ( !identP->valid && host->interface )
            || ( identP->valid && !host->interface )
            || ( identP->valid
-             && !afs_uuid_equal(&identP->uuid, &host->interface->uuid) ) ) ) {
-               /* The host in the cache is not the host for this connection */
-               host->hostFlags |= HOSTDELETED;
-               h_Unlock_r(host);
-               if (!held) h_Release_r(host);
-               ViceLog(0, ("CB: new identity for host %s:%d, deleting\n",
-                          afs_inet_ntoa_r(host->host, hoststr), host->port));
-               goto retry;
+             && !afs_uuid_equal(&identP->uuid, &host->interface->uuid) ) ) ) 
+       {
+           char uuid1[128], uuid2[128];
+           if (identP->valid)
+               afsUUID_to_string(identP->uuid, uuid1, 127);
+           if (host->interface)
+               afsUUID_to_string(host->interface->uuid, uuid2, 127);
+           ViceLog(0, 
+                   ("CB: new identity for host %s:%d, deleting(%x %x %s %s)\n", 
+                    afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port), 
+                    identP->valid, host->interface, identP->valid ? uuid1 : 
+                    "", host->interface ? uuid2 : ""));
+
+           /* The host in the cache is not the host for this connection */
+           host->hostFlags |= HOSTDELETED;
+           h_Unlock_r(host);
+           if (!held) h_Release_r(host);
+           goto retry;
        }
     } else {
         host = h_Alloc_r(tcon);
-        h_Hold_r(host);
-        h_Lock_r(host);
        h_gethostcps_r(host,FT_ApproxTime());
         if (!(host->Console&1)) {
-           if (!identP || !interfValid) {
-               H_UNLOCK
-               code = RXAFSCB_WhoAreYou(host->callback_rxcon, &interf);
-               H_LOCK
-               if ( code == RXGEN_OPCODE ) {
-                 identP = (struct Identity *)malloc(sizeof(struct Identity));
-                   identP->valid = 0;
+           int pident = 0;
+           H_UNLOCK
+           code = RXAFSCB_WhoAreYou(host->callback_rxcon, &interf);
+           H_LOCK
+           if ( code == RXGEN_OPCODE ) {
+               if (!identP)
+                   identP = (struct Identity *)malloc(sizeof(struct Identity));
+               else
+                   pident = 1;
+               identP->valid = 0;
+               if (!pident)
                    rx_SetSpecific(tcon, rxcon_ident_key, identP);
-                   ViceLog(25,
-                           ("Host %s:%d does not support WhoAreYou.\n",
-                           afs_inet_ntoa_r(host->host, hoststr), host->port));
-                   code = 0;
-               } else if (code == 0) {
-                   interfValid = 1;
+               ViceLog(25,
+                       ("Host %s:%d does not support WhoAreYou.\n",
+                        afs_inet_ntoa_r(host->host, hoststr), 
+                        ntohs(host->port)));
+               code = 0;
+           } else if (code == 0) {
+               if (!identP)
                    identP = (struct Identity *)malloc(sizeof(struct Identity));
-                   identP->valid = 1;
-                   identP->uuid = interf.uuid;
+               else
+                   pident = 1;
+               identP->valid = 1;
+               interfValid = 1;
+               identP->uuid = interf.uuid;
+               if (!pident)
                    rx_SetSpecific(tcon, rxcon_ident_key, identP);
-                   ViceLog(25, ("WhoAreYou success on %s:%d\n",
-                               afs_inet_ntoa_r(host->host, hoststr), host->port));
-               }
+               ViceLog(25, ("WhoAreYou success on %s:%d\n",
+                            afs_inet_ntoa_r(host->host, hoststr), 
+                            ntohs(host->port)));
            }
            if (code == 0 && !identP->valid) {
                H_UNLOCK
@@ -1104,8 +1123,8 @@ retry:
                        h_Hold_r(oldHost);
                    h_Lock_r(oldHost);
                    ViceLog(25, ("CB: new addr %s:%d for old host %s:%d\n",
-                               afs_inet_ntoa_r(host->host, hoststr), host->port,
-                               afs_inet_ntoa_r(oldHost->host, hoststr2), oldHost->port));
+                               afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
+                               afs_inet_ntoa_r(oldHost->host, hoststr2), ntohs(oldHost->port)));
                    host->hostFlags |= HOSTDELETED;
                    h_Unlock_r(host);
                    h_Release_r(host);
@@ -1120,7 +1139,7 @@ retry:
                    H_LOCK
                    if (code == 0) {
                        ViceLog(25, ("InitCallBackState3 success on %s:%d\n",
-                                   afs_inet_ntoa_r(host->host, hoststr), host->port));
+                                   afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
                        assert(interfValid == 1);
                        initInterfaceAddr_r(host, &interf);
                    }
@@ -1413,7 +1432,7 @@ ticket name length != 64
            ViceLog(0, ("pr_GetCPS failed(%d) for user %d, host %s:%d\n",
                       code, viceid,
                       afs_inet_ntoa_r(client->host->host, hoststr),
-                      client->host->port));
+                      ntohs(client->host->port)));
 
            /* Although ubik_Call (called by pr_GetCPS) traverses thru
             * all protection servers and reevaluates things if no
@@ -1482,15 +1501,35 @@ int GetClient(tcon, cp)
     H_LOCK
 
     *cp = client = (struct client *) rx_GetSpecific(tcon, rxcon_client_key);
-    /* XXXX debug */
-    assert(client && client->tcon && rxr_CidOf(client->tcon) == client->sid);
+    if (client == NULL || client->tcon == NULL) {
+       ViceLog(0, ("GetClient: no client in conn %x (host %x), VBUSYING\n", 
+                   tcon, rx_HostOf(rx_PeerOf(tcon))));
+       H_UNLOCK
+       return VBUSY;
+    }
+    if (rxr_CidOf(client->tcon) != client->sid) {
+       ViceLog(0, ("GetClient: tcon %x tcon sid %d client sid %d\n",
+                   client->tcon, rxr_CidOf(client->tcon),
+                   client->sid));
+       H_UNLOCK
+       return VBUSY;
+    }
+    if (!(client && client->tcon && rxr_CidOf(client->tcon) == client->sid)) {
+       if (!client)
+           ViceLog(0, ("GetClient: no client in conn %x\n", tcon));
+       else
+           ViceLog(0, ("GetClient: tcon %x tcon sid %d client sid %d\n", 
+                       client->tcon, client->tcon ? rxr_CidOf(client->tcon)
+                       : -1, client->sid));
+       assert(0);
+    }
     if (client &&
        client->LastCall > client->expTime && client->expTime) {
        char hoststr[16];
        ViceLog(1, ("Token for %s at %s:%d expired %d\n",
                h_UserName(client),
                afs_inet_ntoa_r(client->host->host, hoststr),
-               client->host->port, client->expTime));
+               ntohs(client->host->port), client->expTime));
        H_UNLOCK
        return VICETOKENDEAD;
     }
@@ -1555,7 +1594,7 @@ static int h_PrintClient(host, held, file)
        return held;
     }
     sprintf(tmpStr,"Host %s:%d down = %d, LastCall %s",
-           afs_inet_ntoa_r(host->host, hoststr), host->port,
+           afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
            (host->hostFlags & VENUSDOWN),
            afs_ctime((time_t *)&host->LastCall, tbuffer, sizeof(tbuffer)));
     STREAM_WRITE(tmpStr, strlen(tmpStr), 1, file);
@@ -1634,7 +1673,7 @@ static int h_DumpHost(host, held, file)
 
     H_LOCK
     sprintf(tmpStr, "ip:%x port:%d hidx:%d cbid:%d lock:%x last:%u active:%u down:%d del:%d cons:%d cldel:%d\n\t hpfailed:%d hcpsCall:%u hcps [",
-           host->host, host->port, host->index, host->cblist,
+           host->host, ntohs(host->port), host->index, host->cblist,
            CheckLock(&host->lock), host->LastCall, host->ActiveCall, 
            (host->hostFlags & VENUSDOWN), host->hostFlags&HOSTDELETED, 
            host->Console, host->hostFlags & CLIENTDELETED, 
@@ -2057,7 +2096,7 @@ struct interfaceAddr *interf;
 {
        int i, j;
        int number, count;
-       afs_int32               myPort, myHost;
+       afs_int32               myHost;
        int found;
        struct Interface *interface;
 
@@ -2068,7 +2107,6 @@ struct interfaceAddr *interf;
                host->host, interf->numberOfInterfaces));
 
        number = interf->numberOfInterfaces;
-       myPort = host->port;
        myHost = host->host; /* current interface address */
 
        /* validation checks */
index 6fe2ad434f9098e28cd7018d1d86aed198be3690..f34308035a71c3828b624b0887b41fdca54449c6 100644 (file)
@@ -19,7 +19,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/viced/viced.c,v 1.1.1.9 2002/09/26 19:09:16 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/viced/viced.c,v 1.1.1.10 2003/04/13 19:08:14 hartmans Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -76,6 +76,11 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/viced/viced.c,v 1.1.1.9 2002/09/26 19:0
 #endif
 #include "viced.h"
 #include "host.h"
+#ifndef AFS_NT40_ENV
+#ifdef AFS_PTHREAD_ENV
+#include "softsig.h"
+#endif
+#endif
 #if defined(AFS_SGI_ENV)
 #include "sys/schedctl.h"
 #include "sys/lock.h"
@@ -128,6 +133,7 @@ struct afs_PerfStats afs_perfstats;
 extern int     LogLevel;
 extern int     Statistics;
 
+int     busyonrst = 1;
 int     timeout = 30;
 int    SawSpare;
 int    SawPctSpare;
@@ -219,22 +225,32 @@ int fs_rxstat_userok(call)
 
 static void ResetCheckSignal(void)
 {
-#ifdef AFS_HPUX_ENV
-    signal(SIGPOLL, CheckSignal_Signal);
-#else
-#ifdef AFS_NT40_ENV
-    signal(SIGUSR2, CheckSignal_Signal);
+    int signo;
+
+#if defined(AFS_HPUX_ENV)
+    signo = SIGPOLL;
+#elif defined(AFS_NT40_ENV)
+    signo = SIGUSR2;
 #else
-    signal(SIGXCPU, CheckSignal_Signal);
+    signo = SIGXCPU;
 #endif
+
+#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
+    softsig_signal(signo, CheckSignal_Signal);
+#else
+    signal(signo, CheckSignal_Signal);
 #endif
 }
 
 static void ResetCheckDescriptors(void)
 {
 #ifndef AFS_NT40_ENV
+#if defined(AFS_PTHREAD_ENV)
+    softsig_signal(SIGTERM, CheckDescriptors_Signal);
+#else
     signal(SIGTERM, CheckDescriptors_Signal);
 #endif
+#endif
 }
 
 
@@ -299,7 +315,6 @@ main(argc, argv)
 #ifdef AFS_PTHREAD_ENV
     pthread_t parentPid, serverPid;
     pthread_attr_t tattr;
-    AFS_SIGSET_DECL;
 #else /* AFS_PTHREAD_ENV */
     PROCESS parentPid, serverPid;
 #endif /* AFS_PTHREAD_ENV */
@@ -372,6 +387,11 @@ main(argc, argv)
     ViceLog(0, ("File server starting\n"));
 #endif
 
+#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
+    /* initialize the pthread soft signal handler thread */
+    softsig_init();
+#endif
+
     /* install signal handlers for controlling the fileserver process */
     ResetCheckSignal();  /* set CheckSignal_Signal() sig handler */
     ResetCheckDescriptors();  /* set CheckDescriptors_Signal() sig handler */
@@ -571,11 +591,9 @@ main(argc, argv)
 #ifdef AFS_PTHREAD_ENV
     assert(pthread_attr_init(&tattr) == 0);
     assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0);
-    /* Block signals in the threads */
-    AFS_SIGSET_CLEAR();
+
     assert(pthread_create(&serverPid, &tattr, (void *)FiveMinuteCheckLWP, &fiveminutes) == 0);
     assert(pthread_create(&serverPid, &tattr, (void *)HostCheckLWP, &fiveminutes) == 0);
-    AFS_SIGSET_RESTORE();
 #else /* AFS_PTHREAD_ENV */
     assert(LWP_CreateProcess(FiveMinuteCheckLWP, stack*1024, LWP_MAX_PRIORITY - 2,
            &fiveminutes, "FiveMinuteChecks", &serverPid) == LWP_SUCCESS);
@@ -617,8 +635,14 @@ main(argc, argv)
                   FS_HostName, hoststr, FS_HostAddr_NBO, FS_HostAddr_HBO));
     }
 
-    /* Install handler to catch the shutdown signal */
-    signal(SIGQUIT, ShutDown_Signal); /* bosserver assumes SIGQUIT shutdown */
+    /* Install handler to catch the shutdown signal;
+     * bosserver assumes SIGQUIT shutdown
+     */
+#if defined(AFS_PTHREAD_ENV) && !defined(AFS_NT40_ENV)
+    softsig_signal(SIGQUIT, ShutDown_Signal);
+#else
+    signal(SIGQUIT, ShutDown_Signal);
+#endif
 
     ViceLog(0,("File Server started %s",
               afs_ctime(&tp.tv_sec, tbuffer, sizeof(tbuffer))));
@@ -635,6 +659,18 @@ main(argc, argv)
 }
 
 
+static void setThreadId(char *s)
+{
+#ifdef AFS_PTHREAD_ENV
+    /* set our 'thread-id' so that the host hold table works */
+    MUTEX_ENTER(&rx_stats_mutex);   /* protects rxi_pthread_hinum */ 
+    ++rxi_pthread_hinum;
+    pthread_setspecific(rx_thread_id_key, (void *)rxi_pthread_hinum);
+    MUTEX_EXIT(&rx_stats_mutex);
+    ViceLog(0,("Set thread id %d for '%s'\n", pthread_getspecific(rx_thread_id_key), s));
+#endif
+}
+
 /* This LWP does things roughly every 5 minutes */
 static FiveMinuteCheckLWP()
 
@@ -643,6 +679,7 @@ static FiveMinuteCheckLWP()
     char tbuffer[32];
 
     ViceLog(1, ("Starting five minute check process\n"));
+    setThreadId("FiveMinuteCheckLWP");
     while (1) {
 #ifdef AFS_PTHREAD_ENV
        sleep(fiveminutes);
@@ -681,6 +718,7 @@ static HostCheckLWP()
 
 {
     ViceLog(1, ("Starting Host check process\n"));
+    setThreadId("HostCheckLWP");
     while(1) {
 #ifdef AFS_PTHREAD_ENV
        sleep(fiveminutes);
@@ -923,6 +961,7 @@ static FlagMsg()
     strcat(buffer, "[-implicit <admin mode bits: rlidwka>] ");
     strcat(buffer, "[-hr <number of hours between refreshing the host cps>] ");
     strcat(buffer, "[-busyat <redirect clients when queue > n>] ");
+    strcat(buffer, "[-nobusy <no VBUSY before a volume is attached>] ");
     strcat(buffer, "[-rxpck <number of rx extra packets>] ");
     strcat(buffer, "[-rxdbg (enable rx debugging)] ");
     strcat(buffer, "[-rxdbge (enable rxevent debugging)] ");
@@ -1152,7 +1191,10 @@ static ParseArgs(argc, argv)
                           busy_threshold);
                    Sawbusy = 0;
                }
-           }
+             }
+           else
+             if (!strcmp(argv[i], "-nobusy")) 
+               busyonrst=0;
 #ifdef AFS_AIX32_ENV
        else
            if (!strcmp(argv[i], "-m")) {
index 4109c81477e698db326ab1fb11b67466959c62b2..8a5b51af058aa1366d43bf00e911eaaa4770b76f 100644 (file)
@@ -189,6 +189,8 @@ struct AFSStatistics
        struct AFSDisk  Disks[AFS_MSTATDISKS];
 };
 
+extern int busyonrst;
+
 #define RESTART_ORDINARY 1
 #define RESTART_FAST 2
 #define RESTART_SAFE 3
index 68155fd722109b34e8a185ca5593df632fab1892..17bc7551bb05b4303d7be91518f2984db4a05eee 100644 (file)
@@ -18,7 +18,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/vol/clone.c,v 1.1.1.7 2001/10/14 18:07:21 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/vol/clone.c,v 1.1.1.8 2003/04/13 19:08:16 hartmans Exp $");
 
 #include <sys/types.h>
 #include <stdio.h>
@@ -230,8 +230,13 @@ afs_int32 DoCloneIndex(rwvp, clvp, class, reclone)
         if (clinode && (clinode == rwinode)) {
            clinode = 0; /* already cloned - don't delete later */
         } else if (rwinode) {
-           assert(IH_INC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) != -1);
-           inodeinced = 1;
+            if (IH_INC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) {
+                Log("IH_INC failed: %x, %s, %d errno %d\n", 
+                    V_linkHandle(rwvp), PrintInode(NULL, rwinode), 
+                    V_parentId(rwvp), errno);
+                assert(0);
+            }
+            inodeinced = 1;
         }
 
         /* If a directory, mark vnode in old volume as cloned */
@@ -273,7 +278,12 @@ afs_int32 DoCloneIndex(rwvp, clvp, class, reclone)
        clonefailed:
         /* Couldn't clone, go back and decrement the inode's link count */
         if (inodeinced) {
-           assert(IH_DEC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) != -1);
+            if (IH_DEC(V_linkHandle(rwvp), rwinode, V_parentId(rwvp)) == -1) {
+                Log("IH_DEC failed: %x, %s, %d errno %d\n", 
+                    V_linkHandle(rwvp), PrintInode(NULL, rwinode), 
+                    V_parentId(rwvp), errno);
+                assert(0);
+            }
         }
         /* And if the directory was marked clone, unmark it */
         if (dircloned) {
index 6d8b422cabf19370afe54f4715b13d5205c5697c..76d8b1e4b94655ac5621f2435d085f5a42067404 100644 (file)
@@ -38,7 +38,7 @@ static int newVLDB = 1;
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/vol/fssync.c,v 1.1.1.8 2002/12/11 02:46:15 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/vol/fssync.c,v 1.1.1.9 2003/04/13 19:08:17 hartmans Exp $");
 
 #include <sys/types.h>
 #include <stdio.h>
@@ -252,10 +252,23 @@ static void FSYNC_sync() {
     extern VInit;
     int code;
     int numTries;
+#ifdef AFS_PTHREAD_ENV
+    int tid;
+#endif
 
 #ifndef AFS_NT40_ENV
     signal(SIGPIPE, SIG_IGN);
 #endif
+
+#ifdef AFS_PTHREAD_ENV
+    /* set our 'thread-id' so that the host hold table works */ 
+    MUTEX_ENTER(&rx_stats_mutex);   /* protects rxi_pthread_hinum */
+    tid=++rxi_pthread_hinum;
+    MUTEX_EXIT(&rx_stats_mutex);
+    pthread_setspecific(rx_thread_id_key, (void *)tid);
+    Log("Set thread id %d for FSYNC_sync\n", tid);
+#endif /* AFS_PTHREAD_ENV */
+
     while (!VInit) {
       /* Let somebody else run until level > 0.  That doesn't mean that 
        * all volumes have been attached. */
index 15454c993f9a3e7e8e526edf78007e92f009bd63..3a417d3a720f418658197ddc2e95cc179583ba21 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/vol/nuke.c,v 1.1.1.5 2001/09/11 14:35:44 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/vol/nuke.c,v 1.1.1.6 2003/04/13 19:08:18 hartmans Exp $");
 
 #include <rx/xdr.h>
 #include <afs/afsint.h>
@@ -204,11 +204,11 @@ afs_int32 avolid; {
         * volume's ID in its inode, and has to be removed explicitly.
         */
        /* reuse devName buffer now */
-#ifdef AFS_NAMEI_ENV
+#ifdef AFS_NT40_ENV
        sprintf(devName, "%c:\\%s", *lastDevComp , VolumeExternalName(avolid));
 #else
        sprintf(devName, "%s/%s", aname, VolumeExternalName(avolid));
-#endif /* AFS_NAMEI_ENV */
+#endif /* AFS_NT40_ENV */
        code = unlink(devName);
        if (code) code = errno;
     }
index bc1913bbaaf192e072df2e328d02703372731ea3..79af3f990085c82b37ecc8284c0d5c1a95587c70 100644 (file)
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vnode.c,v 1.1.1.7 2001/10/14 18:07:24 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vnode.c,v 1.1.1.8 2003/04/13 19:08:18 hartmans Exp $");
 
 #include <errno.h>
 #include <stdio.h>
@@ -55,7 +55,7 @@ RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vnode.c,v 1.1.1.7 2001/10/14 18:07:
 #include <unistd.h>
 #endif /* AFS_NT40_ENV */
 #include <sys/stat.h>
-
+#include <stdarg.h>
 
 struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES];
 
@@ -634,7 +634,7 @@ Vnode *VGetVnode_r(ec,vp,vnodeNumber,locktype)
     /* Check that the vnode hasn't been removed while we were obtaining
        the lock */
     VNLog(102, 2, vnodeNumber, (afs_int32) vnp);
-    if (vnp->disk.type == vNull) {
+    if ((vnp->disk.type == vNull) || (vnp->cacheCheck == 0)){
        if (vnp->nUsers-- == 1)
            StickOnLruChain_r(vnp,vcp);
        if (locktype == READ_LOCK)
index a8e24f1c2854accf6cdeb6b658c0f82663a6d52c..d679720a4d39651761566e40542ebbbddbb6ee5a 100644 (file)
@@ -91,7 +91,7 @@ Vnodes with 0 inode pointers in RW volumes are now deleted.
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vol-salvage.c,v 1.1.1.11 2002/09/26 19:09:26 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/vol/vol-salvage.c,v 1.1.1.12 2003/04/13 19:08:19 hartmans Exp $");
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -1114,7 +1114,7 @@ char *wpath, *pbuffer;
 void SalvageFileSys1(struct DiskPartition *partP, VolumeId singleVolumeNumber)
 {
     char *name, *tdir;
-    char inodeListPath[50];
+    char inodeListPath[256];
     static char tmpDevName[100];
     static char wpath[100];
     struct VolumeSummary *vsp, *esp;
@@ -1180,9 +1180,9 @@ void SalvageFileSys1(struct DiskPartition *partP, VolumeId singleVolumeNumber)
     tdir = (tmpdir ? tmpdir : fileSysPath);
 #ifdef AFS_NT40_ENV
     (void) _putenv("TMP="); /* If "TMP" is set, then that overrides tdir. */
-    (void) strcpy(inodeListPath, _tempnam(tdir, "salvage.inodes."));
+    (void) strncpy(inodeListPath, _tempnam(tdir, "salvage.inodes."), 255);
 #else
-    sprintf(inodeListPath, "%s/salvage.inodes.%s.%d", tdir, name, getpid());
+    snprintf(inodeListPath, 255, "%s/salvage.inodes.%s.%d", tdir, name, getpid());
 #endif
     if (GetInodeSummary(inodeListPath, singleVolumeNumber) < 0) {
        unlink(inodeListPath);
@@ -1797,8 +1797,8 @@ void DoSalvageVolumeGroup(register struct InodeSummary *isp, int nVols)
     allInodes = inodes - isp->index; /* this would the base of all the inodes
                                        for the partition, if all the inodes
                                        had been read into memory */
-    assert(lseek(inodeFd,isp->index*sizeof(struct ViceInodeInfo),SEEK_SET) != -1)
-    assert(read(inodeFd,inodes,size) == size)
+    assert(lseek(inodeFd,isp->index*sizeof(struct ViceInodeInfo),SEEK_SET) != -1);
+    assert(read(inodeFd,inodes,size) == size);
 
     /* Don't try to salvage a read write volume if there isn't one on this
        partition */
@@ -2074,7 +2074,7 @@ int SalvageVolumeHeaderFile(register struct InodeSummary *isp,
            isp->volumeId, (Testing?"it would have been ":""),
                           fileSysPathName, name);
        headerFd = open(name, O_RDWR|O_CREAT|O_TRUNC, 0644);
-       assert(headerFd != -1)
+       assert(headerFd != -1);
        isp->volSummary = (struct VolumeSummary *)
            malloc(sizeof(struct VolumeSummary));
        isp->volSummary->fileName = ToString(name);
@@ -2100,7 +2100,7 @@ int SalvageVolumeHeaderFile(register struct InodeSummary *isp,
                return -1;
 
            headerFd = open(name, O_RDWR|O_TRUNC, 0644);
-           assert(headerFd != -1)
+           assert(headerFd != -1);
          }
     }
     if (headerFd) {
@@ -2307,14 +2307,14 @@ int SalvageIndex(Inode ino, VnodeClass class, int RW,
     fdP = IH_OPEN(handle);
     assert(fdP != NULL);
     file = FDH_FDOPEN(fdP, "r+");
-    assert(file != NULL)
+    assert(file != NULL);
     vcp = &VnodeClassInfo[class];
     size = OS_SIZE(fdP->fd_fd);
     assert(size != -1);
     nVnodes = (size / vcp->diskSize) - 1;
     if (nVnodes > 0) {
-       assert((nVnodes+1) * vcp->diskSize == size)
-       assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0)
+       assert((nVnodes+1) * vcp->diskSize == size);
+       assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0);
     }
     else {
        nVnodes = 0;
@@ -2699,12 +2699,13 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
        }
        if (!Testing) {
            CopyOnWrite(dir);
-           assert(Delete(&dir->dirHandle, name) == 0)
+           assert(Delete(&dir->dirHandle, name) == 0);
         }
        return;
     }
  
 #ifdef AFS_AIX_ENV
+#ifndef AFS_NAMEI_ENV
     /* On AIX machines, don't allow entries to point to inode 0. That is a special 
      * mount inode for the partition. If this inode were deleted, it would crash
      * the machine.
@@ -2720,6 +2721,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
        }
        return;
     }
+#endif
 #endif
 
     if (!(vnodeNumber & 1) && !Showmode &&
@@ -2765,9 +2767,9 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
            fid.Vnode = vnodeNumber;
            fid.Unique = vnodeEssence->unique;
            CopyOnWrite(dir);
-           assert(Delete(&dir->dirHandle, name) == 0)
+           assert(Delete(&dir->dirHandle, name) == 0);
            if (!todelete)
-              assert(Create(&dir->dirHandle, name, &fid) == 0)
+              assert(Create(&dir->dirHandle, name, &fid) == 0);
        }
        if (todelete) return; /* no need to continue */
     }
@@ -2779,10 +2781,10 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
                dir->vnodeNumber, dir->unique, vnodeNumber, unique);
            if (!Testing) {
                CopyOnWrite(dir);
-               assert(Delete(&dir->dirHandle, ".") == 0)
+               assert(Delete(&dir->dirHandle, ".") == 0);
                fid.Vnode = dir->vnodeNumber;
                fid.Unique = dir->unique;
-               assert(Create(&dir->dirHandle, ".", &fid) == 0)
+               assert(Create(&dir->dirHandle, ".", &fid) == 0);
            }
 
            vnodeNumber = fid.Vnode;         /* Get the new Essence */
@@ -2825,7 +2827,7 @@ void JudgeEntry(struct DirSummary *dir, char *name, VnodeId vnodeNumber,
        }
         if (!Testing) {
            CopyOnWrite(dir);
-           assert(Delete(&dir->dirHandle, name) == 0)
+           assert(Delete(&dir->dirHandle, name) == 0);
        }
        vnodeEssence->claimed  = 0;   /* Not claimed: Orphaned */
        vnodeEssence->todelete = 1;   /* Will later delete vnode and decr inode */
@@ -2931,20 +2933,20 @@ void DistilVnodeEssence(VolumeId rwVId, VnodeClass class, Inode ino,
 
     IH_INIT(vip->handle, fileSysDevice, rwVId, ino);
     fdP = IH_OPEN(vip->handle);
-    assert(fdP != NULL)
+    assert(fdP != NULL);
     file = FDH_FDOPEN(fdP, "r+");
     assert(file != NULL);
     size = OS_SIZE(fdP->fd_fd);
     assert(size != -1);
     vip->nVnodes = (size / vcp->diskSize) - 1;
     if (vip->nVnodes > 0) {
-       assert((vip->nVnodes+1)*vcp->diskSize == size)
-       assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0)
+       assert((vip->nVnodes+1)*vcp->diskSize == size);
+       assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0);
        assert((vip->vnodes = (struct VnodeEssence *)
-         calloc(vip->nVnodes, sizeof(struct VnodeEssence))) != NULL)
+         calloc(vip->nVnodes, sizeof(struct VnodeEssence))) != NULL);
        if (class == vLarge) {
            assert((vip->inodes = (Inode *)
-             calloc(vip->nVnodes, sizeof (Inode))) != NULL)
+             calloc(vip->nVnodes, sizeof (Inode))) != NULL);
        }
        else {
            vip->inodes = NULL;
@@ -2976,7 +2978,7 @@ void DistilVnodeEssence(VolumeId rwVId, VnodeClass class, Inode ino,
            vep->owner = vnode->owner;
            vep->group = vnode->group;
            if (vnode->type == vDirectory) {
-               assert(class == vLarge)
+               assert(class == vLarge);
                vip->inodes[vnodeIndex] = VNDISK_GET_INO(vnode); 
            }
        }
@@ -3380,7 +3382,7 @@ void ClearROInUseBit(struct VolumeSummary *summary)
     
     nBytes = IH_IREAD(h, 0, (char*)&volHeader, sizeof(volHeader));
     assert(nBytes == sizeof(volHeader));
-    assert(volHeader.stamp.magic == VOLUMEINFOMAGIC)
+    assert(volHeader.stamp.magic == VOLUMEINFOMAGIC);
     volHeader.inUse = 0;
     volHeader.needsSalvaged = 0;
     volHeader.inService = 1;
@@ -3514,7 +3516,7 @@ int Fork(void) {
     assert(0); /* Fork is never executed in the NT code path */
 #else
     f = fork();
-    assert(f >= 0)
+    assert(f >= 0);
 #endif
     return f;
 }
@@ -3538,7 +3540,7 @@ int Wait(char *prog)
     int status;
     int pid;
     pid = wait(&status);
-    assert(pid != -1)
+    assert(pid != -1);
     if (WCOREDUMP(status))
        Log("\"%s\" core dumped!\n", prog);
     if (WIFSIGNALED(status) != 0 || WEXITSTATUS(status) != 0)
@@ -3655,7 +3657,7 @@ char * ToString(char *s)
 {
     register char *p;
     p = (char *) malloc(strlen(s)+1);
-    assert(p != NULL)
+    assert(p != NULL);
     strcpy(p,s);
     return p;
 
index bde41248e13b76b7d8e112263a4470534121eaa8..d4520dd69675bbf0dee71e4912c028d015308ab8 100644 (file)
@@ -19,7 +19,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/vol/volume.c,v 1.1.1.13 2002/12/11 02:46:19 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/vol/volume.c,v 1.1.1.14 2003/04/13 19:08:20 hartmans Exp $");
 
 #include <rx/xdr.h>
 #include <afs/afsint.h>
@@ -699,6 +699,9 @@ private Volume *attach2(ec, path, header, partp, isbusy)
     IH_INIT(vp->linkHandle, partp->device, header->parent,
                   header->linkTable);
     vp->cacheCheck = ++VolumeCacheCheck;
+    /* just in case this ever rolls over */
+    if (!vp->cacheCheck) 
+       vp->cacheCheck = ++VolumeCacheCheck;
     vp->shuttingDown = 0;
     vp->goingOffline = 0;
     vp->nUsers = 1;
index 3cbab60262bd026b1db9cf60dced31f14d6ac0cd..e691852c3f7496bde81c66a520fbe8fa77ecc897 100644 (file)
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/volser/dumpstuff.c,v 1.1.1.8 2001/10/14 18:07:28 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/volser/dumpstuff.c,v 1.1.1.9 2003/04/13 19:08:21 hartmans Exp $");
 
 #include <sys/types.h>
 #include <ctype.h>
@@ -75,7 +75,7 @@ static int DumpPartial(register struct iod *iodp, register Volume *vp,
 static int DumpVnodeIndex(register struct iod *iodp, Volume *vp,
                          VnodeClass class, afs_int32 fromtime, int forcedump);
 static int DumpVnode(register struct iod *iodp, struct VnodeDiskObject *v,
-                    int vnodeNumber, int dumpEverything);
+                    int volid, int vnodeNumber, int dumpEverything);
 static int ReadDumpHeader(register struct iod *iodp, struct DumpHeader *hp);
 static int ReadVnodes(register struct iod *iodp, Volume *vp,
                      int incremental, afs_int32 *Lbuf, afs_int32 s1,
@@ -649,8 +649,8 @@ static int DumpVnodeIndex(register struct iod *iodp, Volume *vp,
     assert(size != -1);
     nVnodes = (size / vcp->diskSize) - 1;
     if (nVnodes > 0) {
-       assert((nVnodes+1)*vcp->diskSize == size)
-       assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0)
+       assert((nVnodes+1)*vcp->diskSize == size);
+       assert(STREAM_SEEK(file, vcp->diskSize, 0) == 0);
     }
     else nVnodes = 0;
     for (vnodeIndex = 0; nVnodes && STREAM_READ(vnode, vcp->diskSize, 1, file) == 1 && !code;
@@ -659,7 +659,7 @@ static int DumpVnodeIndex(register struct iod *iodp, Volume *vp,
        /* Note:  the >= test is very important since some old volumes may not have
           a serverModifyTime.  For an epoch dump, this results in 0>=0 test, which
           does dump the file! */
-       if (!code) code = DumpVnode(iodp, vnode, bitNumberToVnodeNumber(vnodeIndex, class), flag);
+       if (!code) code = DumpVnode(iodp, vnode, V_id(vp), bitNumberToVnodeNumber(vnodeIndex, class), flag);
        if (!flag) IOMGR_Poll(); /* if we dont' xfr data, but scan instead, could lose conn */
     }
     STREAM_CLOSE(file);
@@ -686,7 +686,7 @@ static int DumpDumpHeader(register struct iod *iodp, register Volume *vp,
 }
 
 static int DumpVnode(register struct iod *iodp, struct VnodeDiskObject *v,
-                    int vnodeNumber, int dumpEverything)
+                    int volid, int vnodeNumber, int dumpEverything)
 {
     int code = 0;
     IHandle_t *ihP;
@@ -715,8 +715,8 @@ static int DumpVnode(register struct iod *iodp, struct VnodeDiskObject *v,
        IH_INIT(ihP, iodp->device, iodp->parentId, VNDISK_GET_INO(v));
        fdP = IH_OPEN(ihP);
        if (fdP == NULL) {
-           Log("1 Volser: DumpVnode: dump: Unable to open inode %d for vnode %d; not dumped, error %d\n",
-               VNDISK_GET_INO(v), vnodeNumber, errno);
+           Log("1 Volser: DumpVnode: dump: Unable to open inode %d for vnode %d (volume %d); not dumped, error %d\n",
+               VNDISK_GET_INO(v), vnodeNumber, volid, errno);
            IH_RELEASE(ihP);
            return VOLSERREAD_DUMPERROR;
        }
@@ -780,7 +780,7 @@ int ProcessIndex(Volume *vp, VnodeClass class, afs_int32 **Bufp, int *sizep,
        OS_SYNC(afile->str_fd);
     } else {
        size = OS_SIZE(fdP->fd_fd);
-       assert(size != -1)
+       assert(size != -1);
        nVnodes = (size <= vcp->diskSize ? 0 :
                   size-vcp->diskSize) >> vcp->logSize;
        if (nVnodes > 0) {
index 76ab9fde9cf469749c512627473b3fca8d87e1d3..11716831465fccd7cb58218012f3da3ae86404ce 100644 (file)
@@ -25,7 +25,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /tmp/cvstemp/openafs/src/xstat/xstat_fs_callback.c,v 1.1.1.5 2002/05/11 00:04:10 hartmans Exp $");
+RCSID("$Header: /tmp/cvstemp/openafs/src/xstat/xstat_fs_callback.c,v 1.1.1.6 2003/04/13 19:08:27 hartmans Exp $");
 
 #include <errno.h>
 #include <stdio.h>                     /*Standard I/O stuff*/
@@ -652,6 +652,16 @@ int SRXAFSCB_GetCellServDB(
 }
 
 
+afs_int32 SRXAFSCB_GetCellByNum(
+    struct rx_call *a_call,
+    afs_int32 a_cellnum,
+    char **a_name,
+    serverList *a_hosts)
+{
+    return RXGEN_OPCODE;
+}
+
+
 /*------------------------------------------------------------------------
  * EXPORTED SRXAFSCB_GetLocalCell
  *