which included commits to RCS files with non-trunk default branches.
#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 */
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`
[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
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
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])
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
AC_MSG_RESULT(sun4)
SOLARIS_UFSVFS_HAS_DQRWLOCK
SOLARIS_PROC_HAS_P_COREFILE
+ SOLARIS_FS_HAS_FS_ROLLED
;;
*-sunos*)
MKAFS_OSTYPE=SUNOS
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"
;;
alpha*-dec-osf5.0*)
AFS_SYSNAME="alpha_dux50"
;;
+ alpha*-dec-osf5.1*)
+ AFS_SYSNAME="alpha_dux51"
+ ;;
mips-sgi-irix6.5)
AFS_SYSNAME="sgi_65"
;;
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)
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);
smb_NotifyChange(0,
FILE_NOTIFY_GENERIC_FILE_FILTER,
dscp, NULL, NULL, TRUE);
+ if (dscp) cm_ReleaseSCache(dscp);
}
}
}
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;
+}
#include <osi.h>
#include <rx/rx.h>
#ifndef DJGPP
-#include <rxkad.h>
+#include <rx/rxkad.h>
#else
#include <rx/rxkad.h>
#endif
#include "smb.h"
#ifndef DJGPP
-#include <rxkad.h>
+#include <rx/rxkad.h>
#include "afsrpc.h"
#else
#include <rx/rxkad.h>
* 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);
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);
#include "smb.h"
-#include <rxkad.h>
+#include <rx/rxkad.h>
/*
* The motivation for this whole module is that in transmitting tokens
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;
* 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 {
|| (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);
}
#include <objbase.h>
-#include <initguid.h>
#include <windows.h>
#include <windowsx.h>
#undef INITGUID
#include <afxpriv.h>
#include "stdafx.h"
+#include <atlconv.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "afs_shl_ext.h"
#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 */
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;
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
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();
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);
}
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)
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))
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);
#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 */
{
struct VenusFid vfid;
struct vrequest treq;
- extern struct cell *afs_GetCellByIndex();
register struct cell *tcell;
register afs_int32 code = 0;
afs_int32 ret;
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;
#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"
*/
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 */
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;
}
#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 */
set_current_state(TASK_INTERRUPTIBLE);
AFS_ASSERT_GLOCK();
AFS_GUNLOCK();
- spin_lock_irq(¤t->sigmask_lock);
+
+ SIG_LOCK(current);
saved_set = current->blocked;
sigfillset(¤t->blocked);
- recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
+ RECALC_SIGPENDING(current);
+ SIG_UNLOCK(current);
schedule();
- spin_lock_irq(¤t->sigmask_lock);
+ SIG_LOCK(current);
current->blocked = saved_set;
- recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
+ RECALC_SIGPENDING(current);
+ SIG_UNLOCK(current);
AFS_GLOCK();
}
remove_wait_queue(&evp->cond, &wait);
#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
free(ptr);
}
+void afs_osi_FreeStr(char *ptr)
+{
+ free(ptr);
+}
+
void *osi_AllocLargeSpace(size_t size)
{
AFS_STATCNT(osi_AllocLargeSpace);
#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 */
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;
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);
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",
#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*/
#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;
{
int plen;
struct cell *tcell;
- struct afs_q *cq, *tq;
char *t_name, *p_name = NULL;
#ifdef RX_ENABLE_LOCKS
/* 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 */
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;
}
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;
+}
+
* 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;
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;
+ }
+}
#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*/
/*
* 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++;
register afs_int32 code;
register struct dcache *tdc;
+ int entryok;
AFS_STATCNT(afs_UFSGetDSlot);
if (CheckLock(&afs_xdcache) != -1) osi_Panic("getdslot nolock");
/*
* 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;
/*
* 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;
* afs_IsDynrootFid
* afs_GetDynrootFid
* afs_IsDynroot
- * afs_RefreshDynroot
+ * afs_DynrootInvalidate
* afs_GetDynroot
* afs_PutDynroot
* afs_DynrootNewVnode
#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
* 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 */
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.
*/
{
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);
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;
*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
/* 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) {
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;
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);
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);
ts = ts->next;
}
- newCellCount = maxcellidx + afs_dynSymlinkIndex;
ReleaseReadLock(&afs_dynSymlinkLock);
ObtainWriteLock(&afs_dynrootDirLock, 549);
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);
}
/*
* 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));
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;
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;
}
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"
*/
strcat(avc->linkData, ":root.cell");
status->UnixModeBits = 0644;
+ afs_PutCell(c, READ_LOCK);
}
status->Length = linklen;
- afs_PutCell(c, READ_LOCK);
return 1;
}
int enable;
{
afs_dynrootEnable = enable;
- return 0;
+ return afs_dynrootCellInit();
}
/*
* 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)
}
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;
- }
}
/*
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);
afs_dynSymlinkBase = tps;
ReleaseWriteLock(&afs_dynSymlinkLock);
- afs_RefreshDynroot();
+ afs_DynrootInvalidate();
return 0;
}
#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 */
* 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;
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");
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) {
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;
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
*/
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*/
#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__
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;
#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 */
/* unmask signals in rxk listener */
void afs_osi_UnmaskRxkSignals(){
-#ifdef AFS_LINUX22_ENV
- osi_linux_unmask();
-#endif
}
/* register rxk listener proc info */
#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?
#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
#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 */
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
#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 */
-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,
{
struct VenusFid vfid;
struct SmallFid Sfid;
- extern struct cell *afs_GetCellByIndex();
register struct cell *tcell;
struct vrequest treq;
register afs_int32 code = 0, cellindex;
#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.
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,
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);
/* 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);
#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 */
+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
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) {
/*
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);
* 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))
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;
*/
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 */
/* 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;
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++;
}
}
}
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 {
#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 */
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)
{
#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*/
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);
* entries locked.
*/
-afs_RemoveVCB(afid)
- register struct VenusFid *afid;
-
+afs_RemoveVCB(struct VenusFid *afid)
{ /*afs_RemoveVCB*/
register int i, j;
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
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++;
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++;
#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 */
{
register struct volume *tv, **lv;
- register char *tfile;
+ struct osi_file *tfile;
register afs_int32 i, code;
afs_int32 bestTime;
struct volume *bestVp, **bestLp;
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;
}
}
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))
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);
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;
}
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;
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();
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 ;;\
#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
#define AFSLOGFILE "AFSLog"
#define DCACHEFILE "CacheItems"
#define VOLINFOFILE "VolumeItems"
+#define CELLINFOFILE "CellItems"
#define MAXIPADDRS 1024
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*/
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*/
*/
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();
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
*
*/
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
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 */
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++)
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;
}
/*
* 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);
}
#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);
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);
}
#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.
*/
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.
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}
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 ; \
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 ; \
-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"
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"
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"
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"
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"])
#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>
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;
}
#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
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
#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__
#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>
#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 */
#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>
#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 */
OUT cacheConfig *config
) = 218;
+proc GetCellByNum(
+ IN afs_int32 cellNumber,
+ OUT string cellName<AFSNAMEMAX>,
+ OUT serverList *cellHosts
+) = 65537;
+
#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*/
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
*
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 ;; \
#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>
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, ×, schedule, DECRYPT);
times.start = ntohl(times.start);
times.end = ntohl(times.end);
#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>
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;
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);
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]);
}
u_int locktime
);
+extern afs_int32 krb4_cross;
#define LOCKPW
#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>
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);
#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
#endif
#include <rx/xdr.h>
#include <rx/rx.h>
-#include <ptclient.h>
+#include <afs/ptclient.h>
#include "acl.h"
#ifdef AFS_PTHREAD_ENV
#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
#endif
#include <rx/xdr.h>
#include <rx/rx.h>
-#include <ptclient.h>
+#include <afs/ptclient.h>
#include "acl.h"
int acl_HtonACL(acl)
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
## 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 ; \
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
$(DEST_LIBAFSNONFS): $(LIBAFSNONFS)
${INSTALL} -f $? $@
-<all>
${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
$(RM) -f $@
$(LD) -r -o $@ $(AFSAOBJS) ${AFSNFSOBJS}
$(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
rx_enable_hot_thread @203 DATA
xdr_int64 @204
xdr_uint64 @205
+ osi_AssertFailU @206
#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>
#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"
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);
#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>
#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"
#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>
#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"
{
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);
#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"
struct uio u;
int i;
struct iovec iov[RX_MAXIOVECS];
- struct sockaddr *sa;
+ struct sockaddr *sa = NULL;
int code;
int haveGlock = ISAFS_GLOCK();
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;
}
#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"
struct uio u;
int i;
struct iovec iov[RX_MAXIOVECS];
- struct sockaddr *sa;
+ struct sockaddr *sa = NULL;
int code;
int haveGlock = ISAFS_GLOCK();
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;
}
#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)
#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.
struct coda_inode_info {};
#endif
#include "linux/wait.h"
-#include "linux/sched.h"
typedef struct afs_kmutex {
struct semaphore sem;
if (isAFSGlocked) AFS_GUNLOCK();
MUTEX_EXIT(l);
- spin_lock_irq(¤t->sigmask_lock);
+ SIG_LOCK(current);
saved_set = current->blocked;
sigfillset(¤t->blocked);
- recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
+ RECALC_SIGPENDING(current);
+ SIG_UNLOCK(current);
schedule();
remove_wait_queue(cv, &wait);
- spin_lock_irq(¤t->sigmask_lock);
+ SIG_LOCK(current);
current->blocked = saved_set;
- recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
+ RECALC_SIGPENDING(current);
+ SIG_UNLOCK(current);
if (isAFSGlocked) AFS_GLOCK();
MUTEX_ENTER(l);
if (isAFSGlocked) AFS_GUNLOCK();
MUTEX_EXIT(l);
- spin_lock_irq(¤t->sigmask_lock);
+ SIG_LOCK(current);
saved_set = current->blocked;
sigfillset(¤t->blocked);
- recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
+ RECALC_SIGPENDING(current);
+ SIG_UNLOCK(current);
t = schedule_timeout(t);
remove_wait_queue(cv, &wait);
- spin_lock_irq(¤t->sigmask_lock);
+ SIG_LOCK(current);
current->blocked = saved_set;
- recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
+ RECALC_SIGPENDING(current);
+ SIG_UNLOCK(current);
if (isAFSGlocked) AFS_GLOCK();
MUTEX_ENTER(l);
#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)
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);
#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"
{
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);
}
#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 */
*/
#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)
#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"
#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)
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;
#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 */
}
#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
#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>
# 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>
*/
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.
int *tnop;
struct rx_call **newcallp;
{
- u_long host;
+ unsigned int host;
u_short port;
register struct rx_packet *p = (struct rx_packet *)0;
/* 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;
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) {
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);
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;
}
#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
#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
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
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
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
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
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
{
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;
#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>
kvno,
client.name, client.instance, client.cell,
&sessionkey, &host, &start, &end);
- if (code) return RXKADBADTICKET;
+ if (code) return code;
}
/*
#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"
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;
afs_int32 *end;
{ char clear_ticket[MAXKTCTICKETLEN];
char *ticket;
- Key_schedule schedule;
+ union Key_schedule_safe schedule;
/* unsigned char flags; */
int code;
((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
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,
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;
}
#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"
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
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);
+#include <stddef.h>
#include "asn1_err.h"
#include <errno.h>
/*
#
# $ 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.
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;; \
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;
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
dirpath.o: ${UTIL}/dirpath.c
${COMPILE}
+softsig.o: ${UTIL}/softsig.c
+ ${COMPILE}
+
lock.o: ${LWP}/lock.c
${COMPILE}
#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
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;
ubik_print("Aborting..\n");
return UBADHOST;
}
+ usednetfiles++;
}
else {
/* get all my interface addresses in net byte order */
{
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
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)
#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)
/* 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>
#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>
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, ¢ry);
if (!aint32 && !IsLocked(¢ry.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(¢ry.lock)) {
printf(" locks: ");
PrintLock(¢ry.lock);
#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;
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;
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);
#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
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;
${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 $? $@ ; \
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 $? $@ ; \
#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() */
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
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
}
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 {
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;
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;
}
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:
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
}
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);
}
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++)
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++)
#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>
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;
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
/*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
/*
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
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;
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);
{
/* 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
&& ( ( !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
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);
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);
}
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
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;
}
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);
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,
{
int i, j;
int number, count;
- afs_int32 myPort, myHost;
+ afs_int32 myHost;
int found;
struct Interface *interface;
host->host, interf->numberOfInterfaces));
number = interf->numberOfInterfaces;
- myPort = host->port;
myHost = host->host; /* current interface address */
/* validation checks */
#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>
#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"
extern int LogLevel;
extern int Statistics;
+int busyonrst = 1;
int timeout = 30;
int SawSpare;
int SawPctSpare;
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
}
#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 */
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 */
#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);
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))));
}
+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()
char tbuffer[32];
ViceLog(1, ("Starting five minute check process\n"));
+ setThreadId("FiveMinuteCheckLWP");
while (1) {
#ifdef AFS_PTHREAD_ENV
sleep(fiveminutes);
{
ViceLog(1, ("Starting Host check process\n"));
+ setThreadId("HostCheckLWP");
while(1) {
#ifdef AFS_PTHREAD_ENV
sleep(fiveminutes);
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)] ");
busy_threshold);
Sawbusy = 0;
}
- }
+ }
+ else
+ if (!strcmp(argv[i], "-nobusy"))
+ busyonrst=0;
#ifdef AFS_AIX32_ENV
else
if (!strcmp(argv[i], "-m")) {
struct AFSDisk Disks[AFS_MSTATDISKS];
};
+extern int busyonrst;
+
#define RESTART_ORDINARY 1
#define RESTART_FAST 2
#define RESTART_SAFE 3
#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>
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 */
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) {
#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>
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. */
#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>
* 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;
}
#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>
#include <unistd.h>
#endif /* AFS_NT40_ENV */
#include <sys/stat.h>
-
+#include <stdarg.h>
struct VnodeClassInfo VnodeClassInfo[nVNODECLASSES];
/* 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)
#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>
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;
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);
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 */
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);
return -1;
headerFd = open(name, O_RDWR|O_TRUNC, 0644);
- assert(headerFd != -1)
+ assert(headerFd != -1);
}
}
if (headerFd) {
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;
}
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.
}
return;
}
+#endif
#endif
if (!(vnodeNumber & 1) && !Showmode &&
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 */
}
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 */
}
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 */
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;
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);
}
}
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;
assert(0); /* Fork is never executed in the NT code path */
#else
f = fork();
- assert(f >= 0)
+ assert(f >= 0);
#endif
return f;
}
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)
{
register char *p;
p = (char *) malloc(strlen(s)+1);
- assert(p != NULL)
+ assert(p != NULL);
strcpy(p,s);
return p;
#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>
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;
#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>
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,
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;
/* 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);
}
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;
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;
}
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) {
#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*/
}
+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
*