Index: openafs/src/Makefile diff -c openafs/src/Makefile:1.4.2.2 openafs/src/Makefile:1.4.2.5 *** openafs/src/Makefile:1.4.2.2 Fri Jan 19 04:29:22 2001 --- openafs/src/Makefile Tue Mar 6 17:26:48 2001 *************** *** 32,38 **** all: set ${SYS_NAME}/dest; $(MKDIR_IF_NEEDED) ! $(MAKE) install "COMPILE_PART1=cd obj; cd" "COMPILE_PART2=; $(MAKE) install SYS_NAME=${SYS_NAME} DESTDIR=`pwd`/${SYS_NAME}/dest/ SRCDIR=`pwd`/${SYS_NAME}/dest/" SYS_NAME=${SYS_NAME} "WASHTOOL=echo No washtool: " basics: -if test -f "${WASHTOOL}"; \ --- 32,38 ---- all: set ${SYS_NAME}/dest; $(MKDIR_IF_NEEDED) ! $(MAKE) install "COMPILE_PART1=cd obj; cd" "COMPILE_PART2=; $(MAKE) install SYS_NAME=${SYS_NAME} DESTDIR=`pwd`/${SYS_NAME}/dest/ SRCDIR=`pwd`/${SYS_NAME}/dest/" "COMPILE_PART3=; $(MAKE) test SYS_NAME=${SYS_NAME} DESTDIR=`pwd`/${SYS_NAME}/dest/ SRCDIR=`pwd`/${SYS_NAME}/dest/" SYS_NAME=${SYS_NAME} "WASHTOOL=echo No washtool: " basics: -if test -f "${WASHTOOL}"; \ *************** *** 95,101 **** ${COMPILE_PART1} rx ${COMPILE_PART2} rxtests: rxobj ! ${COMPILE_PART1} rx ${COMPILE_PART2} fsint: project kfsint --- 95,101 ---- ${COMPILE_PART1} rx ${COMPILE_PART2} rxtests: rxobj ! ${COMPILE_PART1} rx ${COMPILE_PART3} fsint: project kfsint *************** *** 138,145 **** ubik: project auth ${COMPILE_PART1} ubik ${COMPILE_PART2} ubiktests: ubik sys ! cd obj/ubik; $(MAKE) test SYS_NAME=${SYS_NAME} ptserver: project ubik cmd comerr auth audit ${COMPILE_PART1} ptserver ${COMPILE_PART2} --- 138,146 ---- ubik: project auth ${COMPILE_PART1} ubik ${COMPILE_PART2} + # cd obj/ubik; $(MAKE) test SYS_NAME=${SYS_NAME} ubiktests: ubik sys ! ${COMPILE_PART1} ubik ${COMPILE_PART3} ptserver: project ubik cmd comerr auth audit ${COMPILE_PART1} ptserver ${COMPILE_PART2} *************** *** 444,450 **** # Warning: The next few lines are _extremely_ sensitive to spaces and tabs. ${WASHTOOL} object libafs case ${SYS_NAME} in \ ! alpha_dux4* ) \ MKAFS_OSTYPE=DUX;; \ hp_ux* ) \ MKAFS_OSTYPE=HPUX;; \ --- 445,451 ---- # Warning: The next few lines are _extremely_ sensitive to spaces and tabs. ${WASHTOOL} object libafs case ${SYS_NAME} in \ ! alpha_dux* ) \ MKAFS_OSTYPE=DUX;; \ hp_ux* ) \ MKAFS_OSTYPE=HPUX;; \ *************** *** 475,481 **** MKAFS_OSTYPE=AIX;; \ sun4x_5* ) \ MKAFS_OSTYPE=SOLARIS;; \ ! alpha_dux4* ) \ MKAFS_OSTYPE=DUX;; \ sgi_6* ) \ MKAFS_OSTYPE=IRIX;; \ --- 476,482 ---- MKAFS_OSTYPE=AIX;; \ sun4x_5* ) \ MKAFS_OSTYPE=SOLARIS;; \ ! alpha_dux* ) \ MKAFS_OSTYPE=DUX;; \ sgi_6* ) \ MKAFS_OSTYPE=IRIX;; \ *************** *** 522,533 **** - /bin/rm -rf @sys/dest/* ; - /bin/mkdir @sys/obj ; echo "Create the obj directories" cd src; \ for file in `find [!NW]* -type d -print` ; do \ ! /bin/mkdir ../obj/$${file} ; \ done; echo "Create the obj file links" cd src; \ for file in `find [!NW]* -type f -print` ; do \ ! /bin/ln -s `pwd`/$${file} ../obj/$${file} ; \ done; --- 523,536 ---- - /bin/rm -rf @sys/dest/* ; - /bin/mkdir @sys/obj ; echo "Create the obj directories" + here=`pwd` ; \ cd src; \ for file in `find [!NW]* -type d -print` ; do \ ! /bin/mkdir $${here}/obj/$${file} ; \ done; echo "Create the obj file links" + here=`pwd` ; \ cd src; \ for file in `find [!NW]* -type f -print` ; do \ ! /bin/ln -s `pwd`/$${file} $${here}/obj/$${file} ; \ done; Index: openafs/src/README diff -c openafs/src/README:1.4 openafs/src/README:1.4.2.3 *** openafs/src/README:1.4 Sat Dec 2 13:06:26 2000 --- openafs/src/README Tue Mar 6 17:16:18 2001 *************** *** 10,28 **** A. Creating the proper directory structure. ! Uncompress the source into a directory of your choice. ! Preferrably, afs space. In the directory that you uncompressed the ! source in, you will only have an src directory. ! 1. Make a directory for each system type that you plan on building. Current tested system types include the following (this step is skipped for the i386_nt40 system type): alpha_dux40/ i386_linux22/ rs_aix42/ sun4x_56/ sun4x_57/ Example: % mkdir i386_linux22 --- 10,32 ---- A. Creating the proper directory structure. ! Uncompress the source into a directory of your choice. A directory ! in afs space is also valid. In the directory that you uncompressed the ! source in, you will only have an src/ directory. ! 1. Make a directory for each system type that you plan on building. Current tested system types include the following (this step is skipped for the i386_nt40 system type): alpha_dux40/ + alpha_dux50/ (only tested on 5.0A) i386_linux22/ + i386_linux24/ (only tested with 2.4.0 kernel) rs_aix42/ + sgi_65/ (file server not tested) sun4x_56/ sun4x_57/ + sun4x_58/ Example: % mkdir i386_linux22 *************** *** 32,38 **** Builds for the following platforms will not fully compile: hp_ux110/ - sgi_65/ 2. Within each of those directories, create a dest/ and obj/ directory. --- 36,41 ---- *************** *** 41,71 **** % mkdir i386_linux22/obj 3. Create symbolic links to the system type you are about to build ! Example: ! % ln -s @sys/dest dest ! % ln -s @sys/obj obj ! % ls -CF ! Makefile@ dest@ i386_linux22/ obj@ src/ ! ! 4. If this source is NOT in AFS space, You must make a link from ! @sys to your current system type. ! Example: ! % ln -s i386_linux22 @sys ! Within AFS space, the AFS Cache Manager automatically ! substitutes the local machine's AFS system name (CPU/operating ! system type [ie: alpha_dux40, i386_linux22, ...]) for the @sys ! variable. 5. Create the top level Makefile: - a. For LINUX and UNIX versions Example: % ln -s src/Makefile Makefile % ls -CF ! Makefile@ i386_linux22/ src/ B Building --- 44,78 ---- % mkdir i386_linux22/obj 3. Create symbolic links to the system type you are about to build + a. If the source is in AFS space ! Example: ! % ln -s @sys/dest dest ! % ln -s @sys/obj obj ! % ls -CF ! dest@ i386_linux22/ obj@ src/ ! Within AFS space, the AFS Cache Manager automatically ! substitutes the local machine's AFS system name (CPU/operating ! system type [ie: alpha_dux40, i386_linux22, ...]) for the @sys ! variable. ! b. If this source is NOT in AFS space, You must make a link from ! @sys to your current system type. + Example: + % ln -s i386_linux22 @sys + % ln -s @sys/dest dest + % ln -s @sys/obj obj + % ls -CF + dest@ i386_linux22/ obj@ src/ sys@ + 5. Create the top level Makefile: Example: % ln -s src/Makefile Makefile % ls -CF ! Makefile@ dest@ i386_linux22/ obj@ src/ B Building Index: openafs/src/WINNT/afsd/smb3.c diff -c openafs/src/WINNT/afsd/smb3.c:1.2 openafs/src/WINNT/afsd/smb3.c:1.2.2.1 *** openafs/src/WINNT/afsd/smb3.c:1.2 Sat Nov 4 05:01:44 2000 --- openafs/src/WINNT/afsd/smb3.c Tue Mar 6 16:21:09 2001 *************** *** 2367,2373 **** * we're supposed to close the search if we're done, and we're done, * or if something went wrong, close the search. */ ! if ((searchFlags & 1) || ((searchFlags & 2) && eos) || code != 0) smb_DeleteDirSearch(dsp); if (code) smb_SendTran2Error(vcp, p, opx, code); --- 2367,2374 ---- * we're supposed to close the search if we're done, and we're done, * or if something went wrong, close the search. */ ! /* ((searchFlags & 1) || ((searchFlags & 2) && eos) */ ! if ((searchFlags & 1) || (returnedNames == 0) || code != 0) smb_DeleteDirSearch(dsp); if (code) smb_SendTran2Error(vcp, p, opx, code); Index: openafs/src/WINNT/afssvrmgr/svc_create.cpp diff -c openafs/src/WINNT/afssvrmgr/svc_create.cpp:1.2 openafs/src/WINNT/afssvrmgr/svc_create.cpp:1.2.2.1 *** openafs/src/WINNT/afssvrmgr/svc_create.cpp:1.2 Sat Nov 4 05:02:10 2000 --- openafs/src/WINNT/afssvrmgr/svc_create.cpp Tue Mar 6 16:44:15 2001 *************** *** 139,145 **** void Services_Create_OnType (HWND hDlg) { ! SERVICETYPE type; if (IsDlgButtonChecked (hDlg, IDC_SVC_TYPE_FS)) type = SERVICETYPE_FS; else if (IsDlgButtonChecked (hDlg, IDC_SVC_TYPE_CRON)) --- 139,145 ---- void Services_Create_OnType (HWND hDlg) { ! AFSSERVICETYPE type; if (IsDlgButtonChecked (hDlg, IDC_SVC_TYPE_FS)) type = SERVICETYPE_FS; else if (IsDlgButtonChecked (hDlg, IDC_SVC_TYPE_CRON)) Index: openafs/src/WINNT/client_config/drivemap.cpp diff -c openafs/src/WINNT/client_config/drivemap.cpp:1.3 openafs/src/WINNT/client_config/drivemap.cpp:1.3.2.1 *** openafs/src/WINNT/client_config/drivemap.cpp:1.3 Tue Nov 7 10:44:17 2000 --- openafs/src/WINNT/client_config/drivemap.cpp Tue Mar 6 16:02:08 2001 *************** *** 684,692 **** lstrcpy (pszTarget, (fWantAFS) ? TEXT("/afs") : TEXT("")); else if ((*pszSource != TEXT('/')) && (*pszSource != TEXT('\\'))) wsprintf (pszTarget, TEXT("/afs/%s"), pszSource); ! else if (fWantAFS && lstrncmpi (&pszSource[1], TEXT("afs"), 3)) wsprintf (pszTarget, TEXT("/afs%s"), pszSource); ! else if (!fWantAFS && !lstrncmpi (&pszSource[1], TEXT("afs"), 3)) lstrcpy (pszTarget, &pszSource[4]); else lstrcpy (pszTarget, pszSource); --- 684,697 ---- lstrcpy (pszTarget, (fWantAFS) ? TEXT("/afs") : TEXT("")); else if ((*pszSource != TEXT('/')) && (*pszSource != TEXT('\\'))) wsprintf (pszTarget, TEXT("/afs/%s"), pszSource); ! // We don't want to strip afs off the start if it is part of something for example afscell.company.com ! else if (fWantAFS && (lstrncmpi (&pszSource[1], TEXT("afs"), 3)) || !((pszSource[4] == TEXT('/')) || ! (pszSource[4] == TEXT('\\')) || ! (lstrlen(pszSource) == 4))) wsprintf (pszTarget, TEXT("/afs%s"), pszSource); ! else if (!fWantAFS && (!lstrncmpi (&pszSource[1], TEXT("afs"), 3) || ((pszSource[4] == TEXT('/')) || ! (pszSource[4] == TEXT('\\')) || ! (lstrlen(pszSource) == 4)))) lstrcpy (pszTarget, &pszSource[4]); else lstrcpy (pszTarget, pszSource); Index: openafs/src/afs/afs_osi.c diff -c openafs/src/afs/afs_osi.c:1.2 openafs/src/afs/afs_osi.c:1.2.2.1 *** openafs/src/afs/afs_osi.c:1.2 Sat Nov 4 05:03:12 2000 --- openafs/src/afs/afs_osi.c Tue Mar 6 16:24:01 2001 *************** *** 713,718 **** --- 713,725 ---- void afs_osi_TraverseProcTable() { struct pid_entry *pe; + #ifdef AFS_DUX50_ENV + extern struct pid_entry *pidtab; + extern int npid; + #define pidNPID (pidtab + npid) + #define PID_LOCK() + #define PID_UNLOCK() + #endif PID_LOCK(); for (pe = pidtab; pe < pidNPID; ++pe) { if (pe->pe_proc != PROC_NULL) Index: openafs/src/afs/afs_pioctl.c diff -c openafs/src/afs/afs_pioctl.c:1.4.2.5 openafs/src/afs/afs_pioctl.c:1.4.2.6 *** openafs/src/afs/afs_pioctl.c:1.4.2.5 Fri Jan 19 04:52:21 2001 --- openafs/src/afs/afs_pioctl.c Tue Mar 6 16:38:25 2001 *************** *** 61,66 **** --- 61,67 ---- static int PGetCPrefs(), PSetCPrefs(); /* client network addresses */ static int PGetInitParams(), PFlushMount(), PRxStatProc(), PRxStatPeer(); static int PGetRxkcrypt(), PSetRxkcrypt(); + static int PPrefetchFromTape(), PResidencyCmd(); int PExportAfs(); static int HandleClientContext(struct afs_ioctl *ablob, int *com, struct AFS_UCRED **acred, struct AFS_UCRED *credp); *************** *** 134,139 **** --- 135,142 ---- PNoop, /* 63 -- arla: print xfs status */ PNoop, /* 64 -- arla: force cache check */ PNoop, /* 65 -- arla: break callback */ + PPrefetchFromTape, /* 66 -- MR-AFS: prefetch file from tape */ + PResidencyCmd, /* 67 -- MR-AFS: generic commnd interface */ }; #define PSetClientContext 99 /* Special pioctl to setup caller's creds */ *************** *** 3555,3557 **** --- 3558,3720 ---- return code; } + static PPrefetchFromTape(avc, afun, areq, ain, aout, ainSize, aoutSize) + struct vcache *avc; + int afun; + struct vrequest *areq; + char *ain, *aout; + afs_int32 ainSize; + afs_int32 *aoutSize; /* set this */ + { + register afs_int32 code, code1; + afs_int32 bytes; + struct conn *tc; + struct rx_call *tcall; + struct AFSVolSync tsync; + struct AFSFetchStatus OutStatus; + struct AFSCallBack CallBack; + struct VenusFid tfid; + struct AFSFid *Fid; + struct vcache *tvc; + XSTATS_DECLS; + + AFS_STATCNT(PSetAcl); + if (!avc) + return EINVAL; + + if (ain && (ainSize == 3 * sizeof(afs_int32))) + Fid = (struct AFSFid *) ain; + else + Fid = &avc->fid.Fid; + tfid.Cell = avc->fid.Cell; + tfid.Fid.Volume = Fid->Volume; + tfid.Fid.Vnode = Fid->Vnode; + tfid.Fid.Unique = Fid->Unique; + + tvc = afs_GetVCache(&tfid, areq, (afs_int32 *)0, (struct vcache *)0, + WRITE_LOCK); + if (!tvc) { + afs_Trace3(afs_iclSetp, CM_TRACE_PREFETCHCMD, + ICL_TYPE_POINTER, tvc, + ICL_TYPE_FID, &tfid, + ICL_TYPE_FID, &avc->fid); + return ENOENT; + } + afs_Trace3(afs_iclSetp, CM_TRACE_PREFETCHCMD, + ICL_TYPE_POINTER, tvc, + ICL_TYPE_FID, &tfid, + ICL_TYPE_FID, &tvc->fid); + + do { + tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK); + if (tc) { + + #ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); + #endif /* RX_ENABLE_LOCKS */ + tcall = rx_NewCall(tc->id); + code = StartRXAFS_FetchData(tcall, + (struct AFSFid *) &tvc->fid.Fid, 0, 0); + if (!code) { + bytes = rx_Read(tcall, (char *) aout, sizeof(afs_int32)); + code = EndRXAFS_FetchData(tcall, &OutStatus, &CallBack, &tsync); + } + code1 = rx_EndCall(tcall, code); + #ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); + #endif /* RX_ENABLE_LOCKS */ + } else + code = -1; + } while + (afs_Analyze(tc, code, &tvc->fid, areq, + AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, SHARED_LOCK, + (struct cell *)0)); + /* This call is done only to have the callback things handled correctly */ + afs_FetchStatus(tvc, &tfid, areq, &OutStatus); + afs_PutVCache(tvc, WRITE_LOCK); + + if (!code) { + *aoutSize = sizeof(afs_int32); + } + return code; + } + + static PResidencyCmd(avc, afun, areq, ain, aout, ainSize, aoutSize) + struct vcache *avc; + int afun; + struct vrequest *areq; + char *ain, *aout; + afs_int32 ainSize; + afs_int32 *aoutSize; /* set this */ + { + register afs_int32 code; + struct conn *tc; + struct vcache *tvc; + struct ResidencyCmdInputs *Inputs; + struct ResidencyCmdOutputs *Outputs; + struct VenusFid tfid; + struct AFSFid *Fid; + + Inputs = (struct ResidencyCmdInputs *) ain; + Outputs = (struct ResidencyCmdOutputs *) aout; + if (!avc) return EINVAL; + if (!ain || ainSize != sizeof(struct ResidencyCmdInputs)) return EINVAL; + + Fid = &Inputs->fid; + if (!Fid->Volume) + Fid = &avc->fid.Fid; + + tfid.Cell = avc->fid.Cell; + tfid.Fid.Volume = Fid->Volume; + tfid.Fid.Vnode = Fid->Vnode; + tfid.Fid.Unique = Fid->Unique; + + tvc = afs_GetVCache(&tfid, areq, (afs_int32 *)0, (struct vcache *)0, + WRITE_LOCK); + afs_Trace3(afs_iclSetp, CM_TRACE_RESIDCMD, + ICL_TYPE_POINTER, tvc, + ICL_TYPE_INT32, Inputs->command, + ICL_TYPE_FID, &tfid); + if (!tvc) + return ENOENT; + + if (Inputs->command) { + do { + tc = afs_Conn(&tvc->fid, areq, SHARED_LOCK); + if (tc) { + #ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); + #endif /* RX_ENABLE_LOCKS */ + code = RXAFS_ResidencyCmd(tc->id, Fid, + Inputs, + (struct ResidencyCmdOutputs *) aout); + #ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); + #endif /* RX_ENABLE_LOCKS */ + } else + code = -1; + } while + (afs_Analyze(tc, code, &tvc->fid, areq, + AFS_STATS_FS_RPCIDX_RESIDENCYRPCS, SHARED_LOCK, + (struct cell *)0)); + /* This call is done to have the callback things handled correctly */ + afs_FetchStatus(tvc, &tfid, areq, &Outputs->status); + } else { /* just a status request, return also link data */ + code = 0; + Outputs->code = afs_FetchStatus(tvc, &tfid, areq, &Outputs->status); + Outputs->chars[0] = 0; + if (vType(tvc) == VLNK) { + ObtainWriteLock(&tvc->lock,555); + if (afs_HandleLink(tvc, areq) == 0) + strncpy((char *) &Outputs->chars, tvc->linkData, MAXCMDCHARS); + ReleaseWriteLock(&tvc->lock); + } + } + + afs_PutVCache(tvc, WRITE_LOCK); + + if (!code) { + *aoutSize = sizeof(struct ResidencyCmdOutputs); + } + return code; + } Index: openafs/src/afs/afs_stats.h diff -c openafs/src/afs/afs_stats.h:1.2 openafs/src/afs/afs_stats.h:1.2.2.1 *** openafs/src/afs/afs_stats.h:1.2 Sat Nov 4 05:03:14 2000 --- openafs/src/afs/afs_stats.h Tue Mar 6 16:38:26 2001 *************** *** 838,843 **** --- 838,844 ---- #define AFS_STATS_FS_RPCIDX_XSTATSVERSION 26 #define AFS_STATS_FS_RPCIDX_GETXSTATS 27 #define AFS_STATS_FS_RPCIDX_XLOOKUP 28 + #define AFS_STATS_FS_RPCIDX_RESIDENCYRPCS 29 #define AFS_STATS_NUM_FS_RPC_OPS 29 Index: openafs/src/afs/afs_trace.et diff -c openafs/src/afs/afs_trace.et:1.2 openafs/src/afs/afs_trace.et:1.2.2.1 *** openafs/src/afs/afs_trace.et:1.2 Sat Nov 4 05:03:14 2000 --- openafs/src/afs/afs_trace.et Tue Mar 6 16:38:27 2001 *************** *** 127,131 **** --- 127,133 ---- ec CM_TRACE_READPAGE, "Ireadpage ip 0x%lx pp 0x%x count 0x%x code %x" ec CM_TRACE_UPDATEPAGE, "Iupdatepage ip 0x%lx pp 0x%x count 0x%x code %d" ec CM_TRACE_VM_CLOSE, "VMclose ip 0x%lx mapcnt %d opens %d XoW %d" + ec CM_TRACE_PREFETCHCMD, "PrefetchCmd tvc 0x%x tfid (%d:%d.%d.%d) fid (%d:%d.%d.%d)" + ec CM_TRACE_RESIDCMD, "ResidencyCmd tvc 0x%x command %d fid (%d:%d.%d.%d)" end Index: openafs/src/afs/sysincludes.h diff -c openafs/src/afs/sysincludes.h:1.3 openafs/src/afs/sysincludes.h:1.3.2.1 *** openafs/src/afs/sysincludes.h:1.3 Sat Dec 2 12:41:44 2000 --- openafs/src/afs/sysincludes.h Tue Mar 6 16:11:16 2001 *************** *** 79,85 **** --- 79,88 ---- #ifdef AFS_SGI64_ENV #include #endif /* AFS_SGI64_ENV */ + #include "../fs/efs_inode.h" + #ifdef AFS_SGI_EFS_IOPS_ENV #include "../sgiefs/efs.h" + #endif #include "../sys/kmem.h" #include "../sys/cred.h" #include "../sys/resource.h" Index: openafs/src/afs/DUX/osi_inode.c diff -c openafs/src/afs/DUX/osi_inode.c:1.2 openafs/src/afs/DUX/osi_inode.c:1.2.2.2 *** openafs/src/afs/DUX/osi_inode.c:1.2 Sat Nov 4 05:03:19 2000 --- openafs/src/afs/DUX/osi_inode.c Tue Mar 6 16:41:24 2001 *************** *** 56,61 **** --- 56,64 ---- } MOUNTLIST_LOCK(); } + #ifdef AFS_DUX50_ENV + #define m_next m_nxt + #endif mp = mp->m_next; } while (mp != rootfs); MOUNTLIST_UNLOCK(); *************** *** 212,217 **** --- 215,223 ---- int fd; extern struct fileops vnops; register int code; + #ifdef AFS_DUX50_ENV + struct ufile_entry *fe; + #endif AFS_STATCNT(afs_syscall_iopen); *************** *** 222,231 **** --- 228,244 ---- if (code) { return(code); } + #ifdef AFS_DUX50_ENV + if ((code = falloc(&fp, &fd, &fe)) != 0) { + iput(ip); + return(code); + } + #else if ((code = falloc(&fp, &fd)) != 0) { iput(ip); return(code); } + #endif IN_UNLOCK(ip); FP_LOCK(fp); *************** *** 235,241 **** --- 248,258 ---- fp->f_data = (caddr_t)ITOV(ip); FP_UNLOCK(fp); + #ifdef AFS_DUX50_ENV + u_set_fe(fd, fe, fp, &u.u_file_state); + #else U_FD_SET(fd, fp, &u.u_file_state); + #endif *retval = fd; return(0); } Index: openafs/src/afs/DUX/osi_vfsops.c diff -c openafs/src/afs/DUX/osi_vfsops.c:1.2 openafs/src/afs/DUX/osi_vfsops.c:1.2.2.2 *** openafs/src/afs/DUX/osi_vfsops.c:1.2 Sat Nov 4 05:03:19 2000 --- openafs/src/afs/DUX/osi_vfsops.c Tue Mar 6 17:20:16 2001 *************** *** 200,205 **** --- 200,213 ---- } + #ifdef AFS_DUX50_ENV + int mp_afs_smoothsync(struct mount *mp, u_int age, u_int smsync_flag) + { + AFS_STATCNT(afs_sync); + return 0; + } + #endif + int mp_afs_fhtovp(struct mount *afsp, struct fid *fidp, struct vnode **avcp) { struct vrequest treq; *************** *** 350,356 **** mp_afs_vptofh, mp_Afs_init, mp_afs_mountroot, ! mp_afs_swapvp }; --- 358,367 ---- mp_afs_vptofh, mp_Afs_init, mp_afs_mountroot, ! mp_afs_swapvp, ! #ifdef AFS_DUX50_ENV ! mp_afs_smoothsync ! #endif }; *************** *** 469,476 **** --- 480,491 ---- AFS_GLOCK(); sysent[AFS_SYSCALL].sy_call = afs3_syscall; + #ifdef SY_NARG + sysent[AFS_SYSCALL].sy_info = 6; + #else sysent[AFS_SYSCALL].sy_parallel = 0; sysent[AFS_SYSCALL].sy_narg = 6; + #endif sysent[SYS_setgroups].sy_call = Afs_xsetgroups; afs_xioctl_func = afsxioctl; afs_xsetgroups_func = afsxsetgroups; Index: openafs/src/afs/DUX/osi_vnodeops.c diff -c openafs/src/afs/DUX/osi_vnodeops.c:1.2 openafs/src/afs/DUX/osi_vnodeops.c:1.2.2.1 *** openafs/src/afs/DUX/osi_vnodeops.c:1.2 Sat Nov 4 05:03:20 2000 --- openafs/src/afs/DUX/osi_vnodeops.c Tue Mar 6 16:24:06 2001 *************** *** 40,45 **** --- 40,46 ---- int mp_afs_page_read(), mp_afs_page_write(), mp_afs_swap(), mp_afs_bread(); int mp_afs_brelse(), mp_afs_lockctl(), mp_afs_syncdata(), mp_afs_close(); int mp_afs_closex(); + int mp_afs_ioctl(); /* AFS vnodeops */ struct vnodeops Afs_vnodeops = { *************** *** 53,59 **** mp_afs_setattr, mp_afs_ubcrdwr, mp_afs_ubcrdwr, ! afs_badop, /* vn_ioctl */ seltrue, /* vn_select */ mp_afs_mmap, mp_afs_fsync, --- 54,60 ---- mp_afs_setattr, mp_afs_ubcrdwr, mp_afs_ubcrdwr, ! mp_afs_ioctl, /* vn_ioctl */ seltrue, /* vn_select */ mp_afs_mmap, mp_afs_fsync, *************** *** 510,517 **** --- 511,523 ---- flags = 0; ReleaseWriteLock(&avc->lock); AFS_GUNLOCK(); + #ifdef AFS_DUX50_ENV code = ubc_lookup(((struct vnode *)avc)->v_object, pageBase, + PAGE_SIZE, PAGE_SIZE, &page, &flags, NULL); + #else + code = ubc_lookup(((struct vnode *)avc)->v_object, pageBase, PAGE_SIZE, PAGE_SIZE, &page, &flags); + #endif AFS_GLOCK(); ObtainWriteLock(&avc->lock,163); *************** *** 561,569 **** } AFS_GUNLOCK(); ubc_page_wait(page); ! data = (char *)page->pg_addr; /* DUX 4.0D */ ! if (data == 0) ! data = (char *)PHYS_TO_KSEG(page->pg_phys_addr); /* DUX 4.0E */ AFS_GLOCK(); ReleaseWriteLock(&avc->lock); /* uiomove may page fault */ AFS_GUNLOCK(); --- 567,573 ---- } AFS_GUNLOCK(); ubc_page_wait(page); ! data = ubc_load(page, pageOffset, page_size); AFS_GLOCK(); ReleaseWriteLock(&avc->lock); /* uiomove may page fault */ AFS_GUNLOCK(); *************** *** 666,671 **** --- 670,681 ---- return code; } + int + mp_afs_ioctl(struct vnode *vp, int com, caddr_t data, int fflag, + struct ucred *cred, int *retval) + { + return ENOSYS; + } /* * Now for some bad news. Since we artificially hold on to vnodes by doing *************** *** 724,738 **** } ! int mp_afs_getpage(vop, offset, len, protp, pl, plsz, mape, addr, rw, cred) vm_ubc_object_t vop; vm_offset_t offset; vm_size_t len; vm_prot_t *protp; vm_page_t *pl; int plsz; vm_map_entry_t mape; vm_offset_t addr; int rw; struct ucred *cred; { --- 734,758 ---- } ! int mp_afs_getpage(vop, offset, len, protp, pl, plsz, ! #ifdef AFS_DUX50_ENV ! policy, ! #else ! mape, addr, ! #endif ! rw, cred) vm_ubc_object_t vop; vm_offset_t offset; vm_size_t len; vm_prot_t *protp; vm_page_t *pl; int plsz; + #ifdef AFS_DUX50_ENV + struct vm_policy *policy; + #else vm_map_entry_t mape; vm_offset_t addr; + #endif int rw; struct ucred *cred; { *************** *** 774,781 **** --- 794,806 ---- flags = 0; ReleaseWriteLock(&avc->lock); AFS_GUNLOCK(); + #ifdef AFS_DUX50_ENV code = ubc_lookup(((struct vnode *)avc)->v_object, off, + PAGE_SIZE, PAGE_SIZE, pagep, &flags, NULL); + #else + code = ubc_lookup(((struct vnode *)avc)->v_object, off, PAGE_SIZE, PAGE_SIZE, pagep, &flags); + #endif AFS_GLOCK(); ObtainWriteLock(&avc->lock,168); if (code) { *************** *** 815,821 **** --- 840,850 ---- } if ((rw & B_READ) == 0) { AFS_GUNLOCK(); + #ifdef AFS_DUX50_ENV + ubc_page_dirty(pl[i], 0); + #else ubc_page_dirty(pl[i]); + #endif AFS_GLOCK(); } else { if (protp && (flags & B_DIRTY) == 0) { *************** *** 1045,1050 **** --- 1074,1094 ---- return TRUE; } + #ifdef AFS_DUX50_ENV + int + mp_afs_objtovp(vm_ubc_object_t vop, struct vnode **vp) + { + *vp = vop->vu_vp; + return 0; + } + + int + mp_afs_setpgstamp(vm_page_t pp, unsigned int tick) + { + pp->pg_stamp = tick; + return 0; + } + #endif struct vfs_ubcops afs_ubcops = { *************** *** 1053,1058 **** --- 1097,1106 ---- mp_afs_getpage, /* get page */ mp_afs_putpage, /* put page */ mp_afs_write_check, /* check writablity */ + #ifdef AFS_DUX50_ENV + mp_afs_objtovp, /* get vnode pointer */ + mp_afs_setpgstamp /* set page stamp */ + #endif }; Index: openafs/src/afs/IRIX/osi_file.c diff -c openafs/src/afs/IRIX/osi_file.c:1.2 openafs/src/afs/IRIX/osi_file.c:1.2.2.1 *** openafs/src/afs/IRIX/osi_file.c:1.2 Sat Nov 4 05:03:22 2000 --- openafs/src/afs/IRIX/osi_file.c Tue Mar 6 16:11:18 2001 *************** *** 23,28 **** --- 23,29 ---- * now vectors to the correct EFS or XFS function. If new functionality is * added which accesses the inode, that will also need EFS/XFS variants. */ + #ifdef AFS_SGI_EFS_IOPS_ENV vnode_t *afs_EFSIGetVnode(ino_t ainode) { struct inode *ip; *************** *** 39,44 **** --- 40,46 ---- iunlock(ip); return (EFS_ITOV(ip)); } + #endif /* AFS_SGI_EFS_IOPS_ENV */ vnode_t *afs_XFSIGetVnode(ino_t ainode) { *************** *** 142,147 **** --- 144,150 ---- return code; } + #ifdef AFS_SGI_EFS_IOPS_ENV void osi_DisableAtimes(avp) struct vnode *avp; { *************** *** 152,157 **** --- 155,161 ---- } } + #endif /* AFS_SGI_EFS_IOPS_ENV */ /* Generic read interface */ *************** *** 185,191 **** --- 189,197 ---- if (code == 0) { code = asize - resid; afile->offset += code; + #ifdef AFS_SGI_EFS_IOPS_ENV osi_DisableAtimes(afile->vnode); + #endif /* AFS_SGI_EFS_IOPS_ENV */ } else { afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid, Index: openafs/src/afs/IRIX/osi_inode.c diff -c openafs/src/afs/IRIX/osi_inode.c:1.2 openafs/src/afs/IRIX/osi_inode.c:1.2.2.3 *** openafs/src/afs/IRIX/osi_inode.c:1.2 Sat Nov 4 05:03:22 2000 --- openafs/src/afs/IRIX/osi_inode.c Tue Mar 6 16:20:00 2001 *************** *** 166,172 **** return ENOSYS; #endif ! if (error = iget(vfstom(vfsp), (unsigned int)(inode&0xffffffff), &ip)) { return error; } *ipp = ip; --- 166,173 ---- return ENOSYS; #endif ! if (error = iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)), ! (unsigned int)(inode&0xffffffff), &ip)) { return error; } *ipp = ip; *************** *** 216,223 **** } #endif ! if (error = xfs_iget(vfstom(vfsp), (void*)0, ! (xfs_ino_t)inode,XFS_ILOCK_SHARED, &ip, (daddr_t)0)) { SET_XFS_ERROR(3, vfsp->vfs_dev, inode); return error; } --- 217,226 ---- } #endif ! if (error = xfs_iget((((struct mount *) ! ((vfsp)->vfs_bh.bh_first)->bd_pdata)), ! (void*)0, (xfs_ino_t)inode, ! XFS_ILOCK_SHARED, &ip, (daddr_t)0)) { SET_XFS_ERROR(3, vfsp->vfs_dev, inode); return error; } *************** *** 280,290 **** --- 283,298 ---- int icreate(struct icreateargs *uap, rval_t *rvp) { + #ifdef AFS_SGI_EFS_IOPS_ENV AFS_STATCNT(icreate); return(afs_syscall_icreate(uap->dev, uap->near_inode, uap->param1, uap->param2, uap->param3, uap->param4, rvp)); + #else + return ENOSYS; + #endif } + #ifdef AFS_SGI_EFS_IOPS_ENV int afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, rvp) afs_uint32 dev, near_inode, param1, param2, param3, param4; *************** *** 327,332 **** --- 335,349 ---- iput(newip); return 0; } + #else /* !AFS_SGI_EFS_IOPS_ENV */ + int + afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, rvp) + afs_uint32 dev, near_inode, param1, param2, param3, param4; + rval_t *rvp; + { + return ENOSYS; + } + #endif /* AFS_SGI_EFS_IOPS_ENV */ #ifdef AFS_SGI_XFS_IOPS_ENV /* inode creation routines for icreatename64 entry point. Use for EFS/XFS *************** *** 620,625 **** --- 637,643 ---- if (!vfsp) return ENXIO; + #ifdef AFS_SGI_EFS_IOPS_ENV if (vfsp->vfs_fstype == efs_fstype) { struct inode *ip; if (error = igetinode(vfsp, (dev_t)dev, inode, &ip)) *************** *** 630,650 **** return error; } iunlock(ip); - } - else if (vfsp->vfs_fstype == xfs_fstype) { - struct xfs_inode *xip; - if (error = xfs_igetinode(vfsp, (dev_t)dev, inode, &xip)) - return error; - vp = XFS_ITOV(xip); - if (error = vfile_alloc((usrmod+1) & (FMASK), &fp, &fd)) { - VN_RELE(vp); - return error; - } - } - else { - osi_Panic("afs_syscall_iopen: bad fstype = %d\n", - vfsp->vfs_fstype); } vfile_ready(fp, vp); rvp->r_val1 = fd; return 0; --- 648,670 ---- return error; } iunlock(ip); } + else + #endif /* AFS_SGI_EFS_IOPS_ENV */ + if (vfsp->vfs_fstype == xfs_fstype) { + struct xfs_inode *xip; + if (error = xfs_igetinode(vfsp, (dev_t)dev, inode, &xip)) + return error; + vp = XFS_ITOV(xip); + if (error = vfile_alloc((usrmod+1) & (FMASK), &fp, &fd)) { + VN_RELE(vp); + return error; + } + } + else { + osi_Panic("afs_syscall_iopen: bad fstype = %d\n", + vfsp->vfs_fstype); + } vfile_ready(fp, vp); rvp->r_val1 = fd; return 0; *************** *** 765,770 **** --- 785,791 ---- * Only VICEMAGIC type inodes. */ #ifdef AFS_SGI_XFS_IOPS_ENV + #ifdef AFS_SGI_EFS_IOPS_ENV /* efs_iincdec * * XFS/EFS iinc/idec code for EFS. Uses 32 bit inode numbers. *************** *** 796,801 **** --- 817,823 ---- iput(ip); return error; } + #endif /* AFS_SGI_EFS_IOPS_ENV */ /* xfs_iincdec * *************** *** 814,821 **** int nlink; int vol; ! code = xfs_iget(vfstom(vfsp), (void*)0, (xfs_ino_t)inode, XFS_ILOCK_SHARED, ! &ip, (daddr_t)0); if (code) return code; --- 836,844 ---- int nlink; int vol; ! code = xfs_iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)), ! (void*)0, (xfs_ino_t)inode, XFS_ILOCK_SHARED, &ip, ! (daddr_t)0); if (code) return code; *************** *** 963,971 **** --- 986,996 ---- inode |= inode_lo; return xfs_iincdec64(vfsp, inode, inode_p1, amount); } + #ifdef AFS_SGI_EFS_IOPS_ENV else if (vfsp->vfs_fstype == efs_fstype) { return efs_iincdec(vfsp, inode_lo, inode_p1, amount); } + #endif /* AFS_SGI_EFS_IOPS_ENV */ return ENXIO; } *************** *** 1143,1149 **** inode = inode_hi; inode <<= 32; inode |= inode_lo; ! code = xfs_iget(vfstom(vfsp), (void*)0, (xfs_ino_t)inode, XFS_ILOCK_SHARED, &ip, (daddr_t)0); if (code) return code; --- 1168,1175 ---- inode = inode_hi; inode <<= 32; inode |= inode_lo; ! code = xfs_iget((((struct mount *)((vfsp)->vfs_bh.bh_first)->bd_pdata)), ! (void*)0, (xfs_ino_t)inode, XFS_ILOCK_SHARED, &ip, (daddr_t)0); if (code) return code; Index: openafs/src/afs/IRIX/osi_vnodeops.c diff -c openafs/src/afs/IRIX/osi_vnodeops.c:1.2 openafs/src/afs/IRIX/osi_vnodeops.c:1.2.2.1 *** openafs/src/afs/IRIX/osi_vnodeops.c:1.2 Sat Nov 4 05:03:23 2000 --- openafs/src/afs/IRIX/osi_vnodeops.c Tue Mar 6 16:13:59 2001 *************** *** 10,16 **** /* * SGI specific vnodeops + other misc interface glue */ ! #ident "$Revision: 1.2 $" #include "../afs/param.h" /* Should be always first */ #ifdef AFS_SGI62_ENV --- 10,16 ---- /* * SGI specific vnodeops + other misc interface glue */ ! #ident "$Revision: 1.2.2.1 $" #include "../afs/param.h" /* Should be always first */ #ifdef AFS_SGI62_ENV *************** *** 1829,1834 **** --- 1829,1835 ---- inited = 1; + #ifdef AFS_SGI_EFS_IOPS_ENV swp = vfs_getvfssw("efs"); if (swp) { afs_efs_vnodeopsp = swp->vsw_vnodeops; *************** *** 1838,1843 **** --- 1839,1845 ---- found = 1; } } + #endif /* AFS_SGI_EFS_IOPS_ENV */ swp = vfs_getvfssw("xfs"); if (swp) { Index: openafs/src/afs/LINUX/osi_file.c diff -c openafs/src/afs/LINUX/osi_file.c:1.4.2.1 openafs/src/afs/LINUX/osi_file.c:1.4.2.2 *** openafs/src/afs/LINUX/osi_file.c:1.4.2.1 Fri Jan 19 04:29:39 2001 --- openafs/src/afs/LINUX/osi_file.c Tue Mar 6 16:08:27 2001 *************** *** 104,136 **** return 0; } - #if defined(AFS_LINUX24_ENV) - int osi_notify_change(struct dentry * dentry, struct iattr * attr) - { - struct inode *inode = dentry->d_inode; - int error; - time_t now = CURRENT_TIME; - unsigned int ia_valid = attr->ia_valid; - - attr->ia_ctime = now; - if (!(ia_valid & ATTR_ATIME_SET)) - attr->ia_atime = now; - if (!(ia_valid & ATTR_MTIME_SET)) - attr->ia_mtime = now; - - lock_kernel(); - if (inode && inode->i_op && inode->i_op->setattr) - error = inode->i_op->setattr(dentry, attr); - else { - error = inode_change_ok(inode, attr); - if (!error) - inode_setattr(inode, attr); - } - unlock_kernel(); - return error; - } - #endif - osi_UFSTruncate(afile, asize) register struct osi_file *afile; afs_int32 asize; { --- 104,109 ---- *************** *** 150,162 **** MObtainWriteLock(&afs_xosi,321); AFS_GUNLOCK(); down(&inode->i_sem); - #if defined(AFS_LINUX24_ENV) - newattrs.ia_size = asize; - newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; - code = osi_notify_change(&afile->dentry, &newattrs); - #else inode->i_size = newattrs.ia_size = asize; newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) { code = inode->i_sb->s_op->notify_change(&afile->dentry, &newattrs); } --- 123,140 ---- MObtainWriteLock(&afs_xosi,321); AFS_GUNLOCK(); down(&inode->i_sem); inode->i_size = newattrs.ia_size = asize; newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; + #if defined(AFS_LINUX24_ENV) + newattrs.ia_ctime = CURRENT_TIME; + + /* avoid notify_change() since it wants to update dentry->d_parent */ + lock_kernel(); + code = inode_change_ok(inode, &newattrs); + if (!code) + inode_setattr(inode, &newattrs); + unlock_kernel(); + #else if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) { code = inode->i_sb->s_op->notify_change(&afile->dentry, &newattrs); } Index: openafs/src/afs/LINUX/osi_misc.c diff -c openafs/src/afs/LINUX/osi_misc.c:1.3.2.1 openafs/src/afs/LINUX/osi_misc.c:1.3.2.2 *** openafs/src/afs/LINUX/osi_misc.c:1.3.2.1 Fri Jan 19 04:29:39 2001 --- openafs/src/afs/LINUX/osi_misc.c Tue Mar 6 16:08:27 2001 *************** *** 15,20 **** --- 15,23 ---- #include "../afs/sysincludes.h" #include "../afs/afsincludes.h" #include "../afs/afs_stats.h" + #if defined(AFS_LINUX24_ENV) + #include "../h/smp_lock.h" + #endif char *crash_addr = 0; /* Induce an oops by writing here. */ *************** *** 313,328 **** } } /* iput an inode. Since we still have a separate inode pool, we don't want * to call iput on AFS inodes, since they would then end up on Linux's * inode_unsed list. */ void osi_iput(struct inode *ip) { - extern void afs_delete_inode(struct inode *ip); extern struct vfs *afs_globalVFS; ! #if defined(AFS_LINUX24_ENV) if (atomic_read(&ip->i_count) == 0 || atomic_read(&ip->i_count) & 0xffff0000) { #else --- 316,352 ---- } } + void osi_clear_inode(struct inode *ip) + { + cred_t *credp = crref(); + struct vcache *vc = (struct vcache*)ip; + + #if defined(AFS_LINUX24_ENV) + if (atomic_read(&ip->i_count) > 1) + #else + if (ip->i_count > 1) + #endif + printf("afs_put_inode: ino %d (0x%x) has count %d\n", ip->i_ino, ip); + + afs_InactiveVCache(vc, credp); + #if defined(AFS_LINUX24_ENV) + atomic_set(&ip->i_count, 0); + #else + ip->i_count = 0; + #endif + ip->i_nlink = 0; /* iput checks this after calling this routine. */ + crfree(credp); + } + /* iput an inode. Since we still have a separate inode pool, we don't want * to call iput on AFS inodes, since they would then end up on Linux's * inode_unsed list. */ void osi_iput(struct inode *ip) { extern struct vfs *afs_globalVFS; ! AFS_GLOCK(); #if defined(AFS_LINUX24_ENV) if (atomic_read(&ip->i_count) == 0 || atomic_read(&ip->i_count) & 0xffff0000) { #else *************** *** 343,351 **** ip->i_count --; if (!ip->i_count) #endif ! afs_delete_inode(ip); } else { iput(ip); } } --- 367,377 ---- ip->i_count --; if (!ip->i_count) #endif ! osi_clear_inode(ip); ! AFS_GUNLOCK(); } else { + AFS_GUNLOCK(); iput(ip); } } Index: openafs/src/afs/LINUX/osi_vfs.h diff -c openafs/src/afs/LINUX/osi_vfs.h:1.3.2.1 openafs/src/afs/LINUX/osi_vfs.h:1.3.2.3 *** openafs/src/afs/LINUX/osi_vfs.h:1.3.2.1 Fri Jan 19 04:39:16 2001 --- openafs/src/afs/LINUX/osi_vfs.h Tue Mar 6 16:13:11 2001 *************** *** 36,42 **** uid_t i_uid; gid_t i_gid; kdev_t i_rdev; ! #if defined(AFS_LINUX24_ENV) loff_t i_size; #else off_t i_size; --- 36,42 ---- uid_t i_uid; gid_t i_gid; kdev_t i_rdev; ! #if defined(AFS_LINUX24_ENV) || defined(pgoff2loff) loff_t i_size; #else off_t i_size; Index: openafs/src/afs/LINUX/osi_vfsops.c diff -c openafs/src/afs/LINUX/osi_vfsops.c:1.3.2.1 openafs/src/afs/LINUX/osi_vfsops.c:1.3.2.2 *** openafs/src/afs/LINUX/osi_vfsops.c:1.3.2.1 Fri Jan 19 04:39:16 2001 --- openafs/src/afs/LINUX/osi_vfsops.c Tue Mar 6 16:08:27 2001 *************** *** 231,266 **** * If we use the common inode pool, we'll need to set i_nlink to 0 here. * That will trigger the call to delete routine. */ void afs_delete_inode(struct inode *ip) { - cred_t *credp = crref(); struct vcache *vc = (struct vcache*)ip; AFS_GLOCK(); - #if defined(AFS_LINUX24_ENV) - lock_kernel(); - if (atomic_read(&ip->i_count) > 1) - #else - if (ip->i_count > 1) - #endif - printf("afs_put_inode: ino %d (0x%x) has count %d\n", ip->i_ino, ip); - ObtainWriteLock(&vc->lock, 504); ! afs_InactiveVCache(vc, credp); ! #if defined(AFS_LINUX24_ENV) ! atomic_set(&ip->i_count, 0); ! #else ! ip->i_count = 0; ! #endif ! ip->i_nlink = 0; /* iput checks this after calling this routine. */ ReleaseWriteLock(&vc->lock); - - #ifdef AFS_LINUX24_ENV - unlock_kernel(); - #endif AFS_GUNLOCK(); - crfree(credp); } /* afs_put_super * Called from unmount to release super_block. */ --- 231,248 ---- * If we use the common inode pool, we'll need to set i_nlink to 0 here. * That will trigger the call to delete routine. */ + void afs_delete_inode(struct inode *ip) { struct vcache *vc = (struct vcache*)ip; AFS_GLOCK(); ObtainWriteLock(&vc->lock, 504); ! osi_clear_inode(ip); ReleaseWriteLock(&vc->lock); AFS_GUNLOCK(); } + /* afs_put_super * Called from unmount to release super_block. */ Index: openafs/src/afs/LINUX/osi_vnodeops.c diff -c openafs/src/afs/LINUX/osi_vnodeops.c:1.6.2.2 openafs/src/afs/LINUX/osi_vnodeops.c:1.6.2.4 *** openafs/src/afs/LINUX/osi_vnodeops.c:1.6.2.2 Fri Jan 19 04:39:17 2001 --- openafs/src/afs/LINUX/osi_vnodeops.c Tue Mar 6 16:08:27 2001 *************** *** 30,35 **** --- 30,41 ---- #include "../h/smp_lock.h" #endif + #ifdef pgoff2loff + #define pageoff(pp) pgoff2loff((pp)->index) + #else + #define pageoff(pp) pp->offset + #endif + extern struct vcache *afs_globalVp; extern struct dentry_operations *afs_dops; *************** *** 709,735 **** /* afs_dentry_iput */ static void afs_dentry_iput(struct dentry *dp, struct inode *ip) { ! #if defined(AFS_LINUX24_ENV) ! if (atomic_read(&ip->i_count) == 0 || atomic_read(&ip->i_count) & 0xffff0000) { ! #else ! if (ip->i_count == 0 || ip->i_count & 0xffff0000) { ! #endif ! osi_Panic("Bad refCount %d on inode 0x%x\n", ! #if defined(AFS_LINUX24_ENV) ! atomic_read(&ip->i_count), ip); ! #else ! ip->i_count, ip); ! #endif ! } ! #if defined(AFS_LINUX24_ENV) ! atomic_dec(&ip->i_count); ! if (!atomic_read(&ip->i_count)) { ! #else ! ip->i_count --; ! if (!ip->i_count) { ! #endif ! afs_delete_inode(ip); ! } } #if defined(AFS_LINUX24_ENV) --- 715,721 ---- /* afs_dentry_iput */ static void afs_dentry_iput(struct dentry *dp, struct inode *ip) { ! osi_iput(ip); } #if defined(AFS_LINUX24_ENV) *************** *** 1137,1150 **** setup_uio(&tuio, &iovec, (char*)address, pp->index << PAGE_CACHE_SHIFT, PAGESIZE, UIO_READ, AFS_UIOSYS); #else ! setup_uio(&tuio, &iovec, (char*)address, pp->offset, PAGESIZE, UIO_READ, AFS_UIOSYS); #endif ! #ifdef AFS_LINUX24_ENV lock_kernel(); #endif code = afs_rdwr((struct vcache*)ip, &tuio, UIO_READ, 0, credp); ! #ifdef AFS_LINUX24_ENV unlock_kernel(); #endif --- 1123,1136 ---- setup_uio(&tuio, &iovec, (char*)address, pp->index << PAGE_CACHE_SHIFT, PAGESIZE, UIO_READ, AFS_UIOSYS); #else ! setup_uio(&tuio, &iovec, (char*)address, pageoff(pp), PAGESIZE, UIO_READ, AFS_UIOSYS); #endif ! #if defined(AFS_LINUX24_ENV) lock_kernel(); #endif code = afs_rdwr((struct vcache*)ip, &tuio, UIO_READ, 0, credp); ! #if defined(AFS_LINUX24_ENV) unlock_kernel(); #endif *************** *** 1153,1158 **** --- 1139,1147 ---- memset((void*)(address+(PAGESIZE-tuio.uio_resid)), 0, tuio.uio_resid); #if defined(AFS_LINUX24_ENV) + #ifndef __powerpc__ + flush_dcache_page(pp); + #endif SetPageUptodate(pp); #else set_bit(PG_uptodate, &pp->flags); *************** *** 1163,1170 **** UnlockPage(pp); #else clear_bit(PG_locked, &pp->flags); - #endif wake_up(&pp->wait); free_page(address); crfree(credp); --- 1152,1159 ---- UnlockPage(pp); #else clear_bit(PG_locked, &pp->flags); wake_up(&pp->wait); + #endif free_page(address); crfree(credp); *************** *** 1198,1204 **** --- 1187,1195 ---- if (pp->index >= end_index+1 || !offset) return -EIO; do_it: + AFS_GLOCK(); status = afs_linux_writepage_sync(inode, pp, 0, offset); + AFS_GUNLOCK(); SetPageUptodate(pp); UnlockPage(pp); /* kunmap(pp); */ *************** *** 1262,1269 **** int f_flags = 0; credp = crref(); - AFS_GLOCK(); - lock_kernel(); afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp, ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, atomic_read(&pp->count), --- 1253,1258 ---- *************** *** 1282,1289 **** ICL_TYPE_INT32, atomic_read(&pp->count), ICL_TYPE_INT32, code); - unlock_kernel(); - AFS_GUNLOCK(); crfree(credp); return code; --- 1271,1276 ---- *************** *** 1322,1328 **** ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, atomic_read(&pp->count), ICL_TYPE_INT32, 99999); ! setup_uio(&tuio, &iovec, page_addr + offset, pp->offset + offset, count, UIO_WRITE, AFS_UIOSYS); code = afs_write(vcp, &tuio, fp->f_flags, credp, 0); --- 1309,1315 ---- ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, atomic_read(&pp->count), ICL_TYPE_INT32, 99999); ! setup_uio(&tuio, &iovec, page_addr + offset, pageoff(pp) + offset, count, UIO_WRITE, AFS_UIOSYS); code = afs_write(vcp, &tuio, fp->f_flags, credp, 0); *************** *** 1348,1356 **** { long status; ! /* lock_kernel(); */ status = afs_linux_updatepage(file, page, offset, to-offset); ! /* unlock_kernel(); */ kunmap(page); return status; --- 1335,1345 ---- { long status; ! AFS_GLOCK(); ! lock_kernel(); status = afs_linux_updatepage(file, page, offset, to-offset); ! unlock_kernel(); ! AFS_GUNLOCK(); kunmap(page); return status; Index: openafs/src/afs/SOLARIS/osi_vnodeops.c diff -c openafs/src/afs/SOLARIS/osi_vnodeops.c:1.2.2.1 openafs/src/afs/SOLARIS/osi_vnodeops.c:1.2.2.2 *** openafs/src/afs/SOLARIS/osi_vnodeops.c:1.2.2.1 Fri Jan 19 04:51:43 2001 --- openafs/src/afs/SOLARIS/osi_vnodeops.c Tue Mar 6 17:23:00 2001 *************** *** 560,569 **** /* * Putpage (ASYNC) is called every sec to flush out dirty vm pages */ - if (flags == B_ASYNC) { - /* XXX For testing only XXX */ - return (EINVAL); - } AFS_GLOCK(); afs_Trace4(afs_iclSetp, CM_TRACE_PAGEOUT, ICL_TYPE_POINTER, (afs_int32) vp, ICL_TYPE_LONG, (afs_int32) off, ICL_TYPE_LONG, (afs_int32) len, --- 560,565 ---- Index: openafs/src/afs/VNOPS/afs_vnop_lookup.c diff -c openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.3.2.1 openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.3.2.2 *** openafs/src/afs/VNOPS/afs_vnop_lookup.c:1.3.2.1 Fri Jan 19 04:29:42 2001 --- openafs/src/afs/VNOPS/afs_vnop_lookup.c Tue Mar 6 17:18:24 2001 *************** *** 127,133 **** volnamep = &avc->linkData[1]; tcell = afs_GetCell(avc->fid.Cell, READ_LOCK); } ! if (!tcell) return ENODEV; mtptCell = tcell->cell; /* The cell for the mountpoint */ if (tcell->lcellp) { --- 127,133 ---- volnamep = &avc->linkData[1]; tcell = afs_GetCell(avc->fid.Cell, READ_LOCK); } ! if (!tcell) return ENOENT; mtptCell = tcell->cell; /* The cell for the mountpoint */ if (tcell->lcellp) { *************** *** 182,188 **** } } ! if (!tvp) return ENOENT; /* Couldn't find the volume */ /* Don't cross mountpoint from a BK to a BK volume */ if ((avc->states & CBackup) && (tvp->states & VBackup)) { --- 182,188 ---- } } ! if (!tvp) return ENODEV; /* Couldn't find the volume */ /* Don't cross mountpoint from a BK to a BK volume */ if ((avc->states & CBackup) && (tvp->states & VBackup)) { *************** *** 198,204 **** tfid.Cell = tvp->cell; afs_PutVolume(tvp, WRITE_LOCK); /* release old volume */ tvp = afs_GetVolume(&tfid, areq, WRITE_LOCK); /* get the new one */ ! if (!tvp) return ENOENT; /* oops, can't do it */ } if (avc->mvid == 0) --- 198,204 ---- tfid.Cell = tvp->cell; afs_PutVolume(tvp, WRITE_LOCK); /* release old volume */ tvp = afs_GetVolume(&tfid, areq, WRITE_LOCK); /* get the new one */ ! if (!tvp) return ENODEV; /* oops, can't do it */ } if (avc->mvid == 0) *************** *** 1162,1167 **** --- 1162,1173 ---- ObtainWriteLock(&tvc->lock,133); code = EvalMountPoint(tvc, adp, &tvolp, &treq); ReleaseWriteLock(&tvc->lock); + + if (code) { + if (tvolp) afs_PutVolume(tvolp, WRITE_LOCK); + goto done; + } + /* next, we want to continue using the target of the mt point */ if (tvc->mvid && (tvc->states & CMValid)) { struct vcache *uvc; Index: openafs/src/afs/VNOPS/afs_vnop_readdir.c diff -c openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.2.2.2 openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.2.2.3 *** openafs/src/afs/VNOPS/afs_vnop_readdir.c:1.2.2.2 Fri Jan 19 04:29:43 2001 --- openafs/src/afs/VNOPS/afs_vnop_readdir.c Tue Mar 6 16:12:26 2001 *************** *** 641,651 **** } #else /* AFS_HPUX_ENV */ code = afs_readdir_move(ode, avc, auio, o_slen, - #if defined(AFS_SUN5_ENV) - len, origOffset); - #else auio->afsio_resid, origOffset); - #endif #endif /* AFS_HPUX_ENV */ /* this next line used to be AFSVFS40 or AIX 3.1, but is * really generic */ --- 641,647 ---- Index: openafs/src/afs/VNOPS/afs_vnop_write.c diff -c openafs/src/afs/VNOPS/afs_vnop_write.c:1.2 openafs/src/afs/VNOPS/afs_vnop_write.c:1.2.2.1 *** openafs/src/afs/VNOPS/afs_vnop_write.c:1.2 Sat Nov 4 05:03:32 2000 --- openafs/src/afs/VNOPS/afs_vnop_write.c Tue Mar 6 16:24:09 2001 *************** *** 639,645 **** #if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) && !defined (AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) ! #ifdef AFS_DUX40_ENV #define vno_close vn_close #endif /* We don't need this for AIX since: --- 639,647 ---- #if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) && !defined (AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) ! #ifdef AFS_DUX50_ENV ! #define vno_close(X) vn_close((X), 0, NOCRED) ! #elif defined(AFS_DUX40_ENV) #define vno_close vn_close #endif /* We don't need this for AIX since: Index: openafs/src/afsd/afs.rc.solaris.2.7 diff -c openafs/src/afsd/afs.rc.solaris.2.7:1.2 openafs/src/afsd/afs.rc.solaris.2.7:1.2.2.1 *** openafs/src/afsd/afs.rc.solaris.2.7:1.2 Sat Nov 4 05:03:33 2000 --- openafs/src/afsd/afs.rc.solaris.2.7 Tue Mar 6 16:09:23 2001 *************** *** 1,11 **** - \." Copyright 2000, International Business Machines Corporation and others. - \." All Rights Reserved. - \." - \." This software has been released under the terms of the IBM Public - \." License. For details, see the LICENSE file in the top-level source - \." directory or online at http://www.openafs.org/dl/license10.html - \." #!/bin/sh # # afs.rc: rc script for AFS on Solaris 2.x platforms # --- 1,11 ---- #!/bin/sh + # + # Copyright 2000, International Business Machines Corporation and others. + # All Rights Reserved. + # + # This software has been released under the terms of the IBM Public + # License. For details, see the LICENSE file in the top-level source + # directory or online at http://www.openafs.org/dl/license10.html # # afs.rc: rc script for AFS on Solaris 2.x platforms # Index: openafs/src/afsd/afsd.c diff -c openafs/src/afsd/afsd.c:1.3 openafs/src/afsd/afsd.c:1.3.2.1 *** openafs/src/afsd/afsd.c:1.3 Sun Nov 5 23:24:09 2000 --- openafs/src/afsd/afsd.c Tue Mar 6 17:30:07 2001 *************** *** 1026,1033 **** --- 1026,1035 ---- sprintf(fullpn_VFile, "%s/V", cacheBaseDir); vFileNumber = fullpn_VFile + strlen(fullpn_VFile); + #if 0 fputs(AFS_GOVERNMENT_MESSAGE, stdout); fflush(stdout); + #endif /* * Set up all the kernel processes needed for AFS. Index: openafs/src/audit/audit.h diff -c openafs/src/audit/audit.h:1.2 openafs/src/audit/audit.h:1.2.2.1 *** openafs/src/audit/audit.h:1.2 Sat Nov 4 05:03:54 2000 --- openafs/src/audit/audit.h Tue Mar 6 16:44:57 2001 *************** *** 16,21 **** --- 16,25 ---- #define AUD_DATE 6 /* date (unsigned long) */ #define AUD_FID 7 /* File ID */ #define AUD_FIDS 8 /* array of Fids */ + /* next 3 lines on behalf of MR-AFS */ + #define AUD_RESID 20 /* resid in variable list */ + #define AUD_RSSIZERANGE 21 /* rssizerange in variable list */ + #define AUD_LOOKUPINFO 22 /* LookupInfo in variable list */ /* * Note: the master definitions of these error codes come from *.et *************** *** 62,67 **** --- 66,74 ---- #define VS_MonitorEvent "AFS_VS_Monitor" #define VS_SetIdTyEvent "AFS_VS_SetIdTy" #define VS_SetDateEvent "AFS_VS_SetDate" + /* Next 2 lines on behalf of MR-AFS */ + #define VS_SelectiveDumpEvent "AFS_VS_DmpSelct" + #define VS_ListVolumeResidencyInfoEvent "AFS_VS_LstVInfo" #define PTS_StartEvent "AFS_PTS_Start" #define PTS_FinishEvent "AFS_PTS_Finish" *************** *** 168,173 **** --- 175,186 ---- #define FlushCPSEvent "AFS_SRX_FlusCPS" #define PrivilegeEvent "AFS_Priv" #define PrivSetID "AFS_PrivSet" + /* Next 5 lines on behalf of MR-AFS */ + #define GetResidenciesEvent "AFS_SRX_GetR" + #define ChangeResidenciesEvent "AFS_SRX_ChgR" + #define ImportResidenciesEvent "AFS_SRX_Import" + #define GetExtendedVolumeAttributesEvent "AFS_SRX_GetVA" + #define SetExtendedVolumeAttributesEvent "AFS_SRX_SetVA" #define NoAuthEvent "AFS_RunNoAuth" #define NoAuthDisableEvent "AFS_NoAuthDsbl" *************** *** 213,218 **** --- 226,282 ---- #define VLSetLockEvent "AFS_VL_SetLck" #define VLReleaseLockEvent "AFS_VL_RelLck" #define VLChangeAddrEvent "AFS_VL_ChgAdd" + + /* Next 2 block of lines on behalf of MR-AFS */ + #define RSStartEvent "AFS_RS_StartEnt" + #define RSFinishEvent "AFS_RS_FnshEnt" + #define RSExitEvent "AFS_RS_ExitEnt" + #define RSChangeAddr "AFS_RS_ChgAddr" + #define RSChangeName "AFS_RS_ChgName" + #define RSNewEntry "AFS_RS_NewEntry" + #define RSAddResidencyToServer "AFS_RS_AddRToS" + #define RSRemoveResidencyFromServer "AFS_RS_RemRFS" + #define RSNameToResId "AFS_RS_NameToId" + #define RSResIdToName "AFS_RS_IdToName" + #define RSDelete "AFS_RS_Delete" + #define RSListMax "AFS_RS_ListMax" + #define RSSetMax "AFS_RS_SetMax" + #define RSListEntry "AFS_RS_ListEnt" + #define RSSetFieldsEntry "AFS_RS_SetEnt" + #define RSListElements "AFS_RS_ListElm" + #define RSIsAHolderOf "AFS_RS_IsAHold" + #define RSChooseResidency "AFS_RS_ChooseR" + #define RSSwapAllocatedSpace "AFS_RS_SwapSpc" + #define RSQuickCheck "AFS_RS_QuickChk" + #define RSResidencyWipeableInfo "AFS_RS_WipeInfo" + #define RSGetResidencySummary "AFS_RS_GetRSum" + #define RSGetWiperFreeSpaceFraction "AFS_RS_GetFSpc" + #define RSRegisterAddrs "AFS_RS_Regist" + #define RSGetAddrsU "AFS_RS_GetAddrU" + #define RSSetWeights "AFS_RS_SetWght" + #define RSGetWeights "AFS_RS_GetWght" + #define RSSetThresholds "AFS_RS_SetThrsh" + #define RSGetThresholds "AFS_RS_GetThrsh" + #define RSListResidencies "AFS_RS_ListRes" + #define RSListServers "AFS_RS_ListServ" + #define RSGetRandom "AFS_RS_GetRandm" + + #define REMIOExitEvent "AFS_RE_ExitEnt" + #define SREMIOGetConnection "AFS_RE_GetConn" + #define SREMIORemoteIncDec "AFS_RE_IncDec" + #define SREMIOBulkIncDec "AFS_RE_BlkIDec" + #define SREMIORemoteStat "AFS_RE_Stat" + #define SREMIORemoteCloseIfOpen "AFS_RE_Close" + #define SREMIORemoteOpen "AFS_RE_Open" + #define SREMIORemoteSeek "AFS_RE_Seek" + #define SREMIORemoteRead "AFS_RE_Read" + #define SREMIORemoteWrite "AFS_RE_Write" + #define SREMIORemoteListFiles "AFS_RE_LstFiles" + #define SREMIORemoteTruncate "AFS_RE_Truncate" + #define SREMIORemoteFsyncFile "AFS_RE_Fsync" + #define SREMIORemoteImportFile "AFS_RE_Import" + #define SREMIORemoteGetHSMdata "AFS_RE_HSMdata" + #define SREMIOPrefetch "AFS_RE_Prefetch" /* prototypes for audit functions */ Index: openafs/src/auth/cellconfig.c diff -c openafs/src/auth/cellconfig.c:1.2.2.1 openafs/src/auth/cellconfig.c:1.2.2.3 *** openafs/src/auth/cellconfig.c:1.2.2.1 Wed Dec 13 16:49:19 2000 --- openafs/src/auth/cellconfig.c Tue Mar 6 16:49:50 2001 *************** *** 55,60 **** --- 55,62 ---- "afsnanny", 7007, "afsupdate",7008, "afsrmtsys",7009, + "afsres", 7010, /* residency database for MR-AFS */ + "afsremio", 7011, /* remote I/O interface for MR-AFS */ 0, 0 /* insert new services before this spot */ }; *************** *** 216,222 **** tdir->name = (char *) malloc(strlen(adir)+1); strcpy(tdir->name, adir); ! code = afsconf_OpenInternal(tdir); if (code) { char *afsconf_path, *getenv(), afs_confdir[128]; --- 218,224 ---- tdir->name = (char *) malloc(strlen(adir)+1); strcpy(tdir->name, adir); ! code = afsconf_OpenInternal(tdir, 0, 0); if (code) { char *afsconf_path, *getenv(), afs_confdir[128]; *************** *** 270,276 **** } tdir->name = (char *) malloc(strlen(afsconf_path)+1); strcpy(tdir->name, afsconf_path); ! code = afsconf_OpenInternal(tdir); if (code) { free(tdir->name); free(tdir); --- 272,278 ---- } tdir->name = (char *) malloc(strlen(afsconf_path)+1); strcpy(tdir->name, afsconf_path); ! code = afsconf_OpenInternal(tdir, 0, 0); if (code) { free(tdir->name); free(tdir); *************** *** 320,327 **** #endif /* AFS_NT40_ENV */ ! static int afsconf_OpenInternal(adir) ! register struct afsconf_dir *adir; { FILE *tf; register char *tp, *bp; register struct afsconf_entry *curEntry; --- 322,332 ---- #endif /* AFS_NT40_ENV */ ! static int afsconf_OpenInternal(adir, cell, clones) ! register struct afsconf_dir *adir; ! char *cell; ! char clones[]; ! { FILE *tf; register char *tp, *bp; register struct afsconf_entry *curEntry; *************** *** 407,413 **** return -1; } i = curEntry->cellInfo.numServers; ! code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i]); if (code) { if (code == AFSCONF_SYNTAX) { for (bp=tbuffer; *bp != '\n'; bp++) { /* Take out the from the buffer */ --- 412,421 ---- return -1; } i = curEntry->cellInfo.numServers; ! if (cell && !strcmp(cell, curEntry->cellInfo.name)) ! code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i], &clones[i]); ! else ! code = ParseHostLine(tbuffer, (char *) &curEntry->cellInfo.hostAddr[i], curEntry->cellInfo.hostName[i], 0); if (code) { if (code == AFSCONF_SYNTAX) { for (bp=tbuffer; *bp != '\n'; bp++) { /* Take out the from the buffer */ *************** *** 440,456 **** } /* parse a line of the form ! *"128.2.1.3 #hostname" * into the appropriate pieces. */ ! static ParseHostLine(aline, addr, aname) ! register struct sockaddr_in *addr; ! char *aline, *aname; { int c1, c2, c3, c4; register afs_int32 code; register char *tp; ! code = sscanf(aline, "%d.%d.%d.%d #%s", &c1, &c2, &c3, &c4, aname); if (code != 5) return AFSCONF_SYNTAX; addr->sin_family = AF_INET; addr->sin_port = 0; --- 448,473 ---- } /* parse a line of the form ! *"128.2.1.3 #hostname" or ! *"[128.2.1.3] #hostname" for clones * into the appropriate pieces. */ ! static ParseHostLine(aline, addr, aname, aclone) ! char *aclone; ! register struct sockaddr_in *addr; ! char *aline, *aname; ! { int c1, c2, c3, c4; register afs_int32 code; register char *tp; ! if (*aline == '[') { ! if (aclone) *aclone = 1; ! code = sscanf(aline, "[%d.%d.%d.%d] #%s", &c1, &c2, &c3, &c4, aname); ! } else { ! if (aclone) *aclone = 0; ! code = sscanf(aline, "%d.%d.%d.%d #%s", &c1, &c2, &c3, &c4, aname); ! } if (code != 5) return AFSCONF_SYNTAX; addr->sin_family = AF_INET; addr->sin_port = 0; *************** *** 499,504 **** --- 516,545 ---- } afs_int32 afsconf_SawCell = 0; + + afsconf_GetExtendedCellInfo(adir, acellName, aservice, acellInfo, clones) + struct afsconf_dir *adir; + char *aservice; + char *acellName; + struct afsconf_cell *acellInfo; + char clones[]; + { + afs_int32 code; + char *cell; + + code = afsconf_GetCellInfo(adir, acellName, aservice, acellInfo); + if (code) + return code; + + if (acellName) + cell = acellName; + else + cell = (char *) &acellInfo->name; + + code = afsconf_OpenInternal(adir, cell, clones); + return code; + } + afsconf_GetCellInfo(adir, acellName, aservice, acellInfo) struct afsconf_dir *adir; char *aservice; *************** *** 518,525 **** tcell = acellName; cnLen = strlen(tcell)+1; lcstring (tcell, tcell, cnLen); ! afsconf_SawCell = 1; /* will ignore the AFSCELL switch on future */ ! /* call to afsconf_GetLocalCell: like klog */ } else { i = afsconf_GetLocalCell(adir, tbuffer, sizeof(tbuffer)); if (i) { --- 559,566 ---- tcell = acellName; cnLen = strlen(tcell)+1; lcstring (tcell, tcell, cnLen); ! afsconf_SawCell = 1; /* will ignore the AFSCELL switch on future */ ! /* call to afsconf_GetLocalCell: like klog */ } else { i = afsconf_GetLocalCell(adir, tbuffer, sizeof(tbuffer)); if (i) { *************** *** 641,647 **** register afs_int32 code; code = afsconf_CloseInternal(adir); if (code) return code; ! code = afsconf_OpenInternal(adir); return code; } --- 682,688 ---- register afs_int32 code; code = afsconf_CloseInternal(adir); if (code) return code; ! code = afsconf_OpenInternal(adir, 0, 0); return code; } Index: openafs/src/auth/cellconfig.p.h diff -c openafs/src/auth/cellconfig.p.h:1.2 openafs/src/auth/cellconfig.p.h:1.2.2.1 *** openafs/src/auth/cellconfig.p.h:1.2 Sat Nov 4 05:03:55 2000 --- openafs/src/auth/cellconfig.p.h Tue Mar 6 16:46:24 2001 *************** *** 111,115 **** --- 111,119 ---- #define AFSCONF_UPDATEPORT 7008 #define AFSCONF_RMTSYSSERVICE "afsrmtsys" #define AFSCONF_RMTSYSPORT 7009 + #define AFSCONF_RSDBSERVICE "afsres" + #define AFSCONF_RESPORT 7010 + #define AFSCONF_REMIODBSERVICE "afsremio" + #define AFSCONF_REMIOPORT 7011 #endif /* __CELLCONFIG_AFS_INCL_ */ Index: openafs/src/auth/ktc.c diff -c openafs/src/auth/ktc.c:1.2 openafs/src/auth/ktc.c:1.2.2.1 *** openafs/src/auth/ktc.c:1.2 Sat Nov 4 05:03:55 2000 --- openafs/src/auth/ktc.c Tue Mar 6 17:11:38 2001 *************** *** 83,89 **** #define TKT_FIL_ACC 77 /* Couldn't access tkt file */ #define TKT_FIL_LCK 78 /* Couldn't lock ticket file */ #define TKT_FIL_FMT 79 /* Bad ticket file format */ ! #define TKT_FIL_INI 80 /* tf_init not called first */ /* Values returned by get_credentials */ #define RET_TKFIL 21 /* Can't read ticket file */ --- 83,89 ---- #define TKT_FIL_ACC 77 /* Couldn't access tkt file */ #define TKT_FIL_LCK 78 /* Couldn't lock ticket file */ #define TKT_FIL_FMT 79 /* Bad ticket file format */ ! #define TKT_FIL_INI 80 /* afs_tf_init not called first */ /* Values returned by get_credentials */ #define RET_TKFIL 21 /* Can't read ticket file */ *************** *** 110,118 **** #define EOF (-1) #endif ! static int tf_init(), tf_get_pname(), tf_get_pinst(), tf_get_cred(), tf_save_cred(); ! static int tf_close(); ! static int tf_create(), tf_dest_tkt(), ktc_LocalCell(); char *ktc_tkt_string(); #endif /* AFS_KERBEROS_ENV */ --- 110,121 ---- #define EOF (-1) #endif ! /* the following routines aren't static anymore on behalf of the kerberos IV ! * compatibility library built in subtree krb. ! */ ! int afs_tf_init(), afs_tf_get_pname(), afs_tf_get_pinst(), afs_tf_get_cred(); ! int afs_tf_save_cred(), afs_tf_close(), afs_tf_create(); ! int afs_tf_dest_tkt(), ktc_LocalCell(); char *ktc_tkt_string(); #endif /* AFS_KERBEROS_ENV */ *************** *** 357,363 **** --- 360,380 ---- iob.out = tbuffer; iob.out_size = sizeof(tbuffer); + #if defined(NO_AFS_CLIENT) + { int fd; /* DEBUG */ + char *tkfile; + if ((tkfile=getenv("TKTFILE")) && + ((fd=open(tkfile, O_WRONLY|O_APPEND|O_TRUNC|O_CREAT, 0644)) >= 0)) { + printf("Writing ticket to: %s\n", tkfile); + code = (write(fd, iob.in, iob.in_size) != iob.in_size); + close(fd); + } + else + code = KTC_PIOCTLFAIL; + } + #else /* NO_AFS_CLIENT */ code = PIOCTL(0, VIOCSETTOK, &iob, 0); + #endif /* NO_AFS_CLIENT */ if (code) return KTC_PIOCTLFAIL; return 0; } *************** *** 383,405 **** if (!lrealm[0]) ucstring(lrealm, lcell, MAXKTCREALMLEN); if (strcmp(aserver->instance, lrealm) == 0) { ! tf_create(aclient->name, aclient->instance); } } ! ncode = tf_init(ktc_tkt_string(), W_TKT_FIL); if (ncode == NO_TKT_FIL) { ! (void) tf_create(aclient->name, aclient->instance); ! ncode = tf_init(ktc_tkt_string(), W_TKT_FIL); } if (!ncode) { ! tf_save_cred(aserver, atoken, aclient); } ! tf_close(); } #endif ncode = NewSetToken (aserver, atoken, aclient, flags); if (ncode || /* new style failed */ (strcmp (aserver->name, "afs") == 0)) { /* for afs tokens do both */ --- 400,427 ---- if (!lrealm[0]) ucstring(lrealm, lcell, MAXKTCREALMLEN); if (strcmp(aserver->instance, lrealm) == 0) { ! afs_tf_create(aclient->name, aclient->instance); } } ! ncode = afs_tf_init(ktc_tkt_string(), W_TKT_FIL); if (ncode == NO_TKT_FIL) { ! (void) afs_tf_create(aclient->name, aclient->instance); ! ncode = afs_tf_init(ktc_tkt_string(), W_TKT_FIL); } if (!ncode) { ! afs_tf_save_cred(aserver, atoken, aclient); } ! afs_tf_close(); ! #ifdef NO_AFS_CLIENT ! UNLOCK_GLOBAL_MUTEX ! return ncode; ! #endif /* NO_AFS_CLIENT */ } #endif + #ifndef NO_AFS_CLIENT ncode = NewSetToken (aserver, atoken, aclient, flags); if (ncode || /* new style failed */ (strcmp (aserver->name, "afs") == 0)) { /* for afs tokens do both */ *************** *** 414,419 **** --- 436,442 ---- if (ocode == EIO) return KTC_NOCM; return KTC_PIOCTLFAIL; } + #endif /* NO_AFS_CLIENT */ UNLOCK_GLOBAL_MUTEX return 0; } *************** *** 435,448 **** afs_int32 temp; int maxLen; /* biggest ticket we can copy */ int tktLen; /* server ticket length */ LOCK_GLOBAL_MUTEX TRY_KERNEL (KTC_GETTOKEN_OP, aserver, aclient, atoken, atokenLen); #ifdef AFS_KERBEROS_ENV if (!lcell[0]) ktc_LocalCell(); #endif ! if (strcmp(aserver->name, "afs") != 0) { int i; /* try the local tokens */ for (i=0; iname, "afs") != 0) ! #endif /* NO_AFS_CLIENT */ ! { int i; /* try the local tokens */ for (i=0; iinstance) == 0) && (strcmp (local_tokens[i].server.cell, aserver->cell) == 0)) { bcopy (&local_tokens[i].token, atoken, min (atokenLen, sizeof(struct ktc_token))); ! *aclient = local_tokens[i].client; UNLOCK_GLOBAL_MUTEX return 0; } #ifdef AFS_KERBEROS_ENV ! if (!tf_init(ktc_tkt_string(), R_TKT_FIL) && !tf_get_pname(aclient->name) && ! !tf_get_pinst(aclient->instance)) { struct ktc_principal cprincipal; struct ktc_token ctoken; ! while (!tf_get_cred(&cprincipal, &ctoken)) { if (strcmp(cprincipal.name, aserver->name) == 0 && strcmp(cprincipal.instance, aserver->instance) == 0 && strcmp(cprincipal.cell, aserver->cell) == 0) { ! strcpy(aclient->cell, lcell); bcopy(&ctoken, atoken, min (atokenLen, sizeof(struct ktc_token))); ! tf_close(); UNLOCK_GLOBAL_MUTEX return 0; } } } ! tf_close(); #endif UNLOCK_GLOBAL_MUTEX return KTC_NOENT; } for (index=0; index<200; index++) { /* sanity check in case pioctl fails */ iob.in = (char *) &index; iob.in_size = sizeof(afs_int32); --- 480,530 ---- (strcmp (local_tokens[i].server.instance, aserver->instance) == 0) && (strcmp (local_tokens[i].server.cell, aserver->cell) == 0)) { bcopy (&local_tokens[i].token, atoken, min (atokenLen, sizeof(struct ktc_token))); ! if (aclient) ! *aclient = local_tokens[i].client; UNLOCK_GLOBAL_MUTEX return 0; } #ifdef AFS_KERBEROS_ENV ! if (!afs_tf_init(ktc_tkt_string(), R_TKT_FIL)) { ! if (aclient) { ! if (!afs_tf_get_pname(aclient->name) && ! !afs_tf_get_pinst(aclient->instance)) ! found = 1; ! } else { ! char tmpstring[MAXHOSTCHARS]; ! afs_tf_get_pname(&tmpstring); ! afs_tf_get_pinst(&tmpstring); ! found = 1; ! } ! } ! if (found) { struct ktc_principal cprincipal; struct ktc_token ctoken; ! while (!afs_tf_get_cred(&cprincipal, &ctoken)) { if (strcmp(cprincipal.name, aserver->name) == 0 && strcmp(cprincipal.instance, aserver->instance) == 0 && strcmp(cprincipal.cell, aserver->cell) == 0) { ! if (aclient) ! strcpy(aclient->cell, lcell); bcopy(&ctoken, atoken, min (atokenLen, sizeof(struct ktc_token))); ! afs_tf_close(); UNLOCK_GLOBAL_MUTEX return 0; } } } ! afs_tf_close(); #endif UNLOCK_GLOBAL_MUTEX return KTC_NOENT; } + #ifndef NO_AFS_CLIENT for (index=0; index<200; index++) { /* sanity check in case pioctl fails */ iob.in = (char *) &index; iob.in_size = sizeof(afs_int32); *************** *** 567,572 **** --- 610,616 ---- } } } + #endif /* NO_AFS_CLIENT */ UNLOCK_GLOBAL_MUTEX if ((code < 0) && (errno == EINVAL)) return KTC_NOPIOCTL; *************** *** 577,582 **** --- 621,627 ---- * Forget tokens for this server and the calling user. * NOT IMPLEMENTED YET! */ + #ifndef NO_AFS_CLIENT ktc_ForgetToken(aserver) struct ktc_principal *aserver; { int rc; *************** *** 588,593 **** --- 633,639 ---- UNLOCK_GLOBAL_MUTEX return rc; } + #endif /* NO_AFS_CLIENT */ /* ktc_ListTokens - list all tokens. start aprevIndex at 0, it returns the * next rock in (*aindex). (*aserver) is set to the relevant ticket on *************** *** 603,644 **** afs_int32 temp, index; LOCK_GLOBAL_MUTEX TRY_KERNEL (KTC_LISTTOKENS_OP, aserver, aprevIndex, aindex, 0); index = aprevIndex; #ifdef AFS_KERBEROS_ENV if (index >= 214) { int i; struct ktc_principal cprincipal; struct ktc_token ctoken; ! if (tf_init(ktc_tkt_string(), R_TKT_FIL) || ! tf_get_pname(tbuffer) || ! tf_get_pinst(tbuffer)) { ! tf_close(); UNLOCK_GLOBAL_MUTEX return KTC_NOENT; } for (i=214; i= 214) { int i; struct ktc_principal cprincipal; struct ktc_token ctoken; ! if (afs_tf_init(ktc_tkt_string(), R_TKT_FIL) || ! afs_tf_get_pname(tbuffer) || ! afs_tf_get_pinst(tbuffer)) { ! afs_tf_close(); UNLOCK_GLOBAL_MUTEX return KTC_NOENT; } for (i=214; i= 123) { /* special hack for returning TCS */ while (index-123 < MAXLOCALTOKENS) { if (local_tokens[index-123].valid) { --- 703,715 ---- *aserver = cprincipal; *aindex = index; ! afs_tf_close(); UNLOCK_GLOBAL_MUTEX return 0; } #endif + #ifndef NO_AFS_CLIENT if (index >= 123) { /* special hack for returning TCS */ while (index-123 < MAXLOCALTOKENS) { if (local_tokens[index-123].valid) { *************** *** 724,729 **** --- 778,784 ---- strcpy(aserver->cell, tp); aserver->instance[0] = 0; strcpy(aserver->name, "afs"); + #endif /* NO_AFS_CLIENT */ UNLOCK_GLOBAL_MUTEX return 0; } *************** *** 732,738 **** --- 787,795 ---- static int NewForgetAll () { + #ifndef NO_AFS_CLIENT TRY_KERNEL (KTC_FORGETALLTOKENS_OP, 0,0,0,0); + #endif /* NO_AFS_CLIENT */ return EINVAL; } *************** *** 748,755 **** --- 805,814 ---- iob.in_size = 0; iob.out = 0; iob.out_size = 0; + #ifndef NO_AFS_CLIENT code = PIOCTL(0, VIOCUNPAG, &iob, 0); if (code) return KTC_PIOCTLFAIL; + #endif /* NO_AFS_CLIENT */ return 0; } *************** *** 759,765 **** LOCK_GLOBAL_MUTEX #ifdef AFS_KERBEROS_ENV ! (void) tf_dest_tkt(); #endif ncode = NewForgetAll (); --- 818,824 ---- LOCK_GLOBAL_MUTEX #ifdef AFS_KERBEROS_ENV ! (void) afs_tf_dest_tkt(); #endif ncode = NewForgetAll (); *************** *** 818,829 **** /* * fd must be initialized to something that won't ever occur as a real * file descriptor. Since open(2) returns only non-negative numbers as ! * valid file descriptors, and tf_init always stuffs the return value * from open in here even if it is an error flag, we must * a. Initialize fd to a negative number, to indicate that it is * not initially valid. * b. When checking for a valid fd, assume that negative values ! * are invalid (ie. when deciding whether tf_init has been * called.) * c. In tf_close, be sure it gets reinitialized to a negative * number. --- 877,888 ---- /* * fd must be initialized to something that won't ever occur as a real * file descriptor. Since open(2) returns only non-negative numbers as ! * valid file descriptors, and afs_tf_init always stuffs the return value * from open in here even if it is an error flag, we must * a. Initialize fd to a negative number, to indicate that it is * not initially valid. * b. When checking for a valid fd, assume that negative values ! * are invalid (ie. when deciding whether afs_tf_init has been * called.) * c. In tf_close, be sure it gets reinitialized to a negative * number. *************** *** 862,888 **** * * Short description of routines: * ! * tf_init() opens the ticket file and locks it. * ! * tf_get_pname() returns the principal's name. * ! * tf_get_pinst() returns the principal's instance (may be null). * ! * tf_get_cred() returns the next CREDENTIALS record. * ! * tf_save_cred() appends a new CREDENTIAL record to the ticket file. * ! * tf_close() closes the ticket file and releases the lock. * * tf_gets() returns the next null-terminated string. It's an internal ! * routine used by tf_get_pname(), tf_get_pinst(), and tf_get_cred(). * * tf_read() reads a given number of bytes. It's an internal routine ! * used by tf_get_cred(). */ /* ! * tf_init() should be called before the other ticket file routines. * It takes the name of the ticket file to use, "tf_name", and a * read/write flag "rw" as arguments. * --- 921,948 ---- * * Short description of routines: * ! * afs_tf_init() opens the ticket file and locks it. * ! * afs_tf_get_pname() returns the principal's name. * ! * afs_tf_get_pinst() returns the principal's instance (may be null). * ! * afs_tf_get_cred() returns the next CREDENTIALS record. * ! * afs_tf_save_cred() appends a new CREDENTIAL record to the ticket file. * ! * afs_tf_close() closes the ticket file and releases the lock. * * tf_gets() returns the next null-terminated string. It's an internal ! * routine used by afs_tf_get_pname(), afs_tf_get_pinst(), and ! * afs_tf_get_cred(). * * tf_read() reads a given number of bytes. It's an internal routine ! * used by afs_tf_get_cred(). */ /* ! * afs_tf_init() should be called before the other ticket file routines. * It takes the name of the ticket file to use, "tf_name", and a * read/write flag "rw" as arguments. * *************** *** 897,903 **** * TKT_FIL_LCK - couldn't lock the file, even after a retry */ ! static tf_init(tf_name, rw) char *tf_name; { int wflag; --- 957,963 ---- * TKT_FIL_LCK - couldn't lock the file, even after a retry */ ! afs_tf_init(tf_name, rw) char *tf_name; { int wflag; *************** *** 983,997 **** } /* ! * tf_get_pname() reads the principal's name from the ticket file. It ! * should only be called after tf_init() has been called. The * principal's name is filled into the "p" parameter. If all goes well, ! * 0 is returned. If tf_init() wasn't called, TKT_FIL_INI is * returned. If the name was null, or EOF was encountered, or the name * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned. */ ! static tf_get_pname(p) char *p; { if (fd < 0) { --- 1043,1057 ---- } /* ! * afs_tf_get_pname() reads the principal's name from the ticket file. It ! * should only be called after afs_tf_init() has been called. The * principal's name is filled into the "p" parameter. If all goes well, ! * 0 is returned. If afs_tf_init() wasn't called, TKT_FIL_INI is * returned. If the name was null, or EOF was encountered, or the name * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned. */ ! afs_tf_get_pname(p) char *p; { if (fd < 0) { *************** *** 1003,1018 **** } /* ! * tf_get_pinst() reads the principal's instance from a ticket file. ! * It should only be called after tf_init() and tf_get_pname() have been ! * called. The instance is filled into the "inst" parameter. If all ! * goes well, 0 is returned. If tf_init() wasn't called, * TKT_FIL_INI is returned. If EOF was encountered, or the instance * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned. Note that the * instance may be null. */ ! static tf_get_pinst(inst) char *inst; { if (fd < 0) { --- 1063,1078 ---- } /* ! * afs_tf_get_pinst() reads the principal's instance from a ticket file. ! * It should only be called after afs_tf_init() and afs_tf_get_pname() have ! * been called. The instance is filled into the "inst" parameter. If all ! * goes well, 0 is returned. If afs_tf_init() wasn't called, * TKT_FIL_INI is returned. If EOF was encountered, or the instance * was longer than MAXKTCNAMELEN, TKT_FIL_FMT is returned. Note that the * instance may be null. */ ! afs_tf_get_pinst(inst) char *inst; { if (fd < 0) { *************** *** 1024,1040 **** } /* ! * tf_get_cred() reads a CREDENTIALS record from a ticket file and fills ! * in the given structure "c". It should only be called after tf_init(), ! * tf_get_pname(), and tf_get_pinst() have been called. If all goes well, ! * 0 is returned. Possible error codes are: * ! * TKT_FIL_INI - tf_init wasn't called first * TKT_FIL_FMT - bad format * EOF - end of file encountered */ ! static tf_get_cred(principal, token) struct ktc_principal *principal; struct ktc_token *token; { --- 1084,1100 ---- } /* ! * afs_tf_get_cred() reads a CREDENTIALS record from a ticket file and fills ! * in the given structure "c". It should only be called after afs_tf_init(), ! * afs_tf_get_pname(), and afs_tf_get_pinst() have been called. If all goes ! * well, 0 is returned. Possible error codes are: * ! * TKT_FIL_INI - afs_tf_init wasn't called first * TKT_FIL_FMT - bad format * EOF - end of file encountered */ ! afs_tf_get_cred(principal, token) struct ktc_principal *principal; struct ktc_token *token; { *************** *** 1094,1100 **** * The return value is not defined. */ ! static tf_close() { if (!(fd < 0)) { #if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) --- 1154,1160 ---- * The return value is not defined. */ ! afs_tf_close() { if (!(fd < 0)) { #if defined(AFS_AIX_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SUN5_ENV) *************** *** 1185,1201 **** char *tkt_string(); /* ! * tf_save_cred() appends an incoming ticket to the end of the ticket ! * file. You must call tf_init() before calling tf_save_cred(). * * The "service", "instance", and "realm" arguments specify the * server's name; "aticket" contains the credential. * ! * Returns 0 if all goes well, TKT_FIL_INI if tf_init() wasn't * called previously, and KFAILURE for anything else that went wrong. */ ! static tf_save_cred(aserver, atoken, aclient) struct ktc_principal *aserver; struct ktc_principal *aclient; struct ktc_token *atoken; /* Token */ --- 1245,1261 ---- char *tkt_string(); /* ! * afs_tf_save_cred() appends an incoming ticket to the end of the ticket ! * file. You must call afs_tf_init() before calling afs_tf_save_cred(). * * The "service", "instance", and "realm" arguments specify the * server's name; "aticket" contains the credential. * ! * Returns 0 if all goes well, TKT_FIL_INI if afs_tf_init() wasn't * called previously, and KFAILURE for anything else that went wrong. */ ! afs_tf_save_cred(aserver, atoken, aclient) struct ktc_principal *aserver; struct ktc_principal *aclient; struct ktc_token *atoken; /* Token */ *************** *** 1209,1215 **** int lifetime, kvno; int count; /* count for write */ ! if (fd < 0) { /* fd is ticket file as set by tf_init */ return TKT_FIL_INI; } --- 1269,1275 ---- int lifetime, kvno; int count; /* count for write */ ! if (fd < 0) { /* fd is ticket file as set by afs_tf_init */ return TKT_FIL_INI; } *************** *** 1220,1231 **** (void) lseek(fd, (off_t) 0L, 0); curpos = sizeof(tfbfr); ! if (tf_get_pname(junk) || strcmp(junk, aclient->name) || ! tf_get_pinst(junk) || strcmp(junk, aclient->instance)) goto bad; do { start = lseek(fd, (off_t) 0L, 1) - lastpos + curpos; ! status = tf_get_cred(&principal, &token); } while (status == 0 && (strcmp(aserver->name, principal.name) != 0 || strcmp(aserver->instance, principal.instance) != 0 || --- 1280,1291 ---- (void) lseek(fd, (off_t) 0L, 0); curpos = sizeof(tfbfr); ! if (afs_tf_get_pname(junk) || strcmp(junk, aclient->name) || ! afs_tf_get_pinst(junk) || strcmp(junk, aclient->instance)) goto bad; do { start = lseek(fd, (off_t) 0L, 1) - lastpos + curpos; ! status = afs_tf_get_cred(&principal, &token); } while (status == 0 && (strcmp(aserver->name, principal.name) != 0 || strcmp(aserver->instance, principal.instance) != 0 || *************** *** 1362,1368 **** * success, or KFAILURE if something goes wrong. */ ! static tf_create(pname,pinst) char *pname; char *pinst; { --- 1422,1428 ---- * success, or KFAILURE if something goes wrong. */ ! afs_tf_create(pname,pinst) char *pname; char *pinst; { *************** *** 1441,1447 **** * failure. */ ! static tf_dest_tkt() { char *file = ktc_tkt_string(); int i,fd; --- 1501,1507 ---- * failure. */ ! afs_tf_dest_tkt() { char *file = ktc_tkt_string(); int i,fd; Index: openafs/src/auth/writeconfig.c diff -c openafs/src/auth/writeconfig.c:1.2 openafs/src/auth/writeconfig.c:1.2.2.1 *** openafs/src/auth/writeconfig.c:1.2 Sat Nov 4 05:03:57 2000 --- openafs/src/auth/writeconfig.c Tue Mar 6 16:49:50 2001 *************** *** 74,80 **** afsconf_SetCellInfo(adir, apath, acellInfo) struct afsconf_dir *adir; char *apath; ! struct afsconf_cell *acellInfo; { register afs_int32 code; register int fd; char tbuffer[1024]; --- 74,93 ---- afsconf_SetCellInfo(adir, apath, acellInfo) struct afsconf_dir *adir; char *apath; ! struct afsconf_cell *acellInfo; ! { ! afs_int32 code; ! ! code = afsconf_SetExtendedCellInfo(adir, apath, acellInfo, (char *)0); ! return code; ! } ! ! afsconf_SetExtendedCellInfo(adir, apath, acellInfo, clones) ! struct afsconf_dir *adir; ! char *apath; ! struct afsconf_cell *acellInfo; ! char clones[]; ! { register afs_int32 code; register int fd; char tbuffer[1024]; *************** *** 121,127 **** code = acellInfo->hostAddr[i].sin_addr.s_addr; /* net order */ if (code == 0) continue; /* delete request */ code = ntohl(code); /* convert to host order */ ! fprintf(tf, "%d.%d.%d.%d #%s\n", (code>>24) & 0xff, (code>>16)&0xff, (code>>8)&0xff, code&0xff, acellInfo->hostName[i]); } if (ferror(tf)) { fclose(tf); --- 134,143 ---- code = acellInfo->hostAddr[i].sin_addr.s_addr; /* net order */ if (code == 0) continue; /* delete request */ code = ntohl(code); /* convert to host order */ ! if (clones && clones[i]) ! fprintf(tf, "[%d.%d.%d.%d] #%s\n", (code>>24) & 0xff, (code>>16)&0xff, (code>>8)&0xff, code&0xff, acellInfo->hostName[i]); ! else ! fprintf(tf, "%d.%d.%d.%d #%s\n", (code>>24) & 0xff, (code>>16)&0xff, (code>>8)&0xff, code&0xff, acellInfo->hostName[i]); } if (ferror(tf)) { fclose(tf); Index: openafs/src/bozo/bnode.c diff -c openafs/src/bozo/bnode.c:1.2 openafs/src/bozo/bnode.c:1.2.2.1 *** openafs/src/bozo/bnode.c:1.2 Sat Nov 4 05:03:58 2000 --- openafs/src/bozo/bnode.c Tue Mar 6 16:47:05 2001 *************** *** 19,24 **** --- 19,27 ---- #include #include #endif + #ifdef BOZO_SAVE_CORES + #include + #endif #include #include /* signal(), kill(), wait(), etc. */ #include *************** *** 85,95 **** --- 88,112 ---- char tbuffer[256]; struct stat tstat; register afs_int32 code; + #ifdef BOZO_SAVE_CORES + struct timeval Start; + struct tm *TimeFields; + char FileName[256]; + #endif code = stat(AFSDIR_SERVER_CORELOG_FILEPATH, &tstat); if (code) return; bnode_CoreName(abnode, aproc->coreName, tbuffer); + #ifdef BOZO_SAVE_CORES + TM_GetTimeOfDay(&Start, 0); + TimeFields = localtime(&Start.tv_sec); + sprintf(FileName,"%s.%d%02d%02d%02d%02d%02d", tbuffer, + TimeFields->tm_year, TimeFields->tm_mon + 1, + TimeFields->tm_mday, TimeFields->tm_hour, TimeFields->tm_min, + TimeFields->tm_sec); + strcpy(tbuffer,FileName); + #endif code = renamefile(AFSDIR_SERVER_CORELOG_FILEPATH, tbuffer); } Index: openafs/src/bozo/bos.c diff -c openafs/src/bozo/bos.c:1.2 openafs/src/bozo/bos.c:1.2.2.3 *** openafs/src/bozo/bos.c:1.2 Sat Nov 4 05:03:59 2000 --- openafs/src/bozo/bos.c Tue Mar 6 16:49:30 2001 *************** *** 55,60 **** --- 55,84 ---- #include "bosint.h" #include "../permit_xprt.h" + #define MRAFS_OFFSET 9 + #define ADDPARMOFFSET 26 + + static struct SalvageParms { + afs_int32 Optdebug; + afs_int32 Optnowrite; + afs_int32 Optforce; + afs_int32 Optoktozap; + afs_int32 Optrootfiles; + afs_int32 Optsalvagedirs; + afs_int32 Optblockreads; + afs_int32 OptListResidencies; + afs_int32 OptSalvageRemote; + afs_int32 OptSalvageArchival; + afs_int32 OptIgnoreCheck; + afs_int32 OptForceOnLine; + afs_int32 OptUseRootDirACL; + afs_int32 OptTraceBadLinkCounts; + afs_int32 OptDontAskFS; + afs_int32 OptLogLevel; + afs_int32 OptRxDebug; + afs_uint32 OptResidencies; + } mrafsParm; + /* dummy routine for the audit work. It should do nothing since audits */ /* occur at the server level and bos is not a server. */ osi_audit() {return 0;} *************** *** 154,167 **** bcopy(th->h_addr, &addr, sizeof(afs_int32)); /* get tokens for making authenticated connections */ ! localauth = (as->parms[14].items != 0); confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH); tdir = afsconf_Open (confdir); if (tdir) { struct afsconf_cell info; char *tname; ! if (as->parms[12].items) tname = as->parms[12].items->data; else tname = (char *) 0; /* next call expands cell name abbrevs for us and handles looking up * local cell */ --- 178,192 ---- bcopy(th->h_addr, &addr, sizeof(afs_int32)); /* get tokens for making authenticated connections */ ! localauth = (as->parms[ADDPARMOFFSET + 2].items != 0); confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH); tdir = afsconf_Open (confdir); if (tdir) { struct afsconf_cell info; char *tname; ! if (as->parms[ADDPARMOFFSET].items) ! tname = as->parms[ADDPARMOFFSET].items->data; else tname = (char *) 0; /* next call expands cell name abbrevs for us and handles looking up * local cell */ *************** *** 184,191 **** sc[2] = 0; scIndex = 0; ! if (!as->parms[13].items) { /* not -noauth */ ! if (as->parms[14].items) { /* -localauth */ code = afsconf_GetLatestKey (tdir, 0,0); if (code) com_err ("bos", code, "(getting key from local KeyFile)"); else { --- 209,216 ---- sc[2] = 0; scIndex = 0; ! if (!as->parms[ADDPARMOFFSET + 1].items) { /* not -noauth */ ! if (as->parms[ADDPARMOFFSET + 2].items) { /* -localauth */ code = afsconf_GetLatestKey (tdir, 0,0); if (code) com_err ("bos", code, "(getting key from local KeyFile)"); else { *************** *** 496,501 **** --- 521,556 ---- return 0; } + static BlockScannerCmd(as, arock) + struct cmd_syndesc *as; + char *arock; { + register afs_int32 code; + struct rx_connection *tconn; + char BlockCommand[] = "/usr/afs/bin/scanner -block"; + + tconn = GetConn(as, 0); + code = BOZO_Exec(tconn, BlockCommand); + if (code) + printf("bos: failed to block scanner from making migration requests (%s)\n", + em(code)); + return 0; + } + + static UnBlockScannerCmd(as, arock) + struct cmd_syndesc *as; + char *arock; { + register afs_int32 code; + struct rx_connection *tconn; + char UnBlockCommand[] = "/usr/afs/bin/scanner -unblock"; + + tconn = GetConn(as, 0); + code = BOZO_Exec(tconn, UnBlockCommand); + if (code) + printf("bos: failed to allow scanner daemon to make migration requests again (%s)\n", + em(code)); + return 0; + } + static GetRestartCmd(as, arock) struct cmd_syndesc *as; char *arock; { *************** *** 652,661 **** register struct rx_connection *tconn; register afs_int32 code; register struct cmd_item *ti; tconn = GetConn(as, 0); for(ti = as->parms[1].items; ti; ti=ti->next) { ! code = BOZO_AddCellHost(tconn, ti->data); if (code) printf("bos: failed to add host %s (%s)\n", ti->data, em(code)); } --- 707,727 ---- register struct rx_connection *tconn; register afs_int32 code; register struct cmd_item *ti; + char name[MAXHOSTCHARS]; tconn = GetConn(as, 0); for(ti = as->parms[1].items; ti; ti=ti->next) { ! if (as->parms[2].items) { ! if (strlen(ti->data) > MAXHOSTCHARS - 3) { ! fprintf(stderr, "bos: host name too long\n"); ! return E2BIG; ! } ! name[0] = '['; ! strcpy(&name[1],ti->data); ! strcat((char *)&name, "]"); ! code = BOZO_AddCellHost(tconn, name); ! } else ! code = BOZO_AddCellHost(tconn, ti->data); if (code) printf("bos: failed to add host %s (%s)\n", ti->data, em(code)); } *************** *** 751,758 **** strcpy((char *)&tkey, buf); } else { /* kerberos key */ ! if (as->parms[12].items) { ! strcpy(cellBuffer, as->parms[12].items->data); /* string to key needs upper-case cell names */ --- 817,824 ---- strcpy((char *)&tkey, buf); } else { /* kerberos key */ ! if (as->parms[ADDPARMOFFSET].items) { ! strcpy(cellBuffer, as->parms[ADDPARMOFFSET].items->data); /* string to key needs upper-case cell names */ *************** *** 1034,1039 **** --- 1100,1107 ---- return code; } + #define PARMBUFFERSSIZE 32 + static DoSalvage(aconn, aparm1, aparm2, aoutName, showlog,parallel,atmpDir,orphans) struct rx_connection *aconn; char *aoutName; *************** *** 1054,1059 **** --- 1122,1128 ---- FILE *outFile; int closeIt; char partName[20]; /* canonical name for partition */ + char pbuffer[PARMBUFFERSSIZE]; afs_int32 partNumber; char *notifier = NONOTIFIER; *************** *** 1141,1146 **** --- 1210,1256 ---- strcat(tbuffer, orphans); } + if (mrafsParm.Optdebug) + strcat(tbuffer," -debug"); + if (mrafsParm.Optnowrite) + strcat(tbuffer," -nowrite"); + if (mrafsParm.Optforce) + strcat(tbuffer," -force"); + if (mrafsParm.Optoktozap) + strcat(tbuffer," -oktozap"); + if (mrafsParm.Optrootfiles) + strcat(tbuffer," -rootfiles"); + if (mrafsParm.Optsalvagedirs) + strcat(tbuffer," -salvagedirs"); + if (mrafsParm.Optblockreads) + strcat(tbuffer," -blockreads"); + if (mrafsParm.OptListResidencies) + strcat(tbuffer," -ListResidencies"); + if (mrafsParm.OptSalvageRemote) + strcat(tbuffer," -SalvageRemote"); + if (mrafsParm.OptSalvageArchival) + strcat(tbuffer," -SalvageArchival"); + if (mrafsParm.OptIgnoreCheck) + strcat(tbuffer," -IgnoreCheck"); + if (mrafsParm.OptForceOnLine) + strcat(tbuffer," -ForceOnLine"); + if (mrafsParm.OptUseRootDirACL) + strcat(tbuffer," -UseRootDirACL"); + if (mrafsParm.OptTraceBadLinkCounts) + strcat(tbuffer," -TraceBadLinkCounts"); + if (mrafsParm.OptDontAskFS) + strcat(tbuffer," -DontAskFS"); + if (mrafsParm.OptLogLevel) { + sprintf(pbuffer, " -LogLevel %ld", mrafsParm.OptLogLevel); + strcat(tbuffer, pbuffer); + } + if (mrafsParm.OptRxDebug) + strcat(tbuffer," -rxdebug"); + if (mrafsParm.OptResidencies) { + sprintf(pbuffer, " -Residencies %lu", mrafsParm.OptResidencies); + strcat(tbuffer, pbuffer); + } + parms[0] = tbuffer; parms[1] = "now"; /* when to do it */ code = BOZO_CreateBnode(aconn, "cron", "salvage-tmp", parms[0], parms[1], *************** *** 1158,1163 **** --- 1268,1274 ---- printf("bos: salvage failed (%s)\n", em(code)); goto done; } + code = 0; /* now print the log file to the output file */ printf("bos: salvage completed\n"); *************** *** 1225,1243 **** static SalvageCmd(as) struct cmd_syndesc *as; { register struct rx_connection *tconn; ! register afs_int32 code, rc; char *outName; ! char tname[65]; afs_int32 newID; extern struct ubik_client *cstruct; ! afs_int32 curGoal, showlog = 0; char *parallel; char *tmpDir; char *orphans; /* parm 0 is machine name, 1 is partition, 2 is volume, 3 is -all flag */ tconn = GetConn(as, 0); /* we can do a volume, a partition or the whole thing, but not mixtures * thereof */ if (!as->parms[1].items && as->parms[2].items) { --- 1336,1363 ---- static SalvageCmd(as) struct cmd_syndesc *as; { register struct rx_connection *tconn; ! register afs_int32 code, rc, i; char *outName; ! char tname[BOZO_BSSIZE]; afs_int32 newID; extern struct ubik_client *cstruct; ! afs_int32 curGoal, showlog = 0, mrafs = 0; char *parallel; char *tmpDir; char *orphans; + char *tp; + + bzero(&mrafsParm, sizeof(mrafsParm)); /* parm 0 is machine name, 1 is partition, 2 is volume, 3 is -all flag */ tconn = GetConn(as, 0); + /* Find out whether fileserver is running MR-AFS (has a scanner instance) */ + /* XXX this should really be done some other way, potentially by RPC */ + tp = &tname; + if (code = BOZO_GetInstanceParm(tconn, "fs", 3, &tp) == 0) + mrafs = 1; + /* we can do a volume, a partition or the whole thing, but not mixtures * thereof */ if (!as->parms[1].items && as->parms[2].items) { *************** *** 1274,1281 **** /* -orphans option */ orphans = (char *)0; ! if (as->parms[8].items) ! orphans = as->parms[8].items->data; if (as->parms[4].items) { /* salvage whole enchilada */ --- 1394,1468 ---- /* -orphans option */ orphans = (char *)0; ! if (as->parms[8].items) { ! if (mrafs) { ! printf("Can't specify -orphans for MR-AFS fileserver\n"); ! return EINVAL; ! } ! orphans = as->parms[8].items->data; ! } ! ! if (mrafs) { ! if (as->parms[MRAFS_OFFSET].items) ! mrafsParm.Optdebug = 1; ! if (as->parms[MRAFS_OFFSET + 1].items) ! mrafsParm.Optnowrite = 1; ! if (as->parms[MRAFS_OFFSET + 2].items) ! mrafsParm.Optforce = 1; ! if (as->parms[MRAFS_OFFSET + 3].items) ! mrafsParm.Optoktozap = 1; ! if (as->parms[MRAFS_OFFSET + 4].items) ! mrafsParm.Optrootfiles = 1; ! if (as->parms[MRAFS_OFFSET + 5].items) ! mrafsParm.Optsalvagedirs = 1; ! if (as->parms[MRAFS_OFFSET + 6].items) ! mrafsParm.Optblockreads = 1; ! if (as->parms[MRAFS_OFFSET + 7].items) ! mrafsParm.OptListResidencies = 1; ! if (as->parms[MRAFS_OFFSET + 8].items) ! mrafsParm.OptSalvageRemote = 1; ! if (as->parms[MRAFS_OFFSET + 9].items) ! mrafsParm.OptSalvageArchival = 1; ! if (as->parms[MRAFS_OFFSET + 10].items) ! mrafsParm.OptIgnoreCheck = 1; ! if (as->parms[MRAFS_OFFSET + 11].items) ! mrafsParm.OptForceOnLine = 1; ! if (as->parms[MRAFS_OFFSET + 12].items) ! mrafsParm.OptUseRootDirACL = 1; ! if (as->parms[MRAFS_OFFSET + 13].items) ! mrafsParm.OptTraceBadLinkCounts = 1; ! if (as->parms[MRAFS_OFFSET + 14].items) ! mrafsParm.OptDontAskFS = 1; ! if (as->parms[MRAFS_OFFSET + 15].items) ! mrafsParm.OptLogLevel = atoi(as->parms[MRAFS_OFFSET + 15].items->data); ! if (as->parms[MRAFS_OFFSET + 16].items) ! mrafsParm.OptRxDebug = 1; ! if (as->parms[MRAFS_OFFSET + 17].items) { ! if (as->parms[MRAFS_OFFSET + 8].items || ! as->parms[MRAFS_OFFSET + 9].items) { ! printf("Can't specify -Residencies with -SalvageRemote or -SalvageArchival\n"); ! return EINVAL; ! } ! code = GetUInt32(as->parms[MRAFS_OFFSET + 17].items->data, ! &mrafsParm.OptResidencies); ! if (code) { ! printf("bos: '%s' is not a valid residency mask.\n", ! as->parms[MRAFS_OFFSET + 13].items->data); ! return code; ! } ! } ! } else { ! int stop = 0; ! ! for (i = 9; i < ADDPARMOFFSET; i++) { ! if (as->parms[i].items) { ! printf(" %s only possible for MR-AFS fileserver.\n", ! as->parms[i].name); ! stop = 1; ! } ! } ! if (stop) exit(1); ! } if (as->parms[4].items) { /* salvage whole enchilada */ *************** *** 1355,1364 **** const char *confdir; int localauth; ! if (as->parms[12].items) tmpname = as->parms[12].items->data; else tmpname = (char *) 0; ! localauth = (as->parms[14].items != 0); confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH); code = vsu_ClientInit(/* noauth */ 1, confdir, tmpname, /* server auth */ 0, &cstruct, (int (*)()) 0); --- 1542,1552 ---- const char *confdir; int localauth; ! if (as->parms[ADDPARMOFFSET].items) ! tmpname = as->parms[ADDPARMOFFSET].items->data; else tmpname = (char *) 0; ! localauth = (as->parms[ADDPARMOFFSET + 2].items != 0); confdir = (localauth ? AFSDIR_SERVER_ETC_DIRPATH : AFSDIR_CLIENT_ETC_DIRPATH); code = vsu_ClientInit(/* noauth */ 1, confdir, tmpname, /* server auth */ 0, &cstruct, (int (*)()) 0); *************** *** 1518,1532 **** return 0; } static void add_std_args (ts) register struct cmd_syndesc *ts; { ! cmd_Seek(ts, 12); ! /* 12 */ cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name"); ! /* 13 */cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL, ! "don't authenticate"); ! /* 14 */ cmd_AddParm (ts, "-localauth", CMD_FLAG, CMD_OPTIONAL, ! "create tickets from KeyFile"); } #include "AFS_component_version_number.c" --- 1706,1747 ---- return 0; } + #ifdef BOS_RESTRICTED_MODE + static GetRestrict(as) + struct cmd_syndesc *as; { + register struct rx_connection *tconn; + afs_int32 code, val; + + tconn = GetConn(as, 0); + code = BOZO_GetRestrictedMode(tconn, &val); + if (code) printf("bos: failed to get restricted mode (%s)\n", em(code)); + else printf("Restricted mode is %s\n", val ? "on" : "off"); + + return 0; + } + + static SetRestrict(as) + struct cmd_syndesc *as; { + register struct rx_connection *tconn; + afs_int32 code, val; + + tconn = GetConn(as, 0); + util_GetInt32(as->parms[1].items->data, &val); + code = BOZO_SetRestrictedMode(tconn, val); + if (code) printf("bos: failed to set restricted mode (%s)\n", em(code)); + return 0; + } + #endif + static void add_std_args (ts) register struct cmd_syndesc *ts; { ! cmd_Seek(ts, ADDPARMOFFSET); ! /* + 0 */ cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name"); ! /* + 1 */ cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL, ! "don't authenticate"); ! /* + 2 */ cmd_AddParm (ts, "-localauth", CMD_FLAG, CMD_OPTIONAL, ! "create tickets from KeyFile"); } #include "AFS_component_version_number.c" *************** *** 1681,1686 **** --- 1896,1902 ---- ts = cmd_CreateSyntax("addhost", AddHost, 0, "add host to cell dbase"); cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name"); cmd_AddParm(ts, "-host", CMD_LIST, 0, "host name"); + cmd_AddParm(ts, "-clone", CMD_FLAG, CMD_OPTIONAL, "vote doesn't count"); add_std_args (ts); ts = cmd_CreateSyntax("removehost", RemoveHost, 0, *************** *** 1763,1770 **** --- 1979,2024 ---- "directory to place tmp files"); cmd_AddParm(ts, "-orphans", CMD_SINGLE, CMD_OPTIONAL, "ignore | remove | attach"); + cmd_AddParm(ts, "-debug", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Run in Debugging mode"); + cmd_AddParm(ts, "-nowrite", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Run readonly/test mode"); + cmd_AddParm(ts, "-force", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Force full salvaging"); + cmd_AddParm(ts, "-oktozap", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Give permission to destroy bogus file residencies/volumes - debugging flag"); + cmd_AddParm(ts, "-rootfiles", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Show files owned by root - debugging flag"); + cmd_AddParm(ts, "-salvagedirs", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Force rebuild/salvage of all directories"); + cmd_AddParm(ts, "-blockreads", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Read smaller blocks to handle IO/bad blocks"); + cmd_AddParm(ts, "-ListResidencies", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Just list affected file residencies - debugging flag"); + cmd_AddParm(ts, "-SalvageRemote", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Salvage storage systems that are not directly attached"); + cmd_AddParm(ts, "-SalvageArchival", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Salvage HSM storage systems"); + cmd_AddParm(ts, "-IgnoreCheck", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Don't perform VLDB safety check when deleting unreferenced files. Only a good idea in single server cell."); + cmd_AddParm(ts, "-ForceOnLine", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Force the volume to come online, even if it hasn't salvaged cleanly."); + cmd_AddParm(ts, "-UseRootDirACL", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Use the root directory ACL for lost+found directory if it is created."); + cmd_AddParm(ts, "-TraceBadLinkCounts", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Print out lines about volume reference count changes."); + cmd_AddParm(ts, "-DontAskFS", CMD_FLAG,CMD_OPTIONAL, "(MR-AFS) Don't ask fileserver to take volume offline. THIS IS VERY DANGEROUS."); + cmd_AddParm(ts, "-LogLevel", CMD_SINGLE, CMD_OPTIONAL, "(MR-AFS) log level"); + cmd_AddParm(ts, "-rxdebug", CMD_FLAG, CMD_OPTIONAL, "(MR-AFS) Write out rx debug information."); + cmd_AddParm(ts, "-Residencies", CMD_SINGLE, CMD_OPTIONAL, "(MR-AFS) Numeric mask of residencies to be included in the salvage. Do not use with -SalvageRemote or -SalvageArchival"); add_std_args (ts); + ts = cmd_CreateSyntax("blockscanner", BlockScannerCmd, 0, + "block scanner daemon from making migration requests"); + cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name"); + add_std_args (ts); + + ts = cmd_CreateSyntax("unblockscanner", UnBlockScannerCmd, 0, + "allow scanner daemon to make migration requests again"); + cmd_AddParm(ts, "-server", CMD_SINGLE, CMD_REQUIRED, "machine name"); + add_std_args (ts); + + #ifdef BOS_RESTRICTED_MODE + ts = cmd_CreateSyntax("getrestricted", GetRestrict, 0, "get restrict mode"); + cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name"); + add_std_args (ts); + + ts = cmd_CreateSyntax("setrestricted", SetRestrict, 0, "set restrict mode"); + cmd_AddParm(ts, "-server", CMD_SINGLE, 0, "machine name"); + cmd_AddParm(ts, "-mode", CMD_SINGLE, 0, "mode to set"); + add_std_args (ts); + #endif #endif code = cmd_Dispatch(argc, argv); Index: openafs/src/bozo/bosint.xg diff -c openafs/src/bozo/bosint.xg:1.2 openafs/src/bozo/bosint.xg:1.2.2.1 *** openafs/src/bozo/bosint.xg:1.2 Sat Nov 4 05:03:59 2000 --- openafs/src/bozo/bosint.xg Tue Mar 6 16:03:47 2001 *************** *** 222,224 **** --- 222,233 ---- OUT string spare2, OUT string spare3 ) = 114; + + GetRestrictedMode( + OUT afs_int32 *restmode + ) = 115; + + SetRestrictedMode( + IN afs_int32 restmode + ) = 116; + /* RPC #117 will be Salvage, if I get around to it */ Index: openafs/src/bozo/bosoprocs.c diff -c openafs/src/bozo/bosoprocs.c:1.2 openafs/src/bozo/bosoprocs.c:1.2.2.1 *** openafs/src/bozo/bosoprocs.c:1.2 Sat Nov 4 05:03:59 2000 --- openafs/src/bozo/bosoprocs.c Tue Mar 6 16:03:47 2001 *************** *** 43,48 **** --- 43,51 ---- extern struct rx_securityClass *bozo_rxsc[2]; extern int bozo_newKTs; extern int DoLogging; + #ifdef BOS_RESTRICTED_MODE + extern int bozo_isrestricted; + #endif BOZO_GetRestartTime(acall, atype, aktime) struct rx_call *acall; *************** *** 119,124 **** --- 122,133 ---- code = BZACCESS; goto fail; } + #ifdef BOS_RESTRICTED_MODE + if (bozo_isrestricted) { + code = BZACCESS; + goto fail; + } + #endif if (DoLogging) bozo_Log("%s is executing the shell command '%s'\n", caller, acmd); /* should copy output to acall, but don't yet cause its hard */ *************** *** 180,185 **** --- 189,201 ---- osi_auditU (acall, BOS_UnInstallEvent, code, AUD_STR, aname, AUD_END); return code; } + #ifdef BOS_RESTRICTED_MODE + if (bozo_isrestricted) { + code = BZACCESS; + osi_auditU (acall, BOS_UnInstallEvent, code, AUD_STR, aname, AUD_END); + return code; + } + #endif /* construct local path from canonical (wire-format) path */ if (ConstructLocalBinPath(aname, &filepath)) { *************** *** 267,272 **** --- 283,291 ---- char caller[MAXKTCNAMELEN]; if (!afsconf_SuperUser(bozo_confdir, acall, caller)) return BZACCESS; + #ifdef BOS_RESTRICTED_MODE + if (bozo_isrestricted) return BZACCESS; + #endif /* construct local path from canonical (wire-format) path */ if (ConstructLocalBinPath(aname, &fpp)) { *************** *** 715,720 **** --- 734,750 ---- code = BZACCESS; goto fail; } + #ifdef BOS_RESTRICTED_MODE + if (bozo_isrestricted) { + if (strcmp(atype, "cron") || strcmp(ainstance, "salvage-tmp") || + strcmp(ap2, "now") || + strncmp(ap1, AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH, + strlen(AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH))) { + code = BZACCESS; + goto fail; + } + } + #endif code = bnode_Create(atype, ainstance, &tb, ap1, ap2, ap3, ap4, ap5, notifier,BSTAT_NORMAL); if (!code) *************** *** 754,759 **** --- 784,795 ---- code = BZACCESS; goto fail; } + #ifdef BOS_RESTRICTED_MODE + if (bozo_isrestricted) { + code = BZACCESS; + goto fail; + } + #endif if (DoLogging) bozo_Log("%s is executing DeleteBnode '%s'\n", caller, ainstance); code = bnode_DeleteName(ainstance); *************** *** 1061,1066 **** --- 1097,1108 ---- code = BZACCESS; goto fail; } + #ifdef BOS_RESTRICTED_MODE + if (bozo_isrestricted) { + code = BZACCESS; + goto fail; + } + #endif if (DoLogging) bozo_Log("%s is executing Prune (flags=%d)\n", caller, aflags); /* first scan AFS binary directory */ *************** *** 1299,1304 **** --- 1341,1353 ---- code = BZACCESS; goto fail; } + #ifdef BOS_RESTRICTED_MODE + if (bozo_isrestricted && strchr(aname, '/') && + strcmp(aname, AFSDIR_CANONICAL_SERVER_SLVGLOG_FILEPATH)) { + code = BZACCESS; + goto fail; + } + #endif /* construct local path from canonical (wire-format) path */ if (ConstructLocalLogPath(aname, &logpath)) { *************** *** 1369,1374 **** --- 1418,1468 ---- return BZNOENT; } + #ifdef BOS_RESTRICTED_MODE + BOZO_GetRestrictedMode(acall, arestmode) + struct rx_call *acall; + afs_int32 *arestmode; + { + *arestmode=bozo_isrestricted; + return 0; + } + + BOZO_SetRestrictedMode(acall, arestmode) + struct rx_call *acall; + afs_int32 arestmode; + { + afs_int32 code; + char caller[MAXKTCNAMELEN]; + + if (!afsconf_SuperUser(bozo_confdir, acall, caller)) { + return BZACCESS; + } + if (bozo_isrestricted) { + return BZACCESS; + } + if (arestmode !=0 && arestmode !=1) { + return BZDOM; + } + bozo_isrestricted=arestmode; + code = WriteBozoFile(0); + fail: + return code; + } + #else + BOZO_GetRestrictedMode(acall, arestmode) + struct rx_call *acall; + afs_int32 *arestmode; + { + return RXGEN_OPCODE; + } + + BOZO_SetRestrictedMode(acall, arestmode) + struct rx_call *acall; + afs_int32 arestmode; + { + return RXGEN_OPCODE; + } + #endif void bozo_ShutdownAndExit(int asignal) { Index: openafs/src/bozo/bosserver.c diff -c openafs/src/bozo/bosserver.c:1.2 openafs/src/bozo/bosserver.c:1.2.2.4 *** openafs/src/bozo/bosserver.c:1.2 Sat Nov 4 05:03:59 2000 --- openafs/src/bozo/bosserver.c Tue Mar 6 17:27:19 2001 *************** *** 60,66 **** --- 60,77 ---- struct ktime bozo_nextRestartKT, bozo_nextDayKT; int bozo_newKTs; + #ifdef BOS_RESTRICTED_MODE + int bozo_isrestricted=0; + int bozo_restdisable=0; + void bozo_insecureme(int sig) + { + signal(SIGFPE, bozo_insecureme); + bozo_isrestricted=0; + bozo_restdisable=1; + } + #endif + struct bztemp { FILE *file; }; *************** *** 209,214 **** --- 220,228 ---- afs_int32 i, goal; struct bnode *tb; char *parms[MAXPARMS]; + #ifdef BOS_RESTRICTED_MODE + int rmode; + #endif /* rename BozoInit to BosServer for the user */ if (!aname) { *************** *** 219,224 **** --- 233,246 ---- if (code < 0) perror("bosconfig rename"); } + #ifdef BOS_NEW_CONFIG + if (access(AFSDIR_SERVER_BOZCONFNEW_FILEPATH, 0) == 0) { + code = renamefile(AFSDIR_SERVER_BOZCONFNEW_FILEPATH, + AFSDIR_SERVER_BOZCONF_FILEPATH); + if (code < 0) + perror("bosconfig rename"); + } + #endif } /* setup default times we want to do restarts */ *************** *** 280,285 **** --- 302,324 ---- continue; } + #ifdef BOS_RESTRICTED_MODE + if (strncmp(tbuffer, "restrictmode", 12) == 0) { + code = sscanf(tbuffer, "restrictmode %d", + &rmode); + if (code != 1) { + code = -1; + goto fail; + } + if (rmode !=0 && rmode != 1) { + code = -1; + goto fail; + } + bozo_isrestricted=rmode; + continue; + } + #endif + if (strncmp("bnode", tbuffer, 5) != 0) { code = -1; goto fail; *************** *** 351,356 **** --- 390,398 ---- tfile = fopen(tbuffer, "w"); if (!tfile) return -1; btemp.file = tfile; + #ifdef BOS_RESTRICTED_MODE + fprintf(tfile, "restrictmode %d\n", bozo_isrestricted); + #endif fprintf(tfile, "restarttime %d %d %d %d %d\n", bozo_nextRestartKT.mask, bozo_nextRestartKT.day, bozo_nextRestartKT.hour, bozo_nextRestartKT.min, bozo_nextRestartKT.sec); *************** *** 406,411 **** --- 448,459 ---- IOMGR_Sleep(60); now = FT_ApproxTime(); + #ifdef BOS_RESTRICTED_MODE + if (bozo_restdisable) { + bozo_Log("Restricted mode disabled by signal\n"); + bozo_restdisable=0; + } + #endif if (bozo_newKTs) { /* need to recompute restart times */ bozo_newKTs = 0; /* done for a while */ nextRestart = ktime_next(&bozo_nextRestartKT, BOZO_MINSKIP); *************** *** 619,624 **** --- 667,675 ---- sigaction(SIGSEGV, &nsa, NULL); sigaction(SIGABRT, &nsa, NULL); #endif + #ifdef BOS_RESTRICTED_MODE + signal(SIGFPE, bozo_insecureme); + #endif #ifdef AFS_NT40_ENV /* Initialize winsock */ *************** *** 669,674 **** --- 720,730 ---- else if (strcmp(argv[code], "-enable_process_stats")==0) { rx_enableProcessRPCStats(); } + #ifdef BOS_RESTRICTED_MODE + else if (strcmp(argv[code], "-restricted")==0) { + bozo_isrestricted=1; + } + #endif else { /* hack to support help flag */ *************** *** 705,712 **** --- 761,770 ---- /* chdir to AFS log directory */ chdir(AFSDIR_SERVER_LOGS_DIRPATH); + #if 0 fputs(AFS_GOVERNMENT_MESSAGE, stdout); fflush(stdout); + #endif /* go into the background and remove our controlling tty */ *************** *** 740,747 **** } else break; } ! if (i>=10) exit(code); code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1, /* parm */0, "bozo-the-clown", &bozo_pid); --- 798,807 ---- } else break; } ! if (i>=10) { ! bozo_Log("Bos giving up, can't initialize rx\n"); exit(code); + } code = LWP_CreateProcess(BozoDaemon, BOZO_LWP_STACKSIZE, /* priority */ 1, /* parm */0, "bozo-the-clown", &bozo_pid); Index: openafs/src/bozo/fsbnodeops.c diff -c openafs/src/bozo/fsbnodeops.c:1.2 openafs/src/bozo/fsbnodeops.c:1.2.2.2 *** openafs/src/bozo/fsbnodeops.c:1.2 Sat Nov 4 05:04:00 2000 --- openafs/src/bozo/fsbnodeops.c Tue Mar 6 17:17:04 2001 *************** *** 30,35 **** --- 30,36 ---- static int fs_procexit(), fs_getstring(), fs_getparm(), fs_restartp(); static int fs_hascore(); struct bnode *fs_create(); + struct bnode *fsmr_create(); static SetNeedsClock(); static NudgeProcs(); *************** *** 80,99 **** char *filecmd; /* command to start primary file server */ char *volcmd; /* command to start secondary vol server */ char *salcmd; /* command to start salvager */ struct bnode_proc *fileProc; /* process for file server */ struct bnode_proc *volProc; /* process for vol server */ struct bnode_proc *salProc; /* process for salvager */ ! afs_int32 lastFileStart; /* last start for file */ ! afs_int32 lastVolStart; /* last start for vol */ char fileRunning; /* file process is running */ char volRunning; /* volser is running */ char salRunning; /* salvager is running */ char fileSDW; /* file shutdown wait */ char volSDW; /* vol shutdown wait */ char salSDW; /* waiting for the salvager to shutdown */ char fileKillSent; /* kill signal has been sent */ char volKillSent; char salKillSent; char needsSalvage; /* salvage before running */ char needsClock; /* do we need clock ticks */ }; --- 81,106 ---- char *filecmd; /* command to start primary file server */ char *volcmd; /* command to start secondary vol server */ char *salcmd; /* command to start salvager */ + char *scancmd; /* command to start scanner (MR-AFS) */ struct bnode_proc *fileProc; /* process for file server */ struct bnode_proc *volProc; /* process for vol server */ struct bnode_proc *salProc; /* process for salvager */ ! struct bnode_proc *scanProc; /* process for scanner (MR-AFS) */ ! afs_int32 lastFileStart; /* last start for file */ ! afs_int32 lastVolStart; /* last start for vol */ ! afs_int32 lastScanStart; /* last start for scanner (MR-AFS) */ char fileRunning; /* file process is running */ char volRunning; /* volser is running */ char salRunning; /* salvager is running */ + char scanRunning; /* scanner is running (MR_AFS) */ char fileSDW; /* file shutdown wait */ char volSDW; /* vol shutdown wait */ char salSDW; /* waiting for the salvager to shutdown */ + char scanSDW; /* scanner shutdown wait (MR_AFS) */ char fileKillSent; /* kill signal has been sent */ char volKillSent; char salKillSent; + char scanKillSent; /* kill signal has been sent (MR_AFS) */ char needsSalvage; /* salvage before running */ char needsClock; /* do we need clock ticks */ }; *************** *** 120,125 **** --- 127,136 ---- bnode_CoreName(abnode, "salv", tbuffer); if (access(tbuffer, 0) == 0) return 1; + /* see if scanner left a core file (MR-AFS) */ + bnode_CoreName(abnode, "scan", tbuffer); + if (access(tbuffer, 0) == 0) return 1; + /* no one left a core file */ return 0; } *************** *** 155,160 **** --- 166,187 ---- if (tstat.st_ctime > abnode->lastVolStart) code = 1; else code = 0; bnode_FreeTokens(tt); + if (code) return code; + + if (abnode->scancmd) { /* Only in MR-AFS */ + /* now do same for scancmd (MR-AFS) */ + code = bnode_ParseLine(abnode->scancmd, &tt); + if (code) return 0; + if (!tt) return 0; + code = stat(tt->key, &tstat); + if (code) { + bnode_FreeTokens(tt); + return 0; + } + if (tstat.st_ctime > abnode->lastScanStart) code = 1; + else code = 0; + bnode_FreeTokens(tt); + } return code; } *************** *** 210,215 **** --- 237,243 ---- free(abnode->filecmd); free(abnode->volcmd); free(abnode->salcmd); + if (abnode->scancmd) free(abnode->scancmd); free(abnode); return 0; } *************** *** 229,243 **** #endif /* AFS_NT40_ENV */ ! struct bnode *fs_create(ainstance, afilecmd, avolcmd, asalcmd) char *ainstance; char *afilecmd; char *avolcmd; ! char *asalcmd; { struct stat tstat; register struct fsbnode *te; char cmdname[AFSDIR_PATH_MAX]; ! char *fileCmdpath, *volCmdpath, *salCmdpath; int bailout = 0; fileCmdpath = volCmdpath = salCmdpath = NULL; --- 257,272 ---- #endif /* AFS_NT40_ENV */ ! struct bnode *fs_create(ainstance, afilecmd, avolcmd, asalcmd, ascancmd) char *ainstance; char *afilecmd; char *avolcmd; ! char *asalcmd; ! char *ascancmd; { struct stat tstat; register struct fsbnode *te; char cmdname[AFSDIR_PATH_MAX]; ! char *fileCmdpath, *volCmdpath, *salCmdpath, *scanCmdpath; int bailout = 0; fileCmdpath = volCmdpath = salCmdpath = NULL; *************** *** 256,261 **** --- 285,297 ---- bailout = 1; } + if (ascancmd && strlen(ascancmd)) { + if (ConstructLocalBinPath(ascancmd, &scanCmdpath)) { + bozo_Log("BNODE: command path invalid '%s'\n", ascancmd); + bailout = 1; + } + } + if (!bailout) { sscanf(fileCmdpath, "%s", cmdname); #ifdef AFS_NT40_ENV *************** *** 283,288 **** --- 319,335 ---- bozo_Log("BNODE: salvager binary '%s' not found\n", cmdname); bailout = 1; } + + if (ascancmd && strlen(ascancmd)) { + sscanf(scanCmdpath, "%s", cmdname); + #ifdef AFS_NT40_ENV + AppendExecutableExtension(cmdname); + #endif + if (stat(cmdname, &tstat)) { + bozo_Log("BNODE: scanner binary '%s' not found\n", cmdname); + bailout = 1; + } + } } if (bailout) { *************** *** 295,300 **** --- 342,351 ---- te->filecmd = fileCmdpath; te->volcmd = volCmdpath; te->salcmd = salCmdpath; + if (ascancmd && strlen(ascancmd)) + te->scancmd = scanCmdpath; + else + te->scancmd = (char *)0; bnode_InitBnode(te, &fsbnode_ops, ainstance); bnode_SetTimeout(te, POLLTIME); /* ask for timeout activations every 10 seconds */ RestoreSalFlag(te); /* restore needsSalvage flag based on file's existence */ *************** *** 333,338 **** --- 384,397 ---- FSSDTIME); } } + if (abnode->scanSDW) { + if (!abnode->scanKillSent && now - abnode->timeSDStarted > SDTIME) { + bnode_StopProc(abnode->scanProc, SIGKILL); + abnode->scanKillSent = 1; + bozo_Log("bos shutdown: scanner failed to shutdown within %d seconds\n", + SDTIME); + } + } SetNeedsClock(abnode); } *************** *** 340,350 **** struct fsbnode *abnode; afs_int32 *astatus; { register afs_int32 temp; ! if (abnode->volSDW || abnode->fileSDW || abnode->salSDW) temp = BSTAT_SHUTTINGDOWN; else if (abnode->salRunning) temp = BSTAT_NORMAL; ! else if (abnode->volRunning && abnode->fileRunning) temp = BSTAT_NORMAL; ! else if (!abnode->salRunning && !abnode->volRunning && !abnode->fileRunning) ! temp = BSTAT_SHUTDOWN; else temp = BSTAT_STARTINGUP; *astatus = temp; return 0; --- 399,411 ---- struct fsbnode *abnode; afs_int32 *astatus; { register afs_int32 temp; ! if (abnode->volSDW || abnode->fileSDW || abnode->salSDW || abnode->scanSDW) ! temp = BSTAT_SHUTTINGDOWN; else if (abnode->salRunning) temp = BSTAT_NORMAL; ! else if (abnode->volRunning && abnode->fileRunning && (!abnode->scancmd || ! abnode->scanRunning)) temp = BSTAT_NORMAL; ! else if (!abnode->salRunning && !abnode->volRunning && !abnode->fileRunning ! && !abnode->scanRunning) temp = BSTAT_SHUTDOWN; else temp = BSTAT_STARTINGUP; *astatus = temp; return 0; *************** *** 390,395 **** --- 451,462 ---- abnode->salSDW = 0; abnode->salKillSent = 0; } + else if (aproc == abnode->scanProc) { + abnode->scanProc = 0; + abnode->scanRunning = 0; + abnode->scanSDW = 0; + abnode->scanKillSent = 0; + } /* now restart anyone who needs to restart */ return NudgeProcs(abnode); *************** *** 397,406 **** /* make sure we're periodically checking the state if we need to */ static SetNeedsClock(ab) ! register struct fsbnode *ab; { ! if (ab->b.goal == 1 && ab->fileRunning && ab->volRunning) ab->needsClock = 0; /* running normally */ ! else if (ab->b.goal == 0 && !ab->fileRunning && !ab->volRunning && !ab->salRunning) ab->needsClock = 0; /* halted normally */ else ab->needsClock = 1; /* other */ if (ab->needsClock && !bnode_PendingTimeout(ab)) --- 464,476 ---- /* make sure we're periodically checking the state if we need to */ static SetNeedsClock(ab) ! register struct fsbnode *ab; ! { ! if (ab->b.goal == 1 && ab->fileRunning && ab->volRunning ! && (!ab->scancmd || ab->scanRunning)) ab->needsClock = 0; /* running normally */ ! else if (ab->b.goal == 0 && !ab->fileRunning && !ab->volRunning ! && !ab->salRunning && !ab->scanRunning) ab->needsClock = 0; /* halted normally */ else ab->needsClock = 1; /* other */ if (ab->needsClock && !bnode_PendingTimeout(ab)) *************** *** 437,442 **** --- 507,522 ---- abnode->volRunning = 1; } } + if (abnode->scancmd) { + if (!abnode->scanRunning) { + abnode->lastScanStart = FT_ApproxTime(); + code = bnode_NewProc(abnode, abnode->scancmd, "scanner", &tp); + if (code == 0) { + abnode->scanProc = tp; + abnode->scanRunning = 1; + } + } + } } else { /* file is not running */ /* see how to start */ *************** *** 459,464 **** --- 539,553 ---- abnode->volRunning = 1; } } + if (abnode->scancmd && !abnode->scanRunning) { + abnode->lastScanStart = FT_ApproxTime(); + code = bnode_NewProc(abnode, abnode->scancmd, "scanner", + &tp); + if (code == 0) { + abnode->scanProc = tp; + abnode->scanRunning = 1; + } + } } else { /* needs to be salvaged */ /* make sure file server and volser are gone *