From 0baeaf9d38809851fb97d0ac7aef20d636417081 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Thu, 24 Feb 2005 00:07:37 +0000 Subject: [PATCH] Import openafs 1.3.79 --- acinclude.m4 | 32 +- aclocal.m4 | 144 +- configure | 717 ++--- configure-libafs | 719 ++--- configure-libafs.in | 2 +- configure.in | 2 +- src/WINNT/afsd/afsd_init.c | 139 +- src/WINNT/afsd/afsd_service.c | 48 +- src/WINNT/afsd/afsd_service.rc | 3 + src/WINNT/afsd/afskfw.c | 70 +- src/WINNT/afsd/afslogon.c | 110 +- src/WINNT/afsd/afslogon.h | 2 +- src/WINNT/afsd/cm_aclent.c | 310 +-- src/WINNT/afsd/cm_aclent.h | 2 +- src/WINNT/afsd/cm_buf.c | 35 +- src/WINNT/afsd/cm_buf.h | 2 + src/WINNT/afsd/cm_callback.c | 8 +- src/WINNT/afsd/cm_cell.c | 23 +- src/WINNT/afsd/cm_conn.c | 279 +- src/WINNT/afsd/cm_dcache.c | 4 +- src/WINNT/afsd/cm_freelance.c | 8 +- src/WINNT/afsd/cm_ioctl.c | 29 +- src/WINNT/afsd/cm_rpc.c | 230 +- src/WINNT/afsd/cm_rpc.h | 4 +- src/WINNT/afsd/cm_scache.c | 10 +- src/WINNT/afsd/cm_vnodeops.c | 18 +- src/WINNT/afsd/fs.c | 3354 +++++++++++++++--------- src/WINNT/afsd/fs.h | 15 +- src/WINNT/afsd/fs_utils.c | 2 + src/WINNT/afsd/smb.c | 87 +- src/WINNT/afsd/smb.h | 4 + src/WINNT/afsd/smb3.c | 492 ++-- src/WINNT/aklog/aklog.c | 3 +- src/WINNT/client_exp/NTMakefile | 3 +- src/WINNT/doc/help/es_ES/AFS-LIGHT.HLP | Bin 208407 -> 208407 bytes src/WINNT/install/wix/config.wxi | 2 +- src/afs/DARWIN/osi_vm.c | 6 +- src/afs/DUX/osi_vnodeops.c | 67 +- src/afs/LINUX/osi_groups.c | 23 +- src/afs/LINUX/osi_machdep.h | 8 + src/afs/LINUX/osi_misc.c | 81 +- src/afs/LINUX/osi_module.c | 486 +--- src/afs/LINUX/osi_probe.c | 1225 +++++++++ src/afs/LINUX/osi_prototypes.h | 7 + src/afs/LINUX/osi_syscall.c | 433 +++ src/afs/LINUX/osi_vfsops.c | 6 +- src/afs/LINUX/osi_vnodeops.c | 95 +- src/afs/OBSD/osi_sleep.c | 11 +- src/afs/OBSD/osi_vnodeops.c | 13 +- src/afs/VNOPS/afs_vnop_attrs.c | 54 +- src/afs/VNOPS/afs_vnop_create.c | 48 +- src/afs/VNOPS/afs_vnop_dirops.c | 46 +- src/afs/VNOPS/afs_vnop_fid.c | 17 +- src/afs/VNOPS/afs_vnop_link.c | 15 +- src/afs/VNOPS/afs_vnop_lookup.c | 40 +- src/afs/VNOPS/afs_vnop_remove.c | 30 +- src/afs/VNOPS/afs_vnop_rename.c | 30 +- src/afs/VNOPS/afs_vnop_symlink.c | 16 +- src/afs/VNOPS/afs_vnop_write.c | 34 +- src/afs/afs.h | 16 +- src/afs/afs_buffer.c | 73 +- src/afs/afs_call.c | 29 +- src/afs/afs_dcache.c | 5 +- src/afs/afs_memcache.c | 8 +- src/afs/afs_osi.c | 24 +- src/afs/afs_osi.h | 9 - src/afs/afs_osi_pag.c | 6 +- src/afs/afs_pioctl.c | 179 +- src/afs/afs_segments.c | 31 +- src/afs/afs_server.c | 15 +- src/afs/afs_vcache.c | 217 +- src/afs/sysincludes.h | 2 + src/afsd/Makefile.in | 2 +- src/afsd/afs.rc.solaris.2.9 | 3 + src/afsd/afsd.c | 6 +- src/cf/linux-test3.m4 | 4 +- src/cf/linux-test4.m4 | 78 +- src/cf/osconf.m4 | 30 +- src/config/NTMakefile.i386_nt40 | 2 +- src/config/afs_args.h | 8 + src/config/afs_sysnames.h | 4 + src/config/afsconfig.h.in | 15 +- src/config/make_libafs_tree.pl | 2 +- src/config/param.amd64_fbsd_53.h | 202 ++ src/config/param.i386_nbsd30.h | 21 + src/config/param.ia64_linux26.h | 6 +- src/config/param.nbsd30.h | 158 ++ src/config/param.s390x_linux26.h | 173 ++ src/config/param.sun4x_510.h | 3 - src/config/param.sunx86_510.h | 26 +- src/libafs/Makefile.common.in | 4 + src/libafs/MakefileProto.LINUX.in | 8 +- src/libafs/MakefileProto.SOLARIS.in | 9 +- src/lwp/Makefile.in | 5 + src/lwp/iomgr.c | 8 +- src/lwp/lwp.c | 31 +- src/lwp/lwp.h | 6 + src/lwp/process.amd64.s | 161 ++ src/packaging/Debian/kern-sysname | 11 +- src/packaging/MacOS/OpenAFS.Info.plist | 4 +- src/packaging/MacOS/OpenAFS.info | 2 +- src/ptserver/Makefile.in | 16 +- src/ptserver/NTMakefile | 3 +- src/ptserver/ptuser.c | 4 +- src/ptserver/ptuser.h | 44 + src/rx/LINUX/rx_knet.c | 14 +- src/rx/rx.c | 15 +- src/rx/rx.h | 3 +- src/rx/rx_globals.h | 7 +- src/rx/rx_packet.c | 8 +- src/rx/rx_prototypes.h | 2 + src/rx/rxdebug.c | 4 +- src/sys/Makefile.in | 2 +- src/sys/pioctl_nt.c | 42 +- src/ubik/remote.c | 3 +- src/venus/fstrace.c | 12 +- src/vfsck/setup.c | 8 +- src/viced/afsfileprocs.c | 23 +- src/viced/callback.c | 18 +- src/viced/fs_stats.h | 5 +- src/volser/vsprocs.c | 2 +- src/xstat/xstat_fs_test.c | 6 +- 122 files changed, 7564 insertions(+), 3986 deletions(-) create mode 100644 src/afs/LINUX/osi_probe.c create mode 100644 src/afs/LINUX/osi_syscall.c create mode 100644 src/config/param.amd64_fbsd_53.h create mode 100644 src/config/param.i386_nbsd30.h create mode 100644 src/config/param.nbsd30.h create mode 100644 src/config/param.s390x_linux26.h create mode 100644 src/lwp/process.amd64.s create mode 100644 src/ptserver/ptuser.h diff --git a/acinclude.m4 b/acinclude.m4 index 6d2f70cb9..a5fb5935d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -316,10 +316,18 @@ else AFS_PARAM_COMMON=param.nbsd16.h AFS_SYSNAME="ppc_nbsd16" ;; - i?86-*-netbsd*2.99*) + i?86-*-netbsd*2.1*) AFS_PARAM_COMMON=param.nbsd21.h AFS_SYSNAME="i386_nbsd21" ;; + i?86-*-netbsd*2.99*) + AFS_PARAM_COMMON=param.nbsd30.h + AFS_SYSNAME="i386_nbsd30" + ;; + i?86-*-netbsd*3.0*) + AFS_PARAM_COMMON=param.nbsd30.h + AFS_SYSNAME="i386_nbsd30" + ;; hppa*-hp-hpux11.0*) AFS_SYSNAME="hp_ux110" ;; @@ -546,19 +554,19 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) OPENAFS_GCC_SUPPORTS_PIPE AC_SUBST(LINUX_GCC_KOPTS) ifdef([OPENAFS_CONFIGURE_LIBAFS], - [LINUX_BUILD_VNODE_FROM_INODE(src/config,afs)], + [LINUX_BUILD_VNODE_FROM_INODE(src/config,src/afs)], [LINUX_BUILD_VNODE_FROM_INODE(${srcdir}/src/config,src/afs/LINUX,${srcdir}/src/afs/LINUX)] ) LINUX_COMPLETION_H_EXISTS LINUX_DEFINES_FOR_EACH_PROCESS LINUX_DEFINES_PREV_TASK - LINUX_EXPORTS_TASKLIST_LOCK LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_GFP_MASK LINUX_FS_STRUCT_INODE_HAS_I_ALLOC_SEM LINUX_FS_STRUCT_INODE_HAS_I_TRUNCATE_SEM LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS LINUX_FS_STRUCT_INODE_HAS_I_DEVICES + LINUX_FS_STRUCT_INODE_HAS_I_SB_LIST LINUX_FS_STRUCT_INODE_HAS_I_SECURITY LINUX_INODE_SETATTR_RETURN_TYPE LINUX_WRITE_INODE_RETURN_TYPE @@ -575,6 +583,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIG LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGHAND LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK + LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_RLIM + LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM + LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_EXIT_STATE LINUX_WHICH_MODULES if test "x$ac_cv_linux_config_modversions" = "xno" -o $AFS_SYSKVERS -ge 26; then AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported]) @@ -625,9 +636,6 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) if test "x$ac_cv_linux_exports_sys_wait4" = "xyes" ; then AC_DEFINE(EXPORTED_SYS_WAIT4, 1, [define if your linux kernel exports sys_wait4]) fi - if test "x$ac_cv_linux_exports_tasklist_lock" = "xyes" ; then - AC_DEFINE(EXPORTED_TASKLIST_LOCK, 1, [define if your linux kernel exports tasklist_lock]) - fi if test "x$ac_cv_linux_exports_sys_call_table" = "xyes"; then AC_DEFINE(EXPORTED_SYS_CALL_TABLE) fi @@ -673,6 +681,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) if test "x$ac_cv_linux_fs_struct_inode_has_i_security" = "xyes"; then AC_DEFINE(STRUCT_INODE_HAS_I_SECURITY, 1, [define if you struct inode has i_security]) fi + if test "x$ac_cv_linux_fs_struct_inode_has_i_sb_list" = "xyes"; then + AC_DEFINE(STRUCT_INODE_HAS_I_SB_LIST, 1, [define if you struct inode has i_sb_list]) + fi if test "x$ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers" = "xyes"; then AC_DEFINE(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, 1, [define if your struct inode has data_buffers]) fi @@ -706,6 +717,15 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) if test "x$ac_cv_linux_sched_struct_task_struct_has_sig" = "xyes"; then AC_DEFINE(STRUCT_TASK_STRUCT_HAS_SIG, 1, [define if your struct task_struct has sig]) fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_rlim" = "xyes"; then + AC_DEFINE(STRUCT_TASK_STRUCT_HAS_RLIM, 1, [define if your struct task_struct has rlim]) + fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_signal_rlim" = "xyes"; then + AC_DEFINE(STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM, 1, [define if your struct task_struct has signal->rlim]) + fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_exit_state" = "xyes"; then + AC_DEFINE(STRUCT_TASK_STRUCT_HAS_EXIT_STATE, 1, [define if your struct task_struct has exit_state]) + fi : fi esac diff --git a/aclocal.m4 b/aclocal.m4 index 62f8b3ef2..d1e0a7d7e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -328,10 +328,18 @@ else AFS_PARAM_COMMON=param.nbsd16.h AFS_SYSNAME="ppc_nbsd16" ;; - i?86-*-netbsd*2.99*) + i?86-*-netbsd*2.1*) AFS_PARAM_COMMON=param.nbsd21.h AFS_SYSNAME="i386_nbsd21" ;; + i?86-*-netbsd*2.99*) + AFS_PARAM_COMMON=param.nbsd30.h + AFS_SYSNAME="i386_nbsd30" + ;; + i?86-*-netbsd*3.0*) + AFS_PARAM_COMMON=param.nbsd30.h + AFS_SYSNAME="i386_nbsd30" + ;; hppa*-hp-hpux11.0*) AFS_SYSNAME="hp_ux110" ;; @@ -558,19 +566,19 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) OPENAFS_GCC_SUPPORTS_PIPE AC_SUBST(LINUX_GCC_KOPTS) ifdef([OPENAFS_CONFIGURE_LIBAFS], - [LINUX_BUILD_VNODE_FROM_INODE(src/config,afs)], + [LINUX_BUILD_VNODE_FROM_INODE(src/config,src/afs)], [LINUX_BUILD_VNODE_FROM_INODE(${srcdir}/src/config,src/afs/LINUX,${srcdir}/src/afs/LINUX)] ) LINUX_COMPLETION_H_EXISTS LINUX_DEFINES_FOR_EACH_PROCESS LINUX_DEFINES_PREV_TASK - LINUX_EXPORTS_TASKLIST_LOCK LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_GFP_MASK LINUX_FS_STRUCT_INODE_HAS_I_ALLOC_SEM LINUX_FS_STRUCT_INODE_HAS_I_TRUNCATE_SEM LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS LINUX_FS_STRUCT_INODE_HAS_I_DEVICES + LINUX_FS_STRUCT_INODE_HAS_I_SB_LIST LINUX_FS_STRUCT_INODE_HAS_I_SECURITY LINUX_INODE_SETATTR_RETURN_TYPE LINUX_WRITE_INODE_RETURN_TYPE @@ -587,6 +595,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIG LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGHAND LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK + LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_RLIM + LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM + LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_EXIT_STATE LINUX_WHICH_MODULES if test "x$ac_cv_linux_config_modversions" = "xno" -o $AFS_SYSKVERS -ge 26; then AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported]) @@ -637,9 +648,6 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) if test "x$ac_cv_linux_exports_sys_wait4" = "xyes" ; then AC_DEFINE(EXPORTED_SYS_WAIT4, 1, [define if your linux kernel exports sys_wait4]) fi - if test "x$ac_cv_linux_exports_tasklist_lock" = "xyes" ; then - AC_DEFINE(EXPORTED_TASKLIST_LOCK, 1, [define if your linux kernel exports tasklist_lock]) - fi if test "x$ac_cv_linux_exports_sys_call_table" = "xyes"; then AC_DEFINE(EXPORTED_SYS_CALL_TABLE) fi @@ -685,6 +693,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) if test "x$ac_cv_linux_fs_struct_inode_has_i_security" = "xyes"; then AC_DEFINE(STRUCT_INODE_HAS_I_SECURITY, 1, [define if you struct inode has i_security]) fi + if test "x$ac_cv_linux_fs_struct_inode_has_i_sb_list" = "xyes"; then + AC_DEFINE(STRUCT_INODE_HAS_I_SB_LIST, 1, [define if you struct inode has i_sb_list]) + fi if test "x$ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers" = "xyes"; then AC_DEFINE(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, 1, [define if your struct inode has data_buffers]) fi @@ -718,6 +729,15 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) if test "x$ac_cv_linux_sched_struct_task_struct_has_sig" = "xyes"; then AC_DEFINE(STRUCT_TASK_STRUCT_HAS_SIG, 1, [define if your struct task_struct has sig]) fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_rlim" = "xyes"; then + AC_DEFINE(STRUCT_TASK_STRUCT_HAS_RLIM, 1, [define if your struct task_struct has rlim]) + fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_signal_rlim" = "xyes"; then + AC_DEFINE(STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM, 1, [define if your struct task_struct has signal->rlim]) + fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_exit_state" = "xyes"; then + AC_DEFINE(STRUCT_TASK_STRUCT_HAS_EXIT_STATE, 1, [define if your struct task_struct has exit_state]) + fi : fi esac @@ -1584,23 +1604,6 @@ AC_MSG_RESULT($ac_cv_linux_exports_sys_wait4) CPPFLAGS="$save_CPPFLAGS"]) -AC_DEFUN([LINUX_EXPORTS_TASKLIST_LOCK], [ -AC_MSG_CHECKING(for exported tasklist_lock) -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" -AC_CACHE_VAL(ac_cv_linux_exports_tasklist_lock, -[ -AC_TRY_COMPILE( -[#include ], -[#ifndef __ver_tasklist_lock -#error tasklist_lock not exported -#endif], -ac_cv_linux_exports_tasklist_lock=yes, -ac_cv_linux_exports_tasklist_lock=no)]) -AC_MSG_RESULT($ac_cv_linux_exports_tasklist_lock) -CPPFLAGS="$save_CPPFLAGS"]) - - AC_DEFUN([LINUX_FS_STRUCT_INODE_HAS_I_CDEV], [ AC_MSG_CHECKING(for i_cdev in struct inode) save_CPPFLAGS="$CPPFLAGS" @@ -1697,6 +1700,22 @@ AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_security) CPPFLAGS="$save_CPPFLAGS"]) +AC_DEFUN([LINUX_FS_STRUCT_INODE_HAS_I_SB_LIST], [ +AC_MSG_CHECKING(for i_sb_list in struct inode) +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_sb_list, +[ +AC_TRY_COMPILE( +[#include ], +[struct inode _inode; +printf("%d\n", _inode.i_sb_list);], +ac_cv_linux_fs_struct_inode_has_i_sb_list=yes, +ac_cv_linux_fs_struct_inode_has_i_sb_list=no)]) +AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_sb_list) +CPPFLAGS="$save_CPPFLAGS"]) + + AC_DEFUN([LINUX_RECALC_SIGPENDING_ARG_TYPE],[ AC_MSG_CHECKING(for recalc_sigpending arg type) save_CPPFLAGS="$CPPFLAGS" @@ -1789,6 +1808,51 @@ ac_cv_linux_sched_struct_task_struct_has_sighand=no)]) AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_sighand) CPPFLAGS="$save_CPPFLAGS"]) +AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_RLIM], [ +AC_MSG_CHECKING(for rlim in struct task_struct) +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_rlim, +[ +AC_TRY_COMPILE( +[#include ], +[struct task_struct _tsk; +printf("%d\n", _tsk.rlim);], +ac_cv_linux_sched_struct_task_struct_has_rlim=yes, +ac_cv_linux_sched_struct_task_struct_has_rlim=no)]) +AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_rlim) +CPPFLAGS="$save_CPPFLAGS"]) + +AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM], [ +AC_MSG_CHECKING(for signal->rlim in struct task_struct) +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_signal_rlim, +[ +AC_TRY_COMPILE( +[#include ], +[struct task_struct _tsk; +printf("%d\n", _tsk.signal->rlim);], +ac_cv_linux_sched_struct_task_struct_has_signal_rlim=yes, +ac_cv_linux_sched_struct_task_struct_has_signal_rlim=no)]) +AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_signal_rlim) +CPPFLAGS="$save_CPPFLAGS"]) + +AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_EXIT_STATE], [ +AC_MSG_CHECKING(for exit_state in struct task_struct) +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_exit_state, +[ +AC_TRY_COMPILE( +[#include ], +[struct task_struct _tsk; +printf("%d\n", _tsk.exit_state);], +ac_cv_linux_sched_struct_task_struct_has_exit_state=yes, +ac_cv_linux_sched_struct_task_struct_has_exit_state=no)]) +AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_exit_state) +CPPFLAGS="$save_CPPFLAGS"]) + AC_DEFUN([LINUX_INODE_SETATTR_RETURN_TYPE],[ AC_MSG_CHECKING(for inode_setattr return type) save_CPPFLAGS="$CPPFLAGS" @@ -2031,7 +2095,7 @@ CPPFLAGS="$save_CPPFLAGS"]) AC_DEFUN([LINUX_KERNEL_PAGE_FOLLOW_LINK],[ AC_MSG_CHECKING(for page_follow_link_light vs page_follow_link) save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -Werror-implicit-function-declaration -D__KERNEL__ $CPPFLAGS" AC_CACHE_VAL(ac_cv_linux_kernel_page_follow_link, [ AC_TRY_COMPILE( @@ -2041,7 +2105,7 @@ AC_TRY_COMPILE( ], ac_cv_linux_kernel_page_follow_link=yes, ac_cv_linux_kernel_page_follow_link=no)]) -AC_MSG_RESULT($ac_cv_linux_kernel_page_follow_page) +AC_MSG_RESULT($ac_cv_linux_kernel_page_follow_link) CPPFLAGS="$save_CPPFLAGS"]) AC_DEFUN([AC_FUNC_RES_SEARCH], [ @@ -2265,7 +2329,7 @@ case $AFS_SYSNAME in YACC="byacc" ;; - *nbsd2*) + *nbsd2*|*nbsd3*) LEX="flex -l" MT_CFLAGS='${XCFLAGS} -DAFS_PTHREAD_ENV -D_REENTRANT ' MT_LIBS="-lpthread" # XXX -pthread soon @@ -2484,21 +2548,7 @@ case $AFS_SYSNAME in EXTRA_VLIBOBJS="fstab.o" ;; - ppc_linux22) - INSTALL="install" - KERN_OPTMZ=-O2 - LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' - MT_LIBS="-lpthread" - PAM_CFLAGS="-O2 -Dlinux -DLINUX_PAM -fPIC" - SHLIB_LDFLAGS="-shared -Xlinker -x" - TXLIBS="-lncurses" - XCFLAGS="-O2 -D_LARGEFILE64_SOURCE" - YACC="bison -y" - SHLIB_LINKER="${MT_CC} -shared" - ;; - - ppc_linux24) + ppc_linux*) KERN_OPTMZ=-O2 LEX="flex -l" MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' @@ -2573,7 +2623,7 @@ case $AFS_SYSNAME in SHLIB_LINKER="${MT_CC} -shared" ;; - s390_linux24) + s390_linux24|s390_linux26) CC="gcc" CCOBJ="gcc" LD="ld" @@ -2590,7 +2640,7 @@ case $AFS_SYSNAME in SHLIB_LINKER="${MT_CC} -shared" ;; - s390x_linux24) + s390x_linux24|s390x_linux26) CC="gcc" CCOBJ="gcc" LD="ld" @@ -2856,7 +2906,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -2877,7 +2927,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -2898,7 +2948,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -2919,7 +2969,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" diff --git a/configure b/configure index e1d8334a3..a8ecf0dc5 100644 --- a/configure +++ b/configure @@ -754,7 +754,7 @@ fi PACKAGE=openafs -VERSION=1.3.77 +VERSION=1.3.79 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -2506,10 +2506,18 @@ echo "configure:2424: checking your AFS sysname" >&5 AFS_PARAM_COMMON=param.nbsd16.h AFS_SYSNAME="ppc_nbsd16" ;; - i?86-*-netbsd*2.99*) + i?86-*-netbsd*2.1*) AFS_PARAM_COMMON=param.nbsd21.h AFS_SYSNAME="i386_nbsd21" ;; + i?86-*-netbsd*2.99*) + AFS_PARAM_COMMON=param.nbsd30.h + AFS_SYSNAME="i386_nbsd30" + ;; + i?86-*-netbsd*3.0*) + AFS_PARAM_COMMON=param.nbsd30.h + AFS_SYSNAME="i386_nbsd30" + ;; hppa*-hp-hpux11.0*) AFS_SYSNAME="hp_ux110" ;; @@ -2698,7 +2706,7 @@ echo "configure:2424: checking your AFS sysname" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include $CPPFLAGS" cat > conftest.$ac_ext < int main() { @@ -2707,7 +2715,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:2711: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2719: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_is_uml=yes else @@ -2742,7 +2750,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) fi echo $ac_n "checking if $CC accepts -march=pentium""... $ac_c" 1>&6 -echo "configure:2746: checking if $CC accepts -march=pentium" >&5 +echo "configure:2754: checking if $CC accepts -march=pentium" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-MARCH=pentium" if eval "test \"`echo '$''{'openafs_gcc_supports_march'+set}'`\" = set"; then @@ -2750,14 +2758,14 @@ if eval "test \"`echo '$''{'openafs_gcc_supports_march'+set}'`\" = set"; then else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2769: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* openafs_gcc_supports_march=yes else @@ -2780,7 +2788,7 @@ CFLAGS="$save_CFLAGS" echo $ac_n "checking if $CC needs -fno-strength-reduce""... $ac_c" 1>&6 -echo "configure:2784: checking if $CC needs -fno-strength-reduce" >&5 +echo "configure:2792: checking if $CC needs -fno-strength-reduce" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-fno-strength-reduce" if eval "test \"`echo '$''{'openafs_gcc_needs_no_strength_reduce'+set}'`\" = set"; then @@ -2788,14 +2796,14 @@ if eval "test \"`echo '$''{'openafs_gcc_needs_no_strength_reduce'+set}'`\" = set else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2807: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* openafs_gcc_needs_no_strength_reduce=yes else @@ -2815,7 +2823,7 @@ CFLAGS="$save_CFLAGS" echo $ac_n "checking if $CC needs -fno-strict-aliasing""... $ac_c" 1>&6 -echo "configure:2819: checking if $CC needs -fno-strict-aliasing" >&5 +echo "configure:2827: checking if $CC needs -fno-strict-aliasing" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-fno-strict-aliasing" if eval "test \"`echo '$''{'openafs_gcc_needs_no_strict_aliasing'+set}'`\" = set"; then @@ -2823,14 +2831,14 @@ if eval "test \"`echo '$''{'openafs_gcc_needs_no_strict_aliasing'+set}'`\" = set else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* openafs_gcc_needs_no_strict_aliasing=yes else @@ -2850,7 +2858,7 @@ CFLAGS="$save_CFLAGS" echo $ac_n "checking if $CC supports -fno-common""... $ac_c" 1>&6 -echo "configure:2854: checking if $CC supports -fno-common" >&5 +echo "configure:2862: checking if $CC supports -fno-common" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-fno-common" if eval "test \"`echo '$''{'openafs_gcc_supports_no_common'+set}'`\" = set"; then @@ -2858,14 +2866,14 @@ if eval "test \"`echo '$''{'openafs_gcc_supports_no_common'+set}'`\" = set"; the else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* openafs_gcc_supports_no_common=yes else @@ -2885,7 +2893,7 @@ CFLAGS="$save_CFLAGS" echo $ac_n "checking if $CC supports -pipe""... $ac_c" 1>&6 -echo "configure:2889: checking if $CC supports -pipe" >&5 +echo "configure:2897: checking if $CC supports -pipe" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-pipe" if eval "test \"`echo '$''{'openafs_gcc_supports_pipe'+set}'`\" = set"; then @@ -2893,14 +2901,14 @@ if eval "test \"`echo '$''{'openafs_gcc_supports_pipe'+set}'`\" = set"; then else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2912: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* openafs_gcc_supports_pipe=yes else @@ -2921,7 +2929,7 @@ CFLAGS="$save_CFLAGS" echo $ac_n "checking whether to build osi_vfs.h""... $ac_c" 1>&6 -echo "configure:2925: checking whether to build osi_vfs.h" >&5 +echo "configure:2933: checking whether to build osi_vfs.h" >&5 configdir=${srcdir}/src/config outputdir=src/afs/LINUX tmpldir=${srcdir}/src/afs/LINUX @@ -2931,7 +2939,7 @@ $configdir/make_vnode.pl -i $LINUX_KERNEL_PATH -t ${tmpldir} -o $outputdir echo $ac_n "checking for linux/completion.h existance""... $ac_c" 1>&6 -echo "configure:2935: checking for linux/completion.h existance" >&5 +echo "configure:2943: checking for linux/completion.h existance" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_completion_h_exists'+set}'`\" = set"; then @@ -2939,7 +2947,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_completion_h_exists'+set}'`\" = set"; th else cat > conftest.$ac_ext < #include @@ -2951,7 +2959,7 @@ lose ; return 0; } EOF -if { (eval echo configure:2955: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2963: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_completion_h_exists=yes else @@ -2967,7 +2975,7 @@ echo "$ac_t""$ac_cv_linux_completion_h_exists" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for defined for_each_process""... $ac_c" 1>&6 -echo "configure:2971: checking for defined for_each_process" >&5 +echo "configure:2979: checking for defined for_each_process" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_defines_for_each_process'+set}'`\" = set"; then @@ -2975,7 +2983,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_defines_for_each_process'+set}'`\" = set else cat > conftest.$ac_ext < int main() { @@ -2984,7 +2992,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:2988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_defines_for_each_process=yes else @@ -3000,7 +3008,7 @@ echo "$ac_t""$ac_cv_linux_defines_for_each_process" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for defined prev_task""... $ac_c" 1>&6 -echo "configure:3004: checking for defined prev_task" >&5 +echo "configure:3012: checking for defined prev_task" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_defines_prev_task'+set}'`\" = set"; then @@ -3008,7 +3016,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_defines_prev_task'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -3017,7 +3025,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_defines_prev_task=yes else @@ -3031,42 +3039,9 @@ fi echo "$ac_t""$ac_cv_linux_defines_prev_task" 1>&6 CPPFLAGS="$save_CPPFLAGS" - -echo $ac_n "checking for exported tasklist_lock""... $ac_c" 1>&6 -echo "configure:3037: checking for exported tasklist_lock" >&5 -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" -if eval "test \"`echo '$''{'ac_cv_linux_exports_tasklist_lock'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - -cat > conftest.$ac_ext < -int main() { -#ifndef __ver_tasklist_lock -#error tasklist_lock not exported -#endif -; return 0; } -EOF -if { (eval echo configure:3054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_linux_exports_tasklist_lock=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_linux_exports_tasklist_lock=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_linux_exports_tasklist_lock" 1>&6 -CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for page_lock in struct address_space""... $ac_c" 1>&6 -echo "configure:3070: checking for page_lock in struct address_space" >&5 +echo "configure:3045: checking for page_lock in struct address_space" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_address_space_has_page_lock'+set}'`\" = set"; then @@ -3074,7 +3049,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_address_space_has_page_lock'+s else cat > conftest.$ac_ext < int main() { @@ -3082,7 +3057,7 @@ struct address_space _a_s; printf("%x\n", _a_s.page_lock); ; return 0; } EOF -if { (eval echo configure:3086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_address_space_has_page_lock=yes else @@ -3098,7 +3073,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_address_space_has_page_lock" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for gfp_mask in struct address_space""... $ac_c" 1>&6 -echo "configure:3102: checking for gfp_mask in struct address_space" >&5 +echo "configure:3077: checking for gfp_mask in struct address_space" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_address_space_has_gfp_mask'+set}'`\" = set"; then @@ -3106,7 +3081,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_address_space_has_gfp_mask'+se else cat > conftest.$ac_ext < int main() { @@ -3114,7 +3089,7 @@ struct address_space _a; printf("%d\n", _a.gfp_mask); ; return 0; } EOF -if { (eval echo configure:3118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_address_space_has_gfp_mask=yes else @@ -3130,7 +3105,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_address_space_has_gfp_mask" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for i_alloc_sem in struct inode""... $ac_c" 1>&6 -echo "configure:3134: checking for i_alloc_sem in struct inode" >&5 +echo "configure:3109: checking for i_alloc_sem in struct inode" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_alloc_sem'+set}'`\" = set"; then @@ -3138,7 +3113,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_alloc_sem'+set}'`\ else cat > conftest.$ac_ext < int main() { @@ -3146,7 +3121,7 @@ struct inode _i; printf("%x\n", _i.i_alloc_sem); ; return 0; } EOF -if { (eval echo configure:3150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_inode_has_i_alloc_sem=yes else @@ -3162,7 +3137,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_alloc_sem" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for i_truncate_sem in struct inode""... $ac_c" 1>&6 -echo "configure:3166: checking for i_truncate_sem in struct inode" >&5 +echo "configure:3141: checking for i_truncate_sem in struct inode" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_truncate_sem'+set}'`\" = set"; then @@ -3170,7 +3145,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_truncate_sem'+set} else cat > conftest.$ac_ext < int main() { @@ -3178,7 +3153,7 @@ struct inode _i; printf("%x\n", _i.i_truncate_sem); ; return 0; } EOF -if { (eval echo configure:3182: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_inode_has_i_truncate_sem=yes else @@ -3194,7 +3169,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_truncate_sem" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for i_dirty_data_buffers in struct inode""... $ac_c" 1>&6 -echo "configure:3198: checking for i_dirty_data_buffers in struct inode" >&5 +echo "configure:3173: checking for i_dirty_data_buffers in struct inode" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers'+set}'`\" = set"; then @@ -3202,7 +3177,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers else cat > conftest.$ac_ext < int main() { @@ -3210,7 +3185,7 @@ struct inode _inode; printf("%d\n", _inode.i_dirty_data_buffers); ; return 0; } EOF -if { (eval echo configure:3214: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers=yes else @@ -3226,7 +3201,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for i_devices in struct inode""... $ac_c" 1>&6 -echo "configure:3230: checking for i_devices in struct inode" >&5 +echo "configure:3205: checking for i_devices in struct inode" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_cdev'+set}'`\" = set"; then @@ -3234,7 +3209,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_cdev'+set}'`\" = s else cat > conftest.$ac_ext < int main() { @@ -3242,7 +3217,7 @@ struct inode _inode; printf("%d\n", _inode.i_devices); ; return 0; } EOF -if { (eval echo configure:3246: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_inode_has_i_devices=yes else @@ -3257,8 +3232,40 @@ fi echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_devices" 1>&6 CPPFLAGS="$save_CPPFLAGS" +echo $ac_n "checking for i_sb_list in struct inode""... $ac_c" 1>&6 +echo "configure:3237: checking for i_sb_list in struct inode" >&5 +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_sb_list'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +int main() { +struct inode _inode; +printf("%d\n", _inode.i_sb_list); +; return 0; } +EOF +if { (eval echo configure:3253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_linux_fs_struct_inode_has_i_sb_list=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_linux_fs_struct_inode_has_i_sb_list=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_sb_list" 1>&6 +CPPFLAGS="$save_CPPFLAGS" + echo $ac_n "checking for i_security in struct inode""... $ac_c" 1>&6 -echo "configure:3262: checking for i_security in struct inode" >&5 +echo "configure:3269: checking for i_security in struct inode" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_security'+set}'`\" = set"; then @@ -3266,7 +3273,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_security'+set}'`\" else cat > conftest.$ac_ext < int main() { @@ -3274,7 +3281,7 @@ struct inode _inode; printf("%d\n", _inode.i_security); ; return 0; } EOF -if { (eval echo configure:3278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_inode_has_i_security=yes else @@ -3290,7 +3297,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_security" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for inode_setattr return type""... $ac_c" 1>&6 -echo "configure:3294: checking for inode_setattr return type" >&5 +echo "configure:3301: checking for inode_setattr return type" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_func_inode_setattr_returns_int'+set}'`\" = set"; then @@ -3298,7 +3305,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_func_inode_setattr_returns_int'+set}'`\" else cat > conftest.$ac_ext < int main() { @@ -3308,7 +3315,7 @@ int i; i = inode_setattr(&_inode, &_iattr); ; return 0; } EOF -if { (eval echo configure:3312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3319: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_inode_setattr_returns_int=yes else @@ -3324,7 +3331,7 @@ echo "$ac_t""$ac_cv_linux_func_inode_setattr_returns_int" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for write_inode return type""... $ac_c" 1>&6 -echo "configure:3328: checking for write_inode return type" >&5 +echo "configure:3335: checking for write_inode return type" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_func_write_inode_returns_int'+set}'`\" = set"; then @@ -3332,7 +3339,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_func_write_inode_returns_int'+set}'`\" = else cat > conftest.$ac_ext < int main() { @@ -3342,7 +3349,7 @@ int i; i = _sops.write_inode(&_inode, 0); ; return 0; } EOF -if { (eval echo configure:3346: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_write_inode_returns_int=yes else @@ -3360,13 +3367,13 @@ CPPFLAGS="$save_CPPFLAGS" save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" echo $ac_n "checking whether inode_operations.create takes a nameidata""... $ac_c" 1>&6 -echo "configure:3364: checking whether inode_operations.create takes a nameidata" >&5 +echo "configure:3371: checking whether inode_operations.create takes a nameidata" >&5 if eval "test \"`echo '$''{'ac_cv_linux_func_i_create_takes_nameidata'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3377,7 +3384,7 @@ struct nameidata _nameidata; (void)_inode.i_op->create(&_inode, &_dentry, 0, &_nameidata); ; return 0; } EOF -if { (eval echo configure:3381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3388: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_i_create_takes_nameidata=yes else @@ -3397,13 +3404,13 @@ EOF fi echo $ac_n "checking whether inode_operations.lookup takes a nameidata""... $ac_c" 1>&6 -echo "configure:3401: checking whether inode_operations.lookup takes a nameidata" >&5 +echo "configure:3408: checking whether inode_operations.lookup takes a nameidata" >&5 if eval "test \"`echo '$''{'ac_cv_linux_func_i_lookup_takes_nameidata'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3414,7 +3421,7 @@ struct nameidata _nameidata; (void)_inode.i_op->lookup(&_inode, &_dentry, &_nameidata); ; return 0; } EOF -if { (eval echo configure:3418: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_i_lookup_takes_nameidata=yes else @@ -3434,13 +3441,13 @@ EOF fi echo $ac_n "checking whether inode_operations.permission takes a nameidata""... $ac_c" 1>&6 -echo "configure:3438: checking whether inode_operations.permission takes a nameidata" >&5 +echo "configure:3445: checking whether inode_operations.permission takes a nameidata" >&5 if eval "test \"`echo '$''{'ac_cv_linux_func_i_permission_takes_nameidata'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3450,7 +3457,7 @@ struct nameidata _nameidata; (void)_inode.i_op->permission(&_inode, 0, &_nameidata); ; return 0; } EOF -if { (eval echo configure:3454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3461: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_i_permission_takes_nameidata=yes else @@ -3470,14 +3477,14 @@ EOF fi echo $ac_n "checking whether dentry_operations.d_revalidate takes a nameidata""... $ac_c" 1>&6 -echo "configure:3474: checking whether dentry_operations.d_revalidate takes a nameidata" >&5 +echo "configure:3481: checking whether dentry_operations.d_revalidate takes a nameidata" >&5 CPPFLAGS="$CPPFLAGS -Werror" if eval "test \"`echo '$''{'ac_cv_linux_func_d_revalidate_takes_nameidata'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3487,7 +3494,7 @@ struct nameidata _nameidata; (void)_dentry.d_op->d_revalidate(&_dentry, &_nameidata); ; return 0; } EOF -if { (eval echo configure:3491: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3498: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_d_revalidate_takes_nameidata=yes else @@ -3511,13 +3518,13 @@ CPPFLAGS="$save_CPPFLAGS" save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" echo $ac_n "checking whether address_space_operations.writepage takes a writeback_control""... $ac_c" 1>&6 -echo "configure:3515: checking whether address_space_operations.writepage takes a writeback_control" >&5 +echo "configure:3522: checking whether address_space_operations.writepage takes a writeback_control" >&5 if eval "test \"`echo '$''{'ac_cv_linux_func_a_writepage_takes_writeback_control'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3529,7 +3536,7 @@ struct writeback_control _writeback_control; (void)_aops.writepage(&_page, &_writeback_control); ; return 0; } EOF -if { (eval echo configure:3533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_a_writepage_takes_writeback_control=yes else @@ -3551,7 +3558,7 @@ fi CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for linux/syscall.h in kernel""... $ac_c" 1>&6 -echo "configure:3555: checking for linux/syscall.h in kernel" >&5 +echo "configure:3562: checking for linux/syscall.h in kernel" >&5 if test -f "${LINUX_KERNEL_PATH}/include/linux/syscall.h"; then ac_linux_syscall=yes echo "$ac_t""$ac_linux_syscall" 1>&6 @@ -3562,7 +3569,7 @@ echo "configure:3555: checking for linux/syscall.h in kernel" >&5 echo $ac_n "checking for SELinux kernel""... $ac_c" 1>&6 -echo "configure:3566: checking for SELinux kernel" >&5 +echo "configure:3573: checking for SELinux kernel" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_kernel_is_selinux'+set}'`\" = set"; then @@ -3570,7 +3577,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_kernel_is_selinux'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -3579,7 +3586,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3590: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_kernel_is_selinux=yes else @@ -3595,7 +3602,7 @@ echo "$ac_t""$ac_cv_linux_kernel_is_selinux" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for 5th argument in sock_create found in some SELinux kernels""... $ac_c" 1>&6 -echo "configure:3599: checking for 5th argument in sock_create found in some SELinux kernels" >&5 +echo "configure:3606: checking for 5th argument in sock_create found in some SELinux kernels" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_kernel_sock_create_v'+set}'`\" = set"; then @@ -3603,7 +3610,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_kernel_sock_create_v'+set}'`\" = set"; t else cat > conftest.$ac_ext < int main() { @@ -3612,7 +3619,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3623: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_kernel_sock_create_v=yes else @@ -3628,15 +3635,15 @@ echo "$ac_t""$ac_cv_linux_kernel_sock_create_v" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for page_follow_link_light vs page_follow_link""... $ac_c" 1>&6 -echo "configure:3632: checking for page_follow_link_light vs page_follow_link" >&5 +echo "configure:3639: checking for page_follow_link_light vs page_follow_link" >&5 save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -Werror-implicit-function-declaration -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_kernel_page_follow_link'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -3645,7 +3652,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_kernel_page_follow_link=yes else @@ -3657,7 +3664,7 @@ fi rm -f conftest* fi -echo "$ac_t""$ac_cv_linux_kernel_page_follow_page" 1>&6 +echo "$ac_t""$ac_cv_linux_kernel_page_follow_link" 1>&6 CPPFLAGS="$save_CPPFLAGS" RHCONFIG_SP="" @@ -3666,7 +3673,7 @@ if test "x$enable_redhat_buildsys" = "xyes"; then echo "configure: warning: Configured to build from a Red Hat SPEC file" 1>&2 else echo $ac_n "checking for redhat kernel configuration""... $ac_c" 1>&6 -echo "configure:3670: checking for redhat kernel configuration" >&5 +echo "configure:3677: checking for redhat kernel configuration" >&5 if test -f "${LINUX_KERNEL_PATH}/include/linux/rhconfig.h"; then ac_linux_rhconfig=yes RHCONFIG_SP="-D__BOOT_KERNEL_UP=1 -D__BOOT_KERNEL_SMP=0" @@ -3685,7 +3692,7 @@ fi echo $ac_n "checking for recalc_sigpending arg type""... $ac_c" 1>&6 -echo "configure:3689: checking for recalc_sigpending arg type" >&5 +echo "configure:3696: checking for recalc_sigpending arg type" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_func_recalc_sigpending_takes_void'+set}'`\" = set"; then @@ -3693,14 +3700,14 @@ if eval "test \"`echo '$''{'ac_cv_linux_func_recalc_sigpending_takes_void'+set}' else cat > conftest.$ac_ext < int main() { recalc_sigpending(); ; return 0; } EOF -if { (eval echo configure:3704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3711: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_recalc_sigpending_takes_void=yes else @@ -3716,7 +3723,7 @@ echo "$ac_t""$ac_cv_linux_func_recalc_sigpending_takes_void" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for parent in struct task_struct""... $ac_c" 1>&6 -echo "configure:3720: checking for parent in struct task_struct" >&5 +echo "configure:3727: checking for parent in struct task_struct" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_parent'+set}'`\" = set"; then @@ -3724,7 +3731,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_parent'+set else cat > conftest.$ac_ext < int main() { @@ -3732,7 +3739,7 @@ struct task_struct _tsk; printf("%d\n", _tsk.parent); ; return 0; } EOF -if { (eval echo configure:3736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3743: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_sched_struct_task_struct_has_parent=yes else @@ -3748,7 +3755,7 @@ echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_parent" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for real_parent in struct task_struct""... $ac_c" 1>&6 -echo "configure:3752: checking for real_parent in struct task_struct" >&5 +echo "configure:3759: checking for real_parent in struct task_struct" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_real_parent'+set}'`\" = set"; then @@ -3756,7 +3763,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_real_parent else cat > conftest.$ac_ext < int main() { @@ -3764,7 +3771,7 @@ struct task_struct _tsk; printf("%d\n", _tsk.real_parent); ; return 0; } EOF -if { (eval echo configure:3768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_sched_struct_task_struct_has_real_parent=yes else @@ -3780,7 +3787,7 @@ echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_real_parent" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for sig in struct task_struct""... $ac_c" 1>&6 -echo "configure:3784: checking for sig in struct task_struct" >&5 +echo "configure:3791: checking for sig in struct task_struct" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sig'+set}'`\" = set"; then @@ -3788,7 +3795,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sig'+set}'` else cat > conftest.$ac_ext < int main() { @@ -3796,7 +3803,7 @@ struct task_struct _tsk; printf("%d\n", _tsk.sig); ; return 0; } EOF -if { (eval echo configure:3800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3807: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_sched_struct_task_struct_has_sig=yes else @@ -3812,7 +3819,7 @@ echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_sig" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for sighand in struct task_struct""... $ac_c" 1>&6 -echo "configure:3816: checking for sighand in struct task_struct" >&5 +echo "configure:3823: checking for sighand in struct task_struct" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sighand'+set}'`\" = set"; then @@ -3820,7 +3827,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sighand'+se else cat > conftest.$ac_ext < int main() { @@ -3828,7 +3835,7 @@ struct task_struct _tsk; printf("%d\n", _tsk.sighand); ; return 0; } EOF -if { (eval echo configure:3832: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3839: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_sched_struct_task_struct_has_sighand=yes else @@ -3844,7 +3851,7 @@ echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_sighand" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for sigmask_lock in struct task_struct""... $ac_c" 1>&6 -echo "configure:3848: checking for sigmask_lock in struct task_struct" >&5 +echo "configure:3855: checking for sigmask_lock in struct task_struct" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sigmask_lock'+set}'`\" = set"; then @@ -3852,7 +3859,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sigmask_loc else cat > conftest.$ac_ext < int main() { @@ -3860,7 +3867,7 @@ struct task_struct _tsk; printf("%d\n", _tsk.sigmask_lock); ; return 0; } EOF -if { (eval echo configure:3864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3871: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_sched_struct_task_struct_has_sigmask_lock=yes else @@ -3875,19 +3882,115 @@ fi echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_sigmask_lock" 1>&6 CPPFLAGS="$save_CPPFLAGS" +echo $ac_n "checking for rlim in struct task_struct""... $ac_c" 1>&6 +echo "configure:3887: checking for rlim in struct task_struct" >&5 +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_rlim'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +int main() { +struct task_struct _tsk; +printf("%d\n", _tsk.rlim); +; return 0; } +EOF +if { (eval echo configure:3903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_rlim=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_rlim=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_rlim" 1>&6 +CPPFLAGS="$save_CPPFLAGS" + +echo $ac_n "checking for signal->rlim in struct task_struct""... $ac_c" 1>&6 +echo "configure:3919: checking for signal->rlim in struct task_struct" >&5 +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_signal_rlim'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +int main() { +struct task_struct _tsk; +printf("%d\n", _tsk.signal->rlim); +; return 0; } +EOF +if { (eval echo configure:3935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_signal_rlim=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_signal_rlim=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_signal_rlim" 1>&6 +CPPFLAGS="$save_CPPFLAGS" + +echo $ac_n "checking for exit_state in struct task_struct""... $ac_c" 1>&6 +echo "configure:3951: checking for exit_state in struct task_struct" >&5 +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_exit_state'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +int main() { +struct task_struct _tsk; +printf("%d\n", _tsk.exit_state); +; return 0; } +EOF +if { (eval echo configure:3967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_exit_state=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_exit_state=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_exit_state" 1>&6 +CPPFLAGS="$save_CPPFLAGS" + if test "x$enable_redhat_buildsys" = "xyes"; then MPS=Default else save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $RHCONFIG_SP $CPPFLAGS" echo $ac_n "checking if kernel uses MODVERSIONS""... $ac_c" 1>&6 -echo "configure:3885: checking if kernel uses MODVERSIONS" >&5 +echo "configure:3988: checking if kernel uses MODVERSIONS" >&5 if eval "test \"`echo '$''{'ac_cv_linux_config_modversions'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3899,7 +4002,7 @@ lose; ; return 0; } EOF -if { (eval echo configure:3903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_config_modversions=yes else @@ -3913,7 +4016,7 @@ fi echo "$ac_t""$ac_cv_linux_config_modversions" 1>&6 echo $ac_n "checking which kernel modules to build""... $ac_c" 1>&6 -echo "configure:3917: checking which kernel modules to build" >&5 +echo "configure:4020: checking which kernel modules to build" >&5 if test "x$ac_linux_rhconfig" = "xyes"; then MPS="MP SP" elif test "x$ac_cv_linux_config_modversions" = "xno" -a "$AFS_SYSKVERS" -lt 26; then @@ -3924,7 +4027,7 @@ echo "configure:3917: checking which kernel modules to build" >&5 else cat > conftest.$ac_ext < @@ -3935,7 +4038,7 @@ lose; ; return 0; } EOF -if { (eval echo configure:3939: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_config_smp=yes else @@ -3967,7 +4070,7 @@ fi else echo $ac_n "checking for exported init_mm""... $ac_c" 1>&6 -echo "configure:3971: checking for exported init_mm" >&5 +echo "configure:4074: checking for exported init_mm" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_init_mm'+set}'`\" = set"; then @@ -3975,7 +4078,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_init_mm'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -3984,7 +4087,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4091: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_init_mm=yes else @@ -4000,7 +4103,7 @@ echo "$ac_t""$ac_cv_linux_exports_init_mm" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported kallsyms_address_to_symbol""... $ac_c" 1>&6 -echo "configure:4004: checking for exported kallsyms_address_to_symbol" >&5 +echo "configure:4107: checking for exported kallsyms_address_to_symbol" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_kallsyms_address'+set}'`\" = set"; then @@ -4008,7 +4111,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_kallsyms_address'+set}'`\" = set else cat > conftest.$ac_ext < int main() { @@ -4017,7 +4120,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_kallsyms_address=yes else @@ -4033,7 +4136,7 @@ echo "$ac_t""$ac_cv_linux_exports_kallsyms_address" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported kallsyms_symbol_to_address""... $ac_c" 1>&6 -echo "configure:4037: checking for exported kallsyms_symbol_to_address" >&5 +echo "configure:4140: checking for exported kallsyms_symbol_to_address" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_kallsyms_symbol'+set}'`\" = set"; then @@ -4041,7 +4144,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_kallsyms_symbol'+set}'`\" = set" else cat > conftest.$ac_ext < int main() { @@ -4050,7 +4153,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_kallsyms_symbol=yes else @@ -4066,7 +4169,7 @@ echo "$ac_t""$ac_cv_linux_exports_kallsyms_symbol" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported sys_call_table""... $ac_c" 1>&6 -echo "configure:4070: checking for exported sys_call_table" >&5 +echo "configure:4173: checking for exported sys_call_table" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_call_table'+set}'`\" = set"; then @@ -4074,7 +4177,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_call_table'+set}'`\" = set"; else cat > conftest.$ac_ext < int main() { @@ -4083,7 +4186,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_sys_call_table=yes else @@ -4099,7 +4202,7 @@ echo "$ac_t""$ac_cv_linux_exports_sys_call_table" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported ia32_sys_call_table""... $ac_c" 1>&6 -echo "configure:4103: checking for exported ia32_sys_call_table" >&5 +echo "configure:4206: checking for exported ia32_sys_call_table" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_ia32_sys_call_table'+set}'`\" = set"; then @@ -4107,7 +4210,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_ia32_sys_call_table'+set}'`\" = else cat > conftest.$ac_ext < int main() { @@ -4116,7 +4219,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_ia32_sys_call_table=yes else @@ -4132,7 +4235,7 @@ echo "$ac_t""$ac_cv_linux_exports_ia32_sys_call_table" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported sys_chdir""... $ac_c" 1>&6 -echo "configure:4136: checking for exported sys_chdir" >&5 +echo "configure:4239: checking for exported sys_chdir" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_chdir'+set}'`\" = set"; then @@ -4140,7 +4243,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_chdir'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -4149,7 +4252,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4256: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_sys_chdir=yes else @@ -4165,7 +4268,7 @@ echo "$ac_t""$ac_cv_linux_exports_sys_chdir" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported sys_close""... $ac_c" 1>&6 -echo "configure:4169: checking for exported sys_close" >&5 +echo "configure:4272: checking for exported sys_close" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_close'+set}'`\" = set"; then @@ -4173,7 +4276,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_close'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -4182,7 +4285,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4186: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4289: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_sys_close=yes else @@ -4198,7 +4301,7 @@ echo "$ac_t""$ac_cv_linux_exports_sys_close" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported sys_wait4""... $ac_c" 1>&6 -echo "configure:4202: checking for exported sys_wait4" >&5 +echo "configure:4305: checking for exported sys_wait4" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_wait4'+set}'`\" = set"; then @@ -4206,7 +4309,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_wait4'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -4215,7 +4318,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_sys_wait4=yes else @@ -4278,12 +4381,6 @@ EOF if test "x$ac_cv_linux_exports_sys_wait4" = "xyes" ; then cat >> confdefs.h <<\EOF #define EXPORTED_SYS_WAIT4 1 -EOF - - fi - if test "x$ac_cv_linux_exports_tasklist_lock" = "xyes" ; then - cat >> confdefs.h <<\EOF -#define EXPORTED_TASKLIST_LOCK 1 EOF fi @@ -4374,6 +4471,12 @@ EOF if test "x$ac_cv_linux_fs_struct_inode_has_i_security" = "xyes"; then cat >> confdefs.h <<\EOF #define STRUCT_INODE_HAS_I_SECURITY 1 +EOF + + fi + if test "x$ac_cv_linux_fs_struct_inode_has_i_sb_list" = "xyes"; then + cat >> confdefs.h <<\EOF +#define STRUCT_INODE_HAS_I_SB_LIST 1 EOF fi @@ -4440,6 +4543,24 @@ EOF if test "x$ac_cv_linux_sched_struct_task_struct_has_sig" = "xyes"; then cat >> confdefs.h <<\EOF #define STRUCT_TASK_STRUCT_HAS_SIG 1 +EOF + + fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_rlim" = "xyes"; then + cat >> confdefs.h <<\EOF +#define STRUCT_TASK_STRUCT_HAS_RLIM 1 +EOF + + fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_signal_rlim" = "xyes"; then + cat >> confdefs.h <<\EOF +#define STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM 1 +EOF + + fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_exit_state" = "xyes"; then + cat >> confdefs.h <<\EOF +#define STRUCT_TASK_STRUCT_HAS_EXIT_STATE 1 EOF fi @@ -4459,14 +4580,14 @@ EOF ;; *) echo $ac_n "checking for definition of struct buf""... $ac_c" 1>&6 -echo "configure:4463: checking for definition of struct buf" >&5 +echo "configure:4584: checking for definition of struct buf" >&5 if eval "test \"`echo '$''{'ac_cv_have_struct_buf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_have_struct_buf=no cat > conftest.$ac_ext < int main() { @@ -4474,7 +4595,7 @@ struct buf x; printf("%d\n", sizeof(x)); ; return 0; } EOF -if { (eval echo configure:4478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_struct_buf=yes else @@ -4502,9 +4623,9 @@ if eval "test \"`echo '$''{'ac_cv_sockaddr_len'+set}'`\" = set"; then else echo $ac_n "checking if struct sockaddr has sa_len field""... $ac_c" 1>&6 -echo "configure:4506: checking if struct sockaddr has sa_len field" >&5 +echo "configure:4627: checking if struct sockaddr has sa_len field" >&5 cat > conftest.$ac_ext < #include @@ -4513,7 +4634,7 @@ struct sockaddr *a; a->sa_len=0; ; return 0; } EOF -if { (eval echo configure:4517: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sockaddr_len=yes else @@ -4538,12 +4659,12 @@ else for ac_func in socket do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4542: checking for $ac_func" >&5 +echo "configure:4663: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4595,7 +4716,7 @@ done for lib in socket inet; do if test "$HAVE_SOCKET" != 1; then echo $ac_n "checking for socket in -l${lib}""... $ac_c" 1>&6 -echo "configure:4599: checking for socket in -l${lib}" >&5 +echo "configure:4720: checking for socket in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4603,7 +4724,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4644,12 +4765,12 @@ fi for ac_func in connect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4648: checking for $ac_func" >&5 +echo "configure:4769: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4701,7 +4822,7 @@ done for lib in nsl; do if test "$HAVE_CONNECT" != 1; then echo $ac_n "checking for connect in -l${lib}""... $ac_c" 1>&6 -echo "configure:4705: checking for connect in -l${lib}" >&5 +echo "configure:4826: checking for connect in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4709,7 +4830,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4750,12 +4871,12 @@ fi for ac_func in gethostbyname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4754: checking for $ac_func" >&5 +echo "configure:4875: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4806,7 +4927,7 @@ done for lib in dns nsl resolv; do if test "$HAVE_GETHOSTBYNAME" != 1; then echo $ac_n "checking for gethostbyname in -l${lib}""... $ac_c" 1>&6 -echo "configure:4810: checking for gethostbyname in -l${lib}" >&5 +echo "configure:4931: checking for gethostbyname in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4814,7 +4935,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4853,9 +4974,9 @@ fi fi echo $ac_n "checking for the useability of arpa/nameser_compat.h""... $ac_c" 1>&6 -echo "configure:4857: checking for the useability of arpa/nameser_compat.h" >&5 +echo "configure:4978: checking for the useability of arpa/nameser_compat.h" >&5 cat > conftest.$ac_ext < @@ -4872,7 +4993,7 @@ int main() { static int i; i = 0; ; return 0; } EOF -if { (eval echo configure:4876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4997: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -4890,11 +5011,11 @@ rm -f conftest* openafs_save_libs="$LIBS" echo $ac_n "checking for res_search""... $ac_c" 1>&6 -echo "configure:4894: checking for res_search" >&5 +echo "configure:5015: checking for res_search" >&5 ac_cv_func_res_search=no cat > conftest.$ac_ext < @@ -4918,7 +5039,7 @@ return 0; ; return 0; } EOF -if { (eval echo configure:4922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_res_search=yes else @@ -4935,7 +5056,7 @@ rm -f conftest* ac_cv_func_res_search=no cat > conftest.$ac_ext < @@ -4959,7 +5080,7 @@ return 0; ; return 0; } EOF -if { (eval echo configure:4963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_res_search=yes else @@ -4993,7 +5114,7 @@ fi PTHREAD_LIBS=error echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6 -echo "configure:4997: checking for pthread_attr_init in -lpthread" >&5 +echo "configure:5118: checking for pthread_attr_init in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5001,7 +5122,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5034,7 +5155,7 @@ fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init in -lpthreads""... $ac_c" 1>&6 -echo "configure:5038: checking for pthread_attr_init in -lpthreads" >&5 +echo "configure:5159: checking for pthread_attr_init in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5042,7 +5163,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthreads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5076,7 +5197,7 @@ fi fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init in -lc_r""... $ac_c" 1>&6 -echo "configure:5080: checking for pthread_attr_init in -lc_r" >&5 +echo "configure:5201: checking for pthread_attr_init in -lc_r" >&5 ac_lib_var=`echo c_r'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5084,7 +5205,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5118,12 +5239,12 @@ fi fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init""... $ac_c" 1>&6 -echo "configure:5122: checking for pthread_attr_init" >&5 +echo "configure:5243: checking for pthread_attr_init" >&5 if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_init'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_attr_init=yes" else @@ -5266,7 +5387,7 @@ EOF fi echo $ac_n "checking for tivoli tsm butc support""... $ac_c" 1>&6 -echo "configure:5270: checking for tivoli tsm butc support" >&5 +echo "configure:5391: checking for tivoli tsm butc support" >&5 XBSA_CFLAGS="" if test "$enable_tivoli_tsm" = "yes"; then XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen @@ -5287,12 +5408,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:5291: checking for ANSI C header files" >&5 +echo "configure:5412: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5300,7 +5421,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5317,7 +5438,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -5335,7 +5456,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -5356,7 +5477,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -5367,7 +5488,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:5371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -5391,12 +5512,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:5395: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:5516: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5412,7 +5533,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:5416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5537: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -5437,12 +5558,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:5441: checking for $ac_hdr that defines DIR" >&5 +echo "configure:5562: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -5450,7 +5571,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:5454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5575: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -5475,7 +5596,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:5479: checking for opendir in -ldir" >&5 +echo "configure:5600: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5483,7 +5604,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5516,7 +5637,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:5520: checking for opendir in -lx" >&5 +echo "configure:5641: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5524,7 +5645,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5561,17 +5682,17 @@ for ac_hdr in stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5565: checking for $ac_hdr" >&5 +echo "configure:5686: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5575: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5601,17 +5722,17 @@ for ac_hdr in netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5605: checking for $ac_hdr" >&5 +echo "configure:5726: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5615: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5641,17 +5762,17 @@ for ac_hdr in mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5645: checking for $ac_hdr" >&5 +echo "configure:5766: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5655: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5776: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5681,17 +5802,17 @@ for ac_hdr in sys/mount.h strings.h termios.h signal.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5685: checking for $ac_hdr" >&5 +echo "configure:5806: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5721,17 +5842,17 @@ for ac_hdr in windows.h malloc.h winsock2.h direct.h io.h sys/user.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5725: checking for $ac_hdr" >&5 +echo "configure:5846: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5735: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5761,17 +5882,17 @@ for ac_hdr in security/pam_modules.h siad.h usersec.h ucontext.h regex.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5765: checking for $ac_hdr" >&5 +echo "configure:5886: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5815,12 +5936,12 @@ fi for ac_func in utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5819: checking for $ac_func" >&5 +echo "configure:5940: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5870,12 +5991,12 @@ done for ac_func in setprogname getprogname sigaction mkstemp vsnprintf strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5874: checking for $ac_func" >&5 +echo "configure:5995: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5926,12 +6047,12 @@ done for ac_func in regcomp regexec regerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5930: checking for $ac_func" >&5 +echo "configure:6051: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5979,7 +6100,7 @@ fi done echo $ac_n "checking for POSIX regex library""... $ac_c" 1>&6 -echo "configure:5983: checking for POSIX regex library" >&5 +echo "configure:6104: checking for POSIX regex library" >&5 if test "$ac_cv_header_regex_h" = "yes" && \ test "$ac_cv_func_regcomp" = "yes" && \ test "$ac_cv_func_regexec" = "yes" && \ @@ -5994,12 +6115,12 @@ else fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:5998: checking for ssize_t" >&5 +echo "configure:6119: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6027,7 +6148,7 @@ EOF fi echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:6031: checking size of long" >&5 +echo "configure:6152: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6035,7 +6156,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -6046,7 +6167,7 @@ main() exit(0); } EOF -if { (eval echo configure:6050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -6069,12 +6190,12 @@ EOF for ac_func in timegm do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6073: checking for $ac_func" >&5 +echo "configure:6194: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6201,7 +6322,7 @@ LWP_OPTMZ=-O # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6205: checking for $ac_word" >&5 +echo "configure:6326: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6233,7 +6354,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6237: checking for $ac_word" >&5 +echo "configure:6358: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6268,7 +6389,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6272: checking for $ac_word" >&5 +echo "configure:6393: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6303,7 +6424,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6307: checking for $ac_word" >&5 +echo "configure:6428: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MV'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6338,7 +6459,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6342: checking for $ac_word" >&5 +echo "configure:6463: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6373,7 +6494,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6377: checking for $ac_word" >&5 +echo "configure:6498: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6408,7 +6529,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6412: checking for $ac_word" >&5 +echo "configure:6533: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6443,7 +6564,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6447: checking for $ac_word" >&5 +echo "configure:6568: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6478,7 +6599,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6482: checking for $ac_word" >&5 +echo "configure:6603: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LORDER'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6673,7 +6794,7 @@ case $AFS_SYSNAME in YACC="byacc" ;; - *nbsd2*) + *nbsd2*|*nbsd3*) LEX="flex -l" MT_CFLAGS='${XCFLAGS} -DAFS_PTHREAD_ENV -D_REENTRANT ' MT_LIBS="-lpthread" # XXX -pthread soon @@ -6892,21 +7013,7 @@ case $AFS_SYSNAME in EXTRA_VLIBOBJS="fstab.o" ;; - ppc_linux22) - INSTALL="install" - KERN_OPTMZ=-O2 - LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' - MT_LIBS="-lpthread" - PAM_CFLAGS="-O2 -Dlinux -DLINUX_PAM -fPIC" - SHLIB_LDFLAGS="-shared -Xlinker -x" - TXLIBS="-lncurses" - XCFLAGS="-O2 -D_LARGEFILE64_SOURCE" - YACC="bison -y" - SHLIB_LINKER="${MT_CC} -shared" - ;; - - ppc_linux24) + ppc_linux*) KERN_OPTMZ=-O2 LEX="flex -l" MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' @@ -6981,7 +7088,7 @@ case $AFS_SYSNAME in SHLIB_LINKER="${MT_CC} -shared" ;; - s390_linux24) + s390_linux24|s390_linux26) CC="gcc" CCOBJ="gcc" LD="ld" @@ -6998,7 +7105,7 @@ case $AFS_SYSNAME in SHLIB_LINKER="${MT_CC} -shared" ;; - s390x_linux24) + s390x_linux24|s390x_linux26) CC="gcc" CCOBJ="gcc" LD="ld" @@ -7264,7 +7371,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -7285,7 +7392,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -7306,7 +7413,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -7327,7 +7434,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -7343,7 +7450,7 @@ case $AFS_SYSNAME in sgi_6*) echo $ac_n "checking for mem* in sys/systm.h""... $ac_c" 1>&6 -echo "configure:7347: checking for mem* in sys/systm.h" >&5 +echo "configure:7454: checking for mem* in sys/systm.h" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_KERNEL -D__STRING_H__" if eval "test \"`echo '$''{'ac_cv_irix_sys_systm_h_has_mem_funcs'+set}'`\" = set"; then @@ -7351,7 +7458,7 @@ if eval "test \"`echo '$''{'ac_cv_irix_sys_systm_h_has_mem_funcs'+set}'`\" = set else cat > conftest.$ac_ext < #include @@ -7361,7 +7468,7 @@ extern void *memcpy(char *, const void *, size_t); ; return 0; } EOF -if { (eval echo configure:7365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_irix_sys_systm_h_has_mem_funcs=no else diff --git a/configure-libafs b/configure-libafs index ac5839016..74b5a0564 100644 --- a/configure-libafs +++ b/configure-libafs @@ -754,7 +754,7 @@ fi PACKAGE=openafs-libafs -VERSION=1.3.77 +VERSION=1.3.79 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -2507,10 +2507,18 @@ echo "configure:2425: checking your AFS sysname" >&5 AFS_PARAM_COMMON=param.nbsd16.h AFS_SYSNAME="ppc_nbsd16" ;; - i?86-*-netbsd*2.99*) + i?86-*-netbsd*2.1*) AFS_PARAM_COMMON=param.nbsd21.h AFS_SYSNAME="i386_nbsd21" ;; + i?86-*-netbsd*2.99*) + AFS_PARAM_COMMON=param.nbsd30.h + AFS_SYSNAME="i386_nbsd30" + ;; + i?86-*-netbsd*3.0*) + AFS_PARAM_COMMON=param.nbsd30.h + AFS_SYSNAME="i386_nbsd30" + ;; hppa*-hp-hpux11.0*) AFS_SYSNAME="hp_ux110" ;; @@ -2699,7 +2707,7 @@ echo "configure:2425: checking your AFS sysname" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include $CPPFLAGS" cat > conftest.$ac_ext < int main() { @@ -2708,7 +2716,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:2712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2720: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_is_uml=yes else @@ -2743,7 +2751,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) fi echo $ac_n "checking if $CC accepts -march=pentium""... $ac_c" 1>&6 -echo "configure:2747: checking if $CC accepts -march=pentium" >&5 +echo "configure:2755: checking if $CC accepts -march=pentium" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-MARCH=pentium" if eval "test \"`echo '$''{'openafs_gcc_supports_march'+set}'`\" = set"; then @@ -2751,14 +2759,14 @@ if eval "test \"`echo '$''{'openafs_gcc_supports_march'+set}'`\" = set"; then else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* openafs_gcc_supports_march=yes else @@ -2781,7 +2789,7 @@ CFLAGS="$save_CFLAGS" echo $ac_n "checking if $CC needs -fno-strength-reduce""... $ac_c" 1>&6 -echo "configure:2785: checking if $CC needs -fno-strength-reduce" >&5 +echo "configure:2793: checking if $CC needs -fno-strength-reduce" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-fno-strength-reduce" if eval "test \"`echo '$''{'openafs_gcc_needs_no_strength_reduce'+set}'`\" = set"; then @@ -2789,14 +2797,14 @@ if eval "test \"`echo '$''{'openafs_gcc_needs_no_strength_reduce'+set}'`\" = set else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* openafs_gcc_needs_no_strength_reduce=yes else @@ -2816,7 +2824,7 @@ CFLAGS="$save_CFLAGS" echo $ac_n "checking if $CC needs -fno-strict-aliasing""... $ac_c" 1>&6 -echo "configure:2820: checking if $CC needs -fno-strict-aliasing" >&5 +echo "configure:2828: checking if $CC needs -fno-strict-aliasing" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-fno-strict-aliasing" if eval "test \"`echo '$''{'openafs_gcc_needs_no_strict_aliasing'+set}'`\" = set"; then @@ -2824,14 +2832,14 @@ if eval "test \"`echo '$''{'openafs_gcc_needs_no_strict_aliasing'+set}'`\" = set else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* openafs_gcc_needs_no_strict_aliasing=yes else @@ -2851,7 +2859,7 @@ CFLAGS="$save_CFLAGS" echo $ac_n "checking if $CC supports -fno-common""... $ac_c" 1>&6 -echo "configure:2855: checking if $CC supports -fno-common" >&5 +echo "configure:2863: checking if $CC supports -fno-common" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-fno-common" if eval "test \"`echo '$''{'openafs_gcc_supports_no_common'+set}'`\" = set"; then @@ -2859,14 +2867,14 @@ if eval "test \"`echo '$''{'openafs_gcc_supports_no_common'+set}'`\" = set"; the else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* openafs_gcc_supports_no_common=yes else @@ -2886,7 +2894,7 @@ CFLAGS="$save_CFLAGS" echo $ac_n "checking if $CC supports -pipe""... $ac_c" 1>&6 -echo "configure:2890: checking if $CC supports -pipe" >&5 +echo "configure:2898: checking if $CC supports -pipe" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-pipe" if eval "test \"`echo '$''{'openafs_gcc_supports_pipe'+set}'`\" = set"; then @@ -2894,14 +2902,14 @@ if eval "test \"`echo '$''{'openafs_gcc_supports_pipe'+set}'`\" = set"; then else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2913: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* openafs_gcc_supports_pipe=yes else @@ -2922,16 +2930,16 @@ CFLAGS="$save_CFLAGS" echo $ac_n "checking whether to build osi_vfs.h""... $ac_c" 1>&6 -echo "configure:2926: checking whether to build osi_vfs.h" >&5 +echo "configure:2934: checking whether to build osi_vfs.h" >&5 configdir=src/config -outputdir=afs +outputdir=src/afs tmpldir=src/afs/LINUX chmod +x $configdir/make_vnode.pl $configdir/make_vnode.pl -i $LINUX_KERNEL_PATH -t ${tmpldir} -o $outputdir echo $ac_n "checking for linux/completion.h existance""... $ac_c" 1>&6 -echo "configure:2935: checking for linux/completion.h existance" >&5 +echo "configure:2943: checking for linux/completion.h existance" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_completion_h_exists'+set}'`\" = set"; then @@ -2939,7 +2947,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_completion_h_exists'+set}'`\" = set"; th else cat > conftest.$ac_ext < #include @@ -2951,7 +2959,7 @@ lose ; return 0; } EOF -if { (eval echo configure:2955: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2963: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_completion_h_exists=yes else @@ -2967,7 +2975,7 @@ echo "$ac_t""$ac_cv_linux_completion_h_exists" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for defined for_each_process""... $ac_c" 1>&6 -echo "configure:2971: checking for defined for_each_process" >&5 +echo "configure:2979: checking for defined for_each_process" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_defines_for_each_process'+set}'`\" = set"; then @@ -2975,7 +2983,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_defines_for_each_process'+set}'`\" = set else cat > conftest.$ac_ext < int main() { @@ -2984,7 +2992,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:2988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_defines_for_each_process=yes else @@ -3000,7 +3008,7 @@ echo "$ac_t""$ac_cv_linux_defines_for_each_process" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for defined prev_task""... $ac_c" 1>&6 -echo "configure:3004: checking for defined prev_task" >&5 +echo "configure:3012: checking for defined prev_task" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_defines_prev_task'+set}'`\" = set"; then @@ -3008,7 +3016,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_defines_prev_task'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -3017,7 +3025,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_defines_prev_task=yes else @@ -3031,42 +3039,9 @@ fi echo "$ac_t""$ac_cv_linux_defines_prev_task" 1>&6 CPPFLAGS="$save_CPPFLAGS" - -echo $ac_n "checking for exported tasklist_lock""... $ac_c" 1>&6 -echo "configure:3037: checking for exported tasklist_lock" >&5 -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" -if eval "test \"`echo '$''{'ac_cv_linux_exports_tasklist_lock'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - -cat > conftest.$ac_ext < -int main() { -#ifndef __ver_tasklist_lock -#error tasklist_lock not exported -#endif -; return 0; } -EOF -if { (eval echo configure:3054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_linux_exports_tasklist_lock=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_linux_exports_tasklist_lock=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_linux_exports_tasklist_lock" 1>&6 -CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for page_lock in struct address_space""... $ac_c" 1>&6 -echo "configure:3070: checking for page_lock in struct address_space" >&5 +echo "configure:3045: checking for page_lock in struct address_space" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_address_space_has_page_lock'+set}'`\" = set"; then @@ -3074,7 +3049,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_address_space_has_page_lock'+s else cat > conftest.$ac_ext < int main() { @@ -3082,7 +3057,7 @@ struct address_space _a_s; printf("%x\n", _a_s.page_lock); ; return 0; } EOF -if { (eval echo configure:3086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_address_space_has_page_lock=yes else @@ -3098,7 +3073,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_address_space_has_page_lock" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for gfp_mask in struct address_space""... $ac_c" 1>&6 -echo "configure:3102: checking for gfp_mask in struct address_space" >&5 +echo "configure:3077: checking for gfp_mask in struct address_space" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_address_space_has_gfp_mask'+set}'`\" = set"; then @@ -3106,7 +3081,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_address_space_has_gfp_mask'+se else cat > conftest.$ac_ext < int main() { @@ -3114,7 +3089,7 @@ struct address_space _a; printf("%d\n", _a.gfp_mask); ; return 0; } EOF -if { (eval echo configure:3118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_address_space_has_gfp_mask=yes else @@ -3130,7 +3105,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_address_space_has_gfp_mask" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for i_alloc_sem in struct inode""... $ac_c" 1>&6 -echo "configure:3134: checking for i_alloc_sem in struct inode" >&5 +echo "configure:3109: checking for i_alloc_sem in struct inode" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_alloc_sem'+set}'`\" = set"; then @@ -3138,7 +3113,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_alloc_sem'+set}'`\ else cat > conftest.$ac_ext < int main() { @@ -3146,7 +3121,7 @@ struct inode _i; printf("%x\n", _i.i_alloc_sem); ; return 0; } EOF -if { (eval echo configure:3150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_inode_has_i_alloc_sem=yes else @@ -3162,7 +3137,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_alloc_sem" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for i_truncate_sem in struct inode""... $ac_c" 1>&6 -echo "configure:3166: checking for i_truncate_sem in struct inode" >&5 +echo "configure:3141: checking for i_truncate_sem in struct inode" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_truncate_sem'+set}'`\" = set"; then @@ -3170,7 +3145,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_truncate_sem'+set} else cat > conftest.$ac_ext < int main() { @@ -3178,7 +3153,7 @@ struct inode _i; printf("%x\n", _i.i_truncate_sem); ; return 0; } EOF -if { (eval echo configure:3182: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_inode_has_i_truncate_sem=yes else @@ -3194,7 +3169,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_truncate_sem" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for i_dirty_data_buffers in struct inode""... $ac_c" 1>&6 -echo "configure:3198: checking for i_dirty_data_buffers in struct inode" >&5 +echo "configure:3173: checking for i_dirty_data_buffers in struct inode" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers'+set}'`\" = set"; then @@ -3202,7 +3177,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers else cat > conftest.$ac_ext < int main() { @@ -3210,7 +3185,7 @@ struct inode _inode; printf("%d\n", _inode.i_dirty_data_buffers); ; return 0; } EOF -if { (eval echo configure:3214: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers=yes else @@ -3226,7 +3201,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for i_devices in struct inode""... $ac_c" 1>&6 -echo "configure:3230: checking for i_devices in struct inode" >&5 +echo "configure:3205: checking for i_devices in struct inode" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_cdev'+set}'`\" = set"; then @@ -3234,7 +3209,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_cdev'+set}'`\" = s else cat > conftest.$ac_ext < int main() { @@ -3242,7 +3217,7 @@ struct inode _inode; printf("%d\n", _inode.i_devices); ; return 0; } EOF -if { (eval echo configure:3246: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_inode_has_i_devices=yes else @@ -3257,8 +3232,40 @@ fi echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_devices" 1>&6 CPPFLAGS="$save_CPPFLAGS" +echo $ac_n "checking for i_sb_list in struct inode""... $ac_c" 1>&6 +echo "configure:3237: checking for i_sb_list in struct inode" >&5 +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_sb_list'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +int main() { +struct inode _inode; +printf("%d\n", _inode.i_sb_list); +; return 0; } +EOF +if { (eval echo configure:3253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_linux_fs_struct_inode_has_i_sb_list=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_linux_fs_struct_inode_has_i_sb_list=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_sb_list" 1>&6 +CPPFLAGS="$save_CPPFLAGS" + echo $ac_n "checking for i_security in struct inode""... $ac_c" 1>&6 -echo "configure:3262: checking for i_security in struct inode" >&5 +echo "configure:3269: checking for i_security in struct inode" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_security'+set}'`\" = set"; then @@ -3266,7 +3273,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_fs_struct_inode_has_i_security'+set}'`\" else cat > conftest.$ac_ext < int main() { @@ -3274,7 +3281,7 @@ struct inode _inode; printf("%d\n", _inode.i_security); ; return 0; } EOF -if { (eval echo configure:3278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_fs_struct_inode_has_i_security=yes else @@ -3290,7 +3297,7 @@ echo "$ac_t""$ac_cv_linux_fs_struct_inode_has_i_security" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for inode_setattr return type""... $ac_c" 1>&6 -echo "configure:3294: checking for inode_setattr return type" >&5 +echo "configure:3301: checking for inode_setattr return type" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_func_inode_setattr_returns_int'+set}'`\" = set"; then @@ -3298,7 +3305,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_func_inode_setattr_returns_int'+set}'`\" else cat > conftest.$ac_ext < int main() { @@ -3308,7 +3315,7 @@ int i; i = inode_setattr(&_inode, &_iattr); ; return 0; } EOF -if { (eval echo configure:3312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3319: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_inode_setattr_returns_int=yes else @@ -3324,7 +3331,7 @@ echo "$ac_t""$ac_cv_linux_func_inode_setattr_returns_int" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for write_inode return type""... $ac_c" 1>&6 -echo "configure:3328: checking for write_inode return type" >&5 +echo "configure:3335: checking for write_inode return type" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_func_write_inode_returns_int'+set}'`\" = set"; then @@ -3332,7 +3339,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_func_write_inode_returns_int'+set}'`\" = else cat > conftest.$ac_ext < int main() { @@ -3342,7 +3349,7 @@ int i; i = _sops.write_inode(&_inode, 0); ; return 0; } EOF -if { (eval echo configure:3346: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_write_inode_returns_int=yes else @@ -3360,13 +3367,13 @@ CPPFLAGS="$save_CPPFLAGS" save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" echo $ac_n "checking whether inode_operations.create takes a nameidata""... $ac_c" 1>&6 -echo "configure:3364: checking whether inode_operations.create takes a nameidata" >&5 +echo "configure:3371: checking whether inode_operations.create takes a nameidata" >&5 if eval "test \"`echo '$''{'ac_cv_linux_func_i_create_takes_nameidata'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3377,7 +3384,7 @@ struct nameidata _nameidata; (void)_inode.i_op->create(&_inode, &_dentry, 0, &_nameidata); ; return 0; } EOF -if { (eval echo configure:3381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3388: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_i_create_takes_nameidata=yes else @@ -3397,13 +3404,13 @@ EOF fi echo $ac_n "checking whether inode_operations.lookup takes a nameidata""... $ac_c" 1>&6 -echo "configure:3401: checking whether inode_operations.lookup takes a nameidata" >&5 +echo "configure:3408: checking whether inode_operations.lookup takes a nameidata" >&5 if eval "test \"`echo '$''{'ac_cv_linux_func_i_lookup_takes_nameidata'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3414,7 +3421,7 @@ struct nameidata _nameidata; (void)_inode.i_op->lookup(&_inode, &_dentry, &_nameidata); ; return 0; } EOF -if { (eval echo configure:3418: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3425: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_i_lookup_takes_nameidata=yes else @@ -3434,13 +3441,13 @@ EOF fi echo $ac_n "checking whether inode_operations.permission takes a nameidata""... $ac_c" 1>&6 -echo "configure:3438: checking whether inode_operations.permission takes a nameidata" >&5 +echo "configure:3445: checking whether inode_operations.permission takes a nameidata" >&5 if eval "test \"`echo '$''{'ac_cv_linux_func_i_permission_takes_nameidata'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3450,7 +3457,7 @@ struct nameidata _nameidata; (void)_inode.i_op->permission(&_inode, 0, &_nameidata); ; return 0; } EOF -if { (eval echo configure:3454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3461: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_i_permission_takes_nameidata=yes else @@ -3470,14 +3477,14 @@ EOF fi echo $ac_n "checking whether dentry_operations.d_revalidate takes a nameidata""... $ac_c" 1>&6 -echo "configure:3474: checking whether dentry_operations.d_revalidate takes a nameidata" >&5 +echo "configure:3481: checking whether dentry_operations.d_revalidate takes a nameidata" >&5 CPPFLAGS="$CPPFLAGS -Werror" if eval "test \"`echo '$''{'ac_cv_linux_func_d_revalidate_takes_nameidata'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3487,7 +3494,7 @@ struct nameidata _nameidata; (void)_dentry.d_op->d_revalidate(&_dentry, &_nameidata); ; return 0; } EOF -if { (eval echo configure:3491: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3498: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_d_revalidate_takes_nameidata=yes else @@ -3511,13 +3518,13 @@ CPPFLAGS="$save_CPPFLAGS" save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" echo $ac_n "checking whether address_space_operations.writepage takes a writeback_control""... $ac_c" 1>&6 -echo "configure:3515: checking whether address_space_operations.writepage takes a writeback_control" >&5 +echo "configure:3522: checking whether address_space_operations.writepage takes a writeback_control" >&5 if eval "test \"`echo '$''{'ac_cv_linux_func_a_writepage_takes_writeback_control'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3529,7 +3536,7 @@ struct writeback_control _writeback_control; (void)_aops.writepage(&_page, &_writeback_control); ; return 0; } EOF -if { (eval echo configure:3533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_a_writepage_takes_writeback_control=yes else @@ -3551,7 +3558,7 @@ fi CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for linux/syscall.h in kernel""... $ac_c" 1>&6 -echo "configure:3555: checking for linux/syscall.h in kernel" >&5 +echo "configure:3562: checking for linux/syscall.h in kernel" >&5 if test -f "${LINUX_KERNEL_PATH}/include/linux/syscall.h"; then ac_linux_syscall=yes echo "$ac_t""$ac_linux_syscall" 1>&6 @@ -3562,7 +3569,7 @@ echo "configure:3555: checking for linux/syscall.h in kernel" >&5 echo $ac_n "checking for SELinux kernel""... $ac_c" 1>&6 -echo "configure:3566: checking for SELinux kernel" >&5 +echo "configure:3573: checking for SELinux kernel" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_kernel_is_selinux'+set}'`\" = set"; then @@ -3570,7 +3577,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_kernel_is_selinux'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -3579,7 +3586,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3590: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_kernel_is_selinux=yes else @@ -3595,7 +3602,7 @@ echo "$ac_t""$ac_cv_linux_kernel_is_selinux" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for 5th argument in sock_create found in some SELinux kernels""... $ac_c" 1>&6 -echo "configure:3599: checking for 5th argument in sock_create found in some SELinux kernels" >&5 +echo "configure:3606: checking for 5th argument in sock_create found in some SELinux kernels" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_kernel_sock_create_v'+set}'`\" = set"; then @@ -3603,7 +3610,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_kernel_sock_create_v'+set}'`\" = set"; t else cat > conftest.$ac_ext < int main() { @@ -3612,7 +3619,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3623: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_kernel_sock_create_v=yes else @@ -3628,15 +3635,15 @@ echo "$ac_t""$ac_cv_linux_kernel_sock_create_v" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for page_follow_link_light vs page_follow_link""... $ac_c" 1>&6 -echo "configure:3632: checking for page_follow_link_light vs page_follow_link" >&5 +echo "configure:3639: checking for page_follow_link_light vs page_follow_link" >&5 save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -Werror-implicit-function-declaration -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_kernel_page_follow_link'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -3645,7 +3652,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3656: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_kernel_page_follow_link=yes else @@ -3657,7 +3664,7 @@ fi rm -f conftest* fi -echo "$ac_t""$ac_cv_linux_kernel_page_follow_page" 1>&6 +echo "$ac_t""$ac_cv_linux_kernel_page_follow_link" 1>&6 CPPFLAGS="$save_CPPFLAGS" RHCONFIG_SP="" @@ -3666,7 +3673,7 @@ if test "x$enable_redhat_buildsys" = "xyes"; then echo "configure: warning: Configured to build from a Red Hat SPEC file" 1>&2 else echo $ac_n "checking for redhat kernel configuration""... $ac_c" 1>&6 -echo "configure:3670: checking for redhat kernel configuration" >&5 +echo "configure:3677: checking for redhat kernel configuration" >&5 if test -f "${LINUX_KERNEL_PATH}/include/linux/rhconfig.h"; then ac_linux_rhconfig=yes RHCONFIG_SP="-D__BOOT_KERNEL_UP=1 -D__BOOT_KERNEL_SMP=0" @@ -3685,7 +3692,7 @@ fi echo $ac_n "checking for recalc_sigpending arg type""... $ac_c" 1>&6 -echo "configure:3689: checking for recalc_sigpending arg type" >&5 +echo "configure:3696: checking for recalc_sigpending arg type" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_func_recalc_sigpending_takes_void'+set}'`\" = set"; then @@ -3693,14 +3700,14 @@ if eval "test \"`echo '$''{'ac_cv_linux_func_recalc_sigpending_takes_void'+set}' else cat > conftest.$ac_ext < int main() { recalc_sigpending(); ; return 0; } EOF -if { (eval echo configure:3704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3711: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_func_recalc_sigpending_takes_void=yes else @@ -3716,7 +3723,7 @@ echo "$ac_t""$ac_cv_linux_func_recalc_sigpending_takes_void" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for parent in struct task_struct""... $ac_c" 1>&6 -echo "configure:3720: checking for parent in struct task_struct" >&5 +echo "configure:3727: checking for parent in struct task_struct" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_parent'+set}'`\" = set"; then @@ -3724,7 +3731,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_parent'+set else cat > conftest.$ac_ext < int main() { @@ -3732,7 +3739,7 @@ struct task_struct _tsk; printf("%d\n", _tsk.parent); ; return 0; } EOF -if { (eval echo configure:3736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3743: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_sched_struct_task_struct_has_parent=yes else @@ -3748,7 +3755,7 @@ echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_parent" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for real_parent in struct task_struct""... $ac_c" 1>&6 -echo "configure:3752: checking for real_parent in struct task_struct" >&5 +echo "configure:3759: checking for real_parent in struct task_struct" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_real_parent'+set}'`\" = set"; then @@ -3756,7 +3763,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_real_parent else cat > conftest.$ac_ext < int main() { @@ -3764,7 +3771,7 @@ struct task_struct _tsk; printf("%d\n", _tsk.real_parent); ; return 0; } EOF -if { (eval echo configure:3768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_sched_struct_task_struct_has_real_parent=yes else @@ -3780,7 +3787,7 @@ echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_real_parent" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for sig in struct task_struct""... $ac_c" 1>&6 -echo "configure:3784: checking for sig in struct task_struct" >&5 +echo "configure:3791: checking for sig in struct task_struct" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sig'+set}'`\" = set"; then @@ -3788,7 +3795,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sig'+set}'` else cat > conftest.$ac_ext < int main() { @@ -3796,7 +3803,7 @@ struct task_struct _tsk; printf("%d\n", _tsk.sig); ; return 0; } EOF -if { (eval echo configure:3800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3807: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_sched_struct_task_struct_has_sig=yes else @@ -3812,7 +3819,7 @@ echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_sig" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for sighand in struct task_struct""... $ac_c" 1>&6 -echo "configure:3816: checking for sighand in struct task_struct" >&5 +echo "configure:3823: checking for sighand in struct task_struct" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sighand'+set}'`\" = set"; then @@ -3820,7 +3827,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sighand'+se else cat > conftest.$ac_ext < int main() { @@ -3828,7 +3835,7 @@ struct task_struct _tsk; printf("%d\n", _tsk.sighand); ; return 0; } EOF -if { (eval echo configure:3832: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3839: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_sched_struct_task_struct_has_sighand=yes else @@ -3844,7 +3851,7 @@ echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_sighand" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for sigmask_lock in struct task_struct""... $ac_c" 1>&6 -echo "configure:3848: checking for sigmask_lock in struct task_struct" >&5 +echo "configure:3855: checking for sigmask_lock in struct task_struct" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sigmask_lock'+set}'`\" = set"; then @@ -3852,7 +3859,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_sigmask_loc else cat > conftest.$ac_ext < int main() { @@ -3860,7 +3867,7 @@ struct task_struct _tsk; printf("%d\n", _tsk.sigmask_lock); ; return 0; } EOF -if { (eval echo configure:3864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3871: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_sched_struct_task_struct_has_sigmask_lock=yes else @@ -3875,19 +3882,115 @@ fi echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_sigmask_lock" 1>&6 CPPFLAGS="$save_CPPFLAGS" +echo $ac_n "checking for rlim in struct task_struct""... $ac_c" 1>&6 +echo "configure:3887: checking for rlim in struct task_struct" >&5 +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_rlim'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +int main() { +struct task_struct _tsk; +printf("%d\n", _tsk.rlim); +; return 0; } +EOF +if { (eval echo configure:3903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_rlim=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_rlim=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_rlim" 1>&6 +CPPFLAGS="$save_CPPFLAGS" + +echo $ac_n "checking for signal->rlim in struct task_struct""... $ac_c" 1>&6 +echo "configure:3919: checking for signal->rlim in struct task_struct" >&5 +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_signal_rlim'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +int main() { +struct task_struct _tsk; +printf("%d\n", _tsk.signal->rlim); +; return 0; } +EOF +if { (eval echo configure:3935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_signal_rlim=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_signal_rlim=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_signal_rlim" 1>&6 +CPPFLAGS="$save_CPPFLAGS" + +echo $ac_n "checking for exit_state in struct task_struct""... $ac_c" 1>&6 +echo "configure:3951: checking for exit_state in struct task_struct" >&5 +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +if eval "test \"`echo '$''{'ac_cv_linux_sched_struct_task_struct_has_exit_state'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cat > conftest.$ac_ext < +int main() { +struct task_struct _tsk; +printf("%d\n", _tsk.exit_state); +; return 0; } +EOF +if { (eval echo configure:3967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_exit_state=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_linux_sched_struct_task_struct_has_exit_state=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_linux_sched_struct_task_struct_has_exit_state" 1>&6 +CPPFLAGS="$save_CPPFLAGS" + if test "x$enable_redhat_buildsys" = "xyes"; then MPS=Default else save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $RHCONFIG_SP $CPPFLAGS" echo $ac_n "checking if kernel uses MODVERSIONS""... $ac_c" 1>&6 -echo "configure:3885: checking if kernel uses MODVERSIONS" >&5 +echo "configure:3988: checking if kernel uses MODVERSIONS" >&5 if eval "test \"`echo '$''{'ac_cv_linux_config_modversions'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3899,7 +4002,7 @@ lose; ; return 0; } EOF -if { (eval echo configure:3903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_config_modversions=yes else @@ -3913,7 +4016,7 @@ fi echo "$ac_t""$ac_cv_linux_config_modversions" 1>&6 echo $ac_n "checking which kernel modules to build""... $ac_c" 1>&6 -echo "configure:3917: checking which kernel modules to build" >&5 +echo "configure:4020: checking which kernel modules to build" >&5 if test "x$ac_linux_rhconfig" = "xyes"; then MPS="MP SP" elif test "x$ac_cv_linux_config_modversions" = "xno" -a "$AFS_SYSKVERS" -lt 26; then @@ -3924,7 +4027,7 @@ echo "configure:3917: checking which kernel modules to build" >&5 else cat > conftest.$ac_ext < @@ -3935,7 +4038,7 @@ lose; ; return 0; } EOF -if { (eval echo configure:3939: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_config_smp=yes else @@ -3967,7 +4070,7 @@ fi else echo $ac_n "checking for exported init_mm""... $ac_c" 1>&6 -echo "configure:3971: checking for exported init_mm" >&5 +echo "configure:4074: checking for exported init_mm" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_init_mm'+set}'`\" = set"; then @@ -3975,7 +4078,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_init_mm'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -3984,7 +4087,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4091: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_init_mm=yes else @@ -4000,7 +4103,7 @@ echo "$ac_t""$ac_cv_linux_exports_init_mm" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported kallsyms_address_to_symbol""... $ac_c" 1>&6 -echo "configure:4004: checking for exported kallsyms_address_to_symbol" >&5 +echo "configure:4107: checking for exported kallsyms_address_to_symbol" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_kallsyms_address'+set}'`\" = set"; then @@ -4008,7 +4111,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_kallsyms_address'+set}'`\" = set else cat > conftest.$ac_ext < int main() { @@ -4017,7 +4120,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_kallsyms_address=yes else @@ -4033,7 +4136,7 @@ echo "$ac_t""$ac_cv_linux_exports_kallsyms_address" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported kallsyms_symbol_to_address""... $ac_c" 1>&6 -echo "configure:4037: checking for exported kallsyms_symbol_to_address" >&5 +echo "configure:4140: checking for exported kallsyms_symbol_to_address" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_kallsyms_symbol'+set}'`\" = set"; then @@ -4041,7 +4144,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_kallsyms_symbol'+set}'`\" = set" else cat > conftest.$ac_ext < int main() { @@ -4050,7 +4153,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_kallsyms_symbol=yes else @@ -4066,7 +4169,7 @@ echo "$ac_t""$ac_cv_linux_exports_kallsyms_symbol" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported sys_call_table""... $ac_c" 1>&6 -echo "configure:4070: checking for exported sys_call_table" >&5 +echo "configure:4173: checking for exported sys_call_table" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_call_table'+set}'`\" = set"; then @@ -4074,7 +4177,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_call_table'+set}'`\" = set"; else cat > conftest.$ac_ext < int main() { @@ -4083,7 +4186,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_sys_call_table=yes else @@ -4099,7 +4202,7 @@ echo "$ac_t""$ac_cv_linux_exports_sys_call_table" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported ia32_sys_call_table""... $ac_c" 1>&6 -echo "configure:4103: checking for exported ia32_sys_call_table" >&5 +echo "configure:4206: checking for exported ia32_sys_call_table" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_ia32_sys_call_table'+set}'`\" = set"; then @@ -4107,7 +4210,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_ia32_sys_call_table'+set}'`\" = else cat > conftest.$ac_ext < int main() { @@ -4116,7 +4219,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_ia32_sys_call_table=yes else @@ -4132,7 +4235,7 @@ echo "$ac_t""$ac_cv_linux_exports_ia32_sys_call_table" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported sys_chdir""... $ac_c" 1>&6 -echo "configure:4136: checking for exported sys_chdir" >&5 +echo "configure:4239: checking for exported sys_chdir" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_chdir'+set}'`\" = set"; then @@ -4140,7 +4243,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_chdir'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -4149,7 +4252,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4256: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_sys_chdir=yes else @@ -4165,7 +4268,7 @@ echo "$ac_t""$ac_cv_linux_exports_sys_chdir" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported sys_close""... $ac_c" 1>&6 -echo "configure:4169: checking for exported sys_close" >&5 +echo "configure:4272: checking for exported sys_close" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_close'+set}'`\" = set"; then @@ -4173,7 +4276,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_close'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -4182,7 +4285,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4186: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4289: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_sys_close=yes else @@ -4198,7 +4301,7 @@ echo "$ac_t""$ac_cv_linux_exports_sys_close" 1>&6 CPPFLAGS="$save_CPPFLAGS" echo $ac_n "checking for exported sys_wait4""... $ac_c" 1>&6 -echo "configure:4202: checking for exported sys_wait4" >&5 +echo "configure:4305: checking for exported sys_wait4" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_wait4'+set}'`\" = set"; then @@ -4206,7 +4309,7 @@ if eval "test \"`echo '$''{'ac_cv_linux_exports_sys_wait4'+set}'`\" = set"; then else cat > conftest.$ac_ext < int main() { @@ -4215,7 +4318,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_linux_exports_sys_wait4=yes else @@ -4278,12 +4381,6 @@ EOF if test "x$ac_cv_linux_exports_sys_wait4" = "xyes" ; then cat >> confdefs.h <<\EOF #define EXPORTED_SYS_WAIT4 1 -EOF - - fi - if test "x$ac_cv_linux_exports_tasklist_lock" = "xyes" ; then - cat >> confdefs.h <<\EOF -#define EXPORTED_TASKLIST_LOCK 1 EOF fi @@ -4374,6 +4471,12 @@ EOF if test "x$ac_cv_linux_fs_struct_inode_has_i_security" = "xyes"; then cat >> confdefs.h <<\EOF #define STRUCT_INODE_HAS_I_SECURITY 1 +EOF + + fi + if test "x$ac_cv_linux_fs_struct_inode_has_i_sb_list" = "xyes"; then + cat >> confdefs.h <<\EOF +#define STRUCT_INODE_HAS_I_SB_LIST 1 EOF fi @@ -4440,6 +4543,24 @@ EOF if test "x$ac_cv_linux_sched_struct_task_struct_has_sig" = "xyes"; then cat >> confdefs.h <<\EOF #define STRUCT_TASK_STRUCT_HAS_SIG 1 +EOF + + fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_rlim" = "xyes"; then + cat >> confdefs.h <<\EOF +#define STRUCT_TASK_STRUCT_HAS_RLIM 1 +EOF + + fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_signal_rlim" = "xyes"; then + cat >> confdefs.h <<\EOF +#define STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM 1 +EOF + + fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_exit_state" = "xyes"; then + cat >> confdefs.h <<\EOF +#define STRUCT_TASK_STRUCT_HAS_EXIT_STATE 1 EOF fi @@ -4459,14 +4580,14 @@ EOF ;; *) echo $ac_n "checking for definition of struct buf""... $ac_c" 1>&6 -echo "configure:4463: checking for definition of struct buf" >&5 +echo "configure:4584: checking for definition of struct buf" >&5 if eval "test \"`echo '$''{'ac_cv_have_struct_buf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_have_struct_buf=no cat > conftest.$ac_ext < int main() { @@ -4474,7 +4595,7 @@ struct buf x; printf("%d\n", sizeof(x)); ; return 0; } EOF -if { (eval echo configure:4478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_struct_buf=yes else @@ -4502,9 +4623,9 @@ if eval "test \"`echo '$''{'ac_cv_sockaddr_len'+set}'`\" = set"; then else echo $ac_n "checking if struct sockaddr has sa_len field""... $ac_c" 1>&6 -echo "configure:4506: checking if struct sockaddr has sa_len field" >&5 +echo "configure:4627: checking if struct sockaddr has sa_len field" >&5 cat > conftest.$ac_ext < #include @@ -4513,7 +4634,7 @@ struct sockaddr *a; a->sa_len=0; ; return 0; } EOF -if { (eval echo configure:4517: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sockaddr_len=yes else @@ -4538,12 +4659,12 @@ else for ac_func in socket do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4542: checking for $ac_func" >&5 +echo "configure:4663: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4595,7 +4716,7 @@ done for lib in socket inet; do if test "$HAVE_SOCKET" != 1; then echo $ac_n "checking for socket in -l${lib}""... $ac_c" 1>&6 -echo "configure:4599: checking for socket in -l${lib}" >&5 +echo "configure:4720: checking for socket in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4603,7 +4724,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4644,12 +4765,12 @@ fi for ac_func in connect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4648: checking for $ac_func" >&5 +echo "configure:4769: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4701,7 +4822,7 @@ done for lib in nsl; do if test "$HAVE_CONNECT" != 1; then echo $ac_n "checking for connect in -l${lib}""... $ac_c" 1>&6 -echo "configure:4705: checking for connect in -l${lib}" >&5 +echo "configure:4826: checking for connect in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4709,7 +4830,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4750,12 +4871,12 @@ fi for ac_func in gethostbyname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4754: checking for $ac_func" >&5 +echo "configure:4875: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4806,7 +4927,7 @@ done for lib in dns nsl resolv; do if test "$HAVE_GETHOSTBYNAME" != 1; then echo $ac_n "checking for gethostbyname in -l${lib}""... $ac_c" 1>&6 -echo "configure:4810: checking for gethostbyname in -l${lib}" >&5 +echo "configure:4931: checking for gethostbyname in -l${lib}" >&5 ac_lib_var=`echo ${lib}'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4814,7 +4935,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${lib} $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4853,9 +4974,9 @@ fi fi echo $ac_n "checking for the useability of arpa/nameser_compat.h""... $ac_c" 1>&6 -echo "configure:4857: checking for the useability of arpa/nameser_compat.h" >&5 +echo "configure:4978: checking for the useability of arpa/nameser_compat.h" >&5 cat > conftest.$ac_ext < @@ -4872,7 +4993,7 @@ int main() { static int i; i = 0; ; return 0; } EOF -if { (eval echo configure:4876: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4997: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -4890,11 +5011,11 @@ rm -f conftest* openafs_save_libs="$LIBS" echo $ac_n "checking for res_search""... $ac_c" 1>&6 -echo "configure:4894: checking for res_search" >&5 +echo "configure:5015: checking for res_search" >&5 ac_cv_func_res_search=no cat > conftest.$ac_ext < @@ -4918,7 +5039,7 @@ return 0; ; return 0; } EOF -if { (eval echo configure:4922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_res_search=yes else @@ -4935,7 +5056,7 @@ rm -f conftest* ac_cv_func_res_search=no cat > conftest.$ac_ext < @@ -4959,7 +5080,7 @@ return 0; ; return 0; } EOF -if { (eval echo configure:4963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_res_search=yes else @@ -4993,7 +5114,7 @@ fi PTHREAD_LIBS=error echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6 -echo "configure:4997: checking for pthread_attr_init in -lpthread" >&5 +echo "configure:5118: checking for pthread_attr_init in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5001,7 +5122,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5034,7 +5155,7 @@ fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init in -lpthreads""... $ac_c" 1>&6 -echo "configure:5038: checking for pthread_attr_init in -lpthreads" >&5 +echo "configure:5159: checking for pthread_attr_init in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5042,7 +5163,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthreads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5076,7 +5197,7 @@ fi fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init in -lc_r""... $ac_c" 1>&6 -echo "configure:5080: checking for pthread_attr_init in -lc_r" >&5 +echo "configure:5201: checking for pthread_attr_init in -lc_r" >&5 ac_lib_var=`echo c_r'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5084,7 +5205,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5118,12 +5239,12 @@ fi fi if test "x$PTHREAD_LIBS" = xerror; then echo $ac_n "checking for pthread_attr_init""... $ac_c" 1>&6 -echo "configure:5122: checking for pthread_attr_init" >&5 +echo "configure:5243: checking for pthread_attr_init" >&5 if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_init'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_attr_init=yes" else @@ -5266,7 +5387,7 @@ EOF fi echo $ac_n "checking for tivoli tsm butc support""... $ac_c" 1>&6 -echo "configure:5270: checking for tivoli tsm butc support" >&5 +echo "configure:5391: checking for tivoli tsm butc support" >&5 XBSA_CFLAGS="" if test "$enable_tivoli_tsm" = "yes"; then XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen @@ -5287,12 +5408,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:5291: checking for ANSI C header files" >&5 +echo "configure:5412: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5300,7 +5421,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5317,7 +5438,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -5335,7 +5456,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -5356,7 +5477,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -5367,7 +5488,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:5371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -5391,12 +5512,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:5395: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:5516: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5412,7 +5533,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:5416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5537: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -5437,12 +5558,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:5441: checking for $ac_hdr that defines DIR" >&5 +echo "configure:5562: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -5450,7 +5571,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:5454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5575: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -5475,7 +5596,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:5479: checking for opendir in -ldir" >&5 +echo "configure:5600: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5483,7 +5604,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5516,7 +5637,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:5520: checking for opendir in -lx" >&5 +echo "configure:5641: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5524,7 +5645,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5561,17 +5682,17 @@ for ac_hdr in stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5565: checking for $ac_hdr" >&5 +echo "configure:5686: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5575: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5601,17 +5722,17 @@ for ac_hdr in netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5605: checking for $ac_hdr" >&5 +echo "configure:5726: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5615: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5641,17 +5762,17 @@ for ac_hdr in mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5645: checking for $ac_hdr" >&5 +echo "configure:5766: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5655: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5776: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5681,17 +5802,17 @@ for ac_hdr in sys/mount.h strings.h termios.h signal.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5685: checking for $ac_hdr" >&5 +echo "configure:5806: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5721,17 +5842,17 @@ for ac_hdr in windows.h malloc.h winsock2.h direct.h io.h sys/user.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5725: checking for $ac_hdr" >&5 +echo "configure:5846: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5735: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5761,17 +5882,17 @@ for ac_hdr in security/pam_modules.h siad.h usersec.h ucontext.h regex.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5765: checking for $ac_hdr" >&5 +echo "configure:5886: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5815,12 +5936,12 @@ fi for ac_func in utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5819: checking for $ac_func" >&5 +echo "configure:5940: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5870,12 +5991,12 @@ done for ac_func in setprogname getprogname sigaction mkstemp vsnprintf strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5874: checking for $ac_func" >&5 +echo "configure:5995: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5926,12 +6047,12 @@ done for ac_func in regcomp regexec regerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5930: checking for $ac_func" >&5 +echo "configure:6051: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5979,7 +6100,7 @@ fi done echo $ac_n "checking for POSIX regex library""... $ac_c" 1>&6 -echo "configure:5983: checking for POSIX regex library" >&5 +echo "configure:6104: checking for POSIX regex library" >&5 if test "$ac_cv_header_regex_h" = "yes" && \ test "$ac_cv_func_regcomp" = "yes" && \ test "$ac_cv_func_regexec" = "yes" && \ @@ -5994,12 +6115,12 @@ else fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:5998: checking for ssize_t" >&5 +echo "configure:6119: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6027,7 +6148,7 @@ EOF fi echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:6031: checking size of long" >&5 +echo "configure:6152: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6035,7 +6156,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -6046,7 +6167,7 @@ main() exit(0); } EOF -if { (eval echo configure:6050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -6069,12 +6190,12 @@ EOF for ac_func in timegm do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6073: checking for $ac_func" >&5 +echo "configure:6194: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6201,7 +6322,7 @@ LWP_OPTMZ=-O # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6205: checking for $ac_word" >&5 +echo "configure:6326: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6233,7 +6354,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6237: checking for $ac_word" >&5 +echo "configure:6358: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6268,7 +6389,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6272: checking for $ac_word" >&5 +echo "configure:6393: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6303,7 +6424,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6307: checking for $ac_word" >&5 +echo "configure:6428: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MV'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6338,7 +6459,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6342: checking for $ac_word" >&5 +echo "configure:6463: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6373,7 +6494,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6377: checking for $ac_word" >&5 +echo "configure:6498: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6408,7 +6529,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6412: checking for $ac_word" >&5 +echo "configure:6533: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6443,7 +6564,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6447: checking for $ac_word" >&5 +echo "configure:6568: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6478,7 +6599,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6482: checking for $ac_word" >&5 +echo "configure:6603: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LORDER'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6673,7 +6794,7 @@ case $AFS_SYSNAME in YACC="byacc" ;; - *nbsd2*) + *nbsd2*|*nbsd3*) LEX="flex -l" MT_CFLAGS='${XCFLAGS} -DAFS_PTHREAD_ENV -D_REENTRANT ' MT_LIBS="-lpthread" # XXX -pthread soon @@ -6892,21 +7013,7 @@ case $AFS_SYSNAME in EXTRA_VLIBOBJS="fstab.o" ;; - ppc_linux22) - INSTALL="install" - KERN_OPTMZ=-O2 - LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' - MT_LIBS="-lpthread" - PAM_CFLAGS="-O2 -Dlinux -DLINUX_PAM -fPIC" - SHLIB_LDFLAGS="-shared -Xlinker -x" - TXLIBS="-lncurses" - XCFLAGS="-O2 -D_LARGEFILE64_SOURCE" - YACC="bison -y" - SHLIB_LINKER="${MT_CC} -shared" - ;; - - ppc_linux24) + ppc_linux*) KERN_OPTMZ=-O2 LEX="flex -l" MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' @@ -6981,7 +7088,7 @@ case $AFS_SYSNAME in SHLIB_LINKER="${MT_CC} -shared" ;; - s390_linux24) + s390_linux24|s390_linux26) CC="gcc" CCOBJ="gcc" LD="ld" @@ -6998,7 +7105,7 @@ case $AFS_SYSNAME in SHLIB_LINKER="${MT_CC} -shared" ;; - s390x_linux24) + s390x_linux24|s390x_linux26) CC="gcc" CCOBJ="gcc" LD="ld" @@ -7264,7 +7371,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -7285,7 +7392,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -7306,7 +7413,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -7327,7 +7434,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -7343,7 +7450,7 @@ case $AFS_SYSNAME in sgi_6*) echo $ac_n "checking for mem* in sys/systm.h""... $ac_c" 1>&6 -echo "configure:7347: checking for mem* in sys/systm.h" >&5 +echo "configure:7454: checking for mem* in sys/systm.h" >&5 save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_KERNEL -D__STRING_H__" if eval "test \"`echo '$''{'ac_cv_irix_sys_systm_h_has_mem_funcs'+set}'`\" = set"; then @@ -7351,7 +7458,7 @@ if eval "test \"`echo '$''{'ac_cv_irix_sys_systm_h_has_mem_funcs'+set}'`\" = set else cat > conftest.$ac_ext < #include @@ -7361,7 +7468,7 @@ extern void *memcpy(char *, const void *, size_t); ; return 0; } EOF -if { (eval echo configure:7365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7472: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_irix_sys_systm_h_has_mem_funcs=no else diff --git a/configure-libafs.in b/configure-libafs.in index 265e6f18b..b30d966ae 100644 --- a/configure-libafs.in +++ b/configure-libafs.in @@ -1,5 +1,5 @@ AC_INIT(src/libafs/Makefile.common.in) -AM_INIT_AUTOMAKE(openafs-libafs,1.3.77) +AM_INIT_AUTOMAKE(openafs-libafs,1.3.79) AC_CONFIG_HEADER(src/config/afsconfig.h) define(OPENAFS_CONFIGURE_LIBAFS) diff --git a/configure.in b/configure.in index 2098caade..d8b2851e1 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT(src/config/stds.h) -AM_INIT_AUTOMAKE(openafs,1.3.77) +AM_INIT_AUTOMAKE(openafs,1.3.79) AC_CONFIG_HEADER(src/config/afsconfig.h) AC_PROG_CC diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index ae625b85e..e2ff15a32 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -388,13 +388,13 @@ int afsd_InitCM(char **reasonP) long maxcpus; long ltt, ltto; long rx_mtu, rx_nojumbo; - long virtualCache; + long virtualCache = 0; char rootCellName[256]; struct rx_service *serverp; static struct rx_securityClass *nullServerSecurityClassp; struct hostent *thp; char *msgBuf; - char buf[1024]; + char buf[1024], *p, *q; HKEY parmKey; DWORD dummyLen; DWORD regType; @@ -622,9 +622,12 @@ int afsd_InitCM(char **reasonP) } afsi_log("Cache path %s", cm_CachePath); } else { - GetWindowsDirectory(cm_CachePath, sizeof(cm_CachePath)); - cm_CachePath[2] = 0; /* get drive letter only */ - StringCbCatA(cm_CachePath, sizeof(cm_CachePath), "\\AFSCache"); + dummyLen = ExpandEnvironmentStrings("%TEMP%\\AFSCache", cm_CachePath, sizeof(cm_CachePath)); + if (dummyLen > sizeof(cm_CachePath)) { + afsi_log("Cache path [%%TEMP%%\\AFSCache] longer than %d after expanding env strings", + sizeof(cm_CachePath)); + osi_panic("CachePath too long", __FILE__, __LINE__); + } afsi_log("Default cache path %s", cm_CachePath); } @@ -668,35 +671,36 @@ int afsd_InitCM(char **reasonP) dummyLen = sizeof(buf); code = RegQueryValueEx(parmKey, "SysName", NULL, NULL, buf, &dummyLen); - if (code == ERROR_SUCCESS && buf[0]) { - char * p, *q; - afsi_log("Sys name %s", buf); + if (code != ERROR_SUCCESS || !buf[0]) { +#if defined(_IA64_) + StringCbCopyA(buf, sizeof(buf), "ia64_win64"); +#elif defined(_AMD64) + StringCbCopyA(buf, sizeof(buf), "amd64_win64"); +#else /* assume x86 32-bit */ + StringCbCopyA(buf, sizeof(buf), "x86_win32 i386_w2k i386_nt40"); +#endif + } + afsi_log("Sys name %s", buf); - for (p = q = buf; p < buf + dummyLen; p++) - { - if (*p == '\0' || isspace(*p)) { - memcpy(cm_sysNameList[cm_sysNameCount],q,p-q); - cm_sysNameList[cm_sysNameCount][p-q] = '\0'; - cm_sysNameCount++; - - do { - if (*p == '\0') - goto done_sysname; - - p++; - } while (*p == '\0' || isspace(*p)); - q = p; - p--; - } + /* breakup buf into individual search string entries */ + for (p = q = buf; p < buf + dummyLen; p++) + { + if (*p == '\0' || isspace(*p)) { + memcpy(cm_sysNameList[cm_sysNameCount],q,p-q); + cm_sysNameList[cm_sysNameCount][p-q] = '\0'; + cm_sysNameCount++; + + do { + if (*p == '\0') + goto done_sysname; + p++; + } while (*p == '\0' || isspace(*p)); + q = p; + p--; } - done_sysname: - StringCbCopyA(cm_sysName, MAXSYSNAME, cm_sysNameList[0]); - } else { - cm_sysNameCount = 1; - StringCbCopyA(cm_sysName, MAXSYSNAME, "i386_nt40"); - StringCbCopyA(cm_sysNameList[0], MAXSYSNAME, "i386_nt40"); - afsi_log("Default sys name %s", cm_sysName); } + done_sysname: + StringCbCopyA(cm_sysName, MAXSYSNAME, cm_sysNameList[0]); dummyLen = sizeof(cryptall); code = RegQueryValueEx(parmKey, "SecurityLevel", NULL, NULL, @@ -890,42 +894,6 @@ int afsd_InitCM(char **reasonP) /* Ensure the AFS Netbios Name is registered to allow loopback access */ configureBackConnectionHostNames(); - /* initialize RX, and tell it to listen to port 7001, which is used for - * callback RPC messages. - */ - code = rx_Init(htons(7001)); - afsi_log("rx_Init code %x", code); - if (code != 0) { - *reasonP = "afsd: failed to init rx client on port 7001"; - return -1; - } - - /* Initialize the RPC server for session keys */ - RpcInit(); - - /* create an unauthenticated service #1 for callbacks */ - nullServerSecurityClassp = rxnull_NewServerSecurityObject(); - serverp = rx_NewService(0, 1, "AFS", &nullServerSecurityClassp, 1, - RXAFSCB_ExecuteRequest); - afsi_log("rx_NewService addr %x", (int)serverp); - if (serverp == NULL) { - *reasonP = "unknown error"; - return -1; - } - - nullServerSecurityClassp = rxnull_NewServerSecurityObject(); - serverp = rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", - &nullServerSecurityClassp, 1, RXSTATS_ExecuteRequest); - afsi_log("rx_NewService addr %x", (int)serverp); - if (serverp == NULL) { - *reasonP = "unknown error"; - return -1; - } - - /* start server threads, *not* donating this one to the pool */ - rx_StartServer(0); - afsi_log("rx_StartServer"); - /* init user daemon, and other packages */ cm_InitUser(); @@ -962,6 +930,39 @@ int afsd_InitCM(char **reasonP) #endif #endif + /* initialize RX, and tell it to listen to port 7001, which is used for + * callback RPC messages. + */ + code = rx_Init(htons(7001)); + afsi_log("rx_Init code %x", code); + if (code != 0) { + *reasonP = "afsd: failed to init rx client on port 7001"; + return -1; + } + + /* create an unauthenticated service #1 for callbacks */ + nullServerSecurityClassp = rxnull_NewServerSecurityObject(); + serverp = rx_NewService(0, 1, "AFS", &nullServerSecurityClassp, 1, + RXAFSCB_ExecuteRequest); + afsi_log("rx_NewService addr %x", (int)serverp); + if (serverp == NULL) { + *reasonP = "unknown error"; + return -1; + } + + nullServerSecurityClassp = rxnull_NewServerSecurityObject(); + serverp = rx_NewService(0, RX_STATS_SERVICE_ID, "rpcstats", + &nullServerSecurityClassp, 1, RXSTATS_ExecuteRequest); + afsi_log("rx_NewService addr %x", (int)serverp); + if (serverp == NULL) { + *reasonP = "unknown error"; + return -1; + } + + /* start server threads, *not* donating this one to the pool */ + rx_StartServer(0); + afsi_log("rx_StartServer"); + code = cm_GetRootCellName(rootCellName); afsi_log("cm_GetRootCellName code %d, cm_freelanceEnabled= %d, rcn= %s", code, cm_freelanceEnabled, (code ? "" : rootCellName)); @@ -988,6 +989,10 @@ int afsd_InitCM(char **reasonP) if (cm_freelanceEnabled) cm_InitFreelance(); #endif + + /* Initialize the RPC server for session keys */ + RpcInit(); + return 0; } diff --git a/src/WINNT/afsd/afsd_service.c b/src/WINNT/afsd/afsd_service.c index 0df35f782..3df179134 100644 --- a/src/WINNT/afsd/afsd_service.c +++ b/src/WINNT/afsd/afsd_service.c @@ -171,10 +171,18 @@ afsd_ServiceControlHandler(DWORD ctrlCode) long code; switch (ctrlCode) { + case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_STOP: - /* Shutdown RPC */ - RpcMgmtStopServerListening(NULL); + ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING; + ServiceStatus.dwWin32ExitCode = NO_ERROR; + ServiceStatus.dwCheckPoint = 1; + ServiceStatus.dwWaitHint = 30000; + ServiceStatus.dwControlsAccepted = 0; + SetServiceStatus(StatusHandle, &ServiceStatus); +#ifdef FLUSH_VOLUME + afsd_ServiceFlushVolume((DWORD) lpEventData); +#endif /* Force trace if requested */ code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSConfigKeyName, @@ -195,20 +203,15 @@ afsd_ServiceControlHandler(DWORD ctrlCode) } doneTrace: - ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING; - ServiceStatus.dwWin32ExitCode = NO_ERROR; - ServiceStatus.dwCheckPoint = 1; - ServiceStatus.dwWaitHint = 10000; - ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; - SetServiceStatus(StatusHandle, &ServiceStatus); SetEvent(WaitToTerminate); break; + case SERVICE_CONTROL_INTERROGATE: ServiceStatus.dwCurrentState = SERVICE_RUNNING; ServiceStatus.dwWin32ExitCode = NO_ERROR; ServiceStatus.dwCheckPoint = 0; ServiceStatus.dwWaitHint = 0; - ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; + ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; SetServiceStatus(StatusHandle, &ServiceStatus); break; /* XXX handle system shutdown */ @@ -236,9 +239,18 @@ afsd_ServiceControlHandlerEx( switch (ctrlCode) { + case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_STOP: - /* Shutdown RPC */ - RpcMgmtStopServerListening(NULL); + ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING; + ServiceStatus.dwWin32ExitCode = NO_ERROR; + ServiceStatus.dwCheckPoint = 1; + ServiceStatus.dwWaitHint = 30000; + ServiceStatus.dwControlsAccepted = 0; + SetServiceStatus(StatusHandle, &ServiceStatus); + +#ifdef FLUSH_VOLUME + afsd_ServiceFlushVolume((DWORD) lpEventData); +#endif /* Force trace if requested */ code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, @@ -260,12 +272,6 @@ afsd_ServiceControlHandlerEx( } doneTrace: - ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING; - ServiceStatus.dwWin32ExitCode = NO_ERROR; - ServiceStatus.dwCheckPoint = 1; - ServiceStatus.dwWaitHint = 10000; - ServiceStatus.dwControlsAccepted = 0; - SetServiceStatus(StatusHandle, &ServiceStatus); SetEvent(WaitToTerminate); dwRet = NO_ERROR; break; @@ -275,7 +281,7 @@ afsd_ServiceControlHandlerEx( ServiceStatus.dwWin32ExitCode = NO_ERROR; ServiceStatus.dwCheckPoint = 0; ServiceStatus.dwWaitHint = 0; - ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_POWEREVENT; + ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_POWEREVENT; SetServiceStatus(StatusHandle, &ServiceStatus); dwRet = NO_ERROR; break; @@ -966,7 +972,7 @@ typedef SERVICE_STATUS_HANDLE ( * RegisterServiceCtrlHandlerFunc )( LPCTSTR , RegisterServiceCtrlHandlerExFunc pRegisterServiceCtrlHandlerEx = NULL; RegisterServiceCtrlHandlerFunc pRegisterServiceCtrlHandler = NULL; -void afsd_Main(DWORD argc, LPTSTR *argv) +VOID WINAPI afsd_Main(DWORD argc, LPTSTR *argv) { long code; char *reason; @@ -1155,7 +1161,7 @@ void afsd_Main(DWORD argc, LPTSTR *argv) ServiceStatus.dwWaitHint = 0; /* accept Power events */ - ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_POWEREVENT; + ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_POWEREVENT; SetServiceStatus(StatusHandle, &ServiceStatus); #endif { @@ -1181,6 +1187,8 @@ void afsd_Main(DWORD argc, LPTSTR *argv) DismountGlobalDrives(); smb_Shutdown(); rx_Finalize(); + RpcShutdown(); + buf_Shutdown(); #ifdef REGISTER_POWER_NOTIFICATIONS /* terminate thread used to flush cache */ diff --git a/src/WINNT/afsd/afsd_service.rc b/src/WINNT/afsd/afsd_service.rc index 189c56cd6..4cf9a0e07 100644 --- a/src/WINNT/afsd/afsd_service.rc +++ b/src/WINNT/afsd/afsd_service.rc @@ -13,5 +13,8 @@ #define AFS_VERINFO_NAME "afsd_service" #define AFS_VERINFO_FILENAME "afsd_service.exe" +1 ICON afsd.ico + #include "AFS_component_version_number.h" #include "..\..\config\NTVersioninfo.rc" + diff --git a/src/WINNT/afsd/afskfw.c b/src/WINNT/afsd/afskfw.c index 01ace95a8..69bd6bdcf 100644 --- a/src/WINNT/afsd/afskfw.c +++ b/src/WINNT/afsd/afskfw.c @@ -63,6 +63,7 @@ #include #include /* for life_to_time */ #include +#include /* * TIMING _____________________________________________________________________ @@ -99,6 +100,7 @@ DECL_FUNC_PTR(Leash_get_default_life_max); DECL_FUNC_PTR(Leash_get_default_renew_min); DECL_FUNC_PTR(Leash_get_default_renew_max); DECL_FUNC_PTR(Leash_get_default_renewable); +DECL_FUNC_PTR(Leash_get_default_mslsa_import); // krb5 functions DECL_FUNC_PTR(krb5_change_password); @@ -153,6 +155,7 @@ DECL_FUNC_PTR(krb5_get_renewed_creds); DECL_FUNC_PTR(krb5_get_default_config_files); DECL_FUNC_PTR(krb5_free_config_files); DECL_FUNC_PTR(krb5_get_default_realm); +DECL_FUNC_PTR(krb5_free_default_realm); DECL_FUNC_PTR(krb5_free_ticket); DECL_FUNC_PTR(krb5_decode_ticket); DECL_FUNC_PTR(krb5_get_host_realm); @@ -356,7 +359,9 @@ static int inited = 0; static int mid_cnt = 0; static struct textField * mid_tb = NULL; static HINSTANCE hKrb5 = 0; +#ifdef USE_KRB4 static HINSTANCE hKrb4 = 0; +#endif /* USE_KRB4 */ static HINSTANCE hKrb524 = 0; #ifdef USE_MS2MIT static HINSTANCE hSecur32 = 0; @@ -426,8 +431,10 @@ KFW_cleanup(void) { if (hKrb5) FreeLibrary(hKrb5); +#ifdef USE_KRB4 if (hKrb4) FreeLibrary(hKrb4); +#endif /* USE_KRB4 */ if (hProfile) FreeLibrary(hProfile); if (hComErr) @@ -900,8 +907,9 @@ KFW_import_windows_lsa(void) char * pname = NULL; krb5_data * princ_realm; krb5_error_code code; - char cell[128]="", realm[128]=""; + char cell[128]="", realm[128]="", *def_realm = 0; int i; + DWORD dwMsLsaImport; if (!pkrb5_init_context) return; @@ -922,6 +930,32 @@ KFW_import_windows_lsa(void) code = pkrb5_cc_get_principal(ctx, cc, &princ); if ( code ) goto cleanup; + dwMsLsaImport = pLeash_get_default_mslsa_import(); + switch ( dwMsLsaImport ) { + case 0: /* do not import */ + goto cleanup; + case 1: /* always import */ + break; + case 2: { /* matching realm */ + char ms_realm[128] = "", *r; + int i; + + for ( r=ms_realm, i=0; ilength; r++, i++ ) { + *r = krb5_princ_realm(ctx, princ)->data[i]; + } + *r = '\0'; + + if (code = pkrb5_get_default_realm(ctx, &def_realm)) + goto cleanup; + + if (strcmp(def_realm, ms_realm)) + goto cleanup; + break; + } + default: + break; + } + code = pkrb5_unparse_name(ctx,princ,&pname); if ( code ) goto cleanup; @@ -948,6 +982,8 @@ KFW_import_windows_lsa(void) pkrb5_free_unparsed_name(ctx,pname); if (princ) pkrb5_free_principal(ctx,princ); + if (def_realm) + pkrb5_free_default_realm(ctx, def_realm); if (cc) pkrb5_cc_close(ctx,cc); if (ctx) @@ -1165,8 +1201,7 @@ KFW_AFS_get_cred( char * username, { krb5_context ctx = 0; krb5_ccache cc = 0; - char * realm = 0; - char ** realmlist = 0; + char * realm = 0, * userrealm = 0; krb5_principal principal = 0; char * pname = 0; krb5_error_code code; @@ -1194,19 +1229,19 @@ KFW_AFS_get_cred( char * username, code = KFW_AFS_get_cellconfig( cell, (void*)&cellconfig, local_cell); if ( code ) goto cleanup; - realm = strchr(username,'@'); - if ( realm ) { + realm = afs_realm_of_cell(ctx, &cellconfig); // do not free + userrealm = strchr(username,'@'); + if (userrealm) { pname = strdup(username); - realm = strchr(pname, '@'); - *realm = '\0'; + userrealm = strchr(pname, '@'); + *userrealm = '\0'; /* handle kerberos iv notation */ while ( dot = strchr(pname,'.') ) { *dot = '/'; } - *realm++ = '@'; + *userrealm++ = '@'; } else { - realm = afs_realm_of_cell(ctx, &cellconfig); // do not free pname = malloc(strlen(username) + strlen(realm) + 2); strcpy(pname, username); @@ -2429,7 +2464,9 @@ ViceIDToUsername(char *username, { static char lastcell[MAXCELLCHARS+1] = { 0 }; static char confname[512] = { 0 }; +#ifdef AFS_ID_TO_NAME char username_copy[BUFSIZ]; +#endif /* AFS_ID_TO_NAME */ long viceId; /* AFS uid of user */ int status = 0; #ifdef ALLOW_REGISTER @@ -2509,7 +2546,7 @@ ViceIDToUsername(char *username, * level */ - if (status = pr_Initialize(1L, confname, aserver->cell, 0)) + if (status = pr_Initialize(1L, confname, aserver->cell)) return status; if (status = pr_CreateUser(username, &id)) return status; @@ -2537,7 +2574,9 @@ KFW_AFS_klog( { long rc = 0; CREDENTIALS creds; +#ifdef USE_KRB4 KTEXT_ST ticket; +#endif /* USE_KRB4 */ struct ktc_principal aserver; struct ktc_principal aclient; char realm_of_user[REALM_SZ]; /* Kerberos realm of user */ @@ -2559,6 +2598,7 @@ KFW_AFS_klog( krb5_creds * k5creds = 0; krb5_error_code code; krb5_principal client_principal = 0; + krb5_data * k5data; int i, retry = 0; CurrentState = 0; @@ -2620,7 +2660,15 @@ KFW_AFS_klog( goto skip_krb5_init; } - if ( strchr(krb5_princ_component(ctx,client_principal,0),'.') != NULL ) + /* lookfor client principals which cannot be distinguished + * from Kerberos 4 multi-component principal names + */ + k5data = krb5_princ_component(ctx,client_principal,0); + for ( i=0; ilength; i++ ) { + if ( k5data->data[i] == '.' ) + break; + } + if (i != k5data->length) { OutputDebugString("Illegal Principal name contains dot in first component\n"); rc = KRB5KRB_ERR_GENERIC; diff --git a/src/WINNT/afsd/afslogon.c b/src/WINNT/afsd/afslogon.c index 0446fb498..746c6cce2 100644 --- a/src/WINNT/afsd/afslogon.c +++ b/src/WINNT/afsd/afslogon.c @@ -254,6 +254,28 @@ BOOL IsServiceRunning (void) return (Status.dwCurrentState == SERVICE_RUNNING); } +BOOL IsServiceStartPending (void) +{ + SERVICE_STATUS Status; + SC_HANDLE hManager; + memset (&Status, 0x00, sizeof(Status)); + Status.dwCurrentState = SERVICE_STOPPED; + + if ((hManager = OpenSCManager (NULL, NULL, GENERIC_READ)) != NULL) + { + SC_HANDLE hService; + if ((hService = OpenService (hManager, TEXT("TransarcAFSDaemon"), GENERIC_READ)) != NULL) + { + QueryServiceStatus (hService, &Status); + CloseServiceHandle (hService); + } + + CloseServiceHandle (hManager); + } + DebugEvent("AFS AfsLogon - Test Service Start Pending","Return Code[%x] ?Start Pending[%d]",Status.dwCurrentState,(Status.dwCurrentState == SERVICE_START_PENDING)); + return (Status.dwCurrentState == SERVICE_RUNNING); +} + /* LOOKUPKEYCHAIN: macro to look up the value in the list of keys in order until it's found v:variable to receive value (reference type) t:type @@ -550,6 +572,10 @@ UnicodeStringToANSI(UNICODE_STRING uInputString, LPSTR lpszOutputString, int nOu GetCPInfo(CP_ACP, &CodePageInfo); + if (CodePageInfo.MaxCharSize > 1) + // Only supporting non-Unicode strings + return FALSE; + if (uInputString.Buffer && ((LPBYTE) uInputString.Buffer)[1] == '\0') { // Looks like unicode, better translate it @@ -561,7 +587,6 @@ UnicodeStringToANSI(UNICODE_STRING uInputString, LPSTR lpszOutputString, int nOu } else lpszOutputString[0] = '\0'; - return FALSE; } // UnicodeStringToANSI @@ -586,7 +611,7 @@ DWORD APIENTRY NPLogonNotify( DWORD code; int pw_exp; - char *reason; + char *reason = 0; char *ctemp; BOOLEAN interactive; @@ -598,7 +623,7 @@ DWORD APIENTRY NPLogonNotify( BOOLEAN afsWillAutoStart; - BOOLEAN uppercased_name = TRUE; + BOOLEAN lowercased_name = TRUE; LogonOptions_t opt; /* domain specific logon options */ int retryInterval; @@ -629,10 +654,10 @@ DWORD APIENTRY NPLogonNotify( ctemp = strchr(uname, '@'); if (ctemp) *ctemp = 0; - /* is the name all uppercase? */ + /* is the name all lowercase? */ for ( ctemp = uname; *ctemp ; ctemp++) { - if ( islower(*ctemp) ) { - uppercased_name = FALSE; + if ( !islower(*ctemp) ) { + lowercased_name = FALSE; break; } } @@ -654,6 +679,9 @@ DWORD APIENTRY NPLogonNotify( sleepInterval = opt.sleepInterval; *lpLogonScript = opt.logonScript; + if (retryInterval < sleepInterval) + sleepInterval = retryInterval; + DebugEvent("Got logon script: %S",opt.logonScript); afsWillAutoStart = AFSWillAutoStart(); @@ -687,7 +715,7 @@ DWORD APIENTRY NPLogonNotify( /* We get the user's home directory path, if applicable, though we can't lookup the cell right away because the client service may not have started yet. This call also sets the AD_REALM flag in opt.flags if applicable. */ - if(ISREMOTE(opt.flags)) { + if (ISREMOTE(opt.flags)) { DebugEvent("Is Remote"); GetAdHomePath(homePath,MAX_PATH,lpLogonId,&opt); } @@ -698,9 +726,9 @@ DWORD APIENTRY NPLogonNotify( DebugEvent("while(TRUE) LogonOption[%x], Service AutoStart[%d]", opt.LogonOption,afsWillAutoStart); - if(ISADREALM(opt.flags)) { + if (ISADREALM(opt.flags)) { code = GetFileCellName(homePath,cell,256); - if(!code) { + if (!code) { DebugEvent("profile path [%s] is in cell [%s]",homePath,cell); } /* Don't bail out if GetFileCellName failed. @@ -711,46 +739,54 @@ DWORD APIENTRY NPLogonNotify( /* if Integrated Logon */ if (ISLOGONINTEGRATED(opt.LogonOption)) - { + { if ( KFW_is_available() ) { code = KFW_AFS_get_cred(uname, cell, password, 0, opt.smbName, &reason); - DebugEvent("KFW_AFS_get_cred uname=[%s] smbname=[%s] cell=[%s] code=[%d]",uname,opt.smbName,cell,code); - } - else { + DebugEvent("KFW_AFS_get_cred uname=[%s] smbname=[%s] cell=[%s] code=[%d]", + uname,opt.smbName,cell,code); + } else { code = ka_UserAuthenticateGeneral2(KA_USERAUTH_VERSION+KA_USERAUTH_AUTHENT_LOGON, uname, "", cell, password, opt.smbName, 0, &pw_exp, 0, &reason); - DebugEvent("AFS AfsLogon - (INTEGRATED only)ka_UserAuthenticateGeneral2","Code[%x]", - code); + + DebugEvent("AFS AfsLogon - ka_UserAuthenticateGeneral2","Code[%x] uname[%s] Cell[%s] Reason[%s]", + code,uname,cell,reason ? reason : ""); + { + char msg[2048]; + sprintf(msg, "Code[%x] uname[%s] Cell[%s] Reason[%s]", + code,uname,cell,reason ? reason : ""); + MessageBox(hwndOwner, + msg, + "AFS Logon", + MB_ICONINFORMATION | MB_OK); + } } - if ( code && code != KTC_NOCM && code != KTC_NOCMRPC && uppercased_name ) { + if ( code && code != KTC_NOCM && code != KTC_NOCMRPC && !lowercased_name ) { for ( ctemp = uname; *ctemp ; ctemp++) { *ctemp = tolower(*ctemp); } - uppercased_name = FALSE; - continue; + lowercased_name = TRUE; + goto sleeping; } - } - else { + + /* is service started yet?*/ + /* If we've failed because the client isn't running yet and the + * client is set to autostart (and therefore it makes sense for + * us to wait for it to start) then sleep a while and try again. + * If the error was something else, then give up. */ + if (code != KTC_NOCM && code != KTC_NOCMRPC || !afsWillAutoStart) + break; + } else { /*JUST check to see if its running*/ if (IsServiceRunning()) break; - code = KTC_NOCM; - if (!afsWillAutoStart) + if (afsWillAutoStart && !IsServiceStartPending()) { + code = KTC_NOCMRPC; + reason = "AFS Service start failed"; break; + } } - /* is service started yet?*/ - DebugEvent("AFS AfsLogon - ka_UserAuthenticateGeneral2","Code[%x] uname[%s] Cell[%s]", - code,uname,cell); - - /* If we've failed because the client isn't running yet and the - * client is set to autostart (and therefore it makes sense for - * us to wait for it to start) then sleep a while and try again. - * If the error was something else, then give up. */ - if (code != KTC_NOCM && code != KTC_NOCMRPC || !afsWillAutoStart) - break; - /* If the retry interval has expired and we still aren't * logged in, then just give up if we are not in interactive * mode or the failSilently flag is set, otherwise let the @@ -767,14 +803,11 @@ DWORD APIENTRY NPLogonNotify( break; /* Wait just a little while and try again */ - retryInterval = sleepInterval = DEFAULT_SLEEP_INTERVAL; + retryInterval = opt.retryInterval; } - if (retryInterval < sleepInterval) - sleepInterval = retryInterval; - + sleeping: Sleep(sleepInterval * 1000); - retryInterval -= sleepInterval; } @@ -809,7 +842,6 @@ DWORD APIENTRY NPLogonNotify( *lpLogonScript = NULL; if (!afsWillAutoStart) // its not running, so if not autostart or integrated logon then just skip code = 0; - } } diff --git a/src/WINNT/afsd/afslogon.h b/src/WINNT/afsd/afslogon.h index d222642f3..120be6b06 100644 --- a/src/WINNT/afsd/afslogon.h +++ b/src/WINNT/afsd/afslogon.h @@ -41,7 +41,7 @@ SOFTWARE. #define REG_CLIENT_TRACE_OPTION_PARM "TraceOption" #define REG_CLIENT_LOGON_OPTION_PARM "LogonOptions" #define REG_CLIENT_LOGON_SCRIPT_PARMW L"LogonScript" -#define DEFAULT_RETRY_INTERVAL 30 /* seconds*/ +#define DEFAULT_RETRY_INTERVAL 60 /* seconds*/ #define DEFAULT_FAIL_SILENTLY FALSE #define DEFAULT_SLEEP_INTERVAL 5 /* seconds*/ #define DEFAULT_LOGON_OPTION 1 diff --git a/src/WINNT/afsd/cm_aclent.c b/src/WINNT/afsd/cm_aclent.c index 6dc9dff77..44e623cbd 100644 --- a/src/WINNT/afsd/cm_aclent.c +++ b/src/WINNT/afsd/cm_aclent.c @@ -24,12 +24,43 @@ * in either the free list or in the LRU queue. A read lock prevents someone * from modifying the list(s), and a write lock is required for modifying * the list. The actual data stored in the randomUid and randomAccess fields - * is actually maintained as up-to-date or not via the scache llock. + * is actually maintained as up-to-date or not via the scache lock. * An aclent structure is free if it has no back vnode pointer. */ osi_rwlock_t cm_aclLock; /* lock for system's aclents */ -cm_aclent_t *cm_aclLRUp; /* LRUQ for dudes in vnodes' lists */ -cm_aclent_t *cm_aclLRUEndp; /* ditto */ +cm_aclent_t *cm_aclLRUp; /* LRUQ for dudes in vnode's lists */ +cm_aclent_t *cm_aclLRUEndp; /* ditto */ + +/* This function must be called with cm_aclLock and the aclp->back_mx held */ +static void CleanupACLEnt(cm_aclent_t * aclp) +{ + cm_aclent_t *taclp; + cm_aclent_t **laclpp; + + if (aclp->backp) { + /* + * Remove the entry from the vnode's list + */ + laclpp = &aclp->backp->randomACLp; + for ( taclp = *laclpp; taclp; laclpp = &taclp->nextp, taclp = *laclpp ) { + if (taclp == aclp) + break; + } + if (!taclp) + osi_panic("CleanupACLEnt race",__FILE__,__LINE__); + *laclpp = aclp->nextp; /* remove from the vnode's list */ + aclp->backp = NULL; + } + + /* release the old user */ + if (aclp->userp) { + cm_ReleaseUser(aclp->userp); + aclp->userp = NULL; + } + + aclp->randomAccess = 0; + aclp->tgtLifetime = 0; +} /* * Get an acl cache entry for a particular user and file, or return that it doesn't exist. @@ -37,39 +68,41 @@ cm_aclent_t *cm_aclLRUEndp; /* ditto */ */ long cm_FindACLCache(cm_scache_t *scp, cm_user_t *userp, long *rightsp) { - cm_aclent_t *aclp; - - lock_ObtainWrite(&cm_aclLock); - for (aclp = scp->randomACLp; aclp; aclp = aclp->nextp) { - if (aclp->userp == userp) { - if (aclp->tgtLifetime && aclp->tgtLifetime <= (long) osi_Time()) { - /* ticket expired */ - aclp->tgtLifetime = 0; - *rightsp = 0; - break; /* get a new acl from server */ - } - else { - *rightsp = aclp->randomAccess; - if (cm_aclLRUEndp == aclp) - cm_aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q); - - /* move to the head of the LRU queue */ - osi_QRemove((osi_queue_t **) &cm_aclLRUp, &aclp->q); - osi_QAddH((osi_queue_t **) &cm_aclLRUp, - (osi_queue_t **) &cm_aclLRUEndp, - &aclp->q); - } - lock_ReleaseWrite(&cm_aclLock); - return 0; - } - } - - /* - * If we make it here, this entry isn't present, so we're going to fail. - */ - lock_ReleaseWrite(&cm_aclLock); - return -1; -} + cm_aclent_t *aclp; + long retval = -1; + + lock_ObtainWrite(&cm_aclLock); + *rightsp = 0; /* get a new acl from server if we don't find a + * current entry + */ + for (aclp = scp->randomACLp; aclp; aclp = aclp->nextp) { + if (aclp->userp == userp) { + if (aclp->tgtLifetime && aclp->tgtLifetime <= osi_Time()) { + /* ticket expired */ + osi_QRemove((osi_queue_t **) &cm_aclLRUp, &aclp->q); + CleanupACLEnt(aclp); + osi_QAddT((osi_queue_t **) &cm_aclLRUp, + (osi_queue_t **) &cm_aclLRUEndp, + &aclp->q); + } else { + *rightsp = aclp->randomAccess; + if (cm_aclLRUEndp == aclp) + cm_aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q); + + /* move to the head of the LRU queue */ + osi_QRemove((osi_queue_t **) &cm_aclLRUp, &aclp->q); + osi_QAddH((osi_queue_t **) &cm_aclLRUp, + (osi_queue_t **) &cm_aclLRUEndp, + &aclp->q); + retval = 0; /* success */ + } + break; + } + } + + lock_ReleaseWrite(&cm_aclLock); + return retval; +} /* @@ -78,38 +111,16 @@ long cm_FindACLCache(cm_scache_t *scp, cm_user_t *userp, long *rightsp) */ static cm_aclent_t *GetFreeACLEnt(void) { - cm_aclent_t *aclp; - cm_aclent_t *taclp; - cm_aclent_t **laclpp; - - if (cm_aclLRUp == NULL) - osi_panic("empty aclent LRU", __FILE__, __LINE__); - - aclp = cm_aclLRUEndp; - if (aclp == cm_aclLRUEndp) - cm_aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q); - osi_QRemove((osi_queue_t **) &cm_aclLRUp, &aclp->q); - if (aclp->backp) { - /* - * Remove the entry from the vnode's list - */ - laclpp = &aclp->backp->randomACLp; - for (taclp = *laclpp; taclp; laclpp = &taclp->nextp, taclp = *laclpp) { - if (taclp == aclp) - break; - } - if (!taclp) - osi_panic("GetFreeACLEnt race", __FILE__, __LINE__); - *laclpp = aclp->nextp; /* remove from vnode list */ - aclp->backp = NULL; - } - - /* release the old user */ - if (aclp->userp) { - cm_ReleaseUser(aclp->userp); - aclp->userp = NULL; - } - return aclp; + cm_aclent_t *aclp; + + if (cm_aclLRUp == NULL) + osi_panic("empty aclent LRU", __FILE__, __LINE__); + + aclp = cm_aclLRUEndp; + cm_aclLRUEndp = (cm_aclent_t *) osi_QPrev(&aclp->q); + osi_QRemove((osi_queue_t **) &cm_aclLRUp, &aclp->q); + CleanupACLEnt(aclp); + return aclp; } @@ -121,36 +132,36 @@ static cm_aclent_t *GetFreeACLEnt(void) */ long cm_AddACLCache(cm_scache_t *scp, cm_user_t *userp, long rights) { - register struct cm_aclent *aclp; - - lock_ObtainWrite(&cm_aclLock); - for (aclp = scp->randomACLp; aclp; aclp = aclp->nextp) { - if (aclp->userp == userp) { - aclp->randomAccess = rights; - if (aclp->tgtLifetime == 0) - aclp->tgtLifetime = cm_TGTLifeTime(pag); - lock_ReleaseWrite(&cm_aclLock); - return 0; - } - } - - /* - * Didn't find the dude we're looking for, so take someone from the LRUQ - * and reuse. But first try the free list and see if there's already - * someone there. - */ - aclp = GetFreeACLEnt(); /* can't fail, panics instead */ - osi_QAddH((osi_queue_t **) &cm_aclLRUp, (osi_queue_t **) &cm_aclLRUEndp, &aclp->q); - aclp->backp = scp; - aclp->nextp = scp->randomACLp; - scp->randomACLp = aclp; + register struct cm_aclent *aclp; + + lock_ObtainWrite(&cm_aclLock); + for (aclp = scp->randomACLp; aclp; aclp = aclp->nextp) { + if (aclp->userp == userp) { + aclp->randomAccess = rights; + if (aclp->tgtLifetime == 0) + aclp->tgtLifetime = cm_TGTLifeTime(pag); + lock_ReleaseWrite(&cm_aclLock); + return 0; + } + } + + /* + * Didn't find the dude we're looking for, so take someone from the LRUQ + * and reuse. But first try the free list and see if there's already + * someone there. + */ + aclp = GetFreeACLEnt(); /* can't fail, panics instead */ + osi_QAddH((osi_queue_t **) &cm_aclLRUp, (osi_queue_t **) &cm_aclLRUEndp, &aclp->q); + aclp->backp = scp; + aclp->nextp = scp->randomACLp; + scp->randomACLp = aclp; cm_HoldUser(userp); - aclp->userp = userp; - aclp->randomAccess = rights; - aclp->tgtLifetime = cm_TGTLifeTime(userp); - lock_ReleaseWrite(&cm_aclLock); + aclp->userp = userp; + aclp->randomAccess = rights; + aclp->tgtLifetime = cm_TGTLifeTime(userp); + lock_ReleaseWrite(&cm_aclLock); - return 0; + return 0; } /* @@ -158,32 +169,29 @@ long cm_AddACLCache(cm_scache_t *scp, cm_user_t *userp, long rights) */ long cm_InitACLCache(long size) { - cm_aclent_t *aclp; - long i; - static osi_once_t once; - - - if (osi_Once(&once)) { - lock_InitializeRWLock(&cm_aclLock, "cm_aclLock"); - osi_EndOnce(&once); - } - - lock_ObtainWrite(&cm_aclLock); - cm_aclLRUp = cm_aclLRUEndp = NULL; - aclp = (cm_aclent_t *) malloc(size * sizeof(cm_aclent_t)); - memset(aclp, 0, size * sizeof(cm_aclent_t)); - - /* - * Put all of these guys on the LRU queue - */ - for (i = 0; i < size; i++) { - osi_QAddH((osi_queue_t **) &cm_aclLRUp, (osi_queue_t **) &cm_aclLRUEndp, - &aclp->q); - aclp++; - } - - lock_ReleaseWrite(&cm_aclLock); - return 0; + cm_aclent_t *aclp; + long i; + static osi_once_t once; + + if (osi_Once(&once)) { + lock_InitializeRWLock(&cm_aclLock, "cm_aclLock"); + osi_EndOnce(&once); + } + + lock_ObtainWrite(&cm_aclLock); + cm_aclLRUp = cm_aclLRUEndp = NULL; + aclp = (cm_aclent_t *) malloc(size * sizeof(cm_aclent_t)); + memset(aclp, 0, size * sizeof(cm_aclent_t)); + + /* + * Put all of these guys on the LRU queue + */ + for (i = 0; i < size; i++) { + osi_QAddH((osi_queue_t **) &cm_aclLRUp, (osi_queue_t **) &cm_aclLRUEndp, &aclp->q); + aclp++; + } + lock_ReleaseWrite(&cm_aclLock); + return 0; } @@ -194,22 +202,22 @@ long cm_InitACLCache(long size) */ void cm_FreeAllACLEnts(cm_scache_t *scp) { - cm_aclent_t *aclp; - cm_aclent_t *taclp; - - lock_ObtainWrite(&cm_aclLock); - for (aclp = scp->randomACLp; aclp; aclp = taclp) { - taclp = aclp->nextp; - if (aclp->userp) { - cm_ReleaseUser(aclp->userp); - aclp->userp = NULL; - } - aclp->backp = (struct cm_scache *) 0; - } - - scp->randomACLp = (struct cm_aclent *) 0; - scp->anyAccess = 0; /* reset this, too */ - lock_ReleaseWrite(&cm_aclLock); + cm_aclent_t *aclp; + cm_aclent_t *taclp; + + lock_ObtainWrite(&cm_aclLock); + for (aclp = scp->randomACLp; aclp; aclp = taclp) { + taclp = aclp->nextp; + if (aclp->userp) { + cm_ReleaseUser(aclp->userp); + aclp->userp = NULL; + } + aclp->backp = (struct cm_scache *) 0; + } + + scp->randomACLp = (struct cm_aclent *) 0; + scp->anyAccess = 0; /* reset this, too */ + lock_ReleaseWrite(&cm_aclLock); } @@ -220,19 +228,19 @@ void cm_FreeAllACLEnts(cm_scache_t *scp) */ void cm_InvalidateACLUser(cm_scache_t *scp, cm_user_t *userp) { - cm_aclent_t *aclp; - cm_aclent_t **laclpp; - - lock_ObtainWrite(&cm_aclLock); - laclpp = &scp->randomACLp; - for (aclp = *laclpp; aclp; laclpp = &aclp->nextp, aclp = *laclpp) { - if (userp == aclp->userp) { /* One for a given user/scache */ - *laclpp = aclp->nextp; + cm_aclent_t *aclp; + cm_aclent_t **laclpp; + + lock_ObtainWrite(&cm_aclLock); + laclpp = &scp->randomACLp; + for (aclp = *laclpp; aclp; laclpp = &aclp->nextp, aclp = *laclpp) { + if (userp == aclp->userp) { /* One for a given user/scache */ + *laclpp = aclp->nextp; cm_ReleaseUser(aclp->userp); aclp->userp = NULL; - aclp->backp = (struct cm_scache *) 0; - break; - } - } - lock_ReleaseWrite(&cm_aclLock); + aclp->backp = (struct cm_scache *) 0; + break; + } + } + lock_ReleaseWrite(&cm_aclLock); } diff --git a/src/WINNT/afsd/cm_aclent.h b/src/WINNT/afsd/cm_aclent.h index 2e2a63f3e..f24ee67d4 100644 --- a/src/WINNT/afsd/cm_aclent.h +++ b/src/WINNT/afsd/cm_aclent.h @@ -23,7 +23,7 @@ typedef struct cm_aclent { struct cm_scache *backp; /* back ptr to vnode */ struct cm_user *userp; /* user whose access is cached */ long randomAccess; /* watch for more rights in acl.h */ - long tgtLifetime; /* time this expires */ + unsigned long tgtLifetime; /* time this expires */ } cm_aclent_t; extern osi_rwlock_t cm_aclLock; diff --git a/src/WINNT/afsd/cm_buf.c b/src/WINNT/afsd/cm_buf.c index 8abbf431f..26ff2422c 100644 --- a/src/WINNT/afsd/cm_buf.c +++ b/src/WINNT/afsd/cm_buf.c @@ -86,6 +86,9 @@ int buf_cacheType = CM_BUF_CACHETYPE_FILE; static HANDLE CacheHandle; +static +VOID * ViewOfFile; + static SYSTEM_INFO sysInfo; #endif /* !DJGPP */ @@ -316,10 +319,20 @@ long buf_Init(cm_buf_ops_t *opsp) afsi_log("Error creating cache file \"%s\" error %d", cm_CachePath, GetLastError()); return CM_ERROR_INVAL; + } else if (GetLastError() == ERROR_ALREADY_EXISTS) { + BY_HANDLE_FILE_INFORMATION fileInfo; + + afsi_log("Cache File \"%s\" already exists", cm_CachePath); + if ( GetFileInformationByHandle(hf, &fileInfo) ) + afsi_log("Existing File Size: %08X:%08X", + fileInfo.nFileSizeHigh, + fileInfo.nFileSizeLow); } } else { /* buf_cacheType == CM_BUF_CACHETYPE_VIRTUAL */ hf = INVALID_HANDLE_VALUE; } + afsi_log("File Mapping Size: %08X", buf_nbuffers * buf_bufferSize); + CacheHandle = hf; hm = CreateFileMapping(hf, NULL, @@ -328,17 +341,16 @@ long buf_Init(cm_buf_ops_t *opsp) NULL); if (hm == NULL) { if (GetLastError() == ERROR_DISK_FULL) { - afsi_log("Error creating cache file \"%s\" mapping: disk full", - cm_CachePath); + afsi_log("Error creating cache file mapping: disk full"); return CM_ERROR_TOOMANYBUFS; } return CM_ERROR_INVAL; } - data = MapViewOfFile(hm, - FILE_MAP_ALL_ACCESS, - 0, 0, - buf_nbuffers * buf_bufferSize); - if (data == NULL) { + ViewOfFile = MapViewOfFile(hm, + FILE_MAP_ALL_ACCESS, + 0, 0, + buf_nbuffers * buf_bufferSize); + if (ViewOfFile == NULL) { afsi_log("Error mapping view of file: 0x%X", GetLastError()); if (hf != INVALID_HANDLE_VALUE) CloseHandle(hf); @@ -346,6 +358,8 @@ long buf_Init(cm_buf_ops_t *opsp) return CM_ERROR_INVAL; } CloseHandle(hm); + + data = ViewOfFile; #else /* djgpp doesn't support memory mapped files */ data = malloc(buf_nbuffers * buf_bufferSize); @@ -406,6 +420,13 @@ long buf_Init(cm_buf_ops_t *opsp) return 0; } +void +buf_Shutdown(void) +{ + UnmapViewOfFile(ViewOfFile); + CloseHandle(CacheHandle); +} + /* add nbuffers to the buffer pool, if possible. * Called with no locks held. */ diff --git a/src/WINNT/afsd/cm_buf.h b/src/WINNT/afsd/cm_buf.h index 1f1bc42ac..c7f59fcac 100644 --- a/src/WINNT/afsd/cm_buf.h +++ b/src/WINNT/afsd/cm_buf.h @@ -142,6 +142,8 @@ extern cm_buf_t **buf_fileHashTablepp; extern long buf_Init(cm_buf_ops_t *); +extern void buf_Shutdown(void); + extern long buf_CountFreeList(void); extern void buf_Release(cm_buf_t *); diff --git a/src/WINNT/afsd/cm_callback.c b/src/WINNT/afsd/cm_callback.c index 7e7ec2828..917bf364b 100644 --- a/src/WINNT/afsd/cm_callback.c +++ b/src/WINNT/afsd/cm_callback.c @@ -775,13 +775,17 @@ void cm_EndCallbackGrantingCall(cm_scache_t *scp, cm_callbackRequest_t *cbrp, */ lock_ReleaseMutex(&scp->mx); cm_CallbackNotifyChange(scp); + lock_ReleaseWrite(&cm_callbackLock); lock_ObtainMutex(&scp->mx); + lock_ObtainWrite(&cm_callbackLock); } - if (freeFlag) free(revp); + if (freeFlag) + free(revp); } /* if we freed the list, zap the pointer to it */ - if (freeFlag) cm_racingRevokesp = NULL; + if (freeFlag) + cm_racingRevokesp = NULL; lock_ReleaseWrite(&cm_callbackLock); diff --git a/src/WINNT/afsd/cm_cell.c b/src/WINNT/afsd/cm_cell.c index e82ff9663..f16fabecc 100644 --- a/src/WINNT/afsd/cm_cell.c +++ b/src/WINNT/afsd/cm_cell.c @@ -95,12 +95,25 @@ cm_cell_t *cm_GetCell_Gen(char *namep, char *newnamep, long flags) memset(cp, 0, sizeof(cm_cell_t)); } else { + cm_cell_t **cpp; + dns_expired = 1; - /* must empty cp->vlServersp */ - lock_ObtainWrite(&cp->mx); - cm_FreeServerList(&cp->vlServersp); - cp->vlServersp = NULL; - lock_ReleaseWrite(&cp->mx); + if (cp->vlServersp) { + /* must empty cp->vlServersp */ + lock_ObtainMutex(&cp->mx); + cm_FreeServerList(&cp->vlServersp); + cp->vlServersp = NULL; + lock_ReleaseMutex(&cp->mx); + } + /* remove the entry from the allCells list + * we will re-insert it later + */ + for (cpp = &cm_allCellsp; *cpp; cpp=&(*cpp)->nextp) { + if (*cpp == cp) { + (*cpp) = cp->nextp; + break; + } + } } code = cm_SearchCellFile(namep, fullname, cm_AddCellProc, cp); diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 4dbfb2cfd..e2a6da12d 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -138,30 +138,30 @@ static long cm_GetServerList(struct cm_fid *fidp, struct cm_user *userp, */ int cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, - struct cm_fid *fidp, - AFSVolSync *volSyncp, - cm_serverRef_t * serversp, - cm_callbackRequest_t *cbrp, long errorCode) + struct cm_fid *fidp, + AFSVolSync *volSyncp, + cm_serverRef_t * serversp, + cm_callbackRequest_t *cbrp, long errorCode) { cm_server_t *serverp = 0; cm_serverRef_t **serverspp = 0; - cm_serverRef_t *tsrp; - cm_ucell_t *ucellp; + cm_serverRef_t *tsrp; + cm_ucell_t *ucellp; int retry = 0; int free_svr_list = 0; - int dead_session; + int dead_session; long timeUsed, timeLeft; - osi_Log2(afsd_logp, "cm_Analyze connp 0x%x, code %d", - (long) connp, errorCode); + osi_Log2(afsd_logp, "cm_Analyze connp 0x%x, code %d", + (long) connp, errorCode); - /* no locking required, since connp->serverp never changes after - * creation */ - dead_session = (userp->cellInfop == NULL); - if (connp) - serverp = connp->serverp; + /* no locking required, since connp->serverp never changes after + * creation */ + dead_session = (userp->cellInfop == NULL); + if (connp) + serverp = connp->serverp; - /* Update callback pointer */ + /* Update callback pointer */ if (cbrp && serverp && errorCode == 0) { if (cbrp->serverp) { if ( cbrp->serverp != serverp ) { @@ -178,39 +178,39 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, lock_ReleaseWrite(&cm_callbackLock); } - /* If not allowed to retry, don't */ - if (reqp->flags & CM_REQ_NORETRY) - goto out; + /* If not allowed to retry, don't */ + if (reqp->flags & CM_REQ_NORETRY) + goto out; - /* if timeout - check that it did not exceed the SMB timeout + /* if timeout - check that it did not exceed the SMB timeout * and retry */ - /* timeleft - get if from reqp the same way as cmXonnByMServers does */ + /* timeleft - get if from reqp the same way as cmXonnByMServers does */ #ifndef DJGPP - timeUsed = (GetCurrentTime() - reqp->startTime) / 1000; + timeUsed = (GetCurrentTime() - reqp->startTime) / 1000; #else - gettimeofday(&now, NULL); - timeUsed = sub_time(now, reqp->startTime) / 1000; + gettimeofday(&now, NULL); + timeUsed = sub_time(now, reqp->startTime) / 1000; #endif - /* leave 5 seconds margin for sleep */ - timeLeft = RDRtimeout - timeUsed; + /* leave 5 seconds margin for sleep */ + timeLeft = RDRtimeout - timeUsed; if (errorCode == CM_ERROR_TIMEDOUT && timeLeft > 5 ) { - thrd_Sleep(3000); - cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL); - retry = 1; - } + thrd_Sleep(3000); + cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL); + retry = 1; + } /* if all servers are offline, mark them non-busy and start over */ if (errorCode == CM_ERROR_ALLOFFLINE && timeLeft > 7) { - osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLOFFLINE."); - thrd_Sleep(5000); - /* cm_ForceUpdateVolume marks all servers as non_busy */ - /* No it doesn't and it won't do anything if all of the - * the servers are marked as DOWN. So clear the DOWN - * flag and reset the busy state as well. - */ + osi_Log0(afsd_logp, "cm_Analyze passed CM_ERROR_ALLOFFLINE."); + thrd_Sleep(5000); + /* cm_ForceUpdateVolume marks all servers as non_busy */ + /* No it doesn't and it won't do anything if all of the + * the servers are marked as DOWN. So clear the DOWN + * flag and reset the busy state as well. + */ if (!serversp) { cm_GetServerList(fidp, userp, reqp, &serverspp); serversp = *serverspp; @@ -233,7 +233,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, if (fidp != NULL) /* Not a VLDB call */ cm_ForceUpdateVolume(fidp, userp, reqp); - } + } /* if all servers are busy, mark them non-busy and start over */ if (errorCode == CM_ERROR_ALLBUSY && timeLeft > 7) { @@ -258,127 +258,128 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, /* special codes: VBUSY and VRESTARTING */ if (errorCode == VBUSY || errorCode == VRESTARTING) { - if (!serversp) { - cm_GetServerList(fidp, userp, reqp, &serverspp); - serversp = *serverspp; - free_svr_list = 1; - } - lock_ObtainWrite(&cm_serverLock); - for (tsrp = serversp; tsrp; tsrp=tsrp->next) { - if (tsrp->server == serverp - && tsrp->status == not_busy) { - tsrp->status = busy; - break; - } - } - lock_ReleaseWrite(&cm_serverLock); - if (free_svr_list) { - cm_FreeServerList(&serversp); - *serverspp = serversp; - } - retry = 1; + if (!serversp) { + cm_GetServerList(fidp, userp, reqp, &serverspp); + serversp = *serverspp; + free_svr_list = 1; + } + lock_ObtainWrite(&cm_serverLock); + for (tsrp = serversp; tsrp; tsrp=tsrp->next) { + if (tsrp->server == serverp + && tsrp->status == not_busy) { + tsrp->status = busy; + break; + } + } + lock_ReleaseWrite(&cm_serverLock); + if (free_svr_list) { + cm_FreeServerList(&serversp); + *serverspp = serversp; + } + retry = 1; } /* special codes: missing volumes */ if (errorCode == VNOVOL || errorCode == VMOVED || errorCode == VOFFLINE - || errorCode == VSALVAGE || errorCode == VNOSERVICE) { - /* Log server being offline for this volume */ - osi_Log4(afsd_logp, "cm_Analyze found server %d.%d.%d.%d marked offline for a volume", - ((serverp->addr.sin_addr.s_addr & 0xff)), - ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8), - ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16), - ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24)); - /* Create Event Log message */ - { - HANDLE h; - char *ptbuf[1]; - char s[100]; - h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); - sprintf(s, "cm_Analyze: Server %d.%d.%d.%d reported volume %d as missing.", - ((serverp->addr.sin_addr.s_addr & 0xff)), - ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8), - ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16), - ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24), - fidp->volume); - ptbuf[0] = s; - ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1009, NULL, - 1, 0, ptbuf, NULL); - DeregisterEventSource(h); - } + || errorCode == VSALVAGE || errorCode == VNOSERVICE) + { + /* Log server being offline for this volume */ + osi_Log4(afsd_logp, "cm_Analyze found server %d.%d.%d.%d marked offline for a volume", + ((serverp->addr.sin_addr.s_addr & 0xff)), + ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8), + ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16), + ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24)); + /* Create Event Log message */ + { + HANDLE h; + char *ptbuf[1]; + char s[100]; + h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); + sprintf(s, "cm_Analyze: Server %d.%d.%d.%d reported volume %d as missing.", + ((serverp->addr.sin_addr.s_addr & 0xff)), + ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8), + ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16), + ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24), + fidp->volume); + ptbuf[0] = s; + ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1009, NULL, + 1, 0, ptbuf, NULL); + DeregisterEventSource(h); + } - /* Mark server offline for this volume */ - if (!serversp) { - cm_GetServerList(fidp, userp, reqp, &serverspp); - serversp = *serverspp; - free_svr_list = 1; - } - for (tsrp = serversp; tsrp; tsrp=tsrp->next) { - if (tsrp->server == serverp) - tsrp->status = offline; - } - if (free_svr_list) { - cm_FreeServerList(&serversp); - *serverspp = serversp; - } - if ( timeLeft > 2 ) + /* Mark server offline for this volume */ + if (!serversp) { + cm_GetServerList(fidp, userp, reqp, &serverspp); + serversp = *serverspp; + free_svr_list = 1; + } + for (tsrp = serversp; tsrp; tsrp=tsrp->next) { + if (tsrp->server == serverp) + tsrp->status = offline; + } + if (free_svr_list) { + cm_FreeServerList(&serversp); + *serverspp = serversp; + } + if ( timeLeft > 2 ) retry = 1; } /* RX codes */ if (errorCode == RX_CALL_TIMEOUT) { - /* server took longer than hardDeadTime - * don't mark server as down but don't retry - * this is to prevent the SMB session from timing out - * In addition, we log an event to the event log - */ + /* server took longer than hardDeadTime + * don't mark server as down but don't retry + * this is to prevent the SMB session from timing out + * In addition, we log an event to the event log + */ #ifndef DJGPP - HANDLE h; - char *ptbuf[1]; - char s[100]; - h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); - sprintf(s, "cm_Analyze: HardDeadTime exceeded."); - ptbuf[0] = s; - ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1009, NULL, - 1, 0, ptbuf, NULL); - DeregisterEventSource(h); + HANDLE h; + char *ptbuf[1]; + char s[100]; + h = RegisterEventSource(NULL, AFS_DAEMON_EVENT_NAME); + sprintf(s, "cm_Analyze: HardDeadTime exceeded."); + ptbuf[0] = s; + ReportEvent(h, EVENTLOG_WARNING_TYPE, 0, 1009, NULL, + 1, 0, ptbuf, NULL); + DeregisterEventSource(h); #endif /* !DJGPP */ - retry = 0; - osi_Log0(afsd_logp, "cm_Analyze: hardDeadTime exceeded"); + retry = 0; + osi_Log0(afsd_logp, "cm_Analyze: hardDeadTime exceeded"); } else if (errorCode >= -64 && errorCode < 0) { - /* mark server as down */ - lock_ObtainMutex(&serverp->mx); - serverp->flags |= CM_SERVERFLAG_DOWN; - lock_ReleaseMutex(&serverp->mx); + /* mark server as down */ + lock_ObtainMutex(&serverp->mx); + serverp->flags |= CM_SERVERFLAG_DOWN; + lock_ReleaseMutex(&serverp->mx); if ( timeLeft > 2 ) - retry = 1; - } + retry = 1; + } - if (errorCode == RXKADEXPIRED && !dead_session) { - lock_ObtainMutex(&userp->mx); - ucellp = cm_GetUCell(userp, serverp->cellp); - if (ucellp->ticketp) { - free(ucellp->ticketp); - ucellp->ticketp = NULL; - } - ucellp->flags &= ~CM_UCELLFLAG_RXKAD; - ucellp->gen++; - lock_ReleaseMutex(&userp->mx); - if ( timeLeft > 2 ) - retry = 1; - } + if (errorCode == RXKADEXPIRED && !dead_session) { + lock_ObtainMutex(&userp->mx); + ucellp = cm_GetUCell(userp, serverp->cellp); + if (ucellp->ticketp) { + free(ucellp->ticketp); + ucellp->ticketp = NULL; + } + ucellp->flags &= ~CM_UCELLFLAG_RXKAD; + ucellp->gen++; + lock_ReleaseMutex(&userp->mx); + if ( timeLeft > 2 ) + retry = 1; + } + + if (retry && dead_session) + retry = 0; - if (retry && dead_session) - retry = 0; - -out: - /* drop this on the way out */ - if (connp) - cm_PutConn(connp); + out: + /* drop this on the way out */ + if (connp) + cm_PutConn(connp); - /* retry until we fail to find a connection */ - return retry; + /* retry until we fail to find a connection */ + return retry; } long cm_ConnByMServers(cm_serverRef_t *serversp, cm_user_t *usersp, diff --git a/src/WINNT/afsd/cm_dcache.c b/src/WINNT/afsd/cm_dcache.c index 550fa2278..279f0f6b2 100644 --- a/src/WINNT/afsd/cm_dcache.c +++ b/src/WINNT/afsd/cm_dcache.c @@ -1191,8 +1191,8 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *up, afsStatus.ParentVnode = 0x1; afsStatus.ParentUnique = 0x1; afsStatus.ResidencyMask = 0; - afsStatus.ClientModTime = FakeFreelanceModTime; - afsStatus.ServerModTime = FakeFreelanceModTime; + afsStatus.ClientModTime = (afs_uint32)FakeFreelanceModTime; + afsStatus.ServerModTime = (afs_uint32)FakeFreelanceModTime; afsStatus.Group = 0; afsStatus.SyncCounter = 0; afsStatus.dataVersionHigh = 0; diff --git a/src/WINNT/afsd/cm_freelance.c b/src/WINNT/afsd/cm_freelance.c index 28ee45f8b..a2b8c5f8a 100644 --- a/src/WINNT/afsd/cm_freelance.c +++ b/src/WINNT/afsd/cm_freelance.c @@ -477,8 +477,8 @@ long cm_InitLocalMountPoints() { rootCellName[0] = '.'; code = cm_GetRootCellName(&rootCellName[1]); if (code == 0) { - cm_FreelanceAddMount(&rootCellName[1], &rootCellName[1], "root.cell", 0, NULL); - cm_FreelanceAddMount(rootCellName, &rootCellName[1], "root.cell", 1, NULL); + cm_FreelanceAddMount(&rootCellName[1], &rootCellName[1], "root.cell.", 0, NULL); + cm_FreelanceAddMount(rootCellName, &rootCellName[1], "root.cell.", 1, NULL); dwMountPoints = 2; } } @@ -660,8 +660,8 @@ long cm_InitLocalMountPoints() { rootCellName[0] = '.'; code = cm_GetRootCellName(&rootCellName[1]); if (code == 0) { - cm_FreelanceAddMount(&rootCellName[1], &rootCellName[1], "root.cell", 0, NULL); - cm_FreelanceAddMount(rootCellName, &rootCellName[1], "root.cell", 1, NULL); + cm_FreelanceAddMount(&rootCellName[1], &rootCellName[1], "root.cell.", 0, NULL); + cm_FreelanceAddMount(rootCellName, &rootCellName[1], "root.cell.", 1, NULL); } return 0; } diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index b4d145f60..c73951df7 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -1164,17 +1164,21 @@ long cm_IoctlNewCell(struct smb_ioctl *ioctlp, struct cm_user *userp) long cm_IoctlGetWsCell(smb_ioctl_t *ioctlp, cm_user_t *userp) { - /* if we don't know our default cell, return failure */ - if (cm_rootCellp == NULL) { - return CM_ERROR_NOSUCHCELL; + long code = 0; + + if (cm_freelanceEnabled) { + StringCbCopyA(ioctlp->outDatap, 999999, "Freelance.Local.Root"); + ioctlp->outDatap += strlen(ioctlp->outDatap) +1; + } else if (cm_rootCellp) { + /* return the default cellname to the caller */ + StringCbCopyA(ioctlp->outDatap, 999999, cm_rootCellp->namep); + ioctlp->outDatap += strlen(ioctlp->outDatap) +1; + } else { + /* if we don't know our default cell, return failure */ + code = CM_ERROR_NOSUCHCELL; } - /* return the default cellname to the caller */ - StringCbCopyA(ioctlp->outDatap, 999999, cm_rootCellp->namep); - ioctlp->outDatap += strlen(ioctlp->outDatap) +1; - - /* done: success */ - return 0; + return code; } long cm_IoctlSysName(struct smb_ioctl *ioctlp, struct cm_user *userp) @@ -1561,9 +1565,6 @@ long cm_IoctlSymlink(struct smb_ioctl *ioctlp, struct cm_user *userp) return code; } -extern long cm_AssembleLink(cm_scache_t *linkScp, char *pathSuffixp, - cm_scache_t **newRootScpp, cm_space_t **newSpaceBufferp, - cm_user_t *userp, cm_req_t *reqp); long cm_IoctlListlink(struct smb_ioctl *ioctlp, struct cm_user *userp) { @@ -1607,6 +1608,7 @@ long cm_IoctlListlink(struct smb_ioctl *ioctlp, struct cm_user *userp) cm_FreeSpace(spacep); if (newRootScp != NULL) cm_ReleaseSCache(newRootScp); + code = 0; } return code; @@ -1936,7 +1938,8 @@ long cm_IoctlGetToken(struct smb_ioctl *ioctlp, struct cm_user *userp) /* cell name is right here */ cellp = cm_GetCell(tp, 0); - if (!cellp) return CM_ERROR_NOSUCHCELL; + if (!cellp) + return CM_ERROR_NOSUCHCELL; tp += strlen(tp) + 1; #ifndef DJGPP diff --git a/src/WINNT/afsd/cm_rpc.c b/src/WINNT/afsd/cm_rpc.c index 17845c34f..ad4d2a136 100644 --- a/src/WINNT/afsd/cm_rpc.c +++ b/src/WINNT/afsd/cm_rpc.c @@ -40,15 +40,17 @@ extern void afsi_log(char *pattern, ...); typedef struct tokenEvent { - afs_uuid_t uuid; - char sessionKey[8]; - struct tokenEvent *next; + afs_uuid_t uuid; + char sessionKey[8]; + struct tokenEvent *next; } tokenEvent_t; tokenEvent_t *tokenEvents = NULL; osi_mutex_t tokenEventLock; +EVENT_HANDLE rpc_ShutdownEvent = NULL; + /* * Add a new uuid and session key to the list. */ @@ -56,13 +58,13 @@ void cm_RegisterNewTokenEvent( afs_uuid_t uuid, char sessionKey[8]) { - tokenEvent_t *te = malloc(sizeof(tokenEvent_t)); - te->uuid = uuid; - memcpy(te->sessionKey, sessionKey, sizeof(te->sessionKey)); - lock_ObtainMutex(&tokenEventLock); - te->next = tokenEvents; - tokenEvents = te; - lock_ReleaseMutex(&tokenEventLock); + tokenEvent_t *te = malloc(sizeof(tokenEvent_t)); + te->uuid = uuid; + memcpy(te->sessionKey, sessionKey, sizeof(te->sessionKey)); + lock_ObtainMutex(&tokenEventLock); + te->next = tokenEvents; + tokenEvents = te; + lock_ReleaseMutex(&tokenEventLock); } /* @@ -73,27 +75,27 @@ void cm_RegisterNewTokenEvent( */ BOOL cm_FindTokenEvent(afs_uuid_t uuid, char sessionKey[8]) { - RPC_STATUS status; - tokenEvent_t *te; - tokenEvent_t **ltep; - - lock_ObtainMutex(&tokenEventLock); - te = tokenEvents; - ltep = &tokenEvents; - while (te) { - if (UuidEqual((UUID *)&uuid, (UUID *)&te->uuid, &status)) { - *ltep = te->next; - lock_ReleaseMutex(&tokenEventLock); - memcpy(sessionKey, te->sessionKey, - sizeof(te->sessionKey)); - free(te); - return TRUE; - } - ltep = &te->next; - te = te->next; - } - lock_ReleaseMutex(&tokenEventLock); - return FALSE; + RPC_STATUS status; + tokenEvent_t *te; + tokenEvent_t **ltep; + + lock_ObtainMutex(&tokenEventLock); + te = tokenEvents; + ltep = &tokenEvents; + while (te) { + if (UuidEqual((UUID *)&uuid, (UUID *)&te->uuid, &status)) { + *ltep = te->next; + lock_ReleaseMutex(&tokenEventLock); + memcpy(sessionKey, te->sessionKey, + sizeof(te->sessionKey)); + free(te); + return TRUE; + } + ltep = &te->next; + te = te->next; + } + lock_ReleaseMutex(&tokenEventLock); + return FALSE; } /* @@ -104,117 +106,137 @@ long AFSRPC_SetToken( afs_uuid_t uuid, unsigned char __RPC_FAR sessionKey[8]) { - cm_RegisterNewTokenEvent(uuid, sessionKey); - return 0; + cm_RegisterNewTokenEvent(uuid, sessionKey); + return 0; } long AFSRPC_GetToken( afs_uuid_t uuid, unsigned char __RPC_FAR sessionKey[8]) { - BOOL found; + BOOL found; - found = cm_FindTokenEvent(uuid, sessionKey); - if (!found) - return 1; + found = cm_FindTokenEvent(uuid, sessionKey); + if (!found) + return 1; - return 0; + return 0; } void __RPC_FAR * __RPC_USER midl_user_allocate (size_t cBytes) { - return ((void __RPC_FAR *) malloc(cBytes)); + return ((void __RPC_FAR *) malloc(cBytes)); } void __RPC_USER midl_user_free(void __RPC_FAR * p) { - free(p); + free(p); } void RpcListen() { - RPC_STATUS status; - char *task; - RPC_BINDING_VECTOR *ptrBindingVector = NULL; - BOOLEAN ifaceRegistered = FALSE; - BOOLEAN epRegistered = FALSE; + RPC_STATUS status; + char *task; + RPC_BINDING_VECTOR *ptrBindingVector = NULL; + BOOLEAN ifaceRegistered = FALSE; + BOOLEAN epRegistered = FALSE; #ifdef NOOSIDEBUGSERVER /* Use All Protseqs already done in OSI */ - status = RpcServerUseAllProtseqs(1, NULL); - if (status != RPC_S_OK) { - task = "Use All Protocol Sequences"; - goto cleanup; - } + status = RpcServerUseAllProtseqs(1, NULL); + if (status != RPC_S_OK) { + task = "Use All Protocol Sequences"; + goto cleanup; + } #endif /* NOOSIDEBUGSERVER */ - status = RpcServerRegisterIf(afsrpc_v1_0_s_ifspec, NULL, NULL); - if (status != RPC_S_OK) { - task = "Register Interface"; - goto cleanup; - } - ifaceRegistered = TRUE; - - status = RpcServerInqBindings(&ptrBindingVector); - if (status != RPC_S_OK) { - task = "Inquire Bindings"; - goto cleanup; - } - - status = RpcServerRegisterAuthInfo(NULL, RPC_C_AUTHN_WINNT, NULL, NULL); - if (status != RPC_S_OK) { - task = "Register Authentication Info"; - goto cleanup; - } - - status = RpcEpRegister(afsrpc_v1_0_s_ifspec, ptrBindingVector, - NULL, "AFS session key interface"); - if (status != RPC_S_OK) { - task = "Register Endpoints"; - goto cleanup; - } - epRegistered = TRUE; - - afsi_log("RPC server listening"); - - status = RpcServerListen(OSI_MAXRPCCALLS, OSI_MAXRPCCALLS, 0); - if (status != RPC_S_OK) { - task = "Server Listen"; - } + status = RpcServerRegisterIf(afsrpc_v1_0_s_ifspec, NULL, NULL); + if (status != RPC_S_OK) { + task = "Register Interface"; + goto cleanup; + } + ifaceRegistered = TRUE; + + status = RpcServerInqBindings(&ptrBindingVector); + if (status != RPC_S_OK) { + task = "Inquire Bindings"; + goto cleanup; + } + + status = RpcServerRegisterAuthInfo(NULL, RPC_C_AUTHN_WINNT, NULL, NULL); + if (status != RPC_S_OK) { + task = "Register Authentication Info"; + goto cleanup; + } + + status = RpcEpRegister(afsrpc_v1_0_s_ifspec, ptrBindingVector, + NULL, "AFS session key interface"); + if (status != RPC_S_OK) { + task = "Register Endpoints"; + goto cleanup; + } + epRegistered = TRUE; + + afsi_log("RPC server listening"); + + status = RpcServerListen(OSI_MAXRPCCALLS, OSI_MAXRPCCALLS, 0); + if (status != RPC_S_OK) { + task = "Server Listen"; + } cleanup: - if (epRegistered) - (void) RpcEpUnregister(afsrpc_v1_0_s_ifspec, ptrBindingVector, - NULL); + if (epRegistered) + (void) RpcEpUnregister(afsrpc_v1_0_s_ifspec, ptrBindingVector, + NULL); - if (ptrBindingVector) - (void) RpcBindingVectorFree(&ptrBindingVector); + if (ptrBindingVector) + (void) RpcBindingVectorFree(&ptrBindingVector); - if (ifaceRegistered) - (void) RpcServerUnregisterIf(afsrpc_v1_0_s_ifspec, NULL, FALSE); + if (ifaceRegistered) + (void) RpcServerUnregisterIf(afsrpc_v1_0_s_ifspec, NULL, FALSE); - if (status != RPC_S_OK) - afsi_log("RPC problem, code %d for %s", status, task); + if (status != RPC_S_OK) + afsi_log("RPC problem, code %d for %s", status, task); + else + afsi_log("RPC shutdown"); - return; + if (rpc_ShutdownEvent != NULL) + thrd_SetEvent(rpc_ShutdownEvent); + return; } long RpcInit() { - LONG status = ERROR_SUCCESS; - HANDLE listenThread; - ULONG listenThreadID = 0; + LONG status = ERROR_SUCCESS; + HANDLE listenThread; + ULONG listenThreadID = 0; + char * name = "afsd_rpc_ShutdownEvent"; + + lock_InitializeMutex(&tokenEventLock, "token event lock"); - lock_InitializeMutex(&tokenEventLock, "token event lock"); + rpc_ShutdownEvent = thrd_CreateEvent(NULL, FALSE, FALSE, name); + if ( GetLastError() == ERROR_ALREADY_EXISTS ) + afsi_log("Event Object Already Exists: %s", name); - listenThread = CreateThread(NULL, 0, (PTHREAD_START_ROUTINE)RpcListen, - 0, 0, &listenThreadID); + listenThread = CreateThread(NULL, 0, (PTHREAD_START_ROUTINE)RpcListen, + 0, 0, &listenThreadID); - if (listenThread == NULL) { - status = GetLastError(); - } - CloseHandle(listenThread); + if (listenThread == NULL) { + status = GetLastError(); + } + CloseHandle(listenThread); - return status; + return status; } + +void RpcShutdown(void) +{ + RpcMgmtStopServerListening(NULL); + + if (rpc_ShutdownEvent != NULL) { + thrd_WaitForSingleObject_Event(rpc_ShutdownEvent, INFINITE); + CloseHandle(rpc_ShutdownEvent); + } +} + diff --git a/src/WINNT/afsd/cm_rpc.h b/src/WINNT/afsd/cm_rpc.h index beba2e3d7..8571ad782 100644 --- a/src/WINNT/afsd/cm_rpc.h +++ b/src/WINNT/afsd/cm_rpc.h @@ -19,6 +19,6 @@ void cm_RegisterNewTokenEvent(afs_uuid_t uuid, char sessionKey[8]); BOOL cm_FindTokenEvent(afs_uuid_t uuid, char sessionKey[8]); -extern long RpcInit(); - +extern long RpcInit(void); +extern void RpcShutdown(void); #endif /* __CM_RPC_H__ */ diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index 41577dcc8..0442af527 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -344,7 +344,7 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp, scp->parentUnique = 0x1; scp->parentVnode=0x1; scp->group=0; - scp->dataVersion=0x8; + scp->dataVersion=cm_fakeDirVersion; *outScpp = scp; lock_ReleaseWrite(&cm_scacheLock); /*afsi_log(" getscache done");*/ @@ -853,8 +853,8 @@ void cm_MergeStatus(cm_scache_t *scp, AFSFetchStatus *statusp, AFSVolSync *volp, statusp->ParentVnode = 0x1; statusp->ParentUnique = 0x1; statusp->ResidencyMask = 0; - statusp->ClientModTime = FakeFreelanceModTime; - statusp->ServerModTime = FakeFreelanceModTime; + statusp->ClientModTime = (afs_uint32)FakeFreelanceModTime; + statusp->ServerModTime = (afs_uint32)FakeFreelanceModTime; statusp->Group = 0; statusp->SyncCounter = 0; statusp->dataVersionHigh = 0; @@ -982,7 +982,7 @@ void cm_AFSFidFromFid(AFSFid *afsFidp, cm_fid_t *fidp) void cm_HoldSCacheNoLock(cm_scache_t *scp) { #ifdef NOLOCK_ASSERT - osi_assert(scp->refCount > 0); + osi_assert(scp->refCount >= 0); #endif scp->refCount++; } @@ -990,7 +990,7 @@ void cm_HoldSCacheNoLock(cm_scache_t *scp) void cm_HoldSCache(cm_scache_t *scp) { lock_ObtainWrite(&cm_scacheLock); - osi_assert(scp->refCount > 0); + osi_assert(scp->refCount >= 0); scp->refCount++; lock_ReleaseWrite(&cm_scacheLock); } diff --git a/src/WINNT/afsd/cm_vnodeops.c b/src/WINNT/afsd/cm_vnodeops.c index af8e7f6aa..0876597c1 100644 --- a/src/WINNT/afsd/cm_vnodeops.c +++ b/src/WINNT/afsd/cm_vnodeops.c @@ -995,8 +995,19 @@ long cm_LookupInternal(cm_scache_t *dscp, char *namep, long flags, cm_user_t *us * that we stopped early, probably because we found the entry we're * looking for. Any other non-zero code is an error. */ - if (code && code != CM_ERROR_STOPNOW) + if (code && code != CM_ERROR_STOPNOW) { + /* if the cm_scache_t we are searching in is not a directory + * we must return path not found because the error + * is to describe the final component not an intermediary + */ + if (code == CM_ERROR_NOTDIR) { + if (flags & CM_FLAG_CHECKPATH) + return CM_ERROR_NOSUCHPATH; + else + return CM_ERROR_NOSUCHFILE; + } return code; + } getroot = (dscp==cm_rootSCachep) ; if (!rock.found) { @@ -1420,7 +1431,10 @@ long cm_NameI(cm_scache_t *rootSCachep, char *pathp, long flags, cm_ReleaseSCache(tscp); if (psp) cm_FreeSpace(psp); - return code; + if (code == CM_ERROR_NOSUCHFILE && tscp->fileType == CM_SCACHETYPE_SYMLINK) + return CM_ERROR_NOSUCHPATH; + else + return code; } haveComponent = 0; /* component done */ dirScp = tscp; /* for some symlinks */ diff --git a/src/WINNT/afsd/fs.c b/src/WINNT/afsd/fs.c index 1f3630eec..b2d7e4f79 100644 --- a/src/WINNT/afsd/fs.c +++ b/src/WINNT/afsd/fs.c @@ -18,10 +18,13 @@ #include #include #include +#include #include #include #include +#include +#include #include "fs.h" #include "fs_utils.h" @@ -31,10 +34,13 @@ #define MAXHOSTS 13 #define OMAXHOSTS 8 +#define MAXCELLHOSTS 8 #define MAXNAME 100 #define MAXSIZE 2048 #define MAXINSIZE 1300 /* pioctl complains if data is larger than this */ #define VMSGSIZE 128 /* size of msg buf in volume hdr */ +#define MAXCELLCHARS 64 +#define MAXHOSTCHARS 64 static char space[MAXSIZE]; static char tspace[1024]; @@ -43,28 +49,30 @@ static char tspace[1024]; static struct ubik_client *uclient; #endif /* not WIN32 */ -static MemDumpCmd(struct cmd_syndesc *asp); -static CSCPolicyCmd(struct cmd_syndesc *asp); +static int GetClientAddrsCmd(struct cmd_syndesc *asp, char *arock); +static int SetClientAddrsCmd(struct cmd_syndesc *asp, char *arock); +static int FlushMountCmd(struct cmd_syndesc *asp, char *arock); +static int RxStatProcCmd(struct cmd_syndesc *asp, char *arock); +static int RxStatPeerCmd(struct cmd_syndesc *asp, char *arock); + +extern struct cmd_syndesc *cmd_CreateSyntax(); + +static int MemDumpCmd(struct cmd_syndesc *asp, char *arock); +static int CSCPolicyCmd(struct cmd_syndesc *asp, char *arock); extern afs_int32 VL_GetEntryByNameO(); static char pn[] = "fs"; static int rxInitDone = 0; -static GetCellName(); - -#define MAXCELLCHARS 64 -#define MAXHOSTCHARS 64 -#define MAXHOSTSPERCELL 8 - struct afsconf_cell { - char name[MAXCELLCHARS]; - short numServers; - short flags; - struct sockaddr_in hostAddr[MAXHOSTSPERCELL]; - char hostName[MAXHOSTSPERCELL][MAXHOSTCHARS]; - char *linkedCell; -}; + char name[MAXCELLCHARS]; + short numServers; + short flags; + struct sockaddr_in hostAddr[MAXCELLHOSTS]; + char hostName[MAXCELLHOSTS][MAXHOSTCHARS]; + char *linkedCell; +}; /* @@ -76,9 +84,9 @@ struct afsconf_cell { typedef char sec_rgy_name_t[1025]; /* A DCE definition */ struct Acl { - int dfs; /* Originally true if a dfs acl; now also the type - of the acl (1, 2, or 3, corresponding to object, - initial dir, or initial object). */ + int dfs; /* Originally true if a dfs acl; now also the type + * of the acl (1, 2, or 3, corresponding to object, + * initial dir, or initial object). */ sec_rgy_name_t cell; /* DFS cell name */ int nplus; int nminus; @@ -92,27 +100,17 @@ struct AclEntry { afs_int32 rights; }; -void ZapAcl (acl) - struct Acl *acl; { +static void +ZapAcl (struct Acl *acl) +{ + if (!acl) + return; + ZapList(acl->pluslist); ZapList(acl->minuslist); free(acl); } -foldcmp (a, b) - register char *a; - register char *b; { - register char t, u; - while (1) { - t = *a++; - u = *b++; - if (t >= 'A' && t <= 'Z') t += 0x20; - if (u >= 'A' && u <= 'Z') u += 0x20; - if (t != u) return 1; - if (t == 0) return 0; - } -} - /* * Mods for the AFS/DFS protocol translator. * @@ -144,15 +142,15 @@ foldcmp (a, b) * Offset of -id switch in command structure for various commands. * The -if switch is the next switch always. */ -int parm_setacl_id, parm_copyacl_id, parm_listacl_id; +static int parm_setacl_id, parm_copyacl_id, parm_listacl_id; /* * Determine whether either the -id or -if switches are present, and * return 0, 1 or 2, as appropriate. Abort if both switches are present. */ -int getidf(as, id) - struct cmd_syndesc *as; - int id; /* Offset of -id switch; -if is next switch */ +/* int id; Offset of -id switch; -if is next switch */ +static int +getidf(struct cmd_syndesc *as, int id) { int idf = 0; @@ -163,8 +161,7 @@ int getidf(as, id) idf |= 2; } if (idf == 3) { - fprintf - (stderr, + fprintf(stderr, "%s: you may specify either -id or -if, but not both switches\n", pn); exit(1); @@ -172,50 +169,93 @@ int getidf(as, id) return idf; } -void PRights (arights, dfs) - register afs_int32 arights; - int dfs; +static int +PRights(afs_int32 arights, int dfs) { if (!dfs) { - if (arights & PRSFS_READ) printf("r"); - if (arights & PRSFS_LOOKUP) printf("l"); - if (arights & PRSFS_INSERT) printf("i"); - if (arights & PRSFS_DELETE) printf("d"); - if (arights & PRSFS_WRITE) printf("w"); - if (arights & PRSFS_LOCK) printf("k"); - if (arights & PRSFS_ADMINISTER) printf("a"); - if (arights & PRSFS_USR0) printf("A"); - if (arights & PRSFS_USR1) printf("B"); - if (arights & PRSFS_USR2) printf("C"); - if (arights & PRSFS_USR3) printf("D"); - if (arights & PRSFS_USR4) printf("E"); - if (arights & PRSFS_USR5) printf("F"); - if (arights & PRSFS_USR6) printf("G"); - if (arights & PRSFS_USR7) printf("H"); + if (arights & PRSFS_READ) + printf("r"); + if (arights & PRSFS_LOOKUP) + printf("l"); + if (arights & PRSFS_INSERT) + printf("i"); + if (arights & PRSFS_DELETE) + printf("d"); + if (arights & PRSFS_WRITE) + printf("w"); + if (arights & PRSFS_LOCK) + printf("k"); + if (arights & PRSFS_ADMINISTER) + printf("a"); + if (arights & PRSFS_USR0) + printf("A"); + if (arights & PRSFS_USR1) + printf("B"); + if (arights & PRSFS_USR2) + printf("C"); + if (arights & PRSFS_USR3) + printf("D"); + if (arights & PRSFS_USR4) + printf("E"); + if (arights & PRSFS_USR5) + printf("F"); + if (arights & PRSFS_USR6) + printf("G"); + if (arights & PRSFS_USR7) + printf("H"); } else { - if (arights & DFS_READ) printf("r"); else printf("-"); - if (arights & DFS_WRITE) printf("w"); else printf("-"); - if (arights & DFS_EXECUTE) printf("x"); else printf("-"); - if (arights & DFS_CONTROL) printf("c"); else printf("-"); - if (arights & DFS_INSERT) printf("i"); else printf("-"); - if (arights & DFS_DELETE) printf("d"); else printf("-"); - if (arights & (DFS_USRALL)) printf("+"); - if (arights & DFS_USR0) printf("A"); - if (arights & DFS_USR1) printf("B"); - if (arights & DFS_USR2) printf("C"); - if (arights & DFS_USR3) printf("D"); - if (arights & DFS_USR4) printf("E"); - if (arights & DFS_USR5) printf("F"); - if (arights & DFS_USR6) printf("G"); - if (arights & DFS_USR7) printf("H"); + if (arights & DFS_READ) + printf("r"); + else + printf("-"); + if (arights & DFS_WRITE) + printf("w"); + else + printf("-"); + if (arights & DFS_EXECUTE) + printf("x"); + else + printf("-"); + if (arights & DFS_CONTROL) + printf("c"); + else + printf("-"); + if (arights & DFS_INSERT) + printf("i"); + else + printf("-"); + if (arights & DFS_DELETE) + printf("d"); + else + printf("-"); + if (arights & (DFS_USRALL)) + printf("+"); + if (arights & DFS_USR0) + printf("A"); + if (arights & DFS_USR1) + printf("B"); + if (arights & DFS_USR2) + printf("C"); + if (arights & DFS_USR3) + printf("D"); + if (arights & DFS_USR4) + printf("E"); + if (arights & DFS_USR5) + printf("F"); + if (arights & DFS_USR6) + printf("G"); + if (arights & DFS_USR7) + printf("H"); } + return 0; } /* this function returns TRUE (1) if the file is in AFS, otherwise false (0) */ -static int InAFS(apath) -register char *apath; { +static int +InAFS(char *apath) +{ struct ViceIoctl blob; - register afs_int32 code; + afs_int32 code; blob.in_size = 0; blob.out_size = MAXSIZE; @@ -223,15 +263,17 @@ register char *apath; { code = pioctl(apath, VIOC_FILE_CELL_NAME, &blob, 1); if (code) { - if ((errno == EINVAL) || (errno == ENOENT)) return 0; + if ((errno == EINVAL) || (errno == ENOENT)) + return 0; } return 1; } /* return a static pointer to a buffer */ -static char *Parent(apath) -char *apath; { - register char *tp; +static char * +Parent(char *apath) +{ + char *tp; strcpy(tspace, apath); tp = strrchr(tspace, '\\'); if (tp) { @@ -246,14 +288,12 @@ char *apath; { enum rtype {add, destroy, deny}; -afs_int32 Convert(arights, dfs, rtypep) - register char *arights; - int dfs; - enum rtype *rtypep; +static afs_int32 +Convert(char *arights, int dfs, enum rtype *rtypep) { - register int i, len; + int i, len; afs_int32 mode; - register char tc; + char tc; *rtypep = add; /* add rights, by default */ @@ -262,14 +302,25 @@ afs_int32 Convert(arights, dfs, rtypep) *rtypep = deny; return 0; } - if (!strcmp(arights,"read")) return DFS_READ | DFS_EXECUTE; - if (!strcmp(arights, "write")) return DFS_READ | DFS_EXECUTE | DFS_INSERT | DFS_DELETE | DFS_WRITE; - if (!strcmp(arights, "all")) return DFS_READ | DFS_EXECUTE | DFS_INSERT | DFS_DELETE | DFS_WRITE | DFS_CONTROL; + if (!strcmp(arights,"read")) + return DFS_READ | DFS_EXECUTE; + if (!strcmp(arights, "write")) + return DFS_READ | DFS_EXECUTE | DFS_INSERT | DFS_DELETE | + DFS_WRITE; + if (!strcmp(arights, "all")) + return DFS_READ | DFS_EXECUTE | DFS_INSERT | DFS_DELETE | + DFS_WRITE | DFS_CONTROL; } else { - if (!strcmp(arights,"read")) return PRSFS_READ | PRSFS_LOOKUP; - if (!strcmp(arights, "write")) return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK; - if (!strcmp(arights, "mail")) return PRSFS_INSERT | PRSFS_LOCK | PRSFS_LOOKUP; - if (!strcmp(arights, "all")) return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK | PRSFS_ADMINISTER; + if (!strcmp(arights,"read")) + return PRSFS_READ | PRSFS_LOOKUP; + if (!strcmp(arights, "write")) + return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | + PRSFS_WRITE | PRSFS_LOCK; + if (!strcmp(arights, "mail")) + return PRSFS_INSERT | PRSFS_LOCK | PRSFS_LOOKUP; + if (!strcmp(arights, "all")) + return PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE | + PRSFS_WRITE | PRSFS_LOCK | PRSFS_ADMINISTER; } if (!strcmp(arights, "none")) { *rtypep = destroy; /* Remove entire entry */ @@ -280,43 +331,75 @@ afs_int32 Convert(arights, dfs, rtypep) for(i=0;iname, aname)) return alist; + if (!strcasecmp(alist->name, aname)) + return alist; alist = alist->next; } return 0; } /* if no parm specified in a particular slot, set parm to be "." instead */ -static void SetDotDefault(aitemp) -struct cmd_item **aitemp; { - register struct cmd_item *ti; - if (*aitemp) return; /* already has value */ +static void +SetDotDefault(struct cmd_item **aitemp) +{ + struct cmd_item *ti; + if (*aitemp) + return; /* already has value */ /* otherwise, allocate an item representing "." */ ti = (struct cmd_item *) malloc(sizeof(struct cmd_item)); + assert(ti); ti->next = (struct cmd_item *) 0; ti->data = (char *) malloc(2); + assert(ti->data); strcpy(ti->data, "."); *aitemp = ti; } -void ChangeList (al, plus, aname, arights) - struct Acl *al; - char *aname; - afs_int32 arights, plus; { +static void +ChangeList (struct Acl *al, afs_int32 plus, char *aname, afs_int32 arights) +{ struct AclEntry *tlist; tlist = (plus ? al->pluslist : al->minuslist); tlist = FindList (tlist, aname); @@ -365,6 +452,7 @@ void ChangeList (al, plus, aname, arights) } /* Otherwise we make a new item and plug in the new data. */ tlist = (struct AclEntry *) malloc(sizeof (struct AclEntry)); + assert(tlist); strcpy(tlist->name, aname); tlist->rights = arights; if (plus) { @@ -373,27 +461,27 @@ void ChangeList (al, plus, aname, arights) al->nplus++; if (arights == 0 || arights == -1) al->nplus -= PruneList(&al->pluslist, al->dfs); - } - else { + } else { tlist->next = al->minuslist; al->minuslist = tlist; al->nminus++; - if (arights == 0) al->nminus -= PruneList(&al->minuslist, al->dfs); + if (arights == 0) + al->nminus -= PruneList(&al->minuslist, al->dfs); } } -void ZapList (alist) - struct AclEntry *alist; { - register struct AclEntry *tp, *np; +static void +ZapList (struct AclEntry *alist) +{ + struct AclEntry *tp, *np; for (tp = alist; tp; tp = np) { np = tp->next; free(tp); } } -int PruneList (ae, dfs) - struct AclEntry **ae; - int dfs; +static int +PruneList (struct AclEntry **ae, int dfs) { struct AclEntry **lp; struct AclEntry *te, *ne; @@ -406,8 +494,7 @@ int PruneList (ae, dfs) ne = te->next; free(te); ctr++; - } - else { + } else { ne = te->next; lp = &te->next; } @@ -415,9 +502,11 @@ int PruneList (ae, dfs) return ctr; } -char *SkipLine (astr) - register char *astr; { - while (*astr !='\n') astr++; +static char * +SkipLine (char *astr) +{ + while (*astr !='\n') + astr++; astr++; return astr; } @@ -429,13 +518,14 @@ char *SkipLine (astr) * assume that the acl is AFS: for DFS, the user can always resort to * acl_edit, but for AFS there may be no other way out). */ -struct Acl *EmptyAcl(astr) - char *astr; +static struct Acl * +EmptyAcl(char *astr) { - register struct Acl *tp; + struct Acl *tp; int junk; tp = (struct Acl *)malloc(sizeof (struct Acl)); + assert(tp); tp->nplus = tp->nminus = 0; tp->pluslist = tp->minuslist = 0; tp->dfs = 0; @@ -443,14 +533,16 @@ struct Acl *EmptyAcl(astr) return tp; } -struct Acl *ParseAcl (astr) - char *astr; { +static struct Acl * +ParseAcl (char *astr) +{ int nplus, nminus, i, trights; char tname[MAXNAME]; struct AclEntry *first, *last, *tl; struct Acl *ta; ta = (struct Acl *) malloc (sizeof (struct Acl)); + assert(ta); ta->dfs = 0; sscanf(astr, "%d dfs:%d %s", &ta->nplus, &ta->dfs, ta->cell); astr = SkipLine(astr); @@ -466,11 +558,14 @@ struct Acl *ParseAcl (astr) sscanf(astr, "%100s %d", tname, &trights); astr = SkipLine(astr); tl = (struct AclEntry *) malloc(sizeof (struct AclEntry)); - if (!first) first = tl; + assert(tl); + if (!first) + first = tl; strcpy(tl->name, tname); tl->rights = trights; tl->next = 0; - if (last) last->next = tl; + if (last) + last->next = tl; last = tl; } ta->pluslist = first; @@ -481,11 +576,14 @@ struct Acl *ParseAcl (astr) sscanf(astr, "%100s %d", tname, &trights); astr = SkipLine(astr); tl = (struct AclEntry *) malloc(sizeof (struct AclEntry)); - if (!first) first = tl; + assert(tl); + if (!first) + first = tl; strcpy(tl->name, tname); tl->rights = trights; tl->next = 0; - if (last) last->next = tl; + if (last) + last->next = tl; last = tl; } ta->minuslist = first; @@ -493,26 +591,28 @@ struct Acl *ParseAcl (astr) return ta; } -void PrintStatus(status, name, motd, offmsg) - VolumeStatus *status; - char *name; - char *motd; - char *offmsg; { +static int +PrintStatus(VolumeStatus *status, char *name, char *motd, char *offmsg) +{ printf("Volume status for vid = %u named %s\n",status->Vid, name); if (*offmsg != 0) printf("Current offline message is %s\n",offmsg); if (*motd != 0) printf("Current message of the day is %s\n",motd); printf("Current disk quota is "); - if (status->MaxQuota != 0) printf("%d\n", status->MaxQuota); - else printf("unlimited\n"); + if (status->MaxQuota != 0) + printf("%d\n", status->MaxQuota); + else + printf("unlimited\n"); printf("Current blocks used are %d\n",status->BlocksInUse); - printf("The partition has %d blocks available out of %d\n\n",status->PartBlocksAvail, status->PartMaxBlocks); + printf("The partition has %d blocks available out of %d\n\n", + status->PartBlocksAvail, status->PartMaxBlocks); + return 0; } -void QuickPrintStatus(status, name) -VolumeStatus *status; -char *name; { +static int +QuickPrintStatus(VolumeStatus *status, char *name) +{ double QuotaUsed =0.0; double PartUsed =0.0; int WARN = 0; @@ -527,23 +627,24 @@ char *name; { if (QuotaUsed > 90.0){ printf(" %5.0f%%<<", QuotaUsed); WARN = 1; - } - else printf(" %5.0f%% ", QuotaUsed); + } else + printf(" %5.0f%% ", QuotaUsed); PartUsed = (100.0 - ((((double)status->PartBlocksAvail)/status->PartMaxBlocks) * 100.0)); if (PartUsed > 97.0){ printf(" %9.0f%%<<", PartUsed); WARN = 1; - } - else printf(" %9.0f%% ", PartUsed); + } else + printf(" %9.0f%% ", PartUsed); if (WARN){ - printf("\t< 90.0){ printf(" %4.0f%%<<", PartUsed); WARN = 1; - } - else printf(" %4.0f%% ", PartUsed); + } else + printf(" %4.0f%% ", PartUsed); if (WARN){ - printf("\t<dfs) sprintf(dfsstring, " dfs:%d %s", acl->dfs, acl->cell); - else dfsstring[0] = '\0'; + if (acl->dfs) + sprintf(dfsstring, " dfs:%d %s", acl->dfs, acl->cell); + else + dfsstring[0] = '\0'; sprintf(mydata, "%d%s\n%d\n", acl->nplus, dfsstring, acl->nminus); - for(tp = acl->pluslist;tp;tp=tp->next) { + for (tp = acl->pluslist;tp;tp=tp->next) { sprintf(tstring, "%s %d\n", tp->name, tp->rights); strcat(mydata, tstring); } - for(tp = acl->minuslist;tp;tp=tp->next) { + for (tp = acl->minuslist;tp;tp=tp->next) { sprintf(tstring, "%s %d\n", tp->name, tp->rights); strcat(mydata, tstring); } @@ -631,7 +736,9 @@ BOOL IsAdmin (void) } psidAdmin = (PSID)malloc(dwSize); memset(psidAdmin,0,dwSize); + assert(psidAdmin); pszRefDomain = (char *)malloc(dwSize2); + assert(pszRefDomain); if (!LookupAccountName(NULL, pszAdminGroup, psidAdmin, &dwSize, pszRefDomain, &dwSize2, &snu)) { /* We can't lookup the group now even though we looked it up earlier. @@ -655,6 +762,7 @@ BOOL IsAdmin (void) GetTokenInformation (hToken, TokenGroups, NULL, dwSize, &dwSize); pGroups = (PTOKEN_GROUPS)malloc(dwSize); + assert(pGroups); /* Allocate that buffer, and read in the list of groups. */ if (GetTokenInformation (hToken, TokenGroups, pGroups, dwSize, &dwSize)) @@ -687,6 +795,7 @@ BOOL IsAdmin (void) GetTokenInformation(hToken, TokenUser, NULL, 0, &dwSize); pTokenUser = (PTOKEN_USER)malloc(dwSize); + assert(pTokenUser); if (!GetTokenInformation(hToken, TokenUser, pTokenUser, dwSize, &dwSize)) gle = GetLastError(); @@ -718,19 +827,24 @@ BOOL IsAdmin (void) return fAdmin; } -static SetACLCmd(as) -struct cmd_syndesc *as; { - register afs_int32 code; +static int +SetACLCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - struct Acl *ta; - register struct cmd_item *ti, *ui; + struct Acl *ta = 0; + struct cmd_item *ti, *ui; int plusp; afs_int32 rights; int clear; int idf = getidf(as, parm_setacl_id); - if (as->parms[2].items) clear=1; - else clear=0; + int error = 0; + + if (as->parms[2].items) + clear = 1; + else + clear = 0; plusp = !(as->parms[3].items); for(ti=as->parms[0].items; ti;ti=ti->next) { blob.out_size = MAXSIZE; @@ -739,34 +853,47 @@ struct cmd_syndesc *as; { code = pioctl(ti->data, VIOCGETAL, &blob, 1); if (code) { Die(errno, ti->data); - return 1; + error = 1; + continue; } + if (ta) + ZapAcl(ta); ta = ParseAcl(space); if (!plusp && ta->dfs) { fprintf(stderr, "fs: %s: you may not use the -negative switch with DFS acl's.\n%s", ti->data, "(you may specify \"null\" to revoke all rights, however)\n"); - return 1; + error = 1; + continue; } - if (clear) ta = EmptyAcl(space); - else ta = ParseAcl(space); - CleanAcl(ta); + if (ta) + ZapAcl(ta); + if (clear) + ta = EmptyAcl(space); + else + ta = ParseAcl(space); + CleanAcl(ta, ti->data); for(ui=as->parms[1].items; ui; ui=ui->next->next) { enum rtype rtype; if (!ui->next) { - fprintf(stderr,"%s: Missing second half of user/access pair.\n", pn); + fprintf(stderr, + "%s: Missing second half of user/access pair.\n", pn); + ZapAcl(ta); return 1; } rights = Convert(ui->next->data, ta->dfs, &rtype); if (rtype == destroy && !ta->dfs) { - if (!FindList(ta->pluslist, ui->data)) { - fprintf(stderr,"%s: Invalid arg (%s doesn't exist in the current acl)\n", pn, ui->data); - return 1; - } + struct AclEntry *tlist; + + tlist = (plusp ? ta->pluslist : ta->minuslist); + if (!FindList(tlist, ui->data)) + continue; } - if (rtype == deny && !ta->dfs) plusp = 0; - if (rtype == destroy && ta->dfs) rights = -1; + if (rtype == deny && !ta->dfs) + plusp = 0; + if (rtype == destroy && ta->dfs) + rights = -1; ChangeList(ta, plusp, ui->data, rights); } blob.in = AclToString(ta); @@ -810,35 +937,42 @@ struct cmd_syndesc *as; { " (You may inhibit this message by setting \"FS_EXPERT\" in your environment)\n"); } } else { - fprintf(stderr,"%s: Invalid argument, possible reasons include:\n", pn); + fprintf(stderr, + "%s: Invalid argument, possible reasons include:\n", + pn); fprintf(stderr,"\t-File not in AFS\n"); - fprintf(stderr,"\t-Too many users on access control list\n"); - fprintf(stderr,"\t-Tried to add non-existent user to access control list\n"); + fprintf(stderr, + "\t-Too many users on access control list\n"); + fprintf(stderr, + "\t-Tried to add non-existent user to access control list\n"); } - return 1; - } - else { + } else { Die(errno, ti->data); - continue; - } - } + } + error = 1; + } } - return 0; + if (ta) + ZapAcl(ta); + return error; } - -static CopyACLCmd(as) -struct cmd_syndesc *as; { - register afs_int32 code; +static int +CopyACLCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - struct Acl *fa, *ta; + struct Acl *fa, *ta = 0; struct AclEntry *tp; - register struct cmd_item *ti; + struct cmd_item *ti; int clear; int idf = getidf(as, parm_copyacl_id); + int error = 0; - if (as->parms[2].items) clear=1; - else clear=0; + if (as->parms[2].items) + clear=1; + else + clear=0; blob.out_size = MAXSIZE; blob.in_size = idf; blob.in = blob.out = space; @@ -848,7 +982,7 @@ struct cmd_syndesc *as; { return 1; } fa = ParseAcl(space); - CleanAcl(fa); + CleanAcl(fa, as->parms[0].items->data); for (ti=as->parms[1].items; ti;ti=ti->next) { blob.out_size = MAXSIZE; blob.in_size = idf; @@ -856,19 +990,30 @@ struct cmd_syndesc *as; { code = pioctl(ti->data, VIOCGETAL, &blob, 1); if (code) { Die(errno, ti->data); - return 1; + error = 1; + continue; } - if (clear) ta = EmptyAcl(space); - else ta = ParseAcl(space); - CleanAcl(ta); + if (ta) + ZapAcl(ta); + if (clear) + ta = EmptyAcl(space); + else + ta = ParseAcl(space); + CleanAcl(ta, ti->data); if (ta->dfs != fa->dfs) { - fprintf(stderr, "fs: incompatible file system types: acl not copied to %s; aborted\n", ti->data); - goto next; + fprintf(stderr, + "%s: incompatible file system types: acl not copied to %s; aborted\n", + pn, ti->data); + error = 1; + continue; } if (ta->dfs) { if (! clear && strcmp(ta->cell, fa->cell) != 0) { - fprintf(stderr, "fs: default DCE cell differs for file %s: use \"-clear\" switch; acl not merged\n", ti->data); - goto next; + fprintf(stderr, + "%s: default DCE cell differs for file %s: use \"-clear\" switch; acl not merged\n", + pn, ti->data); + error = 1; + continue; } strcpy(ta->cell, fa->cell); } @@ -882,40 +1027,73 @@ struct cmd_syndesc *as; { code = pioctl(ti->data, VIOCSETAL, &blob, 1); if (code) { if (errno == EINVAL) { - fprintf(stderr,"%s: Invalid argument, possible reasons include:\n", pn); + fprintf(stderr, + "%s: Invalid argument, possible reasons include:\n", pn); fprintf(stderr,"\t-File not in AFS\n"); - return 1; - } - else { + } else { Die(errno, ti->data); - goto next; } + error = 1; } - next: + } + if (ta) ZapAcl(ta); - } - return 0; + ZapAcl(fa); + return error; } +/* pioctl() call to get the cellname of a pathname */ +static afs_int32 +GetCell(char *fname, char *cellname) +{ + afs_int32 code; + struct ViceIoctl blob; + + blob.in_size = 0; + blob.out_size = MAXCELLCHARS; + blob.out = cellname; + + code = pioctl(fname, VIOC_FILE_CELL_NAME, &blob, 1); + return code ? errno : 0; +} +/* Check if a username is valid: If it contains only digits (or a + * negative sign), then it might be bad. We then query the ptserver + * to see. + */ +static int +BadName(char *aname, char *fname) +{ + afs_int32 tc, code, id; + char *nm; + char cell[MAXCELLCHARS]; -/* tell if a name is 23 or -45 (digits or minus digits), which are bad names we must prune */ -static BadName(aname) -register char *aname; { - register int tc; - while(tc = *aname++) { + for ( nm = aname; tc = *nm; nm++) { /* all must be '-' or digit to be bad */ - if (tc != '-' && (tc < '0' || tc > '9')) return 0; + if (tc != '-' && (tc < '0' || tc > '9')) + return 0; } - return 1; + + /* Go to the PRDB and see if this all number username is valid */ + code = GetCell(fname, cell); + if (code) + return 0; + + pr_Initialize(1, AFSDIR_CLIENT_ETC_DIRPATH, cell); + code = pr_SNameToId(aname, &id); + pr_End(); + + /* 1=>Not-valid; 0=>Valid */ + return ((!code && (id == ANONYMOUSID)) ? 1 : 0); } /* clean up an access control list of its bad entries; return 1 if we made any changes to the list, and 0 otherwise */ -int CleanAcl(aa) -struct Acl *aa; { - register struct AclEntry *te, **le, *ne; +static int +CleanAcl(struct Acl *aa, char *fname) +{ + struct AclEntry *te, **le, *ne; int changes; /* Don't correct DFS ACL's for now */ @@ -927,28 +1105,26 @@ struct Acl *aa; { le = &aa->pluslist; for(te = aa->pluslist; te; te=ne) { ne = te->next; - if (BadName(te->name)) { + if (BadName(te->name, fname)) { /* zap this dude */ *le = te->next; aa->nplus--; free(te); changes++; - } - else { + } else { le = &te->next; } } le = &aa->minuslist; for(te = aa->minuslist; te; te=ne) { ne = te->next; - if (BadName(te->name)) { + if (BadName(te->name, fname)) { /* zap this dude */ *le = te->next; aa->nminus--; free(te); changes++; - } - else { + } else { le = &te->next; } } @@ -957,14 +1133,16 @@ struct Acl *aa; { /* clean up an acl to not have bogus entries */ -static CleanACLCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; - register struct Acl *ta; +static int +CleanACLCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; + struct Acl *ta = 0; struct ViceIoctl blob; int changes; - register struct cmd_item *ti; - register struct AclEntry *te; + struct cmd_item *ti; + struct AclEntry *te; + int error = 0; SetDotDefault(&as->parms[0].items); for(ti=as->parms[0].items; ti; ti=ti->next) { @@ -974,18 +1152,22 @@ register struct cmd_syndesc *as; { code = pioctl(ti->data, VIOCGETAL, &blob, 1); if (code) { Die(errno, ti->data); + error = 1; continue; } + if (ta) + ZapAcl(ta); ta = ParseAcl(space); if (ta->dfs) { fprintf(stderr, "%s: cleanacl is not supported for DFS access lists.\n", pn); - return 1; + error = 1; + continue; } - changes = CleanAcl(ta); + changes = CleanAcl(ta, ti->data); if (changes) { /* now set the acl */ @@ -995,21 +1177,25 @@ register struct cmd_syndesc *as; { code = pioctl(ti->data, VIOCSETAL, &blob, 1); if (code) { if (errno == EINVAL) { - fprintf(stderr,"%s: Invalid argument, possible reasons include\n", pn); + fprintf(stderr, + "%s: Invalid argument, possible reasons include\n", + pn); fprintf(stderr,"%s: File not in vice or\n", pn); - fprintf(stderr,"%s: Too many users on access control list or\n", pn); - return 1; - } - else { + fprintf(stderr, + "%s: Too many users on access control list or\n", + pn); + } else { Die(errno, ti->data); - continue; } + error = 1; + continue; } /* now list the updated acl */ printf("Access list for %s is now\n", ti->data); if (ta->nplus > 0) { - if (!ta->dfs) printf("Normal rights:\n"); + if (!ta->dfs) + printf("Normal rights:\n"); for(te = ta->pluslist;te;te=te->next) { printf(" %s ", te->name); PRights(te->rights, ta->dfs); @@ -1024,22 +1210,26 @@ register struct cmd_syndesc *as; { printf("\n"); } } - if (ti->next) printf("\n"); - } - else + if (ti->next) + printf("\n"); + } else printf("Access list for %s is fine.\n", ti->data); } - return 0; + if (ta) + ZapAcl(ta); + return error; } -static ListACLCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; - register struct Acl *ta; +static int +ListACLCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; + struct Acl *ta = 0; struct ViceIoctl blob; struct AclEntry *te; - register struct cmd_item *ti; + struct cmd_item *ti; int idf = getidf(as, parm_listacl_id); + int error = 0; SetDotDefault(&as->parms[0].items); for(ti=as->parms[0].items; ti; ti=ti->next) { @@ -1050,6 +1240,7 @@ register struct cmd_syndesc *as; { code = pioctl(ti->data, VIOCGETAL, &blob, 1); if (code) { Die(errno, ti->data); + error = 1; continue; } ta = ParseAcl(space); @@ -1072,7 +1263,8 @@ register struct cmd_syndesc *as; { } separator = ta->dfs? DFS_SEPARATOR : ' '; if (ta->nplus > 0) { - if (!ta->dfs) printf("Normal rights:\n"); + if (!ta->dfs) + printf("Normal rights:\n"); for(te = ta->pluslist;te;te=te->next) { printf(" %s%c", te->name, separator); PRights(te->rights, ta->dfs); @@ -1087,73 +1279,80 @@ register struct cmd_syndesc *as; { printf("\n"); } } - if (ti->next) printf("\n"); + if (ti->next) + printf("\n"); + ZapAcl(ta); } - return 0; + return error; } -static FlushVolumeCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +FlushVolumeCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - register struct cmd_item *ti; + struct cmd_item *ti; + int error = 0; + SetDotDefault(&as->parms[0].items); for(ti=as->parms[0].items; ti; ti=ti->next) { blob.in_size = blob.out_size = 0; code = pioctl(ti->data, VIOC_FLUSHVOLUME, &blob, 0); if (code) { - fprintf(stderr, "Error flushing volume\n"); - Die(errno,ti->data); + fprintf(stderr, "Error flushing volume "); + perror(ti->data); + error = 1; continue; } } - return 0; + return error; } -static FlushCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +FlushCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - int error; - register struct cmd_item *ti; + struct cmd_item *ti; + + int error = 0; - error = 0; for(ti=as->parms[0].items; ti; ti=ti->next) { blob.in_size = blob.out_size = 0; code = pioctl(ti->data, VIOCFLUSH, &blob, 0); if (code) { - error = 1; if (errno == EMFILE) { - fprintf(stderr,"%s: Can't flush active file %s\n", pn, ti->data); - continue; - } - else { - fprintf(stderr, "Error flushing file\n"); - Die(errno,ti->data); - continue; + fprintf(stderr, "%s: Can't flush active file %s\n", pn, + ti->data); + } else { + fprintf(stderr, "%s: Error flushing file ", pn); + perror(ti->data); } + error = 1; + continue; } } return error; } /* all this command does is repackage its args and call SetVolCmd */ -static SetQuotaCmd(as) -register struct cmd_syndesc *as; { +static int +SetQuotaCmd(struct cmd_syndesc *as, char *arock) { struct cmd_syndesc ts; /* copy useful stuff from our command slot; we may later have to reorder */ memcpy(&ts, as, sizeof(ts)); /* copy whole thing */ - return SetVolCmd(&ts); + return SetVolCmd(&ts, arock); } -static SetVolCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +SetVolCmd(struct cmd_syndesc *as, char *arock) { + afs_int32 code; struct ViceIoctl blob; - register struct cmd_item *ti; + struct cmd_item *ti; struct VolumeStatus *status; char *motd, *offmsg, *input; + int error = 0; SetDotDefault(&as->parms[0].items); for(ti=as->parms[0].items; ti; ti=ti->next) { @@ -1164,61 +1363,78 @@ register struct cmd_syndesc *as; { blob.in = space; status = (VolumeStatus *)space; status->MinQuota = status->MaxQuota = -1; - motd = offmsg = (char *) 0; + motd = offmsg = NULL; if (as->parms[1].items) { code = util_GetInt32(as->parms[1].items->data, &status->MaxQuota); if (code) { - fprintf(stderr,"fs: bad integer specified for quota.\n"); - return code; + fprintf(stderr,"%s: bad integer specified for quota.\n", pn); + error = 1; + continue; } } - if (as->parms[2].items) motd = as->parms[2].items->data; - if (as->parms[3].items) offmsg = as->parms[3].items->data; + if (as->parms[2].items) + motd = as->parms[2].items->data; + if (as->parms[3].items) + offmsg = as->parms[3].items->data; input = (char *)status + sizeof(*status); *(input++) = '\0'; /* never set name: this call doesn't change vldb */ if(offmsg) { - if (strlen(offmsg) >= VMSGSIZE) { - fprintf(stderr,"fs: message must be shorter than %d characters\n", - VMSGSIZE); - return code; - } + if (strlen(offmsg) >= VMSGSIZE) { + fprintf(stderr,"%s: message must be shorter than %d characters\n", + pn, VMSGSIZE); + error = 1; + continue; + } strcpy(input,offmsg); blob.in_size += strlen(offmsg); input += strlen(offmsg) + 1; - } - else *(input++) = '\0'; + } else + *(input++) = '\0'; if(motd) { - if (strlen(motd) >= VMSGSIZE) { - fprintf(stderr,"fs: message must be shorter than %d characters\n", - VMSGSIZE); - return code; - } + if (strlen(motd) >= VMSGSIZE) { + fprintf(stderr,"%s: message must be shorter than %d characters\n", + pn, VMSGSIZE); + return code; + } strcpy(input,motd); blob.in_size += strlen(motd); input += strlen(motd) + 1; - } - else *(input++) = '\0'; + } else + *(input++) = '\0'; code = pioctl(ti->data,VIOCSETVOLSTAT, &blob, 1); if (code) { - Die(errno, ti->data); - return 1; + error = 1; } } - return 0; + return error; } -static ExamineCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +#ifndef WIN32 +/* + * Why is VenusFid declared in the kernel-only section of afs.h, + * if it's the exported interface of the (UNIX) cache manager? + */ +struct VenusFid { + afs_int32 Cell; + AFSFid Fid; +}; +#endif /* WIN32 */ + +static int +ExamineCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - register struct cmd_item *ti; + struct cmd_item *ti; struct VolumeStatus *status; char *name, *offmsg, *motd; - int error; + int error = 0; - error = 0; SetDotDefault(&as->parms[0].items); for(ti=as->parms[0].items; ti; ti=ti->next) { +#ifndef WIN32 + struct VenusFid vfid; +#endif /* WIN32 */ /* once per file */ blob.out_size = MAXSIZE; blob.in_size = 0; @@ -1233,18 +1449,31 @@ register struct cmd_syndesc *as; { name = (char *)status + sizeof(*status); offmsg = name + strlen(name) + 1; motd = offmsg + strlen(offmsg) + 1; + +#ifndef WIN32 + blob.out_size = sizeof(struct VenusFid); + blob.out = (char *) &vfid; + if (0 == pioctl(ti->data, VIOCGETFID, &blob, 1)) { + printf("File %s (%u.%u.%u) contained in volume %u\n", + ti->data, vfid.Fid.Volume, vfid.Fid.Vnode, vfid.Fid.Unique, + vfid.Fid.Volume); + } +#endif /* WIN32 */ PrintStatus(status, name, motd, offmsg); } return error; } -static ListQuotaCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +ListQuotaCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - register struct cmd_item *ti; + struct cmd_item *ti; struct VolumeStatus *status; char *name; + + int error = 0; printf("%-25s%-10s%-10s%-7s%-13s\n", "Volume Name", " Quota", " Used", " %Used", " Partition"); @@ -1257,23 +1486,26 @@ register struct cmd_syndesc *as; { code = pioctl(ti->data, VIOCGETVOLSTAT, &blob, 1); if (code) { Die(errno, ti->data); + error = 1; continue; } status = (VolumeStatus *)space; name = (char *)status + sizeof(*status); QuickPrintStatus(status, name); } - return 0; + return error; } -static WhereIsCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +WhereIsCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - register struct cmd_item *ti; - register int j; + struct cmd_item *ti; + int j; afs_int32 *hosts; char *tp; + int error = 0; SetDotDefault(&as->parms[0].items); for(ti=as->parms[0].items; ti; ti=ti->next) { @@ -1285,28 +1517,33 @@ register struct cmd_syndesc *as; { code = pioctl(ti->data, VIOCWHEREIS, &blob, 1); if (code) { Die(errno, ti->data); + error = 1; continue; } hosts = (afs_int32 *) space; - printf("File %s is on host%s ", ti->data, (hosts[0] && !hosts[1]) ? "": "s"); + printf("File %s is on host%s ", ti->data, + (hosts[0] && !hosts[1]) ? "": "s"); for(j=0; jdata, VIOCGETVOLSTAT, &blob, 1); if (code) { Die(errno, ti->data); + error = 1; continue; } status = (VolumeStatus *)space; name = (char *)status + sizeof(*status); QuickPrintSpace(status, name); } - return 0; + return error; } -static QuotaCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +QuotaCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - register struct cmd_item *ti; + struct cmd_item *ti; double quotaPct; struct VolumeStatus *status; + int error = 0; SetDotDefault(&as->parms[0].items); for(ti=as->parms[0].items; ti; ti=ti->next) { @@ -1345,26 +1585,29 @@ register struct cmd_syndesc *as; { code = pioctl(ti->data, VIOCGETVOLSTAT, &blob, 1); if (code) { Die(errno, ti->data); + error = 1; continue; } status = (VolumeStatus *)space; - if (status->MaxQuota) quotaPct = ((((double)status->BlocksInUse)/status->MaxQuota) * 100.0); - else quotaPct = 0.0; + if (status->MaxQuota) + quotaPct = ((((double)status->BlocksInUse)/status->MaxQuota) * 100.0); + else + quotaPct = 0.0; printf("%2.0f%% of quota used.\n", quotaPct); } - return 0; + return error; } -static ListMountCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +ListMountCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - int error; - register struct cmd_item *ti; + struct cmd_item *ti; char orig_name[1024]; /*Original name, may be modified*/ char true_name[1024]; /*``True'' dirname (e.g., symlink target)*/ char parent_dir[1024]; /*Parent directory of true name*/ - register char *last_component; /*Last component of true name*/ + char *last_component; /*Last component of true name*/ #ifndef WIN32 struct stat statbuff; /*Buffer for status info*/ #endif /* not WIN32 */ @@ -1373,7 +1616,7 @@ register struct cmd_syndesc *as; { #endif /* not WIN32 */ int thru_symlink; /*Did we get to a mount point via a symlink?*/ - error = 0; + int error = 0; for(ti=as->parms[0].items; ti; ti=ti->next) { /* once per file */ thru_symlink = 0; @@ -1388,8 +1631,8 @@ register struct cmd_syndesc *as; { #ifndef WIN32 if (lstat(orig_name, &statbuff) < 0) { /* if lstat fails, we should still try the pioctl, since it - may work (for example, lstat will fail, but pioctl will - work if the volume of offline (returning ENODEV). */ + * may work (for example, lstat will fail, but pioctl will + * work if the volume of offline (returning ENODEV). */ statbuff.st_mode = S_IFDIR; /* lie like pros */ } @@ -1404,9 +1647,11 @@ register struct cmd_syndesc *as; { */ link_chars_read = readlink(orig_name, true_name, 1024); if (link_chars_read <= 0) { - fprintf(stderr,"%s: Can't read target name for '%s' symbolic link!\n", + fprintf(stderr, + "%s: Can't read target name for '%s' symbolic link!\n", pn, orig_name); - exit(1); + error = 1; + continue; } /* @@ -1425,8 +1670,7 @@ register struct cmd_syndesc *as; { strcpy(++last_component, true_name); strcpy(true_name, orig_name); } - } - else + } else strcpy(true_name, orig_name); #else /* WIN32 */ strcpy(true_name, orig_name); @@ -1435,8 +1679,10 @@ register struct cmd_syndesc *as; { /* * Find rightmost slash, if any. */ +#ifdef WIN32 last_component = (char *) strrchr(true_name, '\\'); if (!last_component) +#endif /* WIN32 */ last_component = (char *) strrchr(true_name, '/'); if (last_component) { /* @@ -1446,8 +1692,7 @@ register struct cmd_syndesc *as; { strncpy(parent_dir, true_name, last_component - true_name + 1); parent_dir[last_component - true_name + 1] = 0; last_component++; /*Skip the slash*/ - } - else { + } else { /* * No slash appears in the given file name. Set parent_dir to the current * directory, and the last component as the given name. @@ -1459,8 +1704,8 @@ register struct cmd_syndesc *as; { } if (strcmp(last_component, ".") == 0 || strcmp(last_component, "..") == 0) { - fprintf(stderr,"fs: you may not use '.' or '..' as the last component\n"); - fprintf(stderr,"fs: of a name in the 'fs lsmount' command.\n"); + fprintf(stderr,"%s: you may not use '.' or '..' as the last component\n",pn); + fprintf(stderr,"%s: of a name in the 'fs lsmount' command.\n",pn); error = 1; continue; } @@ -1473,29 +1718,29 @@ register struct cmd_syndesc *as; { code = pioctl(parent_dir, VIOC_AFS_STAT_MT_PT, &blob, 1); - if (code == 0) + if (code == 0) { printf("'%s' is a %smount point for volume '%s'\n", ti->data, (thru_symlink ? "symbolic link, leading to a " : ""), space); - else { - error = 1; - if (errno == EINVAL) - fprintf(stderr,"'%s' is not a mount point.\n", - ti->data); - else { + } else { + if (errno == EINVAL) { + fprintf(stderr,"'%s' is not a mount point.\n", ti->data); + } else { Die(errno, (ti->data ? ti->data : parent_dir)); } + error = 1; } } return error; } -static MakeMountCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; - register char *cellName, *volName, *tmpName; +static int +MakeMountCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; + char *cellName, *volName, *tmpName; #ifdef WIN32 char localCellName[1000]; #else /* not WIN32 */ @@ -1504,43 +1749,43 @@ register struct cmd_syndesc *as; { #endif /* not WIN32 */ struct ViceIoctl blob; -/* + /* -defect #3069 + defect #3069 if (as->parms[5].items && !as->parms[2].items) { - fprintf(stderr,"fs: must provide cell when creating cellular mount point.\n"); + fprintf(stderr,"%s: must provide cell when creating cellular mount point.\n", pn); return 1; } -*/ + */ if (as->parms[2].items) /* cell name specified */ cellName = as->parms[2].items->data; else - cellName = (char *) 0; + cellName = NULL; volName = as->parms[1].items->data; if (strlen(volName) >= 64) { - fprintf(stderr,"fs: volume name too long (length must be < 64 characters)\n"); + fprintf(stderr,"%s: volume name too long (length must be < 64 characters)\n", pn); return 1; } /* Check for a cellname in the volume specification, and complain * if it doesn't match what was specified with -cell */ if (tmpName = strchr(volName, ':')) { - *tmpName = '\0'; - if (cellName) { - if (foldcmp(cellName,volName)) { - fprintf(stderr,"fs: cellnames do not match.\n"); - return 1; - } - } - cellName = volName; - volName = ++tmpName; + *tmpName = '\0'; + if (cellName) { + if (strcasecmp(cellName,volName)) { + fprintf(stderr,"fs: cellnames do not match.\n"); + return 1; + } + } + cellName = volName; + volName = ++tmpName; } if (!InAFS(Parent(as->parms[0].items->data))) { - fprintf(stderr,"fs: mount points must be created within the AFS file system\n"); + fprintf(stderr,"%s: mount points must be created within the AFS file system\n", pn); return 1; } @@ -1568,8 +1813,8 @@ defect #3069 /* make the check. Don't complain if there are problems with init */ code = ubik_Call(VL_GetEntryByNameO, uclient, 0, volName, &vldbEntry); if (code == VL_NOENT) { - fprintf(stderr,"fs: warning, volume %s does not exist in cell %s.\n", - volName, cellName ? cellName : space); + fprintf(stderr,"%s: warning, volume %s does not exist in cell %s.\n", + pn, volName, cellName ? cellName : space); } } } @@ -1615,14 +1860,15 @@ defect #3069 * (or ``.'' if none is provided) * tp: Set to point to the actual name of the mount point to nuke. */ -static RemoveMountCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code=0; +static int +RemoveMountCmd(struct cmd_syndesc *as, char *arock) { + afs_int32 code=0; struct ViceIoctl blob; - register struct cmd_item *ti; + struct cmd_item *ti; char tbuffer[1024]; char lsbuffer[1024]; - register char *tp; + char *tp; + int error = 0; for(ti=as->parms[0].items; ti; ti=ti->next) { /* once per file */ @@ -1633,8 +1879,7 @@ register struct cmd_syndesc *as; { strncpy(tbuffer, ti->data, code=tp-ti->data+1); /* the dir name */ tbuffer[code] = 0; tp++; /* skip the slash */ - } - else { + } else { fs_ExtractDriveLetter(ti->data, tbuffer); strcat(tbuffer, "."); tp = ti->data; @@ -1646,11 +1891,12 @@ register struct cmd_syndesc *as; { blob.out_size = sizeof(lsbuffer); code = pioctl(tbuffer, VIOC_AFS_STAT_MT_PT, &blob, 0); if (code) { - if (errno == EINVAL) - fprintf(stderr,"fs: '%s' is not a mount point.\n", ti->data); - else { + if (errno == EINVAL) { + fprintf(stderr,"%s: '%s' is not a mount point.\n", pn, ti->data); + } else { Die(errno, ti->data); } + error = 1; continue; /* don't bother trying */ } blob.out_size = 0; @@ -1659,22 +1905,23 @@ register struct cmd_syndesc *as; { code = pioctl(tbuffer, VIOC_AFS_DELETE_MT_PT, &blob, 0); if (code) { Die(errno, ti->data); + error = 1; } - } - return code; + return error; } /* */ -static CheckServersCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +CheckServersCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - register afs_int32 j; + afs_int32 j; afs_int32 temp; - register char *tp; + char *tp; struct afsconf_cell info; struct chservinfo checkserv; @@ -1688,8 +1935,10 @@ register struct cmd_syndesc *as; { /* prepare flags for checkservers command */ temp = 2; /* default to checking local cell only */ - if (as->parms[2].items) temp |= 1; /* set fast flag */ - if (as->parms[1].items) temp &= ~2; /* turn off local cell check */ + if (as->parms[2].items) + temp |= 1; /* set fast flag */ + if (as->parms[1].items) + temp &= ~2; /* turn off local cell check */ checkserv.magic = 0x12345678; /* XXX */ checkserv.tflags=temp; @@ -1702,29 +1951,25 @@ register struct cmd_syndesc *as; { } strcpy(checkserv.tbuffer,info.name); checkserv.tsize=strlen(info.name)+1; + } else { + strcpy(checkserv.tbuffer,"\0"); + checkserv.tsize=0; } - else - { - strcpy(checkserv.tbuffer,"\0"); - checkserv.tsize=0; - } - if(as->parms[3].items) - { - checkserv.tinterval=atol(as->parms[3].items->data); - - /* sanity check */ - if(checkserv.tinterval<0) { - printf("Warning: The negative -interval is ignored; treated as an inquiry\n"); - checkserv.tinterval=0; - } else if(checkserv.tinterval> 600) { - printf("Warning: The maximum -interval value is 10 mins (600 secs)\n"); - checkserv.tinterval=600; /* 10 min max interval */ - } - } - else { + if(as->parms[3].items) { + checkserv.tinterval=atol(as->parms[3].items->data); + + /* sanity check */ + if(checkserv.tinterval<0) { + printf("Warning: The negative -interval is ignored; treated as an inquiry\n"); + checkserv.tinterval=0; + } else if(checkserv.tinterval> 600) { + printf("Warning: The maximum -interval value is 10 mins (600 secs)\n"); + checkserv.tinterval=600; /* 10 min max interval */ + } + } else { checkserv.tinterval = -1; /* don't change current interval */ - } + } if ( checkserv.tinterval != 0 ) { #ifdef WIN32 @@ -1747,7 +1992,7 @@ register struct cmd_syndesc *as; { return code; } Die(errno, 0); - return code; + return 1; } memcpy(&temp, space, sizeof(afs_int32)); if (checkserv.tinterval >= 0) { @@ -1760,12 +2005,12 @@ register struct cmd_syndesc *as; { } if (temp == 0) { printf("All servers are running.\n"); - } - else { + } else { printf("These servers unavailable due to network or server problems: "); for(j=0; j < MAXHOSTS; j++) { memcpy(&temp, space + j*sizeof(afs_int32), sizeof(afs_int32)); - if (temp == 0) break; + if (temp == 0) + break; tp = hostutil_GetNameByINet(temp); printf(" %s", tp); } @@ -1775,9 +2020,10 @@ register struct cmd_syndesc *as; { return code; } -static GagCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code=0; +static int +MessagesCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code=0; struct ViceIoctl blob; struct gaginfo gagflags; struct cmd_item *show; @@ -1789,36 +2035,38 @@ register struct cmd_syndesc *as; { blob.out = space; memset(space, 0, sizeof(afs_int32)); /* so we assure zero when nothing is copied back */ - if (show = as->parms[0].items) - if (!foldcmp (show->data, "user")) - gagflags.showflags |= GAGUSER; - else if (!foldcmp (show->data, "console")) - gagflags.showflags |= GAGCONSOLE; - else if (!foldcmp (show->data, "all")) - gagflags.showflags |= GAGCONSOLE | GAGUSER; - else if (!foldcmp (show->data, "none")) - /* do nothing */ ; - else { - fprintf(stderr, - "unrecognized flag %s: must be in {user,console,all,none}\n", - show->data); - code = EINVAL; - } - - if (code) - return code; + if (show = as->parms[0].items) { + if (!strcasecmp (show->data, "user")) + gagflags.showflags |= GAGUSER; + else if (!strcasecmp (show->data, "console")) + gagflags.showflags |= GAGCONSOLE; + else if (!strcasecmp (show->data, "all")) + gagflags.showflags |= GAGCONSOLE | GAGUSER; + else if (!strcasecmp (show->data, "none")) + /* do nothing */ ; + else { + fprintf(stderr, + "unrecognized flag %s: must be in {user,console,all,none}\n", + show->data); + code = EINVAL; + } + } + + if (code) + return 1; code = pioctl(0, VIOC_GAG, &blob, 1); if (code) { Die(errno, 0); - return code; + return 1; } - return code; + return 0; } -static CheckVolumesCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +CheckVolumesCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; blob.in_size = 0; @@ -1828,14 +2076,15 @@ register struct cmd_syndesc *as; { Die(errno, 0); return 1; } - else printf("All volumeID/name mappings checked.\n"); + printf("All volumeID/name mappings checked.\n"); return 0; } -static SetCacheSizeCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +SetCacheSizeCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; afs_int32 temp; @@ -1858,53 +2107,61 @@ register struct cmd_syndesc *as; { if (as->parms[0].items) { code = util_GetInt32(as->parms[0].items->data, &temp); if (code) { - fprintf(stderr,"fs: bad integer specified for cache size.\n"); - return code; + fprintf(stderr,"%s: bad integer specified for cache size.\n", pn); + return 1; } - } - else + } else temp = 0; blob.in = (char *) &temp; blob.in_size = sizeof(afs_int32); blob.out_size = 0; code = pioctl(0, VIOCSETCACHESIZE, &blob, 1); - if (code) + if (code) { Die(errno, (char *) 0); - else - printf("New cache size set.\n"); + return 1; + } + + printf("New cache size set.\n"); return 0; } #define MAXGCSIZE 16 -static GetCacheParmsCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +GetCacheParmsCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; afs_int32 parms[MAXGCSIZE]; - - blob.in = (char *) 0; + + memset(parms, 0, sizeof(parms)); + blob.in = NULL; blob.in_size = 0; blob.out_size = sizeof(parms); blob.out = (char *) parms; code = pioctl(0, VIOCGETCACHEPARMS, &blob, 1); - if (code) - Die(errno, (char *) 0); - else { - printf("AFS using %d of the cache's available %d 1K byte blocks.\n", - parms[1], parms[0]); - if (parms[1] > parms[0]) - printf("[Cache guideline temporarily deliberately exceeded; it will be adjusted down but you may wish to increase the cache size.]\n"); + if (code) { + Die(errno, NULL); + return 1; } + + printf("AFS using %d of the cache's available %d 1K byte blocks.\n", + parms[1], parms[0]); + if (parms[1] > parms[0]) + printf("[Cache guideline temporarily deliberately exceeded; it will be adjusted down but you may wish to increase the cache size.]\n"); return 0; } -static ListCellsCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +ListCellsCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; afs_int32 i, j, *lp, magic, size; - char *tcp, *tp; - afs_int32 clear, maxa = OMAXHOSTS; + char *tp; + afs_int32 addr, maxa = OMAXHOSTS; struct ViceIoctl blob; + int resolve; + + resolve = !(as->parms[0].items); /* -numeric */ for(i=0;i<1000;i++) { tp = space; @@ -1919,12 +2176,11 @@ register struct cmd_syndesc *as; { blob.out = space; code = pioctl(0, VIOCGETCELL, &blob, 1); if (code < 0) { - if (errno == EDOM) break; /* done with the list */ - else { - Die(errno, 0); - return 1; - } - } + if (errno == EDOM) + break; /* done with the list */ + Die(errno, 0); + return 1; + } tp = space; memcpy(&magic, tp, sizeof(afs_int32)); if (magic == 0x12345678) { @@ -1933,38 +2189,109 @@ register struct cmd_syndesc *as; { } printf("Cell %s on hosts", tp+maxa*sizeof(afs_int32)); for(j=0; j < maxa; j++) { - memcpy(&clear, tp + j*sizeof(afs_int32), sizeof(afs_int32)); - if (clear == 0) break; - tcp = hostutil_GetNameByINet(clear); - printf(" %s", tcp); + char *name, tbuffer[20]; + + memcpy(&addr, tp + j*sizeof(afs_int32), sizeof(afs_int32)); + if (addr == 0) + break; + + if (resolve) { + name = hostutil_GetNameByINet(addr); + } else { + addr = ntohl(addr); + sprintf(tbuffer, "%d.%d.%d.%d", (addr >> 24) & 0xff, + (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff); + name = tbuffer; + } + printf(" %s", name); } printf(".\n"); } return 0; } -static NewCellCmd(as) -register struct cmd_syndesc *as; { #ifndef WIN32 - register afs_int32 code, linkedstate=0, size=0, *lp; +static int +ListAliasesCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code, i; + char *tp, *aliasName, *realName; struct ViceIoctl blob; - register struct cmd_item *ti; - register char *tp, *cellname=0; - register struct hostent *thp; - afs_int32 fsport = 0, vlport = 0; -#ifdef WIN32 - if ( !IsAdmin() ) { - fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n"); - return EACCES; + for (i = 0;; i++) { + tp = space; + memcpy(tp, &i, sizeof(afs_int32)); + blob.out_size = MAXSIZE; + blob.in_size = sizeof(afs_int32); + blob.in = space; + blob.out = space; + code = pioctl(0, VIOC_GETALIAS, &blob, 1); + if (code < 0) { + if (errno == EDOM) + break; /* done with the list */ + Die(errno, 0); + return 1; + } + tp = space; + aliasName = tp; + tp += strlen(aliasName) + 1; + realName = tp; + printf("Alias %s for cell %s\n", aliasName, realName); } -#else /* WIN32 */ - if (geteuid()) { - fprintf (stderr,"Permission denied: requires root access.\n"); - return EACCES; + return 0; +} + +static int +CallBackRxConnCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; + struct ViceIoctl blob; + struct cmd_item *ti; + afs_int32 hostAddr; + struct hostent *thp; + char *tp; + int setp; + + ti = as->parms[0].items; + setp = 1; + if (ti) { + thp = hostutil_GetHostByName(ti->data); + if (!thp) { + fprintf(stderr, "host %s not found in host table.\n", ti->data); + return 1; + } + else memcpy(&hostAddr, thp->h_addr, sizeof(afs_int32)); + } else { + hostAddr = 0; /* means don't set host */ + setp = 0; /* aren't setting host */ + } + + /* now do operation */ + blob.in_size = sizeof(afs_int32); + blob.out_size = sizeof(afs_int32); + blob.in = (char *) &hostAddr; + blob.out = (char *) &hostAddr; + + code = pioctl(0, VIOC_CBADDR, &blob, 1); + if (code < 0) { + Die(errno, 0); + return 1; } + return 0; +} #endif /* WIN32 */ +static int +NewCellCmd(struct cmd_syndesc *as, char *arock) +{ +#ifndef WIN32 + afs_int32 code, linkedstate=0, size=0, *lp; + struct ViceIoctl blob; + struct cmd_item *ti; + char *tp, *cellname=0; + struct hostent *thp; + afs_int32 fsport = 0, vlport = 0; + memset(space, 0, MAXHOSTS * sizeof(afs_int32)); tp = space; lp = (afs_int32 *)tp; @@ -2025,9 +2352,14 @@ register struct cmd_syndesc *as; { Die(errno, 0); return 0; #else /* WIN32 */ - register afs_int32 code; + afs_int32 code; struct ViceIoctl blob; + if ( !IsAdmin() ) { + fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n"); + return EACCES; + } + blob.in_size = 0; blob.in = (char *) 0; blob.out_size = MAXSIZE; @@ -2036,30 +2368,63 @@ register struct cmd_syndesc *as; { code = pioctl((char *) 0, VIOCNEWCELL, &blob, 1); if (code) { - Die(errno, (char *) 0); + Die(errno, (char *) 0); + return 1; } - else - printf("Cell servers information refreshed\n"); + + printf("Cell servers information refreshed\n"); return 0; #endif /* WIN32 */ } -static WhichCellCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +#ifndef WIN32 +static int +NewAliasCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - register struct cmd_item *ti; - int error; + char *tp; + char *aliasName, *realName; + + /* Setup and do the NEWALIAS pioctl call */ + aliasName = as->parms[0].items->data; + realName = as->parms[1].items->data; + tp = space; + strcpy(tp, aliasName); + tp += strlen(aliasName) + 1; + strcpy(tp, realName); + tp += strlen(realName) + 1; + + blob.in_size = tp - space; + blob.in = space; + blob.out_size = 0; + blob.out = space; + code = pioctl(0, VIOC_NEWALIAS, &blob, 1); + if (code < 0) { + if (errno == EEXIST) { + fprintf(stderr, + "%s: cell name `%s' in use by an existing cell.\n", pn, + aliasName); + } else { + Die(errno, 0); + } + return 1; + } + return 0; +} +#endif /* WIN32 */ + +static int +WhichCellCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; + struct cmd_item *ti; + int error = 0; + char cell[MAXCELLCHARS]=""; - error = 0; /* no error occurred */ SetDotDefault(&as->parms[0].items); for(ti=as->parms[0].items; ti; ti=ti->next) { - /* once per file */ - blob.in_size = 0; - blob.out_size = MAXSIZE; - blob.out = space; - - code = pioctl(ti->data, VIOC_FILE_CELL_NAME, &blob, 1); + code = GetCell(ti->data, cell); if (code) { if (errno == ENOENT) fprintf(stderr,"%s: no such cell as '%s'\n", pn, ti->data); @@ -2068,47 +2433,50 @@ register struct cmd_syndesc *as; { error = 1; continue; } - else - printf("File %s lives in cell '%s'\n", ti->data, space); + printf("File %s lives in cell '%s'\n", ti->data, cell); } return error; } -static WSCellCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +WSCellCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; blob.in_size = 0; - blob.in = (char *) 0; + blob.in = NULL; blob.out_size = MAXSIZE; blob.out = space; - code = pioctl((char *) 0, VIOC_GET_WS_CELL, &blob, 1); + code = pioctl(NULL, VIOC_GET_WS_CELL, &blob, 1); if (code) { - Die(errno, (char *) 0); + Die(errno, NULL); + return 1; } - else - printf("This workstation belongs to cell '%s'\n", space); + + printf("This workstation belongs to cell '%s'\n", space); return 0; } -static PrimaryCellCmd(as) -register struct cmd_syndesc *as; { /* +static int +PrimaryCellCmd(struct cmd_syndesc *as, char *arock) +{ fprintf(stderr,"This command is obsolete, as is the concept of a primary token.\n"); -*/ return 0; } +*/ -static MonitorCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +MonitorCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - register struct cmd_item *ti; + struct cmd_item *ti; afs_int32 hostAddr; - register struct hostent *thp; + struct hostent *thp; char *tp; int setp; @@ -2116,24 +2484,23 @@ register struct cmd_syndesc *as; { setp = 1; if (ti) { /* set the host */ - if (!strcmp(ti->data, "off")) + if (!strcmp(ti->data, "off")) { hostAddr = 0xffffffff; - else { + } else { thp = hostutil_GetHostByName(ti->data); if (!thp) { if (!strcmp(ti->data, "localhost")) { fprintf(stderr,"localhost not in host table, assuming 127.0.0.1\n"); hostAddr = htonl(0x7f000001); - } - else { + } else { fprintf(stderr,"host %s not found in host table.\n", ti->data); return 1; } - } - else memcpy(&hostAddr, thp->h_addr, sizeof(afs_int32)); + } else { + memcpy(&hostAddr, thp->h_addr, sizeof(afs_int32)); + } } - } - else { + } else { hostAddr = 0; /* means don't set host */ setp = 0; /* aren't setting host */ } @@ -2146,17 +2513,15 @@ register struct cmd_syndesc *as; { code = pioctl(0, VIOC_AFS_MARINER_HOST, &blob, 1); if (code) { Die(errno, 0); - exit(1); + return 1; } if (setp) { printf("%s: new monitor host set.\n", pn); - } - else { + } else { /* now decode old address */ if (hostAddr == 0xffffffff) { printf("Cache monitoring is currently disabled.\n"); - } - else { + } else { tp = hostutil_GetNameByINet(hostAddr); printf("Using host %s for monitor services.\n", tp); } @@ -2164,9 +2529,10 @@ register struct cmd_syndesc *as; { return 0; } -static SysNameCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +SysNameCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; struct cmd_item *ti; char *input = space; @@ -2212,7 +2578,7 @@ register struct cmd_syndesc *as; { return 1; } if (setp) { - printf("%s: new sysname%s set.\n", pn, setp > 1 ? "s" : ""); + printf("%s: new sysname%s set.\n", pn, setp > 1 ? " list" : ""); return 0; } @@ -2224,7 +2590,7 @@ register struct cmd_syndesc *as; { return 1; } - printf("Current sysname%s", setp > 1 ? "s are" : " is"); + printf("Current sysname%s is", setp > 1 ? " list" : ""); for (; setp > 0; --setp ) { printf(" \'%s\'", input); input += strlen(input) + 1; @@ -2233,13 +2599,14 @@ register struct cmd_syndesc *as; { return 0; } -char *exported_types[] = {"null", "nfs", ""}; -static ExportAfsCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static char *exported_types[] = {"null", "nfs", ""}; +static int ExportAfsCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; - register struct cmd_item *ti; - int export=0, type=0, mode = 0, exp = 0, gstat = 0, exportcall, pwsync=0, smounts=0; + struct cmd_item *ti; + int export = 0, type = 0, mode = 0, exp = 0, gstat = 0; + int exportcall, pwsync = 0, smounts = 0; #ifdef WIN32 if ( !IsAdmin() ) { @@ -2254,42 +2621,52 @@ register struct cmd_syndesc *as; { #endif /* WIN32 */ ti = as->parms[0].items; - if (strcmp(ti->data, "nfs") == 0) type = 0x71; /* NFS */ + if (strcmp(ti->data, "nfs") == 0) + type = 0x71; /* NFS */ else { - fprintf(stderr,"Invalid exporter type, '%s', Only the 'nfs' exporter is currently supported\n", ti->data); + fprintf(stderr, + "Invalid exporter type, '%s', Only the 'nfs' exporter is currently supported\n", ti->data); return 1; } ti = as->parms[1].items; if (ti) { - if (strcmp(ti->data, "on") == 0) export = 3; - else if (strcmp(ti->data, "off") == 0) export = 2; + if (strcmp(ti->data, "on") == 0) + export = 3; + else if (strcmp(ti->data, "off") == 0) + export = 2; else { - printf("Illegal argument %s\n", ti->data); + fprintf(stderr, "Illegal argument %s\n", ti->data); return 1; } exp = 1; } if (ti = as->parms[2].items) { /* -noconvert */ - if (strcmp(ti->data, "on") == 0) mode = 2; - else if (strcmp(ti->data, "off") == 0) mode = 3; + if (strcmp(ti->data, "on") == 0) + mode = 2; + else if (strcmp(ti->data, "off") == 0) + mode = 3; else { - printf("Illegal argument %s\n", ti->data); + fprintf(stderr, "Illegal argument %s\n", ti->data); return 1; } } if (ti = as->parms[3].items) { /* -uidcheck */ - if (strcmp(ti->data, "on") == 0) pwsync = 3; - else if (strcmp(ti->data, "off") == 0) pwsync = 2; + if (strcmp(ti->data, "on") == 0) + pwsync = 3; + else if (strcmp(ti->data, "off") == 0) + pwsync = 2; else { - printf("Illegal argument %s\n", ti->data); + fprintf(stderr, "Illegal argument %s\n", ti->data); return 1; } } if (ti = as->parms[4].items) { /* -submounts */ - if (strcmp(ti->data, "on") == 0) smounts = 3; - else if (strcmp(ti->data, "off") == 0) smounts = 2; + if (strcmp(ti->data, "on") == 0) + smounts = 3; + else if (strcmp(ti->data, "off") == 0) + smounts = 2; else { - printf("Illegal argument %s\n", ti->data); + fprintf(stderr, "Illegal argument %s\n", ti->data); return 1; } } @@ -2303,11 +2680,12 @@ register struct cmd_syndesc *as; { code = pioctl(0, VIOC_EXPORTAFS, &blob, 1); if (code) { if (errno == ENODEV) { - fprintf(stderr,"Sorry, the %s-exporter type is currently not supported on this AFS client\n", exported_types[type]); + fprintf(stderr, + "Sorry, the %s-exporter type is currently not supported on this AFS client\n", exported_types[type]); } else { Die(errno, 0); - exit(1); } + return 1; } else { if (!gstat) { if (exportcall & 1) { @@ -2320,27 +2698,31 @@ register struct cmd_syndesc *as; { } } } - return(0); + return 0; } -static GetCellCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int +GetCellCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; struct afsconf_cell info; - register struct cmd_item *ti; + struct cmd_item *ti; struct a { afs_int32 stat; afs_int32 junk; } args; - + int error = 0; + + memset(&args, 0, sizeof(args)); /* avoid Purify UMR error */ for(ti=as->parms[0].items; ti; ti=ti->next) { /* once per cell */ blob.out_size = sizeof(args); blob.out = (caddr_t) &args; code = GetCellName(ti->data, &info); if (code) { + error = 1; continue; } blob.in_size = 1+strlen(info.name); @@ -2348,34 +2730,46 @@ register struct cmd_syndesc *as; { code = pioctl(0, VIOC_GETCELLSTATUS, &blob, 1); if (code) { if (errno == ENOENT) - fprintf(stderr,"fs: the cell named '%s' does not exist\n", info.name); + fprintf(stderr,"%s: the cell named '%s' does not exist\n", pn, info.name); else Die(errno, info.name); - return 1; + error = 1; + continue; } printf("Cell %s status: ", info.name); #ifdef notdef - if (args.stat & 1) printf("primary "); + if (args.stat & 1) + printf("primary "); #endif - if (args.stat & 2) printf("no setuid allowed"); - else printf("setuid allowed"); - if (args.stat & 4) printf(", using old VLDB"); + if (args.stat & 2) + printf("no setuid allowed"); + else + printf("setuid allowed"); + if (args.stat & 4) + printf(", using old VLDB"); printf("\n"); } - return 0; + return error; } -static SetCellCmd(as) -register struct cmd_syndesc *as; { - register afs_int32 code; +static int SetCellCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; struct ViceIoctl blob; struct afsconf_cell info; - register struct cmd_item *ti; + struct cmd_item *ti; struct a { afs_int32 stat; afs_int32 junk; char cname[64]; } args; + int error = 0; + + /* Check arguments. */ + if (as->parms[1].items && as->parms[2].items) { + fprintf(stderr, "Cannot specify both -suid and -nosuid.\n"); + return 1; + } /* figure stuff to set */ args.stat = 0; @@ -2393,13 +2787,15 @@ register struct cmd_syndesc *as; { } #endif /* WIN32 */ - if (! as->parms[1].items) args.stat |= CM_SETCELLFLAG_SUID; /* default to -nosuid */ + if (! as->parms[1].items) + args.stat |= CM_SETCELLFLAG_SUID; /* default to -nosuid */ /* set stat for all listed cells */ for(ti=as->parms[0].items; ti; ti=ti->next) { /* once per cell */ code = GetCellName(ti->data, &info); if (code) { + error = 1; continue; } strcpy(args.cname, info.name); @@ -2409,43 +2805,45 @@ register struct cmd_syndesc *as; { blob.out = (caddr_t) 0; code = pioctl(0, VIOC_SETCELLSTATUS, &blob, 1); if (code) { - Die(errno, 0); - exit(1); + Die(errno, info.name); /* XXX added cell name to Die() call */ + error = 1; } } - return 0; + return error; } #ifdef WIN32 -static GetCellName(char *cellNamep, struct afsconf_cell *infop) +static int +GetCellName(char *cellNamep, struct afsconf_cell *infop) { - strcpy(infop->name, cellNamep); - return 0; + strcpy(infop->name, cellNamep); + return 0; } -static VLDBInit(int noAuthFlag, struct afsconf_cell *infop) +static int +VLDBInit(int noAuthFlag, struct afsconf_cell *infop) { - return 0; + return 0; } - #else /* not WIN32 */ - -static GetCellName(cellName, info) -char *cellName; -struct afsconf_cell *info; +static int +GetCellName(char *cellName, struct afsconf_cell *info) { struct afsconf_dir *tdir; - register int code; + int code; - tdir = afsconf_Open(AFSCONF_CLIENTNAME); + tdir = afsconf_Open(AFSDIR_CLIENT_ETC_CLIENTNAME); if (!tdir) { - fprintf(stderr,"Could not process files in configuration directory (%s).\n",AFSCONF_CLIENTNAME); + fprintf(stderr, + "Could not process files in configuration directory (%s).\n", + AFSDIR_CLIENT_ETC_CLIENTNAME); return -1; } code = afsconf_GetCellInfo(tdir, cellName, AFSCONF_VLDBSERVICE, info); if (code) { - fprintf(stderr,"fs: cell %s not in %s/CellServDB\n", cellName, AFSCONF_CLIENTNAME); + fprintf(stderr,"fs: cell %s not in %s/CellServDB\n", cellName, + AFSDIR_CLIENT_ETC_CLIENTNAME); return code; } @@ -2453,82 +2851,22 @@ struct afsconf_cell *info; } -static VLDBInit(noAuthFlag, info) -int noAuthFlag; -struct afsconf_cell *info; -{ afs_int32 code; - struct ktc_principal sname; - struct ktc_token ttoken; - afs_int32 scIndex; - struct rx_securityClass *sc; - struct rx_connection *serverconns[VLDB_MAXSERVERS]; - afs_int32 i; +static int +VLDBInit(int noAuthFlag, struct afsconf_cell *info) +{ + afs_int32 code; - code = rx_Init(0); - if (code) { - fprintf(stderr,"fs: could not initialize rx.\n"); - return code; - } + code = ugen_ClientInit(noAuthFlag, AFSDIR_CLIENT_ETC_DIRPATH, + info->name, 0, &uclient, + NULL, pn, rxkad_clear, + VLDB_MAXSERVERS, AFSCONF_VLDBSERVICE, 50, + 0, 0, USER_SERVICE_ID); rxInitDone = 1; - rx_SetRxDeadTime(50); - if (!noAuthFlag) { /* we don't need tickets for null */ - strcpy(sname.cell, info->name); - sname.instance[0] = 0; - strcpy(sname.name, "afs"); - code = ktc_GetToken(&sname,&ttoken, sizeof(ttoken), (char *)0); - if (code) { - fprintf(stderr,"fs: Could not get afs tokens, running unauthenticated.\n"); - scIndex = 0; - } - else { - /* got a ticket */ - if (ttoken.kvno >= 0 && ttoken.kvno <= 256) scIndex = 2; /* kerberos */ - else { - fprintf (stderr, "fs: funny kvno (%d) in ticket, proceeding\n", - ttoken.kvno); - scIndex = 2; - } - } - } - else scIndex = 0; /* don't authenticate */ - switch (scIndex) { - case 0 : - sc = (struct rx_securityClass *) rxnull_NewClientSecurityObject(); - break; - - case 1 : - break; - case 2: - sc = (struct rx_securityClass *) - rxkad_NewClientSecurityObject(rxkad_clear, &ttoken.sessionKey, - ttoken.kvno, ttoken.ticketLen, - ttoken.ticket); - break; - } - if (info->numServers > VLDB_MAXSERVERS) { - fprintf(stderr, "fs: info.numServers=%d (> VLDB_MAXSERVERS=%d)\n", - info->numServers, VLDB_MAXSERVERS); - exit(1); - } - memset(serverconns, 0, sizeof(serverconns)); - for (i = 0;inumServers;i++) - serverconns[i] = rx_NewConnection(info->hostAddr[i].sin_addr.s_addr, - info->hostAddr[i].sin_port, USER_SERVICE_ID, - sc, scIndex); - - if (sc) - rxs_Release(sc); /* Decrement the initial refCount */ - code = ubik_ClientInit(serverconns, &uclient); - - if (code) { - fprintf(stderr,"fs: ubik client init failed.\n"); - return code; - } - return 0; + return code; } #endif /* not WIN32 */ -static struct ViceIoctl gblob; +static struct ViceIoctl gblob; static int debug = 0; /* * here follow some routines in suport of the setserverprefs and @@ -2541,10 +2879,11 @@ static int debug = 0; * GetPrefCmd reads the Cache Manager's current list of server ranks */ -static pokeServers() +#ifdef WIN32 +static int +pokeServers(void) { -int code; - + int code; cm_SSetPref_t *ssp; code = pioctl(0, VIOC_SETSPREFS, &gblob, 1); @@ -2553,15 +2892,44 @@ int code; gblob.in = space; return code; } +#else +/* + * returns -1 if error message printed, + * 0 on success, + * errno value if error and no error message printed + */ +static int +pokeServers(void) +{ + int code; + + code = pioctl(0, VIOC_SETSPREFS, &gblob, 1); + if (code && (errno == EINVAL)) { + struct setspref *ssp; + ssp = (struct setspref *)gblob.in; + if (!(ssp->flags & DBservers)) { + gblob.in = (void *)&(ssp->servers[0]); + gblob.in_size -= ((char *)&(ssp->servers[0])) - (char *)ssp; + code = pioctl(0, VIOC_SETSPREFS33, &gblob, 1); + return code ? errno : 0; + } + fprintf(stderr, + "This cache manager does not support VL server preferences.\n"); + return -1; + } + + return code ? errno : 0; +} +#endif /* WIN32 */ -static addServer(name, rank) - char *name; - unsigned short rank; +#ifdef WIN32 +static int +addServer(char *name, unsigned short rank) { - int code; - cm_SSetPref_t *ssp; - cm_SPref_t *sp; - struct hostent *thostent; + int code; + cm_SSetPref_t *ssp; + cm_SPref_t *sp; + struct hostent *thostent; #ifndef MAXUSHORT #ifdef MAXSHORT @@ -2571,33 +2939,89 @@ static addServer(name, rank) #endif #endif - code = 0; - thostent = hostutil_GetHostByName(name); - if (!thostent) { - fprintf (stderr, "%s: couldn't resolve name.\n", name); - return EINVAL; - } + code = 0; + thostent = hostutil_GetHostByName(name); + if (!thostent) { + fprintf (stderr, "%s: couldn't resolve name.\n", name); + return EINVAL; + } - ssp = (cm_SSetPref_t *)(gblob.in); + ssp = (cm_SSetPref_t *)(gblob.in); - if (gblob.in_size > MAXINSIZE - sizeof(cm_SPref_t)) { - code = pokeServers(); - ssp->num_servers = 0; - } + if (gblob.in_size > MAXINSIZE - sizeof(cm_SPref_t)) { + code = pokeServers(); + ssp->num_servers = 0; + } - sp = (cm_SPref_t *)((char*)gblob.in + gblob.in_size); - memcpy (&(sp->host.s_addr), thostent->h_addr, sizeof(afs_uint32)); - sp->rank = (rank > MAXUSHORT ? MAXUSHORT : rank); - gblob.in_size += sizeof(cm_SPref_t); - ssp->num_servers++; + sp = (cm_SPref_t *)((char*)gblob.in + gblob.in_size); + memcpy (&(sp->host.s_addr), thostent->h_addr, sizeof(afs_uint32)); + sp->rank = (rank > MAXUSHORT ? MAXUSHORT : rank); + gblob.in_size += sizeof(cm_SPref_t); + ssp->num_servers++; - if (debug) fprintf(stderr, "adding server %s, rank %d, ip addr 0x%lx\n",name,sp->rank,sp->host.s_addr); - - return code; -} + if (debug) fprintf(stderr, "adding server %s, rank %d, ip addr 0x%lx\n",name,sp->rank,sp->host.s_addr); -static BOOL IsWindowsNT (void) -{ + return code; +} +#else +/* + * returns -1 if error message printed, + * 0 on success, + * errno value if error and no error message printed + */ +static int +addServer(char *name, afs_int32 rank) +{ + int t, code; + struct setspref *ssp; + struct spref *sp; + struct hostent *thostent; + afs_uint32 addr; + int error = 0; + +#ifndef MAXUSHORT +#ifdef MAXSHORT +#define MAXUSHORT ((unsigned short) 2*MAXSHORT+1) /* assumes two's complement binary system */ +#else +#define MAXUSHORT ((unsigned short) ~0) +#endif +#endif + + thostent = hostutil_GetHostByName(name); + if (!thostent) { + fprintf(stderr, "%s: couldn't resolve name.\n", name); + return -1; + } + + ssp = (struct setspref *)(gblob.in); + + for (t = 0; thostent->h_addr_list[t]; t++) { + if (gblob.in_size > MAXINSIZE - sizeof(struct spref)) { + code = pokeServers(); + if (code) + error = code; + ssp->num_servers = 0; + } + + sp = (struct spref *)(gblob.in + gblob.in_size); + memcpy(&(sp->server.s_addr), thostent->h_addr_list[t], + sizeof(afs_uint32)); + sp->rank = (rank > MAXUSHORT ? MAXUSHORT : rank); + gblob.in_size += sizeof(struct spref); + ssp->num_servers++; + + if (debug) + fprintf(stderr, "adding server %s, rank %d, ip addr 0x%lx\n", + name, sp->rank, sp->server.s_addr); + } + + return error; +} +#endif /* WIN32 */ + +#ifdef WIN32 +static BOOL IsWindowsNT (void) +{ static BOOL fChecked = FALSE; static BOOL fIsWinNT = FALSE; @@ -2618,178 +3042,351 @@ static BOOL IsWindowsNT (void) } return fIsWinNT; } +#endif /* WIN32 */ - -static SetPrefCmd(as) -register struct cmd_syndesc *as; { - FILE *infd; - afs_int32 code; - struct cmd_item *ti; - char name[80]; - afs_int32 rank; - cm_SSetPref_t *ssp; +#ifdef WIN32 +static int +SetPrefCmd(struct cmd_syndesc *as, char * arock) +{ + FILE *infd; + afs_int32 code; + struct cmd_item *ti; + char name[80]; + afs_int32 rank; + cm_SSetPref_t *ssp; - ssp = (cm_SSetPref_t *)space; - ssp->flags = 0; - ssp->num_servers = 0; - gblob.in_size = ((char*)&(ssp->servers[0])) - (char *)ssp; - gblob.in = space; - gblob.out = space; - gblob.out_size = MAXSIZE; + ssp = (cm_SSetPref_t *)space; + ssp->flags = 0; + ssp->num_servers = 0; + gblob.in_size = ((char*)&(ssp->servers[0])) - (char *)ssp; + gblob.in = space; + gblob.out = space; + gblob.out_size = MAXSIZE; -#ifdef WIN32 if ( !IsAdmin() ) { fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n"); return EACCES; } -#else /* WIN32 */ - if (geteuid()) { - fprintf (stderr,"Permission denied: requires root access.\n"); - return EACCES; + + code = 0; + + ti = as->parms[2].items; /* -file */ + if (ti) { + if (debug) fprintf(stderr,"opening file %s\n",ti->data); + if (!(infd = fopen(ti->data,"r" ))) { + code = errno; + Die(errno,ti->data); + } + else + while ( fscanf(infd, "%79s%ld", name, &rank) != EOF) { + code = addServer (name, (unsigned short) rank); + } } -#endif /* WIN32 */ - code = 0; + ti = as->parms[3].items; /* -stdin */ + if (ti) { + while ( scanf("%79s%ld", name, &rank) != EOF) { + code = addServer (name, (unsigned short) rank); + } + } - ti = as->parms[2].items; /* -file */ - if (ti) { - if (debug) fprintf(stderr,"opening file %s\n",ti->data); - if (!(infd = fopen(ti->data,"r" ))) { - code = errno; - Die(errno,ti->data); + for (ti = as->parms[0].items;ti;ti=ti->next) {/*list of servers, ranks */ + if (ti) { + if (!ti->next) { + break; + } + code = addServer (ti->data, (unsigned short) atol(ti->next->data)); + if (debug) + printf("set fs prefs %s %s\n", ti->data, ti->next->data); + ti=ti->next; + } } - else - while ( fscanf(infd, "%79s%ld", name, &rank) != EOF) { - code = addServer (name, (unsigned short) rank); - } - } + code = pokeServers(); + if (debug) + printf("now working on vlservers, code=%d, errno=%d\n",code,errno); + + ssp = (cm_SSetPref_t *)space; + gblob.in_size = ((char*)&(ssp->servers[0])) - (char *)ssp; + gblob.in = space; + ssp->flags = CM_SPREF_VLONLY; + ssp->num_servers = 0; - ti = as->parms[3].items; /* -stdin */ - if (ti) { - while ( scanf("%79s%ld", name, &rank) != EOF) { - code = addServer (name, (unsigned short) rank); + for (ti = as->parms[1].items;ti;ti=ti->next) { /* list of dbservers, ranks */ + if (ti) { + if (!ti->next) { + break; + } + code = addServer (ti->data, (unsigned short) atol(ti->next->data)); + if (debug) + printf("set vl prefs %s %s\n", ti->data, ti->next->data); + ti=ti->next; + } } - } - - for (ti = as->parms[0].items;ti;ti=ti->next) {/*list of servers, ranks */ + + if (as->parms[1].items) { + if (debug) + printf("now poking vlservers\n"); + code = pokeServers(); + } + + if (code) + Die(errno,0); + + return code; +} +#else +static int +SetPrefCmd(struct cmd_syndesc *as, char *arock) +{ + FILE *infd; + afs_int32 code; + struct cmd_item *ti; + char name[80]; + afs_int32 rank; + struct setspref *ssp; + int error = 0; /* -1 means error message printed, + * >0 means errno value for unprinted message */ + + ssp = (struct setspref *)space; + ssp->flags = 0; + ssp->num_servers = 0; + gblob.in_size = ((char *)&(ssp->servers[0])) - (char *)ssp; + gblob.in = space; + gblob.out = space; + gblob.out_size = MAXSIZE; + + + if (geteuid()) { + fprintf(stderr, "Permission denied: requires root access.\n"); + return 1; + } + + ti = as->parms[2].items; /* -file */ if (ti) { - if (!ti->next) { - break; - } - code = addServer (ti->data, (unsigned short) atol(ti->next->data)); - if (debug) - printf("set fs prefs %s %s\n", ti->data, ti->next->data); - ti=ti->next; - } - } - code = pokeServers(); - if (debug) - printf("now working on vlservers, code=%d, errno=%d\n",code,errno); - - ssp = (cm_SSetPref_t *)space; - gblob.in_size = ((char*)&(ssp->servers[0])) - (char *)ssp; - gblob.in = space; - ssp->flags = CM_SPREF_VLONLY; - ssp->num_servers = 0; - - for (ti = as->parms[1].items;ti;ti=ti->next) { /* list of dbservers, ranks */ + if (debug) + fprintf(stderr, "opening file %s\n", ti->data); + if (!(infd = fopen(ti->data, "r"))) { + perror(ti->data); + error = -1; + } else { + while (fscanf(infd, "%79s%ld", name, &rank) != EOF) { + code = addServer(name, (unsigned short)rank); + if (code) + error = code; + } + } + } + + ti = as->parms[3].items; /* -stdin */ if (ti) { - if (!ti->next) { - break; - } - code = addServer (ti->data, (unsigned short) atol(ti->next->data)); - if (debug) - printf("set vl prefs %s %s\n", ti->data, ti->next->data); - ti=ti->next; + while (scanf("%79s%ld", name, &rank) != EOF) { + code = addServer(name, (unsigned short)rank); + if (code) + error = code; + } } - } - if (as->parms[1].items) { - if (debug) - printf("now poking vlservers\n"); + for (ti = as->parms[0].items; ti; ti = ti->next) { /* list of servers, ranks */ + if (ti) { + if (!ti->next) { + break; + } + code = addServer(ti->data, (unsigned short)atol(ti->next->data)); + if (code) + error = code; + if (debug) + printf("set fs prefs %s %s\n", ti->data, ti->next->data); + ti = ti->next; + } + } code = pokeServers(); - } + if (code) + error = code; + if (debug) + printf("now working on vlservers, code=%d\n", code); -if (code) - Die(errno,0); + ssp = (struct setspref *)space; + ssp->flags = DBservers; + ssp->num_servers = 0; + gblob.in_size = ((char *)&(ssp->servers[0])) - (char *)ssp; + gblob.in = space; -return code; -} + for (ti = as->parms[1].items; ti; ti = ti->next) { /* list of dbservers, ranks */ + if (ti) { + if (!ti->next) { + break; + } + code = addServer(ti->data, (unsigned short)atol(ti->next->data)); + if (code) + error = code; + if (debug) + printf("set vl prefs %s %s\n", ti->data, ti->next->data); + ti = ti->next; + } + } + + if (as->parms[1].items) { + if (debug) + printf("now poking vlservers\n"); + code = pokeServers(); + if (code) + error = code; + } + + if (error > 0) + Die(error, 0); + return error ? 1 : 0; +} +#endif /* WIN32 */ -static GetPrefCmd(as) -register struct cmd_syndesc *as; { - afs_int32 code; - struct cmd_item *ti; - char *name, tbuffer[20]; - afs_int32 addr; - FILE * outfd; - int resolve; - int vlservers; - struct ViceIoctl blob; - struct cm_SPrefRequest *in; - struct cm_SPrefInfo *out; - int i; +#ifdef WIN32 +static int +GetPrefCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; + struct cmd_item *ti; + char *name, tbuffer[20]; + afs_int32 addr; + FILE * outfd; + int resolve; + int vlservers; + struct ViceIoctl blob; + struct cm_SPrefRequest *in; + struct cm_SPrefInfo *out; + int i; - code = 0; - ti = as->parms[0].items; /* -file */ - if (ti) { - if (debug) fprintf(stderr,"opening file %s\n",ti->data); - if (!(outfd = freopen(ti->data,"w",stdout))) { - Die(errno,ti->data); - return errno; - } - } - - ti = as->parms[1].items; /* -numeric */ - resolve = !(ti); - ti = as->parms[2].items; /* -vlservers */ - vlservers = (ti ? CM_SPREF_VLONLY : 0); -/* ti = as->parms[3].items; -cell */ - - in = (struct cm_SPrefRequest *)space; - in->offset = 0; - - do { - blob.in_size=sizeof(struct cm_SPrefRequest); - blob.in = (char *)in; - blob.out = space; - blob.out_size = MAXSIZE; + code = 0; + ti = as->parms[0].items; /* -file */ + if (ti) { + if (debug) fprintf(stderr,"opening file %s\n",ti->data); + if (!(outfd = freopen(ti->data,"w",stdout))) { + Die(errno,ti->data); + return errno; + } + } + + ti = as->parms[1].items; /* -numeric */ + resolve = !(ti); + ti = as->parms[2].items; /* -vlservers */ + vlservers = (ti ? CM_SPREF_VLONLY : 0); + /* ti = as->parms[3].items; -cell */ + + in = (struct cm_SPrefRequest *)space; + in->offset = 0; + + do { + blob.in_size=sizeof(struct cm_SPrefRequest); + blob.in = (char *)in; + blob.out = space; + blob.out_size = MAXSIZE; + + in->num_servers = (MAXSIZE - 2*sizeof(short))/sizeof(struct cm_SPref); + in->flags = vlservers; + + code = pioctl(0, VIOC_GETSPREFS, &blob, 1); + if (code){ + perror("getserverprefs pioctl"); + Die (errno,0); + } + else { + out = (struct cm_SPrefInfo *) blob.out; + + for (i=0;inum_servers;i++) { + if (resolve) { + name = hostutil_GetNameByINet(out->servers[i].host.s_addr); + } + else { + addr = ntohl(out->servers[i].host.s_addr); + sprintf(tbuffer, "%d.%d.%d.%d", (addr>>24) & 0xff, (addr>>16) & 0xff, + (addr>>8) & 0xff, addr & 0xff); + name=tbuffer; + } + printf ("%-50s %5u\n",name,out->servers[i].rank); + } + + in->offset = out->next_offset; + } + } while (!code && out->next_offset > 0); - in->num_servers = (MAXSIZE - 2*sizeof(short))/sizeof(struct cm_SPref); - in->flags = vlservers; + return code; +} +#else +static int +GetPrefCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; + struct cmd_item *ti; + char *name, tbuffer[20]; + afs_int32 rank, addr; + FILE *outfd; + int resolve; + int vlservers = 0; + struct ViceIoctl blob; + struct sprefrequest *in; + struct sprefinfo *out; + int i; - code = pioctl(0, VIOC_GETSPREFS, &blob, 1); - if (code){ - perror("getserverprefs pioctl"); - Die (errno,0); + ti = as->parms[0].items; /* -file */ + if (ti) { + if (debug) + fprintf(stderr, "opening file %s\n", ti->data); + if (!(outfd = freopen(ti->data, "w", stdout))) { + perror(ti->data); + return 1; + } } - else { - out = (struct cm_SPrefInfo *) blob.out; - for (i=0;inum_servers;i++) { - if (resolve) { - name = hostutil_GetNameByINet(out->servers[i].host.s_addr); + ti = as->parms[1].items; /* -numeric */ + resolve = !(ti); + ti = as->parms[2].items; /* -vlservers */ + vlservers |= (ti ? DBservers : 0); + /* ti = as->parms[3].items; -cell */ + + in = (struct sprefrequest *)space; + in->offset = 0; + + do { + blob.in_size = sizeof(struct sprefrequest); + blob.in = (char *)in; + blob.out = space; + blob.out_size = MAXSIZE; + + in->num_servers = + (MAXSIZE - 2 * sizeof(short)) / sizeof(struct spref); + in->flags = vlservers; + + code = pioctl(0, VIOC_GETSPREFS, &blob, 1); + if (code) { + perror("getserverprefs pioctl"); + return 1; } - else { - addr = ntohl(out->servers[i].host.s_addr); - sprintf(tbuffer, "%d.%d.%d.%d", (addr>>24) & 0xff, (addr>>16) & 0xff, - (addr>>8) & 0xff, addr & 0xff); - name=tbuffer; + + out = (struct sprefinfo *)blob.out; + + for (i = 0; i < out->num_servers; i++) { + if (resolve) { + name = hostutil_GetNameByINet(out->servers[i].server.s_addr); + } else { + addr = ntohl(out->servers[i].server.s_addr); + sprintf(tbuffer, "%d.%d.%d.%d", (addr >> 24) & 0xff, + (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff); + name = tbuffer; + } + printf("%-50s %5u\n", name, out->servers[i].rank); } - printf ("%-50s %5u\n",name,out->servers[i].rank); - } - - in->offset = out->next_offset; - } - } while (!code && out->next_offset > 0); - return code; + in->offset = out->next_offset; + } while (out->next_offset > 0); + + return 0; } +#endif /* WIN32 */ -static TraceCmd(struct cmd_syndesc *asp) +static int +TraceCmd(struct cmd_syndesc *asp, char *arock) { - long code; + long code; struct ViceIoctl blob; long inValue; long outValue; @@ -2807,177 +3404,676 @@ static TraceCmd(struct cmd_syndesc *asp) #endif /* WIN32 */ if ((asp->parms[0].items && asp->parms[1].items)) { - fprintf(stderr, "fs trace: must use at most one of '-off' or '-on'\n"); + fprintf(stderr, "fs trace: must use at most one of '-off' or '-on'\n"); return EINVAL; } - /* determine if we're turning this tracing on or off */ - inValue = 0; + /* determine if we're turning this tracing on or off */ + inValue = 0; if (asp->parms[0].items) inValue = 3; /* enable */ - else if (asp->parms[1].items) inValue = 2; /* disable */ - if (asp->parms[2].items) inValue |= 4; /* do reset */ - if (asp->parms[3].items) inValue |= 8; /* dump */ + else if (asp->parms[1].items) + inValue = 2; /* disable */ + if (asp->parms[2].items) + inValue |= 4; /* do reset */ + if (asp->parms[3].items) + inValue |= 8; /* dump */ blob.in_size = sizeof(long); blob.in = (char *) &inValue; blob.out_size = sizeof(long); blob.out = (char *) &outValue; - code = pioctl(NULL, VIOC_TRACECTL, &blob, 1); + code = pioctl(NULL, VIOC_TRACECTL, &blob, 1); + if (code) { + Die(errno, NULL); + return code; + } + + if (outValue) + printf("AFS tracing enabled.\n"); + else + printf("AFS tracing disabled.\n"); + + return 0; +} + +static void sbusage(void) +{ + fprintf(stderr, "example usage: %s storebehind -files *.o -kb 99999 -default 0\n", pn); + fprintf(stderr, " %s sb 50000 *.[ao] -default 10\n", pn); +} + +/* fs sb -kbytes 9999 -files *.o -default 64 */ +static int +StoreBehindCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code = 0; + struct ViceIoctl blob; + struct cmd_item *ti; + struct sbstruct tsb, tsb2; + int verbose = 0; + afs_int32 allfiles; + char *t; + int error = 0; + +#ifdef WIN32 + if ( !IsAdmin() ) { + fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n"); + return EACCES; + } +#endif /* WIN32 */ + + tsb.sb_thisfile = -1; + ti = as->parms[0].items; /* -kbytes */ + if (ti) { + if (!as->parms[1].items) { + fprintf(stderr, "%s: you must specify -files with -kbytes.\n", + pn); + return 1; + } + tsb.sb_thisfile = strtol(ti->data, &t, 10) * 1024; + if ((tsb.sb_thisfile < 0) || (t != ti->data + strlen(ti->data))) { + fprintf(stderr, "%s: %s must be 0 or a positive number.\n", pn, + ti->data); + return 1; + } + } + + allfiles = tsb.sb_default = -1; /* Don't set allfiles yet */ + ti = as->parms[2].items; /* -allfiles */ + if (ti) { + allfiles = strtol(ti->data, &t, 10) * 1024; + if ((allfiles < 0) || (t != ti->data + strlen(ti->data))) { + fprintf(stderr, "%s: %s must be 0 or a positive number.\n", pn, + ti->data); + return 1; + } + } + + /* -verbose or -file only or no options */ + if (as->parms[3].items || (as->parms[1].items && !as->parms[0].items) + || (!as->parms[0].items && !as->parms[1].items + && !as->parms[2].items)) + verbose = 1; + + blob.in = (char *)&tsb; + blob.out = (char *)&tsb2; + blob.in_size = blob.out_size = sizeof(struct sbstruct); + memset(&tsb2, 0, sizeof(tsb2)); + + /* once per -file */ + for (ti = as->parms[1].items; ti; ti = ti->next) { + /* Do this solely to see if the file is there */ + code = pioctl(ti->data, VIOCWHEREIS, &blob, 1); + if (code) { + Die(errno, ti->data); + error = 1; + continue; + } + + code = pioctl(ti->data, VIOC_STOREBEHIND, &blob, 1); if (code) { - Die(errno, NULL); - return code; + Die(errno, ti->data); + error = 1; + continue; } - - if (outValue) printf("AFS tracing enabled.\n"); - else printf("AFS tracing disabled.\n"); - return 0; -} + if (verbose && (blob.out_size == sizeof(tsb2))) { + if (tsb2.sb_thisfile == -1) { + fprintf(stdout, "Will store %s according to default.\n", + ti->data); + } else { + fprintf(stdout, + "Will store up to %d kbytes of %s asynchronously.\n", + (tsb2.sb_thisfile / 1024), ti->data); + } + } + } + + /* If no files - make at least one pioctl call, or + * set the allfiles default if we need to. + */ + if (!as->parms[1].items || (allfiles != -1)) { + tsb.sb_default = allfiles; + code = pioctl(0, VIOC_STOREBEHIND, &blob, 1); + if (code) { + Die(errno, ((allfiles == -1) ? 0 : "-allfiles")); + error = 1; + } + } + + /* Having no arguments also reports the default store asynchrony */ + if (verbose && (blob.out_size == sizeof(tsb2))) { + fprintf(stdout, "Default store asynchrony is %d kbytes.\n", + (tsb2.sb_default / 1024)); + } + + return error; +} + +static afs_int32 +SetCryptCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code = 0, flag; + struct ViceIoctl blob; + char *tp; + +#ifdef WIN32 + if ( !IsAdmin() ) { + fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n"); + return EACCES; + } +#endif /* WIN32 */ + + tp = as->parms[0].items->data; + if (strcmp(tp, "on") == 0) + flag = 1; + else if (strcmp(tp, "off") == 0) + flag = 0; + else { + fprintf (stderr, "%s: %s must be \"on\" or \"off\".\n", pn, tp); + return EINVAL; + } + + blob.in = (char *) &flag; + blob.in_size = sizeof(flag); + blob.out_size = 0; + code = pioctl(0, VIOC_SETRXKCRYPT, &blob, 1); + if (code) + Die(code, NULL); + return 0; +} + +static afs_int32 +GetCryptCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code = 0, flag; + struct ViceIoctl blob; + char *tp; + + blob.in = NULL; + blob.in_size = 0; + blob.out_size = sizeof(flag); + blob.out = space; + + code = pioctl(0, VIOC_GETRXKCRYPT, &blob, 1); + + if (code) + Die(code, NULL); + else { + tp = space; + memcpy(&flag, tp, sizeof(afs_int32)); + printf("Security level is currently "); + if (flag == 1) + printf("crypt (data security).\n"); + else + printf("clear.\n"); + } + return 0; +} + +static int +MemDumpCmd(struct cmd_syndesc *asp, char *arock) +{ + long code; + struct ViceIoctl blob; + long inValue; + long outValue; + + if ((asp->parms[0].items && asp->parms[1].items)) { + fprintf(stderr, "%s trace: must use at most one of '-begin' or '-end'\n", pn); + return EINVAL; + } + + /* determine if we're turning this tracing on or off */ + inValue = 0; + if (asp->parms[0].items) + inValue = 1; /* begin */ + else if (asp->parms[1].items) + inValue = 0; /* end */ + + blob.in_size = sizeof(long); + blob.in = (char *) &inValue; + blob.out_size = sizeof(long); + blob.out = (char *) &outValue; + + code = pioctl(NULL, VIOC_TRACEMEMDUMP, &blob, 1); + if (code) { + Die(errno, NULL); + return code; + } + + if (outValue) printf("AFS memdump begin.\n"); + else printf("AFS memdump end.\n"); + + return 0; +} + +static int +CSCPolicyCmd(struct cmd_syndesc *asp, char *arock) +{ + struct cmd_item *ti; + char *share = NULL; + HKEY hkCSCPolicy; + + for(ti=asp->parms[0].items; ti;ti=ti->next) { + share = ti->data; + if (share) + { + break; + } + } + + if (share) + { + char *policy; + + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\CSCPolicy", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_WRITE, + NULL, + &hkCSCPolicy, + NULL ); + + if ( hkCSCPolicy == NULL ) { + fprintf (stderr,"Permission denied: requires Administrator access.\n"); + return EACCES; + } + + if ( !IsAdmin() ) { + fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n"); + RegCloseKey(hkCSCPolicy); + return EACCES; + } + + policy = "manual"; + + if (asp->parms[1].items) + policy = "manual"; + if (asp->parms[2].items) + policy = "programs"; + if (asp->parms[3].items) + policy = "documents"; + if (asp->parms[4].items) + policy = "disable"; + + RegSetValueEx( hkCSCPolicy, share, 0, REG_SZ, policy, strlen(policy)+1); + + printf("CSC policy on share \"%s\" changed to \"%s\".\n\n", share, policy); + printf("Close all applications that accessed files on this share or restart AFS Client for the change to take effect.\n"); + } + else + { + DWORD dwIndex, dwPolicies; + char policyName[256]; + DWORD policyNameLen; + char policy[256]; + DWORD policyLen; + DWORD dwType; + + /* list current csc policies */ + + RegCreateKeyEx( HKEY_LOCAL_MACHINE, + "SOFTWARE\\OpenAFS\\Client\\CSCPolicy", + 0, + "AFS", + REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_QUERY_VALUE, + NULL, + &hkCSCPolicy, + NULL ); + + RegQueryInfoKey( hkCSCPolicy, + NULL, /* lpClass */ + NULL, /* lpcClass */ + NULL, /* lpReserved */ + NULL, /* lpcSubKeys */ + NULL, /* lpcMaxSubKeyLen */ + NULL, /* lpcMaxClassLen */ + &dwPolicies, /* lpcValues */ + NULL, /* lpcMaxValueNameLen */ + NULL, /* lpcMaxValueLen */ + NULL, /* lpcbSecurityDescriptor */ + NULL /* lpftLastWriteTime */ + ); + + printf("Current CSC policies:\n"); + for ( dwIndex = 0; dwIndex < dwPolicies; dwIndex ++ ) { + + policyNameLen = sizeof(policyName); + policyLen = sizeof(policy); + RegEnumValue( hkCSCPolicy, dwIndex, policyName, &policyNameLen, NULL, + &dwType, policy, &policyLen); + + printf(" %s = %s\n", policyName, policy); + } + } + + RegCloseKey(hkCSCPolicy); + return (0); +} + +#ifndef WIN32 +/* get clients interface addresses */ +static int +GetClientAddrsCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; + struct cmd_item *ti; + char *name; + struct ViceIoctl blob; + struct sprefrequest *in; + struct sprefinfo *out; + + in = (struct sprefrequest *)space; + in->offset = 0; + + do { + blob.in_size = sizeof(struct sprefrequest); + blob.in = (char *)in; + blob.out = space; + blob.out_size = MAXSIZE; + + in->num_servers = + (MAXSIZE - 2 * sizeof(short)) / sizeof(struct spref); + /* returns addr in network byte order */ + code = pioctl(0, VIOC_GETCPREFS, &blob, 1); + if (code) { + perror("getClientInterfaceAddr pioctl"); + return 1; + } + + { + int i; + out = (struct sprefinfo *)blob.out; + for (i = 0; i < out->num_servers; i++) { + afs_int32 addr; + char tbuffer[32]; + addr = ntohl(out->servers[i].server.s_addr); + sprintf(tbuffer, "%d.%d.%d.%d", (addr >> 24) & 0xff, + (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff); + printf("%-50s\n", tbuffer); + } + in->offset = out->next_offset; + } + } while (out->next_offset > 0); + + return 0; +} + +static int +SetClientAddrsCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code, addr; + struct cmd_item *ti; + char name[80]; + struct ViceIoctl blob; + struct setspref *ssp; + int sizeUsed = 0, i, flag; + afs_int32 existingAddr[1024]; /* existing addresses on this host */ + int existNu; + int error = 0; + + ssp = (struct setspref *)space; + ssp->num_servers = 0; + blob.in = space; + blob.out = space; + blob.out_size = MAXSIZE; + + if (geteuid()) { + fprintf(stderr, "Permission denied: requires root access.\n"); + return 1; + } + + /* extract all existing interface addresses */ + existNu = rx_getAllAddr(existingAddr, 1024); + if (existNu < 0) + return 1; + + sizeUsed = sizeof(struct setspref); /* space used in ioctl buffer */ + for (ti = as->parms[0].items; ti; ti = ti->next) { + if (sizeUsed >= sizeof(space)) { + fprintf(stderr, "No more space\n"); + return 1; + } + addr = extractAddr(ti->data, 20); /* network order */ + if ((addr == AFS_IPINVALID) || (addr == AFS_IPINVALIDIGNORE)) { + fprintf(stderr, "Error in specifying address: %s..ignoring\n", + ti->data); + error = 1; + continue; + } + /* see if it is an address that really exists */ + for (flag = 0, i = 0; i < existNu; i++) + if (existingAddr[i] == addr) { + flag = 1; + break; + } + if (!flag) { /* this is an nonexistent address */ + fprintf(stderr, "Nonexistent address: 0x%08x..ignoring\n", addr); + error = 1; + continue; + } + /* copy all specified addr into ioctl buffer */ + (ssp->servers[ssp->num_servers]).server.s_addr = addr; + printf("Adding 0x%08x\n", addr); + ssp->num_servers++; + sizeUsed += sizeof(struct spref); + } + if (ssp->num_servers < 1) { + fprintf(stderr, "No addresses specified\n"); + return 1; + } + blob.in_size = sizeUsed - sizeof(struct spref); + + code = pioctl(0, VIOC_SETCPREFS, &blob, 1); /* network order */ + if (code) { + Die(errno, 0); + error = 1; + } + + return error; +} + +static int +FlushMountCmd(struct cmd_syndesc *as, char *arock) +{ + afs_int32 code; + struct ViceIoctl blob; + struct cmd_item *ti; + char orig_name[1024]; /*Original name, may be modified */ + char true_name[1024]; /*``True'' dirname (e.g., symlink target) */ + char parent_dir[1024]; /*Parent directory of true name */ + char *last_component; /*Last component of true name */ + struct stat statbuff; /*Buffer for status info */ + int link_chars_read; /*Num chars read in readlink() */ + int thru_symlink; /*Did we get to a mount point via a symlink? */ + int error = 0; + + for (ti = as->parms[0].items; ti; ti = ti->next) { + /* once per file */ + thru_symlink = 0; + sprintf(orig_name, "%s%s", (ti->data[0] == '/') ? "" : "./", + ti->data); + + if (lstat(orig_name, &statbuff) < 0) { + /* if lstat fails, we should still try the pioctl, since it + * may work (for example, lstat will fail, but pioctl will + * work if the volume of offline (returning ENODEV). */ + statbuff.st_mode = S_IFDIR; /* lie like pros */ + } + + /* + * The lstat succeeded. If the given file is a symlink, substitute + * the file name with the link name. + */ + if ((statbuff.st_mode & S_IFMT) == S_IFLNK) { + thru_symlink = 1; + /* + * Read name of resolved file. + */ + link_chars_read = readlink(orig_name, true_name, 1024); + if (link_chars_read <= 0) { + fprintf(stderr, + "%s: Can't read target name for '%s' symbolic link!\n", + pn, orig_name); + error = 1; + continue; + } + + /* + * Add a trailing null to what was read, bump the length. + */ + true_name[link_chars_read++] = 0; + + /* + * If the symlink is an absolute pathname, we're fine. Otherwise, we + * have to create a full pathname using the original name and the + * relative symlink name. Find the rightmost slash in the original + * name (we know there is one) and splice in the symlink value. + */ + if (true_name[0] != '/') { + last_component = (char *)strrchr(orig_name, '/'); + strcpy(++last_component, true_name); + strcpy(true_name, orig_name); + } + } else + strcpy(true_name, orig_name); + + /* + * Find rightmost slash, if any. + */ + last_component = (char *)strrchr(true_name, '/'); + if (last_component) { + /* + * Found it. Designate everything before it as the parent directory, + * everything after it as the final component. + */ + strncpy(parent_dir, true_name, last_component - true_name); + parent_dir[last_component - true_name] = 0; + last_component++; /*Skip the slash */ + } else { + /* + * No slash appears in the given file name. Set parent_dir to the current + * directory, and the last component as the given name. + */ + strcpy(parent_dir, "."); + last_component = true_name; + } + + if (strcmp(last_component, ".") == 0 + || strcmp(last_component, "..") == 0) { + fprintf(stderr, + "%s: you may not use '.' or '..' as the last component\n", + pn); + fprintf(stderr, "%s: of a name in the 'fs flushmount' command.\n", + pn); + error = 1; + continue; + } + + blob.in = last_component; + blob.in_size = strlen(last_component) + 1; + blob.out_size = 0; + memset(space, 0, MAXSIZE); + + code = pioctl(parent_dir, VIOC_AFS_FLUSHMOUNT, &blob, 1); -static void sbusage() -{ - fprintf(stderr, "example usage: fs storebehind -files *.o -kb 99999 -default 0\n"); - fprintf(stderr, " fs sb 50000 *.[ao] -default 10\n"); + if (code != 0) { + if (errno == EINVAL) { + fprintf(stderr, "'%s' is not a mount point.\n", ti->data); + } else { + Die(errno, (ti->data ? ti->data : parent_dir)); + } + error = 1; + } + } + return error; } -static StoreBehindCmd(as) /* fs sb -kbytes 9999 -files *.o -default 64 */ -struct cmd_syndesc *as; { +static int +RxStatProcCmd(struct cmd_syndesc *as, char *arock) +{ afs_int32 code; + afs_int32 flags = 0; struct ViceIoctl blob; struct cmd_item *ti; - struct sbstruct tsb; - int kb; - -#ifdef WIN32 - if ( !IsAdmin() ) { - fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n"); - return EACCES; + + if (as->parms[0].items) { /* -enable */ + flags |= AFSCALL_RXSTATS_ENABLE; } -#else /* WIN32 */ - if (geteuid()) { - fprintf (stderr,"Permission denied: requires root access.\n"); - return EACCES; + if (as->parms[1].items) { /* -disable */ + flags |= AFSCALL_RXSTATS_DISABLE; } -#endif /* WIN32 */ - - if ((as->parms[0].items && as->parms[1].items) || - (!as->parms[0].items && !as->parms[1].items)) /* same as logical xor */ - ; - else { - sbusage(); - return EINVAL; + if (as->parms[2].items) { /* -clear */ + flags |= AFSCALL_RXSTATS_CLEAR; } - - ti=as->parms[2].items; - if (ti && ti->data) { - kb = atoi (ti->data); + if (flags == 0) { + fprintf(stderr, "You must specify at least one argument\n"); + return 1; } - else kb = -1; - tsb.sb_default = kb; - ti=as->parms[1].items; - if (ti && ti->data) { - kb = atoi (ti->data); + blob.in = (char *)&flags; + blob.in_size = sizeof(afs_int32); + blob.out_size = 0; + + code = pioctl(NULL, VIOC_RXSTAT_PROC, &blob, 1); + if (code != 0) { + Die(errno, NULL); + return 1; } - else kb = -1; - tsb.sb_thisfile = kb; - - ti=as->parms[0].items; - do { - /* once per file */ - blob.in = &tsb; - blob.out = &tsb; - blob.in_size = sizeof(tsb); - blob.out_size = sizeof(tsb); - fprintf (stderr, "storbehind %s %d %d\n", (ti?ti->data:0), - tsb.sb_thisfile, tsb.sb_default); - code = pioctl((ti ? ti->data : 0) , VIOC_STOREBEHIND, &blob, 1); - if (code) { - Die(errno, (ti ? ti->data : 0)); - continue; - } - if (blob.out_size == sizeof(tsb)) { - fprintf (stderr, "storbehind %s is now %d (default %d)\n", (ti?ti->data:0), - tsb.sb_thisfile, tsb.sb_default); - } - ti = (ti ? ti->next : ti); - } while (ti); return 0; } -static afs_int32 SetCryptCmd(as) - struct cmd_syndesc *as; +static int +RxStatPeerCmd(struct cmd_syndesc *as, char *arock) { - afs_int32 code = 0, flag; + afs_int32 code; + afs_int32 flags = 0; struct ViceIoctl blob; - char *tp; - -#ifdef WIN32 - if ( !IsAdmin() ) { - fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n"); - return EACCES; + struct cmd_item *ti; + + if (as->parms[0].items) { /* -enable */ + flags |= AFSCALL_RXSTATS_ENABLE; } -#else /* WIN32 */ - if (geteuid()) { - fprintf (stderr,"Permission denied: requires root access.\n"); - return EACCES; + if (as->parms[1].items) { /* -disable */ + flags |= AFSCALL_RXSTATS_DISABLE; } -#endif /* WIN32 */ - - tp = as->parms[0].items->data; - if (strcmp(tp, "on") == 0) - flag = 1; - else if (strcmp(tp, "off") == 0) - flag = 0; - else { - fprintf (stderr, "%s: %s must be \"on\" or \"off\".\n", pn, tp); - return EINVAL; + if (as->parms[2].items) { /* -clear */ + flags |= AFSCALL_RXSTATS_CLEAR; + } + if (flags == 0) { + fprintf(stderr, "You must specify at least one argument\n"); + return 1; } - blob.in = (char *) &flag; - blob.in_size = sizeof(flag); + blob.in = (char *)&flags; + blob.in_size = sizeof(afs_int32); blob.out_size = 0; - code = pioctl(0, VIOC_SETRXKCRYPT, &blob, 1); - if (code) - Die(code, (char *) 0); - return 0; -} - -static afs_int32 GetCryptCmd(as) - struct cmd_syndesc *as; -{ - afs_int32 code = 0, flag; - struct ViceIoctl blob; - char *tp; - - blob.in = (char *) 0; - blob.in_size = 0; - blob.out_size = sizeof(flag); - blob.out = space; - code = pioctl(0, VIOC_GETRXKCRYPT, &blob, 1); - - if (code) Die(code, (char *) 0); - else { - tp = space; - memcpy(&flag, tp, sizeof(afs_int32)); - printf("Security level is currently "); - if (flag == 1) - printf("crypt (data security).\n"); - else - printf("clear.\n"); + code = pioctl(NULL, VIOC_RXSTAT_PEER, &blob, 1); + if (code != 0) { + Die(errno, NULL); + return 1; } + return 0; } +#endif /* WIN32 */ + +#ifndef WIN32 +#include "AFS_component_version_number.c" +#endif -main(argc, argv) -int argc; -char **argv; { - register afs_int32 code; - register struct cmd_syndesc *ts; +main(int argc, char **argv) +{ + afs_int32 code; + struct cmd_syndesc *ts; #ifdef AFS_AIX32_ENV /* @@ -3000,10 +4096,20 @@ char **argv; { #endif /* WIN32 */ /* try to find volume location information */ - - osi_Init(); +#ifndef WIN32 + ts = cmd_CreateSyntax("getclientaddrs", GetClientAddrsCmd, 0, + "get client network interface addresses"); + cmd_CreateAlias(ts, "gc"); + + ts = cmd_CreateSyntax("setclientaddrs", SetClientAddrsCmd, 0, + "set client network interface addresses"); + cmd_AddParm(ts, "-address", CMD_LIST, CMD_OPTIONAL | CMD_EXPANDS, + "client network interfaces"); + cmd_CreateAlias(ts, "sc"); +#endif /* WIN32 */ + ts = cmd_CreateSyntax("setserverprefs", SetPrefCmd, 0, "set server ranks"); cmd_AddParm(ts, "-servers", CMD_LIST, CMD_OPTIONAL|CMD_EXPANDS, "fileserver names and ranks"); cmd_AddParm(ts, "-vlservers", CMD_LIST, CMD_OPTIONAL|CMD_EXPANDS, "VL server names and ranks"); @@ -3051,6 +4157,12 @@ char **argv; { ts = cmd_CreateSyntax("flush", FlushCmd, 0, "flush file from cache"); cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path"); +#ifndef WIN32 + ts = cmd_CreateSyntax("flushmount", FlushMountCmd, 0, + "flush mount symlink from cache"); + cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path"); +#endif + ts = cmd_CreateSyntax("setvol", SetVolCmd, 0, "set volume status"); cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path"); cmd_AddParm(ts, "-max", CMD_SINGLE, CMD_OPTIONAL, "disk space quota in 1K units"); @@ -3061,10 +4173,10 @@ char **argv; { cmd_AddParm(ts, "-offlinemsg", CMD_SINGLE, CMD_OPTIONAL, "offline message"); cmd_CreateAlias(ts, "sv"); - ts = cmd_CreateSyntax("messages", GagCmd, 0, "control Cache Manager messages"); + ts = cmd_CreateSyntax("messages", MessagesCmd, 0, "control Cache Manager messages"); cmd_AddParm(ts, "-show", CMD_SINGLE, CMD_OPTIONAL, "[user|console|all|none]"); - ts = cmd_CreateSyntax("examine", ExamineCmd, 0, "display volume status"); + ts = cmd_CreateSyntax("examine", ExamineCmd, 0, "display file/volume status"); cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path"); cmd_CreateAlias(ts, "lv"); cmd_CreateAlias(ts, "listvol"); @@ -3120,6 +4232,7 @@ char **argv; { ts = cmd_CreateSyntax("getcacheparms", GetCacheParmsCmd, 0, "get cache usage info"); ts = cmd_CreateSyntax("listcells", ListCellsCmd, 0, "list configured cells"); + cmd_AddParm(ts, "-numeric", CMD_FLAG, CMD_OPTIONAL, "addresses only"); ts = cmd_CreateSyntax("setquota", SetQuotaCmd, 0, "set volume quota"); cmd_AddParm(ts, "-path", CMD_SINGLE, CMD_OPTIONAL, "dir/file path"); @@ -3134,7 +4247,6 @@ char **argv; { cmd_AddParm(ts, "-name", CMD_SINGLE, 0, "cell name"); cmd_AddParm(ts, "-servers", CMD_LIST, CMD_REQUIRED, "primary servers"); cmd_AddParm(ts, "-linkedcell", CMD_SINGLE, CMD_OPTIONAL, "linked cell name"); -#endif #ifdef FS_ENABLE_SERVER_DEBUG_PORTS /* @@ -3147,6 +4259,12 @@ char **argv; { cmd_AddParm(ts, "-vlport", CMD_SINGLE, CMD_OPTIONAL, "cell's vldb server port"); #endif + ts = cmd_CreateSyntax("newalias", NewAliasCmd, 0, + "configure new cell alias"); + cmd_AddParm(ts, "-alias", CMD_SINGLE, 0, "alias name"); + cmd_AddParm(ts, "-name", CMD_SINGLE, 0, "real name of cell"); +#endif + ts = cmd_CreateSyntax("whichcell", WhichCellCmd, 0, "list file's cell"); cmd_AddParm(ts, "-path", CMD_LIST, CMD_OPTIONAL, "dir/file path"); @@ -3198,6 +4316,23 @@ char **argv; { ts = cmd_CreateSyntax("getcrypt", GetCryptCmd, 0, "get cache manager encryption flag"); +#ifndef WIN32 + ts = cmd_CreateSyntax("rxstatproc", RxStatProcCmd, 0, + "Manage per process RX statistics"); + cmd_AddParm(ts, "-enable", CMD_FLAG, CMD_OPTIONAL, "Enable RX stats"); + cmd_AddParm(ts, "-disable", CMD_FLAG, CMD_OPTIONAL, "Disable RX stats"); + cmd_AddParm(ts, "-clear", CMD_FLAG, CMD_OPTIONAL, "Clear RX stats"); + + ts = cmd_CreateSyntax("rxstatpeer", RxStatPeerCmd, 0, + "Manage per peer RX statistics"); + cmd_AddParm(ts, "-enable", CMD_FLAG, CMD_OPTIONAL, "Enable RX stats"); + cmd_AddParm(ts, "-disable", CMD_FLAG, CMD_OPTIONAL, "Disable RX stats"); + cmd_AddParm(ts, "-clear", CMD_FLAG, CMD_OPTIONAL, "Clear RX stats"); + + ts = cmd_CreateSyntax("setcbaddr", CallBackRxConnCmd, 0, "configure callback connection address"); + cmd_AddParm(ts, "-addr", CMD_SINGLE, CMD_OPTIONAL, "host name or address"); +#endif + ts = cmd_CreateSyntax("trace", TraceCmd, 0, "enable or disable CM tracing"); cmd_AddParm(ts, "-on", CMD_FLAG, CMD_OPTIONAL, "enable tracing"); cmd_AddParm(ts, "-off", CMD_FLAG, CMD_OPTIONAL, "disable tracing"); @@ -3219,30 +4354,36 @@ char **argv; { code = cmd_Dispatch(argc, argv); #ifndef WIN32 - if (rxInitDone) rx_Finalize(); + if (rxInitDone) + rx_Finalize(); #endif /* not WIN32 */ return code; } -void Die(code, filename) - int code; - char *filename; +static void +Die(int code, char *filename) { /*Die*/ if (code == EINVAL) { if (filename) fprintf(stderr,"%s: Invalid argument; it is possible that %s is not in AFS.\n", pn, filename); - else fprintf(stderr,"%s: Invalid argument.\n", pn); + else + fprintf(stderr,"%s: Invalid argument.\n", pn); } else if (code == ENOENT) { - if (filename) fprintf(stderr,"%s: File '%s' doesn't exist\n", pn, filename); - else fprintf(stderr,"%s: no such file returned\n", pn); + if (filename) + fprintf(stderr,"%s: File '%s' doesn't exist\n", pn, filename); + else + fprintf(stderr,"%s: no such file returned\n", pn); } - else if (code == EROFS) fprintf(stderr,"%s: You can not change a backup or readonly volume\n", pn); + else if (code == EROFS) + fprintf(stderr,"%s: You can not change a backup or readonly volume\n", pn); else if (code == EACCES || code == EPERM) { - if (filename) fprintf(stderr,"%s: You don't have the required access rights on '%s'\n", pn, filename); - else fprintf(stderr,"%s: You do not have the required rights to do this operation\n", pn); + if (filename) + fprintf(stderr,"%s: You don't have the required access rights on '%s'\n", pn, filename); + else + fprintf(stderr,"%s: You do not have the required rights to do this operation\n", pn); } else if (code == ENODEV) { fprintf(stderr,"%s: AFS service may not have started.\n", pn); @@ -3263,8 +4404,10 @@ void Die(code, filename) fprintf(stderr,"%s: Connection timed out", pn); } else { - if (filename) fprintf(stderr,"%s:'%s'", pn, filename); - else fprintf(stderr,"%s", pn); + if (filename) + fprintf(stderr,"%s:'%s'", pn, filename); + else + fprintf(stderr,"%s", pn); #ifdef WIN32 fprintf(stderr, ": code 0x%x\n", code); #else /* not WIN32 */ @@ -3273,144 +4416,3 @@ void Die(code, filename) } } /*Die*/ -static MemDumpCmd(struct cmd_syndesc *asp) -{ - long code; - struct ViceIoctl blob; - long inValue; - long outValue; - - if ((asp->parms[0].items && asp->parms[1].items)) { - fprintf(stderr, "fs trace: must use at most one of '-begin' or '-end'\n"); - return EINVAL; - } - - /* determine if we're turning this tracing on or off */ - inValue = 0; - if (asp->parms[0].items) - inValue = 1; /* begin */ - else if (asp->parms[1].items) - inValue = 0; /* end */ - - blob.in_size = sizeof(long); - blob.in = (char *) &inValue; - blob.out_size = sizeof(long); - blob.out = (char *) &outValue; - - code = pioctl(NULL, VIOC_TRACEMEMDUMP, &blob, 1); - if (code) { - Die(errno, NULL); - return code; - } - - if (outValue) printf("AFS memdump begin.\n"); - else printf("AFS memdump end.\n"); - - return 0; -} - -static CSCPolicyCmd(struct cmd_syndesc *asp) -{ - struct cmd_item *ti; - char *share = NULL; - HKEY hkCSCPolicy; - - for(ti=asp->parms[0].items; ti;ti=ti->next) { - share = ti->data; - if (share) - { - break; - } - } - - if (share) - { - char *policy; - - RegCreateKeyEx( HKEY_LOCAL_MACHINE, - "SOFTWARE\\OpenAFS\\Client\\CSCPolicy", - 0, - "AFS", - REG_OPTION_NON_VOLATILE, - KEY_WRITE, - NULL, - &hkCSCPolicy, - NULL ); - - if ( hkCSCPolicy == NULL ) { - fprintf (stderr,"Permission denied: requires Administrator access.\n"); - return EACCES; - } - - if ( !IsAdmin() ) { - fprintf (stderr,"Permission denied: requires AFS Client Administrator access.\n"); - RegCloseKey(hkCSCPolicy); - return EACCES; - } - - policy = "manual"; - - if (asp->parms[1].items) - policy = "manual"; - if (asp->parms[2].items) - policy = "programs"; - if (asp->parms[3].items) - policy = "documents"; - if (asp->parms[4].items) - policy = "disable"; - - RegSetValueEx( hkCSCPolicy, share, 0, REG_SZ, policy, strlen(policy)+1); - - printf("CSC policy on share \"%s\" changed to \"%s\".\n\n", share, policy); - printf("Close all applications that accessed files on this share or restart AFS Client for the change to take effect.\n"); - } - else - { - DWORD dwIndex, dwPolicies; - char policyName[256]; - DWORD policyNameLen; - char policy[256]; - DWORD policyLen; - DWORD dwType; - - /* list current csc policies */ - - RegCreateKeyEx( HKEY_LOCAL_MACHINE, - "SOFTWARE\\OpenAFS\\Client\\CSCPolicy", - 0, - "AFS", - REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_QUERY_VALUE, - NULL, - &hkCSCPolicy, - NULL ); - - RegQueryInfoKey( hkCSCPolicy, - NULL, /* lpClass */ - NULL, /* lpcClass */ - NULL, /* lpReserved */ - NULL, /* lpcSubKeys */ - NULL, /* lpcMaxSubKeyLen */ - NULL, /* lpcMaxClassLen */ - &dwPolicies, /* lpcValues */ - NULL, /* lpcMaxValueNameLen */ - NULL, /* lpcMaxValueLen */ - NULL, /* lpcbSecurityDescriptor */ - NULL /* lpftLastWriteTime */ - ); - - printf("Current CSC policies:\n"); - for ( dwIndex = 0; dwIndex < dwPolicies; dwIndex ++ ) { - - policyNameLen = sizeof(policyName); - policyLen = sizeof(policy); - RegEnumValue( hkCSCPolicy, dwIndex, policyName, &policyNameLen, NULL, - &dwType, policy, &policyLen); - - printf(" %s = %s\n", policyName, policy); - } - } - - RegCloseKey(hkCSCPolicy); - return (0); -} diff --git a/src/WINNT/afsd/fs.h b/src/WINNT/afsd/fs.h index cfd473e20..5f2c3bd0a 100644 --- a/src/WINNT/afsd/fs.h +++ b/src/WINNT/afsd/fs.h @@ -11,18 +11,17 @@ #define __FS_H_ENV__ 1 /* some forward references */ -extern void ZapList(struct AclEntry *); +static void ZapList (struct AclEntry *alist); -extern void ZapAcl(struct Acl *); +static int PruneList (struct AclEntry **ae, int dfs); -extern int PruneList (struct AclEntry **, int); +static int CleanAcl(struct Acl *aa, char *fname); -extern void ChangeList(struct Acl *, afs_int32, char *, afs_int32); +static int SetVolCmd(struct cmd_syndesc *as, char *arock); -extern int CleanAcl(struct Acl *); +static int GetCellName(char *cellNamep, struct afsconf_cell *infop); -extern void Die(int, char *); - -static SetVolCmd(struct cmd_syndesc *); +static int VLDBInit(int noAuthFlag, struct afsconf_cell *infop); +static void Die(int code, char *filename); #endif /* FS_H_ENV */ diff --git a/src/WINNT/afsd/fs_utils.c b/src/WINNT/afsd/fs_utils.c index dddbb342d..45014264b 100644 --- a/src/WINNT/afsd/fs_utils.c +++ b/src/WINNT/afsd/fs_utils.c @@ -121,6 +121,7 @@ long fs_GetFullPath(char *pathp, char *outPathp, long outSize) return 0; } +#ifdef COMMENT struct hostent *hostutil_GetHostByName(char *namep) { struct hostent *thp; @@ -149,6 +150,7 @@ char *hostutil_GetNameByINet(afs_uint32 addr) /* return static buffer */ return hostNameBuffer; } +#endif /* is this a digit or a digit-like thing? */ static int ismeta(ac, abase) diff --git a/src/WINNT/afsd/smb.c b/src/WINNT/afsd/smb.c index 573b9745c..365ca1b2d 100644 --- a/src/WINNT/afsd/smb.c +++ b/src/WINNT/afsd/smb.c @@ -779,9 +779,9 @@ smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana) smb_vc_t *vcp; lock_ObtainWrite(&smb_rctLock); - for(vcp = smb_allVCsp; vcp; vcp=vcp->nextp) { + for (vcp = smb_allVCsp; vcp; vcp=vcp->nextp) { if (lsn == vcp->lsn && lana == vcp->lana) { - vcp->refCount++; + smb_HoldVCNoLock(vcp); break; } } @@ -842,6 +842,11 @@ int smb_IsStarMask(char *maskp) return 0; } +void smb_ReleaseVCNoLock(smb_vc_t *vcp) +{ + osi_assert(vcp->refCount-- > 0); +} + void smb_ReleaseVC(smb_vc_t *vcp) { lock_ObtainWrite(&smb_rctLock); @@ -849,6 +854,11 @@ void smb_ReleaseVC(smb_vc_t *vcp) lock_ReleaseWrite(&smb_rctLock); } +void smb_HoldVCNoLock(smb_vc_t *vcp) +{ + vcp->refCount++; +} + void smb_HoldVC(smb_vc_t *vcp) { lock_ObtainWrite(&smb_rctLock); @@ -873,7 +883,7 @@ smb_tid_t *smb_FindTID(smb_vc_t *vcp, unsigned short tid, int flags) tidp->nextp = vcp->tidsp; tidp->refCount = 1; tidp->vcp = vcp; - vcp->refCount++; + smb_HoldVCNoLock(vcp); vcp->tidsp = tidp; lock_InitializeMutex(&tidp->mx, "tid_t mutex"); tidp->tid = tid; @@ -887,30 +897,27 @@ void smb_ReleaseTID(smb_tid_t *tidp) smb_tid_t *tp; smb_tid_t **ltpp; cm_user_t *userp; - smb_vc_t *vcp; userp = NULL; - vcp = NULL; lock_ObtainWrite(&smb_rctLock); osi_assert(tidp->refCount-- > 0); if (tidp->refCount == 0 && (tidp->flags & SMB_TIDFLAG_DELETE)) { ltpp = &tidp->vcp->tidsp; - for(tp = *ltpp; tp; ltpp = &tp->nextp, tp = *ltpp) { - if (tp == tidp) break; + for (tp = *ltpp; tp; ltpp = &tp->nextp, tp = *ltpp) { + if (tp == tidp) + break; } osi_assert(tp != NULL); *ltpp = tp->nextp; lock_FinalizeMutex(&tidp->mx); userp = tidp->userp; /* remember to drop ref later */ - vcp = tidp->vcp; + tidp->userp = NULL; + smb_ReleaseVCNoLock(tidp->vcp); + tidp->vcp = NULL; } lock_ReleaseWrite(&smb_rctLock); - if (userp) { + if (userp) cm_ReleaseUser(userp); - } - if (vcp) { - smb_ReleaseVC(vcp); - } } smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int flags) @@ -933,7 +940,7 @@ smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int flags) uidp->nextp = vcp->usersp; uidp->refCount = 1; uidp->vcp = vcp; - vcp->refCount++; + smb_HoldVCNoLock(vcp); vcp->usersp = uidp; lock_InitializeMutex(&uidp->mx, "user_t mutex"); uidp->userID = uid; @@ -992,10 +999,8 @@ void smb_ReleaseUID(smb_user_t *uidp) smb_user_t *up; smb_user_t **lupp; cm_user_t *userp; - smb_vc_t *vcp; userp = NULL; - vcp = NULL; lock_ObtainWrite(&smb_rctLock); osi_assert(uidp->refCount-- > 0); if (uidp->refCount == 0 && (uidp->flags & SMB_USERFLAG_DELETE)) { @@ -1007,10 +1012,10 @@ void smb_ReleaseUID(smb_user_t *uidp) *lupp = up->nextp; lock_FinalizeMutex(&uidp->mx); if (uidp->unp) { - userp = uidp->unp->userp; /* remember to drop ref later */ - uidp->unp->userp = NULL; + userp = uidp->unp->userp; /* avoid deadlock by releasing */ + uidp->unp->userp = NULL; /* after releasing the lock */ } - vcp = uidp->vcp; + smb_ReleaseVCNoLock(uidp->vcp); uidp->vcp = NULL; } lock_ReleaseWrite(&smb_rctLock); @@ -1018,9 +1023,6 @@ void smb_ReleaseUID(smb_user_t *uidp) cm_ReleaseUserVCRef(userp); cm_ReleaseUser(userp); } - if (vcp) { - smb_ReleaseVC(vcp); - } } /* retrieve a held reference to a user structure corresponding to an incoming @@ -1110,7 +1112,7 @@ smb_fid_t *smb_FindFID(smb_vc_t *vcp, unsigned short fid, int flags) } retry: - for(fidp = vcp->fidsp; fidp; fidp = (smb_fid_t *) osi_QNext(&fidp->q)) { + for (fidp = vcp->fidsp; fidp; fidp = (smb_fid_t *) osi_QNext(&fidp->q)) { if (fid == fidp->fid) { if (newFid) { fid++; @@ -1141,7 +1143,7 @@ smb_fid_t *smb_FindFID(smb_vc_t *vcp, unsigned short fid, int flags) osi_QAdd((osi_queue_t **)&vcp->fidsp, &fidp->q); fidp->refCount = 1; fidp->vcp = vcp; - vcp->refCount++; + smb_HoldVCNoLock(vcp); lock_InitializeMutex(&fidp->mx, "fid_t mutex"); fidp->fid = fid; fidp->curr_chunk = fidp->prev_chunk = -2; @@ -1170,24 +1172,30 @@ void smb_ReleaseFID(smb_fid_t *fidp) osi_assert(fidp->refCount-- > 0); if (fidp->refCount == 0 && (fidp->flags & SMB_FID_DELETE)) { vcp = fidp->vcp; - if (!(fidp->flags & SMB_FID_IOCTL)) + fidp->vcp = NULL; + if (!(fidp->flags & SMB_FID_IOCTL)) { scp = fidp->scp; + fidp->scp = NULL; + } + osi_QRemove((osi_queue_t **) &vcp->fidsp, &fidp->q); thrd_CloseHandle(fidp->raw_write_event); /* and see if there is ioctl stuff to free */ ioctlp = fidp->ioctlp; if (ioctlp) { - if (ioctlp->prefix) cm_FreeSpace(ioctlp->prefix); - if (ioctlp->inAllocp) free(ioctlp->inAllocp); - if (ioctlp->outAllocp) free(ioctlp->outAllocp); + if (ioctlp->prefix) + cm_FreeSpace(ioctlp->prefix); + if (ioctlp->inAllocp) + free(ioctlp->inAllocp); + if (ioctlp->outAllocp) + free(ioctlp->outAllocp); free(ioctlp); } free(fidp); - /* do not call smb_ReleaseVC() because we already have the lock */ - vcp->refCount--; + smb_ReleaseVCNoLock(vcp); } lock_ReleaseWrite(&smb_rctLock); @@ -1854,6 +1862,8 @@ static NCB *GetNCB(void) void smb_FreePacket(smb_packet_t *tbp) { + smb_vc_t * vcp = NULL; + osi_assert(tbp->magic == SMB_PACKETMAGIC); lock_ObtainWrite(&smb_globalLock); @@ -1861,6 +1871,7 @@ void smb_FreePacket(smb_packet_t *tbp) smb_packetFreeListp = tbp; tbp->magic = SMB_PACKETMAGIC; tbp->ncbp = NULL; + vcp = tbp->vcp; tbp->vcp = NULL; tbp->resumeCode = 0; tbp->inCount = 0; @@ -1871,6 +1882,9 @@ void smb_FreePacket(smb_packet_t *tbp) tbp->ncb_length = 0; tbp->flags = 0; lock_ReleaseWrite(&smb_globalLock); + + if (vcp) + smb_ReleaseVC(vcp); } static void FreeNCB(NCB *bufferp) @@ -2966,6 +2980,8 @@ void smb_WaitingLocksDaemon() cm_FreeSpace(inp->spacep); smb_FreePacket(inp); smb_FreePacket(outp); + if (vcp) + smb_ReleaseVC(vcp); FreeNCB(ncbp); free(wL); } while (nwL); @@ -3404,10 +3420,11 @@ long smb_ReceiveCoreSearchDir(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou memcpy(dsp->mask, mask, 11); /* track if this is likely to match a lot of entries */ - if (smb_IsStarMask(mask)) starPattern = 1; - else starPattern = 0; - } - else { + if (smb_IsStarMask(mask)) + starPattern = 1; + else + starPattern = 0; + } else { /* pull the next cookie value out of the search status block */ nextCookie = inCookiep[13] + (inCookiep[14]<<8) + (inCookiep[15]<<16) + (inCookiep[16]<<24); @@ -3837,7 +3854,7 @@ long smb_ReceiveCoreCheckPath(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *ou caseFold = CM_FLAG_CASEFOLD; code = smb_LookupTIDPath(vcp, ((smb_t *)inp)->tid, &tidPathp); - if(code) { + if (code) { cm_ReleaseUser(userp); return CM_ERROR_NOSUCHPATH; } diff --git a/src/WINNT/afsd/smb.h b/src/WINNT/afsd/smb.h index 4774e397b..d98fa59ca 100644 --- a/src/WINNT/afsd/smb.h +++ b/src/WINNT/afsd/smb.h @@ -436,6 +436,8 @@ extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana); extern void smb_ReleaseVC(smb_vc_t *vcp); +extern void smb_ReleaseVCNoLock(smb_vc_t *vcp); + extern smb_tid_t *smb_FindTID(smb_vc_t *vcp, unsigned short tid, int flags); extern void smb_ReleaseTID(smb_tid_t *tidp); @@ -513,6 +515,8 @@ extern void smb_MapNTError(long code, unsigned long *NTStatusp); extern void smb_HoldVC(smb_vc_t *vcp); +extern void smb_HoldVCNoLock(smb_vc_t *vcp); + /* some globals, too */ extern char *smb_localNamep; extern int loggedOut; diff --git a/src/WINNT/afsd/smb3.c b/src/WINNT/afsd/smb3.c index 9266d3773..f53e10cc7 100644 --- a/src/WINNT/afsd/smb3.c +++ b/src/WINNT/afsd/smb3.c @@ -100,7 +100,7 @@ int smb_V3IsStarMask(char *maskp) char tc; while (tc = *maskp++) - if (tc == '?' || tc == '*') + if (tc == '?' || tc == '*' || tc == '<' || tc == '>') return 1; return 0; } @@ -667,6 +667,8 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * /* extended authentication */ char *secBlobIn; int secBlobInLength; + + OutputDebugF("NT Session Setup: Extended"); if (!(vcp->flags & SMB_VCFLAG_SESSX_RCVD)) { caps = smb_GetSMBParm(inp,10) | (((unsigned long) smb_GetSMBParm(inp,11)) << 16); @@ -703,6 +705,11 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * char *primaryDomain; int datalen; + if (smb_authType == SMB_AUTH_NTLM) + OutputDebugF("NT Session Setup: NTLM"); + else + OutputDebugF("NT Session Setup: None"); + /* TODO: parse for extended auth as well */ ciPwdLength = smb_GetSMBParm(inp, 7); /* case insensitive password length */ csPwdLength = smb_GetSMBParm(inp, 8); /* case sensitive password length */ @@ -719,6 +726,11 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * accountName = smb_ParseString(tp, &tp); primaryDomain = smb_ParseString(tp, NULL); + OutputDebugF("Account Name: %s",accountName); + OutputDebugF("Primary Domain: %s", primaryDomain); + OutputDebugF("Case Sensitive Password: %s", csPwd && csPwd[0] ? "yes" : "no"); + OutputDebugF("Case Insensitive Password: %s", ciPwd && ciPwd[0] ? "yes" : "no"); + if (smb_GetNormalizedUsername(usern, accountName, primaryDomain)) { /* shouldn't happen */ code = CM_ERROR_BADSMB; @@ -732,6 +744,10 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * if (smb_authType == SMB_AUTH_NTLM) { code = smb_AuthenticateUserLM(vcp, accountName, primaryDomain, ciPwd, ciPwdLength, csPwd, csPwdLength); + if ( code ) + OutputDebugF("LM authentication failed [%d]", code); + else + OutputDebugF("LM authentication succeeded"); } } } else { /* V3 */ @@ -740,6 +756,16 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * char *accountName; char *primaryDomain; + switch ( smb_authType ) { + case SMB_AUTH_EXTENDED: + OutputDebugF("V3 Session Setup: Extended"); + break; + case SMB_AUTH_NTLM: + OutputDebugF("V3 Session Setup: NTLM"); + break; + default: + OutputDebugF("V3 Session Setup: None"); + } ciPwdLength = smb_GetSMBParm(inp, 7); tp = smb_GetSMBData(inp, NULL); ciPwd = tp; @@ -748,6 +774,10 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * accountName = smb_ParseString(tp, &tp); primaryDomain = smb_ParseString(tp, NULL); + OutputDebugF("Account Name: %s",accountName); + OutputDebugF("Primary Domain: %s", primaryDomain); + OutputDebugF("Case Insensitive Password: %s", ciPwd && ciPwd[0] ? "yes" : "no"); + if ( smb_GetNormalizedUsername(usern, accountName, primaryDomain)) { /* shouldn't happen */ code = CM_ERROR_BADSMB; @@ -759,6 +789,10 @@ long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t * */ if (smb_authType == SMB_AUTH_NTLM || smb_authType == SMB_AUTH_EXTENDED) { code = smb_AuthenticateUserLM(vcp,accountName,primaryDomain,ciPwd,ciPwdLength,"",0); + if ( code ) + OutputDebugF("LM authentication failed [%d]", code); + else + OutputDebugF("LM authentication succeeded"); } } @@ -1111,7 +1145,8 @@ smb_tran2Packet_t *smb_GetTran2ResponsePacket(smb_vc_t *vcp, /* free a tran2 packet; must be called with smb_globalLock held */ void smb_FreeTran2Packet(smb_tran2Packet_t *t2p) { - if (t2p->vcp) smb_ReleaseVC(t2p->vcp); + if (t2p->vcp) + smb_ReleaseVC(t2p->vcp); if (t2p->flags & SMB_TRAN2PFLAG_ALLOC) { if (t2p->parmsp) free(t2p->parmsp); @@ -3327,7 +3362,7 @@ VOID initUpperCaseTable(VOID) // BOOL : TRUE/FALSE (match/mistmatch) BOOL -szWildCardMatchFileName(PSZ pattern, PSZ name) +szWildCardMatchFileName(PSZ pattern, PSZ name, int casefold) { PSZ pename; // points to the last 'name' character PSZ p; @@ -3344,13 +3379,15 @@ szWildCardMatchFileName(PSZ pattern, PSZ name) if (*pattern == '\0') return TRUE; for (p = pename; p >= name; --p) { - if ((mapCaseTable[*p] == mapCaseTable[*pattern]) && - szWildCardMatchFileName(pattern + 1, p + 1)) + if ((casefold && (mapCaseTable[*p] == mapCaseTable[*pattern]) || + !casefold && (*p == *pattern)) && + szWildCardMatchFileName(pattern + 1, p + 1, casefold)) return TRUE; } /* endfor */ return FALSE; default: - if (mapCaseTable[*name] != mapCaseTable[*pattern]) + if ((casefold && mapCaseTable[*name] != mapCaseTable[*pattern]) || + (!casefold && *name != *pattern)) return FALSE; ++pattern, ++name; break; @@ -3369,12 +3406,14 @@ szWildCardMatchFileName(PSZ pattern, PSZ name) int smb_V3MatchMask(char *namep, char *maskp, int flags) { char * newmask; - int i, j, star, qmark, retval; + int i, j, star, qmark, casefold, retval; /* make sure we only match 8.3 names, if requested */ if ((flags & CM_FLAG_8DOT3) && !cm_Is8Dot3(namep)) return 0; + casefold = (flags & CM_FLAG_CASEFOLD) ? 1 : 0; + /* optimize the pattern: * if there is a mixture of '?' and '*', * for example the sequence "*?*?*?*" @@ -3411,7 +3450,7 @@ int smb_V3MatchMask(char *namep, char *maskp, int flags) } newmask[j++] = '\0'; - retval = szWildCardMatchFileName(newmask, namep) ? 1:0; + retval = szWildCardMatchFileName(newmask, namep, casefold) ? 1:0; free(newmask); return retval; @@ -3708,10 +3747,10 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t smb_StripLastComponent(spacep->data, NULL, pathp); code = smb_LookupTIDPath(vcp, p->tid, &tidPathp); if (code) { - lock_ReleaseMutex(&dsp->mx); cm_ReleaseUser(userp); smb_SendTran2Error(vcp, p, opx, CM_ERROR_NOFILES); smb_FreeTran2Packet(outp); + lock_ReleaseMutex(&dsp->mx); smb_DeleteDirSearch(dsp); smb_ReleaseDirSearch(dsp); return 0; @@ -4092,8 +4131,7 @@ long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t bytesInBuffer++; } } /* if we're including this name */ - else if (!NeedShortName && - !starPattern && + else if (!starPattern && !foundInexact && dep->fid.vnode != 0 && smb_V3MatchMask(dep->name, maskp, CM_FLAG_CASEFOLD)) { @@ -4337,8 +4375,10 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) * and truncate the file if we find it, otherwise we create the * file. */ - if (!lastNamep) lastNamep = pathp; - else lastNamep++; + if (!lastNamep) + lastNamep = pathp; + else + lastNamep++; code = cm_Lookup(dscp, lastNamep, CM_FLAG_CASEFOLD, userp, &req, &scp); if (code && code != CM_ERROR_NOSUCHFILE) { @@ -4356,7 +4396,8 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (code == 0) { code = cm_CheckOpen(scp, openMode, trunc, userp, &req); if (code) { - if (dscp) cm_ReleaseSCache(dscp); + if (dscp) + cm_ReleaseSCache(dscp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); return code; @@ -4364,7 +4405,8 @@ long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (excl) { /* oops, file shouldn't be there */ - if (dscp) cm_ReleaseSCache(dscp); + if (dscp) + cm_ReleaseSCache(dscp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); return CM_ERROR_EXISTS; @@ -4523,7 +4565,8 @@ long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS | CM_SCACHESYNC_LOCK); - if (code) goto doneSync; + if (code) + goto doneSync; LockType = smb_GetSMBParm(inp, 3) & 0xff; Timeout = (smb_GetSMBParm(inp, 5) << 16) + smb_GetSMBParm(inp, 4); @@ -4585,6 +4628,7 @@ long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) /* Put on waiting list */ waitingLock = malloc(sizeof(smb_waitingLock_t)); waitingLock->vcp = vcp; + smb_HoldVC(vcp); waitingLock->inp = smb_CopyPacket(inp); waitingLock->outp = smb_CopyPacket(outp); waitingLock->timeRemaining = Timeout; @@ -4597,7 +4641,8 @@ long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) /* don't send reply immediately */ outp->flags |= SMB_PACKETFLAG_NOSEND; } - if (code) break; + if (code) + break; } if (code) { @@ -4852,9 +4897,14 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) cm_InitReq(&req); + /* This code is very long and has a lot of if-then-else clauses + * scp and dscp get reused frequently and we need to ensure that + * we don't lose a reference. Start by ensuring that they are NULL. + */ + scp = NULL; + dscp = NULL; treeCreate = FALSE; foundscp = FALSE; - scp = NULL; nameLength = smb_GetSMBOffsetParm(inp, 2, 1); flags = smb_GetSMBOffsetParm(inp, 3, 1) @@ -5001,8 +5051,8 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (desiredAccess & AFS_ACCESS_WRITE) fidflags |= SMB_FID_OPENWRITE; - dscp = NULL; code = 0; + /* For an exclusive create, we want to do a case sensitive match for the last component. */ if ( createDisp == FILE_CREATE || createDisp == FILE_OVERWRITE || @@ -5023,15 +5073,17 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) return CM_ERROR_EXISTS; } } - } else - dscp = NULL; + } + /* we have both scp and dscp */ } else { code = cm_NameI(baseDirp, realPathp, CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD, userp, tidPathp, &req, &scp); + /* we might have scp but not dscp */ } - if (code == 0) - foundscp = TRUE; + if (scp) + foundscp = TRUE; + if (!foundscp || (fidflags & (SMB_FID_OPENDELETE | SMB_FID_OPENWRITE))) { /* look up parent directory */ /* If we are trying to create a path (i.e. multiple nested directories), then we don't *need* @@ -5039,8 +5091,10 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) * recognize. */ - if ( !dscp ) { - while (1) { + /* we might or might not have scp */ + + if (dscp == NULL) { + do { char *tp; code = cm_NameI(baseDirp, spacep->data, @@ -5060,20 +5114,27 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) smb_ReleaseFID(baseFidp); cm_ReleaseUser(userp); free(realPathp); + if (scp) + cm_ReleaseSCache(scp); return CM_ERROR_BADNTFILENAME; } + code = 0; } - else - break; - } + } while (dscp == NULL && code == 0); } else - code = 0; + code = 0; + + /* we might have scp and we might have dscp */ if (baseFid != 0) smb_ReleaseFID(baseFidp); if (code) { osi_Log0(smb_logp,"NTCreateX parent not found"); + if (scp) + cm_ReleaseSCache(scp); + if (dscp) + cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); return code; @@ -5081,6 +5142,8 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) if (treeCreate && dscp->fileType == CM_SCACHETYPE_FILE) { /* A file exists where we want a directory. */ + if (scp) + cm_ReleaseSCache(scp); cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); @@ -5093,6 +5156,9 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) lastNamep++; if (!smb_IsLegalFilename(lastNamep)) { + if (scp) + cm_ReleaseSCache(scp); + if (dscp) cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); @@ -5118,196 +5184,208 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) return code; } } - } - else { + /* we have scp and dscp */ + } else { + /* we have scp but not dscp */ if (baseFid != 0) smb_ReleaseFID(baseFidp); - } + } - /* if we get here, if code is 0, the file exists and is represented by - * scp. Otherwise, we have to create it. The dir may be represented - * by dscp, or we may have found the file directly. If code is non-zero, - * scp is NULL. - */ - if (code == 0 && !treeCreate) { - if (createDisp == FILE_CREATE) { - /* oops, file shouldn't be there */ - if (dscp) cm_ReleaseSCache(dscp); - cm_ReleaseSCache(scp); - cm_ReleaseUser(userp); - free(realPathp); - return CM_ERROR_EXISTS; - } + /* if we get here, if code is 0, the file exists and is represented by + * scp. Otherwise, we have to create it. The dir may be represented + * by dscp, or we may have found the file directly. If code is non-zero, + * scp is NULL. + */ + if (code == 0 && !treeCreate) { + if (createDisp == FILE_CREATE) { + /* oops, file shouldn't be there */ + if (dscp) + cm_ReleaseSCache(dscp); + cm_ReleaseSCache(scp); + cm_ReleaseUser(userp); + free(realPathp); + return CM_ERROR_EXISTS; + } - if ( createDisp == FILE_OVERWRITE || - createDisp == FILE_OVERWRITE_IF) { - setAttr.mask = CM_ATTRMASK_LENGTH; - setAttr.length.LowPart = 0; - setAttr.length.HighPart = 0; - /* now watch for a symlink */ - code = 0; - while (code == 0 && scp->fileType == CM_SCACHETYPE_SYMLINK) { - targetScp = 0; - code = cm_EvaluateSymLink(dscp, scp, &targetScp, userp, &req); - if (code == 0) { - /* we have a more accurate file to use (the - * target of the symbolic link). Otherwise, - * we'll just use the symlink anyway. - */ - osi_Log2(smb_logp, "symlink vp %x to vp %x", - scp, targetScp); - cm_ReleaseSCache(scp); - scp = targetScp; - } + if ( createDisp == FILE_OVERWRITE || + createDisp == FILE_OVERWRITE_IF) { + setAttr.mask = CM_ATTRMASK_LENGTH; + setAttr.length.LowPart = 0; + setAttr.length.HighPart = 0; + /* now watch for a symlink */ + code = 0; + while (code == 0 && scp->fileType == CM_SCACHETYPE_SYMLINK) { + targetScp = 0; + osi_assert(dscp != NULL); + code = cm_EvaluateSymLink(dscp, scp, &targetScp, userp, &req); + if (code == 0) { + /* we have a more accurate file to use (the + * target of the symbolic link). Otherwise, + * we'll just use the symlink anyway. + */ + osi_Log2(smb_logp, "symlink vp %x to vp %x", + scp, targetScp); + cm_ReleaseSCache(scp); + scp = targetScp; } - code = cm_SetAttr(scp, &setAttr, userp, &req); - openAction = 3; /* truncated existing file */ } - else - openAction = 1; /* found existing file */ + code = cm_SetAttr(scp, &setAttr, userp, &req); + openAction = 3; /* truncated existing file */ + } + else + openAction = 1; /* found existing file */ - code = cm_CheckNTOpen(scp, desiredAccess, createDisp, userp, - &req); - if (code) { - if (dscp) cm_ReleaseSCache(dscp); - cm_ReleaseSCache(scp); - cm_ReleaseUser(userp); - free(realPathp); - return code; - } - } - else if (createDisp == FILE_OPEN || createDisp == FILE_OVERWRITE) { - /* don't create if not found */ - if (dscp) cm_ReleaseSCache(dscp); + code = cm_CheckNTOpen(scp, desiredAccess, createDisp, userp, &req); + if (code) { + if (dscp) + cm_ReleaseSCache(dscp); + cm_ReleaseSCache(scp); cm_ReleaseUser(userp); free(realPathp); - return CM_ERROR_NOSUCHFILE; - } - else if (realDirFlag == 0 || realDirFlag == -1) { - osi_assert(dscp != NULL); - osi_Log1(smb_logp, "smb_ReceiveNTCreateX creating file %s", - osi_LogSaveString(smb_logp, lastNamep)); - openAction = 2; /* created file */ - setAttr.mask = CM_ATTRMASK_CLIENTMODTIME; - setAttr.clientModTime = time(NULL); - code = cm_Create(dscp, lastNamep, 0, &setAttr, &scp, userp, - &req); - if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH)) + return code; + } + } else if (createDisp == FILE_OPEN || createDisp == FILE_OVERWRITE) { + /* don't create if not found */ + if (dscp) + cm_ReleaseSCache(dscp); + if (scp) + cm_ReleaseSCache(scp); + cm_ReleaseUser(userp); + free(realPathp); + return CM_ERROR_NOSUCHFILE; + } else if (realDirFlag == 0 || realDirFlag == -1) { + osi_assert(dscp != NULL); + osi_Log1(smb_logp, "smb_ReceiveNTCreateX creating file %s", + osi_LogSaveString(smb_logp, lastNamep)); + openAction = 2; /* created file */ + setAttr.mask = CM_ATTRMASK_CLIENTMODTIME; + setAttr.clientModTime = time(NULL); + code = cm_Create(dscp, lastNamep, 0, &setAttr, &scp, userp, &req); + if (code == 0 && (dscp->flags & CM_SCACHEFLAG_ANYWATCH)) + smb_NotifyChange(FILE_ACTION_ADDED, + FILE_NOTIFY_CHANGE_FILE_NAME, + dscp, lastNamep, NULL, TRUE); + if (code == CM_ERROR_EXISTS && createDisp != FILE_CREATE) { + /* Not an exclusive create, and someone else tried + * creating it already, then we open it anyway. We + * don't bother retrying after this, since if this next + * fails, that means that the file was deleted after we + * started this call. + */ + code = cm_Lookup(dscp, lastNamep, CM_FLAG_CASEFOLD, + userp, &req, &scp); + if (code == 0) { + if (createDisp == FILE_OVERWRITE_IF) { + setAttr.mask = CM_ATTRMASK_LENGTH; + setAttr.length.LowPart = 0; + setAttr.length.HighPart = 0; + + /* now watch for a symlink */ + code = 0; + while (code == 0 && scp->fileType == CM_SCACHETYPE_SYMLINK) { + targetScp = 0; + code = cm_EvaluateSymLink(dscp, scp, &targetScp, userp, &req); + if (code == 0) { + /* we have a more accurate file to use (the + * target of the symbolic link). Otherwise, + * we'll just use the symlink anyway. + */ + osi_Log2(smb_logp, "symlink vp %x to vp %x", + scp, targetScp); + cm_ReleaseSCache(scp); + scp = targetScp; + } + } + code = cm_SetAttr(scp, &setAttr, userp, &req); + } + } /* lookup succeeded */ + } + } else { + char *tp, *pp; + char *cp; /* This component */ + int clen = 0; /* length of component */ + cm_scache_t *tscp1, *tscp2; + int isLast = 0; + + /* create directory */ + if ( !treeCreate ) + treeStartp = lastNamep; + osi_assert(dscp != NULL); + osi_Log1(smb_logp, "smb_ReceiveNTCreateX creating directory [%s]", + osi_LogSaveString(smb_logp, treeStartp)); + openAction = 2; /* created directory */ + + setAttr.mask = CM_ATTRMASK_CLIENTMODTIME; + setAttr.clientModTime = time(NULL); + + pp = treeStartp; + cp = spacep->data; + tscp1 = dscp; + cm_HoldSCache(tscp1); + tscp2 = NULL; + + while (pp && *pp) { + tp = strchr(pp, '\\'); + if (!tp) { + strcpy(cp,pp); + clen = strlen(cp); + isLast = 1; /* indicate last component. the supplied path never ends in a slash */ + } else { + clen = tp - pp; + strncpy(cp,pp,clen); + *(cp + clen) = 0; + tp++; + } + pp = tp; + + if (clen == 0) + continue; /* the supplied path can't have consecutive slashes either , but */ + + /* cp is the next component to be created. */ + code = cm_MakeDir(tscp1, cp, 0, &setAttr, userp, &req); + if (code == 0 && (tscp1->flags & CM_SCACHEFLAG_ANYWATCH)) smb_NotifyChange(FILE_ACTION_ADDED, - FILE_NOTIFY_CHANGE_FILE_NAME, - dscp, lastNamep, NULL, TRUE); - if (code == CM_ERROR_EXISTS && createDisp != FILE_CREATE) { + FILE_NOTIFY_CHANGE_DIR_NAME, + tscp1, cp, NULL, TRUE); + if (code == 0 || + (code == CM_ERROR_EXISTS && createDisp != FILE_CREATE)) { /* Not an exclusive create, and someone else tried * creating it already, then we open it anyway. We * don't bother retrying after this, since if this next * fails, that means that the file was deleted after we * started this call. */ - code = cm_Lookup(dscp, lastNamep, CM_FLAG_CASEFOLD, - userp, &req, &scp); - if (code == 0) { - if (createDisp == FILE_OVERWRITE_IF) { - setAttr.mask = CM_ATTRMASK_LENGTH; - setAttr.length.LowPart = 0; - setAttr.length.HighPart = 0; - - /* now watch for a symlink */ - code = 0; - while (code == 0 && scp->fileType == CM_SCACHETYPE_SYMLINK) { - targetScp = 0; - code = cm_EvaluateSymLink(dscp, scp, &targetScp, userp, &req); - if (code == 0) { - /* we have a more accurate file to use (the - * target of the symbolic link). Otherwise, - * we'll just use the symlink anyway. - */ - osi_Log2(smb_logp, "symlink vp %x to vp %x", - scp, targetScp); - cm_ReleaseSCache(scp); - scp = targetScp; - } - } - code = cm_SetAttr(scp, &setAttr, userp, &req); - } - } /* lookup succeeded */ - } - } - else { - char *tp, *pp; - char *cp; /* This component */ - int clen = 0; /* length of component */ - cm_scache_t *tscp; - int isLast = 0; - - /* create directory */ - if ( !treeCreate ) - treeStartp = lastNamep; - osi_assert(dscp != NULL); - osi_Log1(smb_logp, "smb_ReceiveNTCreateX creating directory [%s]", - osi_LogSaveString(smb_logp, treeStartp)); - openAction = 2; /* created directory */ - - setAttr.mask = CM_ATTRMASK_CLIENTMODTIME; - setAttr.clientModTime = time(NULL); - - pp = treeStartp; - cp = spacep->data; - tscp = dscp; - - while (pp && *pp) { - tp = strchr(pp, '\\'); - if (!tp) { - strcpy(cp,pp); - clen = strlen(cp); - isLast = 1; /* indicate last component. the supplied path never ends in a slash */ - } - else { - clen = tp - pp; - strncpy(cp,pp,clen); - *(cp + clen) = 0; - tp++; - } - pp = tp; - - if (clen == 0) - continue; /* the supplied path can't have consecutive slashes either , but */ - - /* cp is the next component to be created. */ - code = cm_MakeDir(tscp, cp, 0, &setAttr, userp, &req); - if (code == 0 && (tscp->flags & CM_SCACHEFLAG_ANYWATCH)) - smb_NotifyChange(FILE_ACTION_ADDED, - FILE_NOTIFY_CHANGE_DIR_NAME, - tscp, cp, NULL, TRUE); - if (code == 0 || - (code == CM_ERROR_EXISTS && createDisp != FILE_CREATE)) { - /* Not an exclusive create, and someone else tried - * creating it already, then we open it anyway. We - * don't bother retrying after this, since if this next - * fails, that means that the file was deleted after we - * started this call. - */ - code = cm_Lookup(tscp, cp, CM_FLAG_CASEFOLD, - userp, &req, &scp); - } - if (code) break; + code = cm_Lookup(tscp1, cp, CM_FLAG_CASEFOLD, + userp, &req, &tscp2); + } + if (code) + break; - if (!isLast) { /* for anything other than dscp, release it unless it's the last one */ - cm_ReleaseSCache(tscp); - tscp = scp; /* Newly created directory will be next parent */ - } + if (!isLast) { /* for anything other than dscp, release it unless it's the last one */ + cm_ReleaseSCache(tscp1); + tscp1 = tscp2; /* Newly created directory will be next parent */ + /* the hold is transfered to tscp1 from tscp2 */ } + } - /* - * if we get here and code == 0, then scp is the last directory created, and tscp is the - * parent of scp. dscp got released if dscp != tscp. both tscp and scp are held. - */ - dscp = tscp; - } + if (dscp) + cm_ReleaseSCache(dscp); + dscp = tscp1; + if (scp) + cm_ReleaseSCache(scp); + scp = tscp2; + /* + * if we get here and code == 0, then scp is the last directory created, and dscp is the + * parent of scp. + */ + } if (code) { /* something went wrong creating or truncating the file */ - if (scp) cm_ReleaseSCache(scp); - if (dscp) cm_ReleaseSCache(dscp); + if (scp) + cm_ReleaseSCache(scp); + if (dscp) + cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); return code; @@ -5325,14 +5403,15 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) * target of the symbolic link). Otherwise, * we'll just use the symlink anyway. */ - osi_Log2(smb_logp, "symlink vp %x to vp %x", - scp, targetScp); + osi_Log2(smb_logp, "symlink vp %x to vp %x", scp, targetScp); cm_ReleaseSCache(scp); scp = targetScp; } } if (scp->fileType != CM_SCACHETYPE_FILE) { + if (dscp) + cm_ReleaseSCache(dscp); cm_ReleaseSCache(scp); cm_ReleaseUser(userp); free(realPathp); @@ -5343,7 +5422,8 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) /* (only applies to single component case) */ if (realDirFlag == 1 && scp->fileType == CM_SCACHETYPE_FILE) { cm_ReleaseSCache(scp); - if (dscp) cm_ReleaseSCache(dscp); + if (dscp) + cm_ReleaseSCache(dscp); cm_ReleaseUser(userp); free(realPathp); return CM_ERROR_NOTDIR; @@ -5353,7 +5433,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) fidp = smb_FindFID(vcp, 0, SMB_FLAG_CREATE); osi_assert(fidp); /* save a pointer to the vnode */ - fidp->scp = scp; + fidp->scp = scp; /* Hold transfered to fidp->scp and no longer needed */ fidp->flags = fidflags; @@ -5367,7 +5447,10 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) fidp->NTopen_wholepathp = realPathp; /* we don't need this any longer */ - if (dscp) cm_ReleaseSCache(dscp); + if (dscp) { + cm_ReleaseSCache(dscp); + dscp = NULL; + } cm_Open(scp, 0, userp); /* set inp->fid so that later read calls in same msg can find fid */ @@ -5408,6 +5491,7 @@ long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) return 0; } + /* * A lot of stuff copied verbatim from NT Create&X to NT Tran Create. * Instead, ultimately, would like to use a subroutine for common code. @@ -6318,7 +6402,6 @@ void smb_NotifyChange(DWORD action, DWORD notifyFilter, } smb_SendPacket(vcp, watch); - smb_ReleaseVC(vcp); smb_FreePacket(watch); watch = nextWatch; } @@ -6385,8 +6468,6 @@ long smb_ReceiveNTCancel(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) ((smb_t *)watch)->errHigh = 0xC0; ((smb_t *)watch)->flg2 |= SMB_FLAGS2_ERR_STATUS; smb_SendPacket(vcp, watch); - if (watch->vcp) - smb_ReleaseVC(watch->vcp); smb_FreePacket(watch); return 0; } @@ -6411,7 +6492,6 @@ long smb_ReceiveNTRename(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp) { char *oldPathp, *newPathp; long code = 0; - cm_user_t *userp; char * tp; int attrs; int rename_type; diff --git a/src/WINNT/aklog/aklog.c b/src/WINNT/aklog/aklog.c index a226d3a15..d08166c59 100644 --- a/src/WINNT/aklog/aklog.c +++ b/src/WINNT/aklog/aklog.c @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef WIN32 #include @@ -280,7 +281,7 @@ void ViceIDToUsername(char *username, char *realm_of_user, char *realm_of_cell, * level */ - if ((*status = pr_Initialize(1L, confname, aserver->cell, 0))) { + if ((*status = pr_Initialize(1L, confname, aserver->cell))) { printf("Error %d\n", status); return; } diff --git a/src/WINNT/client_exp/NTMakefile b/src/WINNT/client_exp/NTMakefile index 61a7367e6..ebfc7b689 100644 --- a/src/WINNT/client_exp/NTMakefile +++ b/src/WINNT/client_exp/NTMakefile @@ -59,7 +59,8 @@ DLLLIBS =\ $(DESTDIR)\lib\afsauthent.lib \ $(DESTDIR)\lib\libafsconf.lib \ $(DESTDIR)\lib\libosi.lib \ - $(DESTDIR)\lib\afs\TaLocale.lib + $(DESTDIR)\lib\afs\TaLocale.lib \ + $(DESTDIR)\lib\afs\afsutil.lib $(DLLFILE): $(DLLOBJS) $(DLLLIBS) $(DLLCONLINK) /DEF:afs_shl_ext.def $(DLLSDKLIBS) diff --git a/src/WINNT/doc/help/es_ES/AFS-LIGHT.HLP b/src/WINNT/doc/help/es_ES/AFS-LIGHT.HLP index ea4e2dd811f7e8240bcedaae708a78c7e7c8b9a3..c004f7d7ce6b0d0569e978fbc35801c37f496aa9 100755 GIT binary patch delta 24 gcmbP!hiCd7o(&)S8HJla^|ycOXWag&pGkEd0G@^nO#lD@ delta 24 gcmbP!hiCd7o(&)S8Ks*)^|ycOXWag&pGkEd0G{>?RR910 diff --git a/src/WINNT/install/wix/config.wxi b/src/WINNT/install/wix/config.wxi index bd7af64ed..aa4bfbcfa 100644 --- a/src/WINNT/install/wix/config.wxi +++ b/src/WINNT/install/wix/config.wxi @@ -101,7 +101,7 @@ - + diff --git a/src/afs/DARWIN/osi_vm.c b/src/afs/DARWIN/osi_vm.c index 9ae45f43b..03b219b24 100644 --- a/src/afs/DARWIN/osi_vm.c +++ b/src/afs/DARWIN/osi_vm.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vm.c,v 1.14 2004/06/23 18:34:48 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/DARWIN/osi_vm.c,v 1.14.2.1 2005/02/21 01:14:18 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -281,7 +281,7 @@ osi_VM_TryReclaim(struct vcache *avc, int *slept) 1 #endif ) - VOP_INACTIVE(vp, p); + VOP_UNLOCK(vp, 0, p); /* was VOP_INACTIVE(vp, p); */ else VOP_UNLOCK(vp, 0, p); #ifdef AFS_DARWIN14_ENV @@ -290,7 +290,7 @@ osi_VM_TryReclaim(struct vcache *avc, int *slept) #endif if (obj) { if (ISSET(vp->v_flag, VTERMINATE)) - panic("afs_vnreclaim: already teminating"); + panic("afs_vnreclaim: already terminating"); SET(vp->v_flag, VTERMINATE); memory_object_destroy(obj, 0); while (ISSET(vp->v_flag, VTERMINATE)) { diff --git a/src/afs/DUX/osi_vnodeops.c b/src/afs/DUX/osi_vnodeops.c index 543a6453a..9f2b08704 100644 --- a/src/afs/DUX/osi_vnodeops.c +++ b/src/afs/DUX/osi_vnodeops.c @@ -15,7 +15,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/DUX/osi_vnodeops.c,v 1.11 2003/07/15 23:14:19 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/DUX/osi_vnodeops.c,v 1.11.2.1 2005/01/31 03:49:11 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ @@ -114,8 +114,15 @@ mp_afs_lookup(adp, ndp) struct nameidata *ndp; { int code; + char aname[MAXNAMLEN + 1]; /* XXX */ + struct vcache **avcp = (struct vcache **)&(ndp->ni_vp); + struct ucred *acred = ndp->ni_cred; + int wantparent = ndp->ni_nameiop & WANTPARENT; + int opflag = ndp->ni_nameiop & OPFLAG; AFS_GLOCK(); - code = afs_lookup(adp, ndp); + memcpy(aname, ndp->ni_ptr, ndp->ni_namelen); + aname[ndp->ni_namelen] = '\0'; + code = afs_lookup(adp, aname, avcp, acred, opflag, wantparent); AFS_GUNLOCK(); return code; } @@ -125,9 +132,18 @@ mp_afs_create(ndp, attrs) struct vattr *attrs; { int code; + register struct vcache *adp = VTOAFS(ndp->ni_dvp); + char *aname = ndp->ni_dent.d_name; + enum vcexcl aexcl = NONEXCL; /* XXX - create called properly */ + int amode = 0; /* XXX - checked in higher level */ + struct vcache **avcp = (struct vcache **)&(ndp->ni_vp); + struct ucred *acred = ndp->ni_cred; AFS_GLOCK(); - code = afs_create(ndp, attrs); + code = afs_create(adp, aname, attrs, aexcl, + amode, avcp, acred); + AFS_GUNLOCK(); + afs_PutVCache(adp); return code; } @@ -208,8 +224,12 @@ mp_afs_remove(ndp) struct nameidata *ndp; { int code; + register struct vcache *adp = VTOAFS(ndp->ni_dvp); + char *aname = ndp->ni_dent.d_name; + struct ucred *acred = ndp->ni_cred; AFS_GLOCK(); - code = afs_remove(ndp); + code = afs_remove(adp, aname, acred); + afs_PutVCache(adp); AFS_GUNLOCK(); return code; } @@ -219,9 +239,13 @@ mp_afs_link(avc, ndp) struct nameidata *ndp; { int code; + struct vcache *adp = VTOAFS(ndp->ni_dvp); + char *aname = ndp->ni_dent.d_name; + struct ucred *acred = ndp->ni_cred; AFS_GLOCK(); - code = afs_link(avc, ndp); + code = afs_link(avc, adp, aname, acred); AFS_GUNLOCK(); + afs_PutVCache(adp); return code; } @@ -229,8 +253,19 @@ mp_afs_rename(fndp, tndp) struct nameidata *fndp, *tndp; { int code; + struct vcache *aodp = VTOAFS(fndp->ni_dvp); + char *aname1 = fndp->ni_dent.d_name; + struct vcache *andp = VTOAFS(tndp->ni_dvp); + char *aname2 = tndp->ni_dent.d_name; + struct ucred *acred = tndp->ni_cred; AFS_GLOCK(); - code = afs_rename(fndp, tndp); + code = afs_rename(aodp, aname1, andp, aname2, acred); + AFS_RELE(tndp->ni_dvp); + if (tndp->ni_vp != NULL) { + AFS_RELE(tndp->ni_vp); + } + AFS_RELE(fndp->ni_dvp); + AFS_RELE(fndp->ni_vp); AFS_GUNLOCK(); return code; } @@ -240,8 +275,13 @@ mp_afs_mkdir(ndp, attrs) struct vattr *attrs; { int code; + register struct vcache *adp = VTOAFS(ndp->ni_dvp); + char *aname = ndp->ni_dent.d_name; + register struct vcache **avcp = (struct vcache **)&(ndp->ni_vp); + struct ucred *acred = ndp->ni_cred; AFS_GLOCK(); - code = afs_mkdir(ndp, attrs); + code = afs_mkdir(adp, aname, attrs, avcp, acred); + AFS_RELE(adp); AFS_GUNLOCK(); return code; } @@ -250,8 +290,13 @@ mp_afs_rmdir(ndp) struct nameidata *ndp; { int code; + register struct vcache *adp = VTOAFS(ndp->ni_dvp); + char *aname = ndp->ni_dent.d_name; + struct ucred *acred = ndp->ni_cred; AFS_GLOCK(); - code = afs_rmdir(ndp); + code = afs_rmdir(adp, aname, acred); + afs_PutVCache(adp); + afs_PutVCache(ndp->ni_vp); AFS_GUNLOCK(); return code; } @@ -262,8 +307,12 @@ mp_afs_symlink(ndp, attrs, atargetName) register char *atargetName; { int code; + register struct vcache *adp = VTOAFS(ndp->ni_dvp); + char *aname = ndp->ni_dent.d_name; + struct ucred *acred = ndp->ni_cred; AFS_GLOCK(); - code = afs_symlink(ndp, attrs, atargetName); + code = afs_symlink(adp, aname, attrs, atargetName, acred); + AFS_RELE(ndp->ni_dvp); AFS_GUNLOCK(); return code; } diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index f338c99c7..5282709c2 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -17,7 +17,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25.2.1 2004/10/18 07:11:46 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/LINUX/osi_groups.c,v 1.25.2.2 2005/01/31 04:14:36 shadow Exp $"); #include "afs/sysincludes.h" #include "afsincludes.h" @@ -155,23 +155,24 @@ setpag(cred_t ** cr, afs_uint32 pagvalue, afs_uint32 * newpag, #if defined(AFS_LINUX26_ENV) struct group_info *group_info; gid_t g0, g1; + struct group_info *tmp; + int i; + int need_space = 0; AFS_STATCNT(setpag); group_info = afs_getgroups(*cr); if (group_info->ngroups < 2 || afs_get_pag_from_groups(GROUP_AT(group_info, 0), - GROUP_AT(group_info, 1)) == NOPAG) { + GROUP_AT(group_info, 1)) == NOPAG) /* We will have to make sure group_info is big enough for pag */ - struct group_info *tmp; - int i; - - tmp = groups_alloc(group_info->ngroups + 2); - for (i = 0; i < group_info->ngroups; ++i) - GROUP_AT(tmp, i + 2) = GROUP_AT(group_info, i); - put_group_info(group_info); - group_info = tmp; - } + need_space = 2; + + tmp = groups_alloc(group_info->ngroups + need_space); + + for (i = 0; i < group_info->ngroups; ++i) + GROUP_AT(tmp, i + need_space) = GROUP_AT(group_info, i); + group_info = tmp; *newpag = (pagvalue == -1 ? genpag() : pagvalue); afs_get_groups_from_pag(*newpag, &g0, &g1); diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 278e56ae9..83f6b1a6d 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -47,6 +47,14 @@ #define SIG_UNLOCK(X) spin_unlock_irq(&X->sig->siglock) #endif +#if defined (STRUCT_TASK_STRUCT_HAS_RLIM) +#define TASK_STRUCT_RLIM rlim +#elif defined (STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM) +#define TASK_STRUCT_RLIM signal->rlim +#else +#error Not sure what to do about rlim (should be in the Linux task struct somewhere....) +#endif + #define afs_hz HZ #include "h/sched.h" diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 82c116cf6..a9165df6c 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -15,7 +15,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/LINUX/osi_misc.c,v 1.34.2.1 2004/12/07 06:12:12 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/LINUX/osi_misc.c,v 1.34.2.3 2005/02/21 01:13:08 shadow Exp $"); #include "afs/sysincludes.h" #include "afsincludes.h" @@ -28,44 +28,60 @@ RCSID #endif #if defined(AFS_LINUX24_ENV) +/* LOOKUP_POSITIVE is becoming the default */ +#ifndef LOOKUP_POSITIVE +#define LOOKUP_POSITIVE 0 +#endif /* Lookup name and return vnode for same. */ int -osi_lookupname(char *aname, uio_seg_t seg, int followlink, - vnode_t ** dirvpp, struct dentry **dpp) +osi_lookupname_internal(char *aname, int followlink, struct vfsmount **mnt, + struct dentry **dpp) { int code; - extern struct nameidata afs_cacheNd; - struct nameidata *nd = &afs_cacheNd; - + struct nameidata nd; + int flags = LOOKUP_POSITIVE; code = ENOENT; - if (seg == AFS_UIOUSER) { - code = - followlink ? user_path_walk(aname, - nd) : user_path_walk_link(aname, nd); - } else { + + if (followlink) + flags |= LOOKUP_FOLLOW; #if defined(AFS_LINUX26_ENV) - code = path_lookup(aname, followlink ? LOOKUP_FOLLOW : 0, nd); + code = path_lookup(aname, flags, &nd); #else - if (path_init(aname, followlink ? LOOKUP_FOLLOW : 0, nd)) - code = path_walk(aname, nd); + if (path_init(aname, flags, &nd)) + code = path_walk(aname, &nd); #endif - } if (!code) { - if (nd->dentry->d_inode) { - *dpp = dget(nd->dentry); - code = 0; - } else { - code = ENOENT; - path_release(nd); - } + *dpp = dget(nd.dentry); + if (mnt) + *mnt = mntget(nd.mnt); + path_release(&nd); } return code; } -#else int osi_lookupname(char *aname, uio_seg_t seg, int followlink, vnode_t ** dirvpp, - struct dentry **dpp) + struct dentry **dpp) +{ + int code; + char *tname; + code = ENOENT; + if (seg == AFS_UIOUSER) { + tname = getname(aname); + if (IS_ERR(tname)) + return PTR_ERR(tname); + } else { + tname = aname; + } + code = osi_lookupname_internal(tname, followlink, NULL, dpp); + if (seg == AFS_UIOUSER) { + putname(tname); + } + return code; +} +#else +int +osi_lookupname(char *aname, uio_seg_t seg, int followlink, vnode_t ** dirvpp, struct dentry **dpp) { struct dentry *dp = NULL; int code; @@ -94,12 +110,13 @@ int osi_InitCacheInfo(char *aname) { int code; - struct dentry *dp; + struct dentry *dp,*dpp; extern ino_t cacheInode; extern struct osi_dev cacheDev; extern afs_int32 afs_fsfragsize; extern struct super_block *afs_cacheSBp; - code = osi_lookupname(aname, AFS_UIOSYS, 1, NULL, &dp); + extern struct vfsmnt *afs_cacheMnt; + code = osi_lookupname_internal(aname, 1, &afs_cacheMnt, &dp); if (code) return ENOENT; @@ -138,8 +155,8 @@ osi_rdwr(int rw, struct osi_file *file, caddr_t addrp, size_t asize, } else filp->f_pos = offset; - savelim = current->rlim[RLIMIT_FSIZE].rlim_cur; - current->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; + savelim = current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur; + current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; /* Read/Write the data. */ TO_USER_SPACE(); @@ -151,7 +168,7 @@ osi_rdwr(int rw, struct osi_file *file, caddr_t addrp, size_t asize, code = asize; TO_KERNEL_SPACE(); - current->rlim[RLIMIT_FSIZE].rlim_cur = savelim; + current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = savelim; if (code >= 0) { *resid = asize - code; @@ -173,8 +190,8 @@ osi_file_uio_rdwr(struct osi_file *osifile, uio_t * uiop, int rw) int count; unsigned long savelim; - savelim = current->rlim[RLIMIT_FSIZE].rlim_cur; - current->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; + savelim = current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur; + current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; if (uiop->uio_seg == AFS_UIOSYS) TO_USER_SPACE(); @@ -217,7 +234,7 @@ osi_file_uio_rdwr(struct osi_file *osifile, uio_t * uiop, int rw) if (uiop->uio_seg == AFS_UIOSYS) TO_KERNEL_SPACE(); - current->rlim[RLIMIT_FSIZE].rlim_cur = savelim; + current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = savelim; return code; } diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index 89bd661b2..d51faca95 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -15,7 +15,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.52.2.5 2004/12/17 15:29:30 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/LINUX/osi_module.c,v 1.52.2.7 2005/02/21 01:15:35 shadow Exp $"); #include /* early to avoid printf->printk mapping */ #include "afs/sysincludes.h" @@ -33,38 +33,6 @@ RCSID #include #include #endif -#if !defined(EXPORTED_SYS_CALL_TABLE) && defined(HAVE_KERNEL_LINUX_SYSCALL_H) -#include -#endif - -#ifdef AFS_SPARC64_LINUX24_ENV -#define __NR_setgroups32 82 /* This number is not exported for some bizarre reason. */ -#endif - -#if !defined(AFS_LINUX24_ENV) -asmlinkage int (*sys_settimeofdayp) (struct timeval * tv, - struct timezone * tz); -#endif -asmlinkage long (*sys_setgroupsp) (int gidsetsize, gid_t * grouplist); -#ifdef EXPORTED_SYS_CALL_TABLE -#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) -extern unsigned int sys_call_table[]; /* changed to uint because SPARC64 and S390X have syscalltable of 32bit items */ -#else -extern void *sys_call_table[]; /* safer for other linuces */ -#endif -#else /* EXPORTED_SYS_CALL_TABLE */ -#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) -static unsigned int *sys_call_table; /* changed to uint because SPARC64 and S390X have syscalltable of 32bit items */ -#else -static void **sys_call_table; /* safer for other linuces */ -#endif -#endif - -#if defined(AFS_S390X_LINUX24_ENV) -#define _S(x) ((x)<<1) -#else -#define _S(x) x -#endif extern struct file_system_type afs_fs_type; @@ -82,56 +50,6 @@ int afs_global_owner = 0; unsigned long afs_linux_page_offset = 0; /* contains the PAGE_OFFSET value */ #endif -/* Since sys_ni_syscall is not exported, I need to cache it in order to restore - * it. - */ -#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) -static unsigned int afs_ni_syscall = 0; -#else -static void *afs_ni_syscall = 0; -#endif - -#ifdef AFS_AMD64_LINUX20_ENV -#ifdef EXPORTED_IA32_SYS_CALL_TABLE -extern void *ia32_sys_call_table[]; -#else -static void **ia32_sys_call_table; -#endif - -static void *ia32_ni_syscall = 0; -asmlinkage long (*sys32_setgroupsp) (int gidsetsize, u16 * grouplist); -#if defined(__NR_ia32_setgroups32) -asmlinkage long (*sys32_setgroups32p) (int gidsetsize, gid_t * grouplist); -#endif /* __NR_ia32_setgroups32 */ -#endif /* AFS_AMD64_LINUX20_ENV */ - -#ifdef AFS_PPC64_LINUX20_ENV -asmlinkage long (*sys32_setgroupsp)(int gidsetsize, gid_t *grouplist); -#endif /* AFS_AMD64_LINUX20_ENV */ - -#ifdef AFS_SPARC64_LINUX20_ENV -static unsigned int afs_ni_syscall32 = 0; -asmlinkage int (*sys32_setgroupsp) (int gidsetsize, - __kernel_gid_t32 * grouplist); -#if defined(__NR_setgroups32) -asmlinkage int (*sys32_setgroups32p) (int gidsetsize, - __kernel_gid_t32 * grouplist); -#endif /* __NR_setgroups32 */ -#ifdef EXPORTED_SYS_CALL_TABLE -extern unsigned int sys_call_table32[]; -#else /* EXPORTED_SYS_CALL_TABLE */ -static unsigned int *sys_call_table32; -#endif /* EXPORTED_SYS_CALL_TABLE */ - -asmlinkage int -afs_syscall32(long syscall, long parm1, long parm2, long parm3, long parm4, - long parm5) -{ - __asm__ __volatile__("srl %o4, 0, %o4\n\t" "mov %o7, %i7\n\t" - "call afs_syscall\n\t" "srl %o5, 0, %o5\n\t" - "ret\n\t" "nop"); -} -#endif /* AFS_SPARC64_LINUX20_ENV */ static int afs_ioctl(struct inode *, struct file *, unsigned int, unsigned long); @@ -216,57 +134,52 @@ afs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, { struct afsprocdata sysargs; + struct afsprocdata32 sysargs32; if (cmd != VIOC_SYSCALL) return -EINVAL; - if (copy_from_user(&sysargs, (void *)arg, sizeof(struct afsprocdata))) - return -EFAULT; - - return afs_syscall(sysargs.syscall, sysargs.param1, - sysargs.param2, sysargs.param3, sysargs.param4); -} - -#ifdef AFS_IA64_LINUX20_ENV - -asmlinkage long -afs_syscall_stub(int r0, int r1, long r2, long r3, long r4, long gp) -{ - __asm__ __volatile__("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t" "mov r41 = b0\n\t" /* save rp */ - "mov out0 = in0\n\t" "mov out1 = in1\n\t" "mov out2 = in2\n\t" "mov out3 = in3\n\t" "mov out4 = in4\n\t" "mov out5 = gp\n\t" /* save gp */ - ";;\n" ".L1:\n\t" "mov r3 = ip\n\t" ";;\n\t" "addl r15=.fptr_afs_syscall-.L1,r3\n\t" ";;\n\t" "ld8 r15=[r15]\n\t" ";;\n\t" "ld8 r16=[r15],8\n\t" ";;\n\t" "ld8 gp=[r15]\n\t" "mov b6=r16\n\t" "br.call.sptk.many b0 = b6\n\t" ";;\n\t" "mov ar.pfs = r42\n\t" "mov b0 = r41\n\t" "mov gp = r48\n\t" /* restore gp */ - "br.ret.sptk.many b0\n" ".fptr_afs_syscall:\n\t" - "data8 @fptr(afs_syscall)\n\t" ".skip 8"); -} - -asmlinkage long -afs_xsetgroups_stub(int r0, int r1, long r2, long r3, long r4, long gp) -{ - __asm__ __volatile__("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t" "mov r41 = b0\n\t" /* save rp */ - "mov out0 = in0\n\t" "mov out1 = in1\n\t" "mov out2 = in2\n\t" "mov out3 = in3\n\t" "mov out4 = in4\n\t" "mov out5 = gp\n\t" /* save gp */ - ";;\n" ".L2:\n\t" "mov r3 = ip\n\t" ";;\n\t" "addl r15=.fptr_afs_xsetgroups - .L2,r3\n\t" ";;\n\t" "ld8 r15=[r15]\n\t" ";;\n\t" "ld8 r16=[r15],8\n\t" ";;\n\t" "ld8 gp=[r15]\n\t" "mov b6=r16\n\t" "br.call.sptk.many b0 = b6\n\t" ";;\n\t" "mov ar.pfs = r42\n\t" "mov b0 = r41\n\t" "mov gp = r48\n\t" /* restore gp */ - "br.ret.sptk.many b0\n" ".fptr_afs_xsetgroups:\n\t" - "data8 @fptr(afs_xsetgroups)\n\t" ".skip 8"); -} - -struct fptr { - void *ip; - unsigned long gp; -}; - -#endif /* AFS_IA64_LINUX20_ENV */ - -#ifdef AFS_LINUX24_ENV -asmlinkage int (*sys_setgroups32p) (int gidsetsize, - __kernel_gid32_t * grouplist); -#endif /* AFS_LINUX24_ENV */ - -#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) -#define POINTER2SYSCALL (unsigned int)(unsigned long) -#define SYSCALL2POINTER (void *)(long) +#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) +#ifdef AFS_SPARC64_LINUX24_ENV + if (current->thread.flags & SPARC_FLAG_32BIT) +#elif defined(AFS_SPARC64_LINUX20_ENV) + if (current->tss.flags & SPARC_FLAG_32BIT) +#elif defined(AFS_AMD64_LINUX20_ENV) +#ifdef AFS_LINUX26_ENV + if (test_thread_flag(TIF_IA32)) #else -#define POINTER2SYSCALL (void *) -#define SYSCALL2POINTER (void *) + if (current->thread.flags & THREAD_IA32) #endif +#elif defined(AFS_PPC64_LINUX20_ENV) +#ifdef AFS_PPC64_LINUX26_ENV + if (current->thread_info->flags & _TIF_32BIT) +#else /*Linux 2.6 */ + if (current->thread.flags & PPC_FLAG_32BIT) +#endif +#elif defined(AFS_S390X_LINUX20_ENV) + if (current->thread.flags & S390_FLAG_31BIT) +#else +#error Not done for this linux type +#endif + { + if (copy_from_user(&sysargs32, (void *)arg, + sizeof(struct afsprocdata32))) + return -EFAULT; + + return afs_syscall((unsigned long)sysargs32.syscall, + (unsigned long)sysargs32.param1, + (unsigned long)sysargs32.param2, + (unsigned long)sysargs32.param3, + (unsigned long)sysargs32.param4); + } else +#endif + { + if (copy_from_user(&sysargs, (void *)arg, sizeof(struct afsprocdata))) + return -EFAULT; + + return afs_syscall(sysargs.syscall, sysargs.param1, + sysargs.param2, sysargs.param3, sysargs.param4); + } +} #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) @@ -277,45 +190,7 @@ int init_module(void) #endif { -#if defined(AFS_IA64_LINUX20_ENV) - unsigned long kernel_gp = 0; - static struct fptr sys_setgroups; -#endif /* defined(AFS_IA64_LINUX20_ENV) */ - extern long afs_xsetgroups(); -#if defined(__NR_setgroups32) - extern int afs_xsetgroups32(); -#endif /* __NR_setgroups32 */ -#if defined(AFS_SPARC64_LINUX20_ENV) || defined (AFS_AMD64_LINUX20_ENV) || defined(AFS_PPC64_LINUX20_ENV) - extern int afs32_xsetgroups(); -#if (defined(__NR_setgroups32) && defined(AFS_SPARC64_LINUX20_ENV)) - extern int afs32_xsetgroups32(); -#endif /* defined(__NR_setgroups32) && defined(AFS_SPARC64_LINUX20_ENV) */ -#if (defined(__NR_ia32_setgroups32) && defined(AFS_AMD64_LINUX20_ENV)) - extern int afs32_xsetgroups32(); -#endif /* (defined(__NR_ia32_setgroups32) && defined(AFS_AMD64_LINUX20_ENV) */ -#endif /* AFS_SPARC64_LINUX20_ENV || AFS_AMD64_LINUX20_ENV || AFS_PPC64_LINUX20_ENV */ - -#if !defined(EXPORTED_SYS_CALL_TABLE) || (defined(AFS_AMD64_LINUX20_ENV) && !defined(EXPORTED_IA32_SYS_CALL_TABLE)) - unsigned long *ptr; - unsigned long offset=0; - unsigned long datalen=0; -#if defined(EXPORTED_KALLSYMS_SYMBOL) - unsigned long token=0; -#endif -#if defined(EXPORTED_KALLSYMS_SYMBOL) || defined(EXPORTED_KALLSYMS_ADDRESS) - int ret; - char *mod_name; - unsigned long mod_start=0; - unsigned long mod_end=0; - char *sec_name; - unsigned long sec_start=0; - unsigned long sec_end=0; - char *sym_name; - unsigned long sym_start=0; - unsigned long sym_end=0; -#endif -#endif /* EXPORTED_SYS_CALL_TABLE */ - + int e; RWLOCK_INIT(&afs_xosi, "afs_xosi"); #if !defined(AFS_LINUX24_ENV) @@ -331,246 +206,11 @@ init_module(void) #endif /* AFS_S390_LINUX22_ENV */ #endif /* !defined(AFS_LINUX24_ENV) */ -#ifndef EXPORTED_SYS_CALL_TABLE - sys_call_table = 0; - -#ifdef EXPORTED_KALLSYMS_SYMBOL - ret = 1; - token = 0; - while (ret) { - sym_start = 0; - ret = - kallsyms_symbol_to_address("sys_call_table", &token, &mod_name, - &mod_start, &mod_end, &sec_name, - &sec_start, &sec_end, &sym_name, - &sym_start, &sym_end); - if (ret && !strcmp(mod_name, "kernel")) - break; - } - if (ret && sym_start) { - sys_call_table = sym_start; - } -#elif defined(EXPORTED_KALLSYMS_ADDRESS) - ret = - kallsyms_address_to_symbol((unsigned long)&init_mm, &mod_name, - &mod_start, &mod_end, &sec_name, - &sec_start, &sec_end, &sym_name, - &sym_start, &sym_end); - ptr = (unsigned long *)sec_start; - datalen = (sec_end - sec_start) / sizeof(unsigned long); -#elif defined(AFS_IA64_LINUX20_ENV) - ptr = (unsigned long *)(&sys_close - 0x180000); - datalen = 0x180000 / sizeof(ptr); -#elif defined(AFS_AMD64_LINUX20_ENV) - ptr = (unsigned long *)&init_mm; - datalen = 0x360000 / sizeof(ptr); -#else - ptr = (unsigned long *)&init_mm; - datalen = 16384; -#endif - for (offset = 0; offset < datalen; ptr++, offset++) { -#if defined(AFS_IA64_LINUX20_ENV) - unsigned long close_ip = - (unsigned long)((struct fptr *)&sys_close)->ip; - unsigned long chdir_ip = - (unsigned long)((struct fptr *)&sys_chdir)->ip; - unsigned long write_ip = - (unsigned long)((struct fptr *)&sys_write)->ip; - if (ptr[0] == close_ip && ptr[__NR_chdir - __NR_close] == chdir_ip - && ptr[__NR_write - __NR_close] == write_ip) { - sys_call_table = (void *)&(ptr[-1 * (__NR_close - 1024)]); - break; - } -#elif defined(EXPORTED_SYS_WAIT4) && defined(EXPORTED_SYS_CLOSE) - if (ptr[0] == (unsigned long)&sys_close - && ptr[__NR_wait4 - __NR_close] == (unsigned long)&sys_wait4) { - sys_call_table = ptr - __NR_close; - break; - } -#elif defined(EXPORTED_SYS_CHDIR) && defined(EXPORTED_SYS_CLOSE) - if (ptr[0] == (unsigned long)&sys_close - && ptr[__NR_chdir - __NR_close] == (unsigned long)&sys_chdir) { - sys_call_table = ptr - __NR_close; - break; - } -#elif defined(EXPORTED_SYS_OPEN) - if (ptr[0] == (unsigned long)&sys_exit - && ptr[__NR_open - __NR_exit] == (unsigned long)&sys_open) { - sys_call_table = ptr - __NR_exit; - break; - } -#else /* EXPORTED_SYS_OPEN */ - break; -#endif /* EXPORTED_KALLSYMS_ADDRESS */ - } -#ifdef EXPORTED_KALLSYMS_ADDRESS - ret = - kallsyms_address_to_symbol((unsigned long)sys_call_table, &mod_name, - &mod_start, &mod_end, &sec_name, - &sec_start, &sec_end, &sym_name, - &sym_start, &sym_end); - if (ret && strcmp(sym_name, "sys_call_table")) - sys_call_table = 0; -#endif /* EXPORTED_KALLSYMS_ADDRESS */ - if (!sys_call_table) { - printf("Failed to find address of sys_call_table\n"); - } else { - printf("Found sys_call_table at %lx\n", (unsigned long)sys_call_table); -#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) - error cant support this yet.; -#endif /* AFS_SPARC64_LINUX20_ENV */ -#endif /* EXPORTED_SYS_CALL_TABLE */ - -#ifdef AFS_AMD64_LINUX20_ENV -#ifndef EXPORTED_IA32_SYS_CALL_TABLE - ia32_sys_call_table = 0; -#ifdef EXPORTED_KALLSYMS_SYMBOL - ret = 1; - token = 0; - while (ret) { - sym_start = 0; - ret = kallsyms_symbol_to_address("ia32_sys_call_table", &token, - &mod_name, &mod_start, &mod_end, - &sec_name, &sec_start, &sec_end, - &sym_name, &sym_start, &sym_end); - if (ret && !strcmp(mod_name, "kernel")) - break; - } - if (ret && sym_start) { - ia32_sys_call_table = sym_start; - } -#else /* EXPORTED_KALLSYMS_SYMBOL */ -#ifdef EXPORTED_KALLSYMS_ADDRESS - ret = kallsyms_address_to_symbol((unsigned long) - &interruptible_sleep_on, - &mod_name, &mod_start, &mod_end, - &sec_name, &sec_start, &sec_end, - &sym_name, &sym_start, &sym_end); - ptr = (unsigned long *)sec_start; - datalen = (sec_end - sec_start) / sizeof(unsigned long); -#else /* EXPORTED_KALLSYMS_ADDRESS */ -#if defined(AFS_AMD64_LINUX20_ENV) - ptr = (unsigned long *)&interruptible_sleep_on; - datalen = 0x180000 / sizeof(ptr); -#else /* AFS_AMD64_LINUX20_ENV */ - ptr = (unsigned long *)&interruptible_sleep_on; - datalen = 16384; -#endif /* AFS_AMD64_LINUX20_ENV */ -#endif /* EXPORTED_KALLSYMS_ADDRESS */ - for (offset = 0; offset < datalen; ptr++, offset++) { - if (ptr[0] == (unsigned long)&sys_exit - && ptr[__NR_ia32_open - __NR_ia32_exit] == - (unsigned long)&sys_open) { - ia32_sys_call_table = ptr - __NR_ia32_exit; - break; - } - } -#ifdef EXPORTED_KALLSYMS_ADDRESS - ret = kallsyms_address_to_symbol((unsigned long)ia32_sys_call_table, - &mod_name, &mod_start, &mod_end, - &sec_name, &sec_start, &sec_end, - &sym_name, &sym_start, &sym_end); - if (ret && strcmp(sym_name, "ia32_sys_call_table")) - ia32_sys_call_table = 0; -#endif /* EXPORTED_KALLSYMS_ADDRESS */ -#endif /* EXPORTED_KALLSYMS_SYMBOL */ - if (!ia32_sys_call_table) { - printf("Warning: Failed to find address of ia32_sys_call_table\n"); - } else { - printf("Found ia32_sys_call_table at %lx\n", (unsigned long)ia32_sys_call_table); - } -#else - printf("Found ia32_sys_call_table at %lx\n", (unsigned long)ia32_sys_call_table); -#endif /* IA32_SYS_CALL_TABLE */ -#endif - - /* Initialize pointers to kernel syscalls. */ -#if !defined(AFS_LINUX24_ENV) - sys_settimeofdayp = SYSCALL2POINTER sys_call_table[_S(__NR_settimeofday)]; -#endif /* AFS_IA64_LINUX20_ENV */ - - /* setup AFS entry point. */ - if ( -#if defined(AFS_IA64_LINUX20_ENV) - SYSCALL2POINTER sys_call_table[__NR_afs_syscall - 1024] -#else - SYSCALL2POINTER sys_call_table[_S(__NR_afs_syscall)] -#endif - == afs_syscall) { - printf("AFS syscall entry point already in use!\n"); - return -EBUSY; - } -#if defined(AFS_IA64_LINUX20_ENV) - afs_ni_syscall = sys_call_table[__NR_afs_syscall - 1024]; - sys_call_table[__NR_afs_syscall - 1024] = - POINTER2SYSCALL((struct fptr *)afs_syscall_stub)->ip; -#else /* AFS_IA64_LINUX20_ENV */ - afs_ni_syscall = sys_call_table[_S(__NR_afs_syscall)]; - sys_call_table[_S(__NR_afs_syscall)] = POINTER2SYSCALL afs_syscall; -#ifdef AFS_SPARC64_LINUX20_ENV - afs_ni_syscall32 = sys_call_table32[__NR_afs_syscall]; - sys_call_table32[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall32; -#endif -#endif /* AFS_IA64_LINUX20_ENV */ -#ifdef AFS_AMD64_LINUX20_ENV - if (ia32_sys_call_table) { - ia32_ni_syscall = ia32_sys_call_table[__NR_ia32_afs_syscall]; - ia32_sys_call_table[__NR_ia32_afs_syscall] = - POINTER2SYSCALL afs_syscall; - } -#endif /* AFS_S390_LINUX22_ENV */ -#ifndef EXPORTED_SYS_CALL_TABLE - } -#endif /* EXPORTED_SYS_CALL_TABLE */ osi_Init(); - register_filesystem(&afs_fs_type); - - /* Intercept setgroups calls */ - if (sys_call_table) { -#if defined(AFS_IA64_LINUX20_ENV) - sys_setgroupsp = (void *)&sys_setgroups; - - ((struct fptr *)sys_setgroupsp)->ip = - SYSCALL2POINTER sys_call_table[__NR_setgroups - 1024]; - ((struct fptr *)sys_setgroupsp)->gp = kernel_gp; - - sys_call_table[__NR_setgroups - 1024] = - POINTER2SYSCALL((struct fptr *)afs_xsetgroups_stub)->ip; -#else /* AFS_IA64_LINUX20_ENV */ - sys_setgroupsp = SYSCALL2POINTER sys_call_table[_S(__NR_setgroups)]; - sys_call_table[_S(__NR_setgroups)] = POINTER2SYSCALL afs_xsetgroups; -#ifdef AFS_SPARC64_LINUX20_ENV - sys32_setgroupsp = SYSCALL2POINTER sys_call_table32[__NR_setgroups]; - sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs32_xsetgroups; -#endif /* AFS_SPARC64_LINUX20_ENV */ -#if defined(__NR_setgroups32) - sys_setgroups32p = SYSCALL2POINTER sys_call_table[__NR_setgroups32]; - sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32; -#ifdef AFS_SPARC64_LINUX20_ENV - sys32_setgroups32p = - SYSCALL2POINTER sys_call_table32[__NR_setgroups32]; - sys_call_table32[__NR_setgroups32] = - POINTER2SYSCALL afs32_xsetgroups32; -#endif /* AFS_SPARC64_LINUX20_ENV */ -#endif /* __NR_setgroups32 */ -#ifdef AFS_AMD64_LINUX20_ENV - if (ia32_sys_call_table) { - sys32_setgroupsp = - SYSCALL2POINTER ia32_sys_call_table[__NR_ia32_setgroups]; - ia32_sys_call_table[__NR_ia32_setgroups] = - POINTER2SYSCALL afs32_xsetgroups; -#if defined(__NR_ia32_setgroups32) - sys32_setgroups32p = - SYSCALL2POINTER ia32_sys_call_table[__NR_ia32_setgroups32]; - ia32_sys_call_table[__NR_ia32_setgroups32] = - POINTER2SYSCALL afs32_xsetgroups32; -#endif /* __NR_ia32_setgroups32 */ - } -#endif /* AFS_AMD64_LINUX20_ENV */ -#endif /* AFS_IA64_LINUX20_ENV */ - - } + e = osi_syscall_init(); + if (e) return e; + register_filesystem(&afs_fs_type); osi_sysctl_init(); afsproc_init(); @@ -586,39 +226,7 @@ cleanup_module(void) #endif { osi_sysctl_clean(); - if (sys_call_table) { -#if defined(AFS_IA64_LINUX20_ENV) - sys_call_table[__NR_setgroups - 1024] = - POINTER2SYSCALL((struct fptr *)sys_setgroupsp)->ip; - sys_call_table[__NR_afs_syscall - 1024] = afs_ni_syscall; -#else /* AFS_IA64_LINUX20_ENV */ - sys_call_table[_S(__NR_setgroups)] = POINTER2SYSCALL sys_setgroupsp; - sys_call_table[_S(__NR_afs_syscall)] = afs_ni_syscall; -# ifdef AFS_SPARC64_LINUX20_ENV - sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys32_setgroupsp; - sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32; -# endif -# if defined(__NR_setgroups32) - sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p; -# ifdef AFS_SPARC64_LINUX20_ENV - sys_call_table32[__NR_setgroups32] = - POINTER2SYSCALL sys32_setgroups32p; -# endif -# endif -#endif /* AFS_IA64_LINUX20_ENV */ -#ifdef AFS_AMD64_LINUX20_ENV - if (ia32_sys_call_table) { - ia32_sys_call_table[__NR_ia32_setgroups] = - POINTER2SYSCALL sys32_setgroupsp; - ia32_sys_call_table[__NR_ia32_afs_syscall] = - POINTER2SYSCALL ia32_ni_syscall; -# if defined(__NR_setgroups32) - ia32_sys_call_table[__NR_ia32_setgroups32] = - POINTER2SYSCALL sys32_setgroups32p; -#endif - } -#endif - } + osi_syscall_clean(); unregister_filesystem(&afs_fs_type); osi_linux_free_inode_pages(); /* Invalidate all pages using AFS inodes. */ diff --git a/src/afs/LINUX/osi_probe.c b/src/afs/LINUX/osi_probe.c new file mode 100644 index 000000000..83f3a191d --- /dev/null +++ b/src/afs/LINUX/osi_probe.c @@ -0,0 +1,1225 @@ +/* + * vi:set cin noet sw=4 tw=70: + * Copyright 2004, 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 + * + * Portions of this code borrowed from arla under the following terms: + * Copyright (c) 2003-2004 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL"). + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* Code to find the Linux syscall table */ + +#ifdef OSI_PROBE_STANDALONE +#define OSI_PROBE_DEBUG +#endif +#ifndef OSI_PROBE_STANDALONE +#include +#include "afs/param.h" +#endif +#include /* early to avoid printf->printk mapping */ +#ifndef OSI_PROBE_STANDALONE +#include "afs/sysincludes.h" +#include "afsincludes.h" +#endif +#include +#include +#include +#include +#include +#include + +#ifdef AFS_AMD64_LINUX20_ENV +#include +#endif + +/* number of syscalls */ +/* NB: on MIPS we care about the 4xxx range */ +#ifndef NR_syscalls +#define NR_syscalls 222 +#endif + +/* lower bound of valid kernel text pointers */ +#ifdef AFS_IA64_LINUX20_ENV +#define ktxt_lower_bound (((unsigned long)&kernel_thread ) & 0xfff00000L) +#else +#define ktxt_lower_bound (((unsigned long)&kernel_thread ) & ~0xfffffL) +#endif + +/* On SPARC64 and S390X, sys_call_table contains 32-bit entries + * even though pointers are 64 bit quantities. + */ +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) +#define SYSCALLTYPE unsigned int +#define PROBETYPE int +#else +#define SYSCALLTYPE void * +#define PROBETYPE long +#endif + +#if defined(AFS_S390X_LINUX20_ENV) && !defined(AFS_S390X_LINUX26_ENV) +#define _SS(x) ((x) << 1) +#define _SX(x) ((x) &~ 1) +#else +#define _SS(x) (x) +#define _SX(x) (x) +#endif + + +/* Allow the user to specify sys_call_table addresses */ +static unsigned long sys_call_table_addr[4] = { 0,0,0,0 }; +MODULE_PARM(sys_call_table_addr, "1-4l"); +MODULE_PARM_DESC(sys_call_table_addr, "Location of system call tables"); + +/* If this is set, we are more careful about avoiding duplicate matches */ +static int probe_carefully = 1; +MODULE_PARM(probe_carefully, "i"); +MODULE_PARM_DESC(probe_carefully, "Probe for system call tables carefully"); + +static int probe_ignore_syscalls[8] = { -1, -1, -1, -1, -1, -1, -1, -1 }; +MODULE_PARM(probe_ignore_syscalls, "1-8i"); +MODULE_PARM_DESC(probe_ignore_syscalls, "Syscalls to ignore in table checks"); + +#ifdef OSI_PROBE_DEBUG +/* + * Debugging flags: + * 0x0001 - General debugging + * 0x0002 - detail - try + * 0x0004 - detail - try_harder + * 0x0008 - detail - check_table + * 0x0010 - detail - check_harder + * 0x0020 - detail - check_harder/zapped + * 0x0040 - automatically ignore setgroups and afs_syscall + */ +static int probe_debug = 0x41; +MODULE_PARM(probe_debug, "i"); +MODULE_PARM_DESC(probe_debug, "Debugging level"); + +static unsigned long probe_debug_addr[4] = { 0,0,0,0 }; +MODULE_PARM(probe_debug_addr, "1-4l"); +MODULE_PARM_DESC(probe_debug_addr, "Debug range starting locations"); + +static unsigned long probe_debug_range = 0; +MODULE_PARM(probe_debug_range, "l"); +MODULE_PARM_DESC(probe_debug_range, "Debug range length"); + +static unsigned long probe_debug_tag = 0; +MODULE_PARM(probe_debug_tag, "l"); +MODULE_PARM_DESC(probe_debug_tag, "Debugging output start tag"); +#endif + + +/* Weak references are our friends. They are supported by the in-kernel + * linker in Linux 2.6 and by all versions of modutils back to 2.2pre1. + * A weak reference not satisified by the kernel will have value zero. + * + * Unfortunately, weak references to functions don't work right on + * IA64; specifically, if you actually try to make a call through + * such a reference, and the symbol doesn't exist in the kernel, then + * the module relocation code will oops. A workaround for this is + * probably possible, but the use of kallsyms_* is of limited value, + * so I'm not bothing with the effort for now. + * -- jhutz, 10-Feb-2005 + */ +#ifdef OSI_PROBE_KALLSYMS +extern int kallsyms_symbol_to_address(char *name, unsigned long *token, + char **mod_name, + unsigned long *mod_start, + unsigned long *mod_end, + char **sec_name, + unsigned long *sec_start, + unsigned long *sec_end, + char **sym_name, + unsigned long *sym_start, + unsigned long *sym_end + ) __attribute__((weak)); + +extern int kallsyms_address_to_symbol(unsigned long address, + char **mod_name, + unsigned long *mod_start, + unsigned long *mod_end, + char **sec_name, + unsigned long *sec_start, + unsigned long *sec_end, + char **sym_name, + unsigned long *sym_start, + unsigned long *sym_end + ) __attribute__((weak)); +#endif + +extern SYSCALLTYPE sys_call_table[] __attribute__((weak)); +extern SYSCALLTYPE ia32_sys_call_table[] __attribute__((weak)); +extern SYSCALLTYPE sys_call_table32[] __attribute__((weak)); +extern SYSCALLTYPE sys_call_table_emu[] __attribute__((weak)); + +extern asmlinkage long sys_close(unsigned int) __attribute__((weak)); +extern asmlinkage long sys_chdir(const char *) __attribute__((weak)); +extern asmlinkage ssize_t sys_write(unsigned int, const char *, size_t) __attribute__((weak)); +#ifdef AFS_LINUX26_ENV +extern asmlinkage long sys_wait4(pid_t, int *, int, struct rusage *) __attribute__((weak)); +#else +extern asmlinkage long sys_wait4(pid_t, unsigned int *, int, struct rusage *) __attribute__((weak)); +#endif +extern asmlinkage long sys_exit (int) __attribute__((weak)); +extern asmlinkage long sys_open (const char *, int, int) __attribute__((weak)); +extern asmlinkage long sys_ioctl(unsigned int, unsigned int, unsigned long) __attribute__((weak)); + + +/* Structures used to control probing. We put all the details of which + * symbols we're interested in, what syscall functions to look for, etc + * into tables, so we can then have a single copy of the functions that + * actually do the work. + */ +typedef struct { + char *name; + int NR1; + void *fn1; + int NR2; + void *fn2; + int NR3; + void *fn3; +} tryctl; + +typedef struct { + char *symbol; /* symbol name */ + char *desc; /* description for messages */ + int offset; /* first syscall number in table */ + + void *weak_answer; /* weak symbol ref */ + void *parm_answer; /* module parameter answer */ + void *debug_answer; /* module parameter answer */ + unsigned long given_answer; /* compiled-in answer, if any */ + + tryctl *trylist; /* array of combinations to try */ + + unsigned long try_sect_sym; /* symbol in section to try scanning */ + unsigned long try_base; /* default base address for scan */ + unsigned long try_base_mask; /* base address bits to force to zero */ + unsigned long try_length; /* default length for scan */ + + int n_zapped_syscalls; /* number of unimplemented system calls */ + int *zapped_syscalls; /* list of unimplemented system calls */ + + int n_unique_syscalls; /* number of unique system calls */ + int *unique_syscalls; /* list of unimplemented system calls */ + + int verifyNR; /* syscall number to verify match */ + void *verify_fn; /* syscall pointer to verify match */ + + int debug_ignore_NR[4]; /* syscalls to ignore for debugging */ +} probectl; + + + +/********** Probing Configuration: sys_call_table **********/ + +/* syscall pairs/triplets to probe */ +/* On PPC64 and SPARC64, we need to omit the ones that might match both tables */ +static tryctl main_try[] = { +#if !defined(AFS_PPC64_LINUX20_ENV) && !defined(AFS_SPARC64_LINUX20_ENV) + { "scan: close+chdir+write", __NR_close, &sys_close, __NR_chdir, &sys_chdir, __NR_write, &sys_write }, +#endif + { "scan: close+wait4", __NR_close, &sys_close, __NR_wait4, &sys_wait4, -1, 0 }, +#if !defined(AFS_PPC64_LINUX20_ENV) && !defined(AFS_SPARC64_LINUX20_ENV) + { "scan: close+chdir", __NR_close, &sys_close, __NR_chdir, &sys_chdir, -1, 0 }, +#endif + { "scan: close+ioctl", __NR_close, &sys_close, __NR_ioctl, &sys_ioctl, -1, 0 }, + { "scan: exit+open", __NR_exit, &sys_exit, __NR_open, &sys_open, -1, 0 }, + { 0 } +}; + +/* zapped syscalls for try_harder */ +/* this list is based on the table in 'zapped_syscalls' */ + +static int main_zapped_syscalls[] = { +/* + * SPARC-Linux uses syscall number mappings chosen to be compatible + * with SunOS. So, it doesn't have any of the traditional calls or + * the new STREAMS ones. However, there are a number of syscalls + * which are SunOS-specific (not implemented on Linux), i386-specific + * (not implemented on SPARC-Linux), or implemented only on one of + * sparc32 or sparc64. Of course, there are no __NR macros for most + * of these. + * + * Note that the calls we list here are implemented by sys_nis_syscall, + * not by sys_ni_syscall. That means we have to exclude all of the + * other entries, or we might get a sys_ni_syscall into the list and + * the test would no longer work. + */ +#if defined(AFS_SPARC64_LINUX20_ENV) + /* mmap2, fstat64, getmsg, putmsg, modify_ldt */ + 56, 63, 151, 152, 218, +#elif defined(AFS_SPARC_LINUX20_ENV) + /* memory_ordering, getmsg, putmsg, unimplemented, modify_ldt */ + 52, 151, 152, 164, 218, +#else /* !AFS_SPARC_LINUX20_ENV */ + +/* + * These 7 syscalls are present in the syscall table on most "older" + * platforms that use the traditional syscall number mappings. They + * are not implemented on any platform. + */ +#ifdef __NR_break + __NR_break, +#endif +#ifdef __NR_stty + __NR_stty, +#endif +#ifdef __NR_gtty + __NR_gtty, +#endif +#ifdef __NR_ftime + __NR_ftime, +#endif +#ifdef __NR_prof + __NR_prof, +#endif +#ifdef __NR_lock + __NR_lock, +#endif +#ifdef __NR_mpx + __NR_mpx, +#endif +/* + * On s390 and arm (but not arm26), the seven traditional unimplemented + * system calls are indeed present and unimplemented. However, the + * corresponding __NR macros are not defined, so the tests above fail. + * Instead, we just have to know the numbers for these. + */ +#if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV) + /* break, stty, gtty, ftime, prof, lock, mpx */ + 17, 31, 32, 35, 44, 53, 56, +#endif + +/* + * Sadly, some newer platforms like IA64, amd64, and PA-RISC don't have + * the traditional numbers, so the list above are not helpful. They + * do have entries for getpmsg/putpmsg, which are always unimplemented. + */ +#ifdef __NR_getpmsg + __NR_getpmsg, +#endif +#ifdef __NR_putpmsg + __NR_putpmsg, +#endif + +/* + * The module-loading mechanism changed in Linux 2.6, and insmod's + * loss is our gain: three new unimplemented system calls! + */ +#if defined(AFS_LINUX26_ENV) +#ifdef __NR_ + __NR_create_module, +#endif +#ifdef __NR_query_module + __NR_query_module, +#endif +#ifdef __NR_get_kernel_syms + __NR_get_kernel_syms, +#endif +#endif /* AFS_LINUX26_ENV */ + +/* + * On IA64, the old module-loading calls are indeed present and + * unimplemented, but the __NR macros are not defined. Again, + * we simply have to know their numbers. + */ +#ifdef AFS_IA64_LINUX26_ENV + /* create_module, query_module, get_kernel_sysms */ + 1132, 1136, 1135, +#endif + +/* And the same deal for arm (not arm26), if we ever support that. */ +#if 0 + /* create_module, query_module, get_kernel_sysms */ + 127, 167, 130, +#endif + +/* + * Alpha-Linux uses syscall number mappings chosen to be compatible + * with OSF/1. So, it doesn't have any of the traditional calls or + * the new STREAMS ones, but it does have several OSF/1-specific + * syscalls which are not implemented on Linux. These don't exist on + * any other platform. + */ +#ifdef __NR_osf_syscall + __NR_osf_syscall, +#endif +#ifdef __NR_osf_profil + __NR_osf_profil, +#endif +#ifdef __NR_osf_reboot + __NR_osf_reboot, +#endif +#ifdef __NR_osf_kmodcall + __NR_osf_kmodcall, +#endif +#ifdef __NR_osf_old_vtrace + __NR_osf_old_vtrace, +#endif + +/* + * On PPC64, we need a couple more entries to distinguish the two + * tables, since the system call numbers are the same and the sets of + * unimplemented calls are very similar. + * mmap2 and fstat64 are implemented only for 32-bit calls + */ +#ifdef AFS_PPC64_LINUX20_ENV + __NR_mmap2, + __NR_fstat64, +#endif /* AFS_PPC64_LINUX20_ENV */ + +/* Similarly for S390X, with lcown16 and fstat64 */ +#ifdef AFS_S390X_LINUX20_ENV + /* lchown16, fstat64 */ + 16, 197, +#endif +#endif /* !AFS_SPARC_LINUX20_ENV */ + 0 +}; + +/* unique syscalls for try_harder */ +static int main_unique_syscalls[] = { +#if defined(AFS_SPARC64_LINUX24_ENV) || defined(AFS_SPARC_LINUX24_ENV) + /* + * On SPARC, we need some additional unique calls to make sure + * we don't match the SunOS-compatibility table. + */ + __NR_sgetmask, __NR_ssetmask, +#endif + __NR_exit, __NR_mount, __NR_read, __NR_write, + __NR_open, __NR_close, __NR_unlink +}; + +/* probe control structure */ +static probectl main_probe = { + /* symbol name and description */ + "sys_call_table", + "system call table", + + /* syscall number of first entry in table */ +#ifdef AFS_IA64_LINUX20_ENV + 1024, +#else + 0, +#endif + + sys_call_table, /* weak symbol ref */ + 0, 0, /* module parameter answers */ +#ifdef AFS_LINUX_sys_call_table + AFS_LINUX_sys_call_table, /* compiled-in answer, if any */ +#else + 0, +#endif + + main_try, /* array of combinations to try */ + + /* symbol in section to try scanning */ +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV) + (unsigned long)&sys_close, +#elif defined(AFS_AMD64_LINUX20_ENV) + /* On this platform, it's in a different section! */ + (unsigned long)&tasklist_lock, +#else + (unsigned long)&init_mm, +#endif + + /* default base address for scan */ + /* base address bits to force to zero */ + /* default length for scan */ +#if defined(AFS_SPARC64_LINUX20_ENV) + (unsigned long)(&sys_close), + 0xfffff, + 0x10000, +#elif defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV) + /* bleah; this is so suboptimal */ + (unsigned long)(&sys_close), + 0xfffff, + 0x20000, +#elif defined(AFS_IA64_LINUX20_ENV) + (unsigned long)(&init_mm), + 0x1fffff, + 0x30000, +#elif defined(AFS_AMD64_LINUX20_ENV) + (unsigned long)(&tasklist_lock) - 0x30000, + 0, + 0x6000, +#elif defined(AFS_PPC_LINUX20_ENV) || defined(AFS_PPC_LINUX20_ENV) + (unsigned long)&init_mm, + 0xffff, + 16384, +#else + (unsigned long)&init_mm, + 0, + 16384, +#endif + + /* number and list of unimplemented system calls */ + ((sizeof(main_zapped_syscalls)/sizeof(main_zapped_syscalls[0])) - 1), + main_zapped_syscalls, + + /* number and list of unique system calls */ + (sizeof(main_unique_syscalls)/sizeof(main_unique_syscalls[0])), + main_unique_syscalls, + + /* syscall number and pointer to verify match */ + __NR_close, &sys_close, + + /* syscalls to ignore for debugging */ + { +#if defined(AFS_ALPHA_LINUX20_ENV) + 338, +#elif defined(AFS_AMD64_LINUX20_ENV) + 183, +#elif defined(AFS_IA64_LINUX20_ENV) + 1141, +#elif defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_SPARC64_LINUX20_ENV) + 227, +#else + 137, +#endif + __NR_setgroups, +#ifdef __NR_setgroups32 + __NR_setgroups32, +#else + -1, +#endif + -1, + } +}; + + +/********** Probing Configuration: amd64 ia32_sys_call_table **********/ +#if defined(AFS_AMD64_LINUX20_ENV) + +/* syscall pairs/triplets to probe */ +static tryctl ia32_try[] = { + { "scan: close+chdir+write", __NR_ia32_close, &sys_close, __NR_ia32_chdir, &sys_chdir, __NR_ia32_write, &sys_write }, + { "scan: close+chdir", __NR_ia32_close, &sys_close, __NR_ia32_chdir, &sys_chdir, -1, 0 }, + { 0 } +}; + +/* zapped syscalls for try_harder */ +static int ia32_zapped_syscalls[] = { + __NR_ia32_break, __NR_ia32_stty, __NR_ia32_gtty, __NR_ia32_ftime, + __NR_ia32_prof, __NR_ia32_lock, __NR_ia32_mpx, + 0 +}; + +/* unique syscalls for try_harder */ +static int ia32_unique_syscalls[] = { + __NR_ia32_exit, __NR_ia32_mount, __NR_ia32_read, __NR_ia32_write, + __NR_ia32_open, __NR_ia32_close, __NR_ia32_unlink +}; + +/* probe control structure */ +static probectl ia32_probe = { + /* symbol name and description */ + "ia32_sys_call_table", + "32-bit system call table", + + /* syscall number of first entry in table */ + 0, + + ia32_sys_call_table, /* weak symbol ref */ + 0, 0, /* module parameter answers */ +#ifdef AFS_LINUX_ia32_sys_call_table + AFS_LINUX_ia32_sys_call_table,/* compiled-in answer, if any */ +#else + 0, +#endif + + ia32_try, /* array of combinations to try */ + + /* symbol in section to try scanning */ + (unsigned long)&init_mm, + + /* default base address for scan */ + /* base address bits to force to zero */ + /* default length for scan */ + (unsigned long)&init_mm, + 0, + (0x180000 / sizeof(unsigned long *)), + + /* number and list of unimplemented system calls */ + ((sizeof(ia32_zapped_syscalls)/sizeof(ia32_zapped_syscalls[0])) - 1), + ia32_zapped_syscalls, + + /* number and list of unique system calls */ + (sizeof(ia32_unique_syscalls)/sizeof(ia32_unique_syscalls[0])), + ia32_unique_syscalls, + + /* syscall number and pointer to verify match */ + __NR_ia32_close, &sys_close, + + /* syscalls to ignore for debugging */ + { + 137, + __NR_ia32_setgroups, + __NR_ia32_setgroups32, + -1, + } +}; + +static probectl *probe_list[] = { + &main_probe, &ia32_probe +}; + + +/********** Probing Configuration: IA64 **********/ +#elif defined(AFS_IA64_LINUX20_ENV) +struct fptr { + void *ip; + unsigned long gp; +}; + +/* no 32-bit support on IA64 for now */ +static probectl *probe_list[] = { + &main_probe +}; + + +/********** Probing Configuration: ppc64, sparc64 sys_call_table32 **********/ +#elif defined(AFS_PPC64_LINUX20_ENV) || defined(AFS_SPARC64_LINUX20_ENV) + +/* + * syscall pairs/triplets to probe + * This has to be empty, because anything that would work will + * also match the main table, and that's no good. + */ +static tryctl sct32_try[] = { + { 0 } +}; + +/* zapped syscalls for try_harder */ +static int sct32_zapped_syscalls[] = { +#ifdef AFS_PPC64_LINUX20_ENV + /* These should be sufficient */ + __NR_break, __NR_stty, __NR_gtty, __NR_ftime, + __NR_prof, __NR_lock, __NR_mpx, +#endif +#ifdef AFS_SPARC64_LINUX20_ENV + /* memory_ordering, getmsg, putmsg, unimplemented, modify_ldt */ + 52, 151, 152, 164, 218, +#endif + 0 +}; + +/* unique syscalls for try_harder */ +/* mmap2 and fstat64 are implemented only for 32-bit calls */ +static int sct32_unique_syscalls[] = { +#ifdef AFS_PPC64_LINUX20_ENV + __NR_mmap2, __NR_fstat64, +#endif +#ifdef AFS_SPARC64_LINUX24_ENV + /* + * On SPARC, we need some additional unique calls to make sure + * we don't match the SunOS-compatibility table. + */ + __NR_sgetmask, __NR_ssetmask, +#endif + __NR_exit, __NR_mount, __NR_read, __NR_write, + __NR_open, __NR_close, __NR_unlink +}; + +/* probe control structure */ +static probectl sct32_probe = { + /* symbol name and description */ + "sys_call_table32", + "32-bit system call table", + + /* syscall number of first entry in table */ + 0, + + sys_call_table32, /* weak symbol ref */ + 0, 0, /* module parameter answers */ +#ifdef AFS_LINUX_sys_call_table32 + AFS_LINUX_sys_call_table32, /* compiled-in answer, if any */ +#else + 0, +#endif + + sct32_try, /* array of combinations to try */ + + /* symbol in section to try scanning */ +#if defined(AFS_SPARC64_LINUX20_ENV) + (unsigned long)&sys_close, +#else + (unsigned long)&init_mm, +#endif + + /* default base address for scan */ + /* base address bits to force to zero */ + /* default length for scan */ +#if defined(AFS_SPARC64_LINUX20_ENV) + (unsigned long)(&sys_close), + 0xfffff, + 0x10000, +#else + (unsigned long)&init_mm, + 0, + 16384, +#endif + + /* number and list of unimplemented system calls */ + ((sizeof(sct32_zapped_syscalls)/sizeof(sct32_zapped_syscalls[0])) - 1), + sct32_zapped_syscalls, + + /* number and list of unique system calls */ + (sizeof(sct32_unique_syscalls)/sizeof(sct32_unique_syscalls[0])), + sct32_unique_syscalls, + + /* syscall number and pointer to verify match */ + __NR_close, &sys_close, + + /* syscalls to ignore for debugging */ + { +#if defined(AFS_SPARC64_LINUX20_ENV) + 227, +#else + 137, +#endif + __NR_setgroups, + -1, + -1, + } +}; + +static probectl *probe_list[] = { + &main_probe, &sct32_probe +}; + + +/********** Probing Configuration: s390x sys_call_table_emu **********/ +/* We only actually need to do this on s390x_linux26 and later. + * On earlier versions, the two tables were interleaved and so + * have related base addresses. + */ +#elif defined(AFS_S390X_LINUX26_ENV) + +/* syscall pairs/triplets to probe */ +/* nothing worthwhile is exported, so this is empty */ +static tryctl emu_try[] = { + { 0 } +}; + +/* zapped syscalls for try_harder */ +static int emu_zapped_syscalls[] = { + /* break, stty, gtty, ftime, prof, lock, mpx */ + 17, 31, 32, 35, 44, 53, 56, + 0 +}; + +/* unique syscalls for try_harder */ +static int emu_unique_syscalls[] = { + /* lchown16, fstat64 */ + 16, 197, + __NR_exit, __NR_mount, __NR_read, __NR_write, + __NR_open, __NR_close, __NR_unlink +}; + +/* probe control structure */ +static probectl emu_probe = { + /* symbol name and description */ + "sys_call_table_emu", + "32-bit system call table", + + /* syscall number of first entry in table */ + 0, + + sys_call_table_emu, /* weak symbol ref */ + 0, 0, /* module parameter answers */ +#ifdef AFS_LINUX_sys_call_table_emu + AFS_LINUX_sys_call_table_emu, /* compiled-in answer, if any */ +#else + 0, +#endif + + emu_try, /* array of combinations to try */ + + /* symbol in section to try scanning */ + (unsigned long)&sys_close, + + /* default base address for scan */ + /* base address bits to force to zero */ + /* default length for scan */ + (unsigned long)&sys_close, + 0xfffff, + 0x20000, + + /* number and list of unimplemented system calls */ + ((sizeof(emu_zapped_syscalls)/sizeof(emu_zapped_syscalls[0])) - 1), + emu_zapped_syscalls, + + /* number and list of unique system calls */ + (sizeof(emu_unique_syscalls)/sizeof(emu_unique_syscalls[0])), + emu_unique_syscalls, + + /* syscall number and pointer to verify match */ + __NR_close, &sys_close, + + /* syscalls to ignore for debugging */ + { + 137, + __NR_setgroups, + -1, + -1, + } +}; + +static probectl *probe_list[] = { + &main_probe, &emu_probe +}; + + +/********** End of Probing Configuration **********/ + +#else /* no per-platform probe control, so use the default list */ +static probectl *probe_list[] = { + &main_probe +}; +#endif + +#define N_PROBE_LIST (sizeof(probe_list) / sizeof(*probe_list)) +#define DEBUG_IN_RANGE(P,x) (!probe_debug_range || \ + (P->debug_answer && \ + (unsigned long)(x) >= (unsigned long)P->debug_answer && \ + (unsigned long)(x) < (unsigned long)P->debug_answer + probe_debug_range)) + + + +static int check_table(probectl *P, PROBETYPE *ptr) +{ + PROBETYPE *x; + int i, j; + + for (x = ptr, i = 0; i < _SS(NR_syscalls); i++, x++) { +#ifdef OSI_PROBE_DEBUG + if (probe_debug & 0x0040) { + for (j = 0; j < 4; j++) { + if (_SS(P->debug_ignore_NR[j]) == _SX(i + P->offset)) break; + } + if (j < 4) continue; + } +#endif + for (j = 0; j < 8; j++) { + if (_SS(probe_ignore_syscalls[j]) == _SX(i) + P->offset) break; + } + if (j < 8) continue; + if (*x <= ktxt_lower_bound) { +#ifdef OSI_PROBE_DEBUG + if ((probe_debug & 0x0008) && DEBUG_IN_RANGE(P,ptr)) + printk("<7>check 0x%lx -> %d [0x%lx]\n", + (unsigned long)ptr, i, (unsigned long)*x); +#endif + return i; + } + } +#ifdef OSI_PROBE_DEBUG + if ((probe_debug & 0x0008) && DEBUG_IN_RANGE(P,ptr)) + printk("<7>check 0x%lx -> ok\n", (unsigned long)ptr); +#endif + return -1; +} + +static void *try(probectl *P, tryctl *T, PROBETYPE *ptr, + unsigned long datalen) +{ +#ifdef OSI_PROBE_KALLSYMS + char *mod_name, *sec_name, *sym_name; + unsigned long mod_start, mod_end; + unsigned long sec_start, sec_end; + unsigned long sym_start, sym_end; +#endif + unsigned long offset, ip1, ip2, ip3; + int ret; + +#ifdef AFS_IA64_LINUX20_ENV + ip1 = T->fn1 ? (unsigned long)((struct fptr *)T->fn1)->ip : 0; + ip2 = T->fn2 ? (unsigned long)((struct fptr *)T->fn2)->ip : 0; + ip3 = T->fn3 ? (unsigned long)((struct fptr *)T->fn3)->ip : 0; +#else + ip1 = (unsigned long)T->fn1; + ip2 = (unsigned long)T->fn2; + ip3 = (unsigned long)T->fn3; +#endif + +#ifdef OSI_PROBE_DEBUG + if (probe_debug & 0x0001) + printk("<7>osi_probe: %s %s (%d->0x%lx, %d->0x%lx, %d->0x%lx)\n", + P->symbol, T->name, T->NR1, ip1, T->NR2, ip2, T->NR3, ip3); +#endif + + if (!ip1 || !ip2 || (T->NR3 >= 0 && !ip3)) + return 0; + + for (offset = 0; offset < datalen; offset++, ptr++) { + ret = check_table(P, ptr); + if (ret >= 0) { + /* return value is number of entries to skip */ + ptr += ret; + offset += ret; + continue; + } + +#ifdef OSI_PROBE_DEBUG + if ((probe_debug & 0x0002) && DEBUG_IN_RANGE(P,ptr)) + printk("<7>try 0x%lx\n", (unsigned long)ptr); +#endif + if (ptr[_SS(T->NR1 - P->offset)] != ip1) continue; + if (ptr[_SS(T->NR2 - P->offset)] != ip2) continue; + if (ip3 && ptr[_SS(T->NR3 - P->offset)] != ip3) continue; + +#ifdef OSI_PROBE_DEBUG + if (probe_debug & 0x0002) + printk("<7>try found 0x%lx\n", (unsigned long)ptr); +#endif +#ifdef OSI_PROBE_KALLSYMS + if (kallsyms_address_to_symbol) { + ret = kallsyms_address_to_symbol((unsigned long)ptr, + &mod_name, &mod_start, &mod_end, + &sec_name, &sec_start, &sec_end, + &sym_name, &sym_start, &sym_end); + if (!ret || strcmp(sym_name, P->symbol)) continue; + } +#endif + /* XXX should we make sure there is only one match? */ + return (void *)ptr; + } + return 0; +} + + +static int check_harder(probectl *P, PROBETYPE *p) +{ + unsigned long ip1; + int i, s; + + /* Check zapped syscalls */ + for (i = 1; i < P->n_zapped_syscalls; i++) { + if (p[_SS(P->zapped_syscalls[i])] != p[_SS(P->zapped_syscalls[0])]) { +#ifdef OSI_PROBE_DEBUG + if ((probe_debug & 0x0020) && DEBUG_IN_RANGE(P,p)) + printk("<7>check_harder 0x%lx zapped failed i=%d\n", (unsigned long)p, i); +#endif + return 0; + } + } + + /* Check unique syscalls */ + for (i = 0; i < P->n_unique_syscalls; i++) { + for (s = 0; s < NR_syscalls; s++) { + if (p[_SS(s)] == p[_SS(P->unique_syscalls[i])] + && s != P->unique_syscalls[i]) { +#ifdef OSI_PROBE_DEBUG + if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p)) + printk("<7>check_harder 0x%lx unique failed i=%d s=%d\n", (unsigned long)p, i, s); +#endif + return 0; + } + } + } + +#ifdef AFS_IA64_LINUX20_ENV + ip1 = P->verify_fn ? (unsigned long)((struct fptr *)(P->verify_fn))->ip : 0; +#else + ip1 = (unsigned long)(P->verify_fn); +#endif + + if (ip1 && p[_SS(P->verifyNR - P->offset)] != ip1) { +#ifdef OSI_PROBE_DEBUG + if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p)) + printk("<7>check_harder 0x%lx verify failed\n", (unsigned long)p); +#endif + return 0; + } + +#ifdef OSI_PROBE_DEBUG + if ((probe_debug & 0x0010) && DEBUG_IN_RANGE(P,p)) + printk("<7>check_harder 0x%lx success!\n", (unsigned long)p); +#endif + return 1; +} + +static void *try_harder(probectl *P, PROBETYPE *ptr, unsigned long datalen) +{ +#ifdef OSI_PROBE_KALLSYMS + char *mod_name, *sec_name, *sym_name; + unsigned long mod_start, mod_end; + unsigned long sec_start, sec_end; + unsigned long sym_start, sym_end; +#endif + unsigned long offset; + void *match = 0; + int ret; + +#ifdef OSI_PROBE_DEBUG + if (probe_debug & 0x0001) + printk("<7>osi_probe: %s try_harder\n", P->symbol); +#endif + for (offset = 0; offset < datalen; offset++, ptr++) { + ret = check_table(P, ptr); + if (ret >= 0) { + /* return value is number of entries to skip */ + ptr += ret; + offset += ret; + continue; + } + +#ifdef OSI_PROBE_DEBUG + if ((probe_debug & 0x0004) && DEBUG_IN_RANGE(P,ptr)) + printk("<7>try_harder 0x%lx\n", (unsigned long)ptr); +#endif + if (!check_harder(P, ptr)) + continue; + +#ifdef OSI_PROBE_DEBUG + if (probe_debug & 0x0004) + printk("<7>try_harder found 0x%lx\n", (unsigned long)ptr); +#endif + +#ifdef OSI_PROBE_KALLSYMS + if (kallsyms_address_to_symbol) { + ret = kallsyms_address_to_symbol((unsigned long)ptr, + &mod_name, &mod_start, &mod_end, + &sec_name, &sec_start, &sec_end, + &sym_name, &sym_start, &sym_end); + if (!ret || strcmp(sym_name, P->symbol)) continue; + } +#endif + + if (match) { +#ifdef OSI_PROBE_DEBUG + if (probe_debug & 0x0005) + printk("<7>%s: try_harder found multiple matches!\n", P->symbol); +#endif + return 0; + } + + match = (void *)ptr; + if (!probe_carefully) + break; + } + return match; +} + + +#ifdef OSI_PROBE_DEBUG +#define check_result(x,m) do { \ + if (probe_debug & 0x0001) { \ + printk("<7>osi_probe: %s = 0x%016lx %s\n", P->symbol, (unsigned long)(x), (m)); \ + } \ + if ((x)) { \ + *method = (m); \ + final_answer = (void *)(x); \ + } \ +} while (0) +#else +#define check_result(x,m) do { \ + if ((x)) { \ + *method = (m); \ + return (void *)(x); \ + } \ +} while (0) +#endif +static void *do_find_syscall_table(probectl *P, char **method) +{ +#ifdef OSI_PROBE_KALLSYMS + char *mod_name, *sec_name, *sym_name; + unsigned long mod_start, mod_end; + unsigned long sec_start, sec_end; + unsigned long sym_start, sym_end; + unsigned long token; + int ret; +#endif + PROBETYPE *B; + unsigned long L; + tryctl *T; + void *answer; +#if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV) + void *answer2; +#endif +#ifdef OSI_PROBE_DEBUG + void *final_answer = 0; +#endif + + *method = "not found"; + + /* if it's exported, there's nothing to do */ + check_result(P->weak_answer, "exported"); + + /* ask the kernel to do the name lookup, if it's willing */ +#ifdef OSI_PROBE_KALLSYMS + if (kallsyms_symbol_to_address) { + token = 0; + sym_start = 0; + do { + ret = kallsyms_symbol_to_address(P->symbol, &token, + &mod_name, &mod_start, &mod_end, + &sec_name, &sec_start, &sec_end, + &sym_name, &sym_start, &sym_end); + if (ret && !strcmp(mod_name, "kernel") && sym_start) + break; + sym_start = 0; + } while (ret); + check_result(sym_start, "kallsyms_symbol_to_address"); + } +#endif + + /* Maybe a little birdie told us */ + check_result(P->parm_answer, "module parameter"); + check_result(P->given_answer, "compiled-in"); + + /* OK, so we have to scan. */ + B = (PROBETYPE *)((P->try_base) & ~(P->try_base_mask)); + L = P->try_length; + /* Now, see if the kernel will tell us something better than the default */ +#ifdef OSI_PROBE_KALLSYMS + if (kallsyms_address_to_symbol) { + ret = kallsyms_address_to_symbol(P->try_sect_sym, + &mod_name, &mod_start, &mod_end, + &sec_name, &sec_start, &sec_end, + &sym_name, &sym_start, &sym_end); + if (ret) { + B = (PROBETYPE *)sec_start; + L = (sec_end - sec_start) / sizeof(unsigned long); + } + } +#endif + +#ifdef OSI_PROBE_DEBUG + if (probe_debug & 0x0007) + printk("<7>osi_probe: %s base=0x%lx, len=0x%lx\n", + P->symbol, (unsigned long)B, L); + if (probe_debug & 0x0009) { + printk("<7>osi_probe: %s ktxt_lower_bound=0x%lx\n", + P->symbol, ktxt_lower_bound); + printk("<7>osi_probe: %s NR_syscalls=%d\n", + P->symbol, NR_syscalls); + } +#endif + + for (T = P->trylist; T->name; T++) { + answer = try(P, T, B, L); +#if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV) + answer2 = try(P, T, (PROBETYPE *)(2 + (void *)B), L); +#ifdef OSI_PROBE_DEBUG + if (probe_debug & 0x0003) { + printk("<7>osi_probe: %s = 0x%016lx %s (even)\n", + P->symbol, (unsigned long)(answer), T->name); + printk("<7>osi_probe: %s = 0x%016lx %s (odd)\n", + P->symbol, (unsigned long)(answer2), T->name); + } +#endif + if (answer && answer2) answer = 0; + else if (answer2) answer = answer2; +#endif + check_result(answer, T->name); + } + + /* XXX more checks here */ + + answer = try_harder(P, B, L); +#if defined(AFS_S390_LINUX20_ENV) || defined(AFS_S390X_LINUX20_ENV) + answer2 = try_harder(P, (PROBETYPE *)(2 + (void *)B), L); +#ifdef OSI_PROBE_DEBUG + if (probe_debug & 0x0005) { + printk("<7>osi_probe: %s = 0x%016lx pattern scan (even)\n", + P->symbol, (unsigned long)(answer)); + printk("<7>osi_probe: %s = 0x%016lx pattern scan (odd)\n", + P->symbol, (unsigned long)(answer2)); + } +#endif + if (answer && answer2) answer = 0; + else if (answer2) answer = answer2; +#endif + check_result(answer, "pattern scan"); + +#ifdef OSI_PROBE_DEBUG + return final_answer; +#else + return 0; +#endif +} + +void *osi_find_syscall_table(int which) +{ + probectl *P; + void *answer; + char *method; + + if (which < 0 || which >= N_PROBE_LIST) { + printk("error - afs_find_syscall_table called with invalid index!\n"); + return 0; + } + P = probe_list[which]; + if (which < 4) { + P->parm_answer = (void *)sys_call_table_addr[which]; +#ifdef OSI_PROBE_DEBUG + P->debug_answer = (void *)probe_debug_addr[which]; +#endif + } + answer = do_find_syscall_table(P, &method); + if (!answer) { + printk("Warning: failed to find address of %s\n", P->desc); + printk("System call hooks will not be installed; proceeding anyway\n"); + return 0; + } + printk("Found %s at 0x%lx (%s)\n", P->desc, (unsigned long)answer, method); + return answer; +} + + +#ifdef OSI_PROBE_STANDALONE +int __init osi_probe_init(void) +{ + int i; + + if (!probe_debug_tag) probe_debug_tag = jiffies; + printk("*** osi_probe %ld debug = 0x%04x ***\n", + probe_debug_tag, probe_debug); + for (i = 0; i < N_PROBE_LIST; i++) + (void)osi_find_syscall_table(i); + return 0; +} + +void osi_probe_exit(void) { } + +module_init(osi_probe_init); +module_exit(osi_probe_exit); +#endif diff --git a/src/afs/LINUX/osi_prototypes.h b/src/afs/LINUX/osi_prototypes.h index 3174826f9..05effc3b1 100644 --- a/src/afs/LINUX/osi_prototypes.h +++ b/src/afs/LINUX/osi_prototypes.h @@ -41,6 +41,13 @@ extern void afs_osi_SetTime(osi_timeval_t * tvp); extern void osi_linux_free_inode_pages(void); extern void check_bad_parent(struct dentry *dp); +/* osi_probe.c */ +extern void *osi_find_syscall_table(int which); + +/* osi_syscall.c */ +extern int osi_syscall_init(void); +extern void osi_syscall_clean(void); + /* osi_sysctl.c */ extern int osi_sysctl_init(void); extern void osi_sysctl_clean(void); diff --git a/src/afs/LINUX/osi_syscall.c b/src/afs/LINUX/osi_syscall.c new file mode 100644 index 000000000..061df4249 --- /dev/null +++ b/src/afs/LINUX/osi_syscall.c @@ -0,0 +1,433 @@ +/* + * 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 + */ + +/* + * Linux module support routines. + * + */ +#include +#include "afs/param.h" + +RCSID + ("$Header: /cvs/openafs/src/afs/LINUX/osi_syscall.c,v 1.1.2.2 2005/02/21 01:15:35 shadow Exp $"); + +#include /* early to avoid printf->printk mapping */ +#include "afs/sysincludes.h" +#include "afsincludes.h" +#include "h/unistd.h" /* For syscall numbers. */ +#include "h/mm.h" + +#ifdef AFS_AMD64_LINUX20_ENV +#include "../asm/ia32_unistd.h" +#endif + +#include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#include +#include +#endif + + +/* On SPARC64 and S390X, sys_call_table contains 32-bit entries + * even though pointers are 64 bit quantities. + * XXX unify this with osi_probe.c + */ +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_S390X_LINUX24_ENV) +#define SYSCALLTYPE unsigned int +#define POINTER2SYSCALL (unsigned int)(unsigned long) +#define SYSCALL2POINTER (void *)(long) +#else +#define SYSCALLTYPE void * +#define POINTER2SYSCALL (void *) +#define SYSCALL2POINTER (void *) +#endif + +#if defined(AFS_S390X_LINUX24_ENV) && !defined(AFS_LINUX26_ENV) +#define _S(x) ((x)<<1) +#elif defined(AFS_IA64_LINUX20_ENV) +#define _S(x) ((x)-1024) +#else +#define _S(x) x +#endif + + +/***** ALL PLATFORMS *****/ +extern asmlinkage long +afs_syscall(long syscall, long parm1, long parm2, long parm3, long parm4); + +static SYSCALLTYPE *afs_sys_call_table; +static SYSCALLTYPE afs_ni_syscall = 0; + +extern long afs_xsetgroups(); +asmlinkage long (*sys_setgroupsp) (int gidsetsize, gid_t * grouplist); + +#ifdef AFS_LINUX24_ENV +extern int afs_xsetgroups32(); +asmlinkage int (*sys_setgroups32p) (int gidsetsize, + __kernel_gid32_t * grouplist); +#endif + +#if !defined(AFS_LINUX24_ENV) +asmlinkage int (*sys_settimeofdayp) (struct timeval * tv, struct timezone * tz); +#endif + + +/***** AMD64 *****/ +#ifdef AFS_AMD64_LINUX20_ENV +static SYSCALLTYPE *afs_ia32_sys_call_table; +static SYSCALLTYPE ia32_ni_syscall = 0; + +extern int afs32_xsetgroups(); +asmlinkage long (*sys32_setgroupsp) (int gidsetsize, u16 * grouplist); +#ifdef AFS_LINUX24_ENV +extern int afs32_xsetgroups32(); +asmlinkage long (*sys32_setgroups32p) (int gidsetsize, gid_t * grouplist); +#endif /* __NR_ia32_setgroups32 */ +#endif /* AFS_AMD64_LINUX20_ENV */ + + +/***** PPC64 *****/ +#ifdef AFS_PPC64_LINUX20_ENV +extern SYSCALLTYPE *afs_sys_call_table32; +static SYSCALLTYPE afs_ni_syscall32 = 0; + +extern int afs32_xsetgroups(); +asmlinkage long (*sys32_setgroupsp)(int gidsetsize, gid_t *grouplist); +#endif /* AFS_AMD64_LINUX20_ENV */ + + +/***** SPARC64 *****/ +#ifdef AFS_SPARC64_LINUX20_ENV +extern SYSCALLTYPE *afs_sys_call_table32; +static SYSCALLTYPE afs_ni_syscall32 = 0; + +extern int afs32_xsetgroups(); +asmlinkage int (*sys32_setgroupsp) (int gidsetsize, + __kernel_gid_t32 * grouplist); +#ifdef AFS_LINUX24_ENV +/* This number is not exported for some bizarre reason. */ +#define __NR_setgroups32 82 +extern int afs32_xsetgroups32(); +asmlinkage int (*sys32_setgroups32p) (int gidsetsize, + __kernel_gid_t32 * grouplist); +#endif + +asmlinkage int +afs_syscall32(long syscall, long parm1, long parm2, long parm3, long parm4, + long parm5) +{ + __asm__ __volatile__("srl %o4, 0, %o4\n\t" + "mov %o7, %i7\n\t" + "call afs_syscall\n\t" + "srl %o5, 0, %o5\n\t" + "ret\n\t" + "nop"); +} +#endif /* AFS_SPARC64_LINUX20_ENV */ + + +/***** IA64 *****/ +#ifdef AFS_IA64_LINUX20_ENV + +asmlinkage long +afs_syscall_stub(int r0, int r1, long r2, long r3, long r4, long gp) +{ + __asm__ __volatile__("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t" + "mov r41 = b0\n\t" /* save rp */ + "mov out0 = in0\n\t" + "mov out1 = in1\n\t" + "mov out2 = in2\n\t" + "mov out3 = in3\n\t" + "mov out4 = in4\n\t" + "mov out5 = gp\n\t" /* save gp */ + ";;\n" + ".L1:\n\t" + "mov r3 = ip\n\t" + ";;\n\t" + "addl r15=.fptr_afs_syscall-.L1,r3\n\t" + ";;\n\t" + "ld8 r15=[r15]\n\t" + ";;\n\t" + "ld8 r16=[r15],8\n\t" + ";;\n\t" + "ld8 gp=[r15]\n\t" + "mov b6=r16\n\t" + "br.call.sptk.many b0 = b6\n\t" + ";;\n\t" + "mov ar.pfs = r42\n\t" + "mov b0 = r41\n\t" + "mov gp = r48\n\t" /* restore gp */ + "br.ret.sptk.many b0\n" + ".fptr_afs_syscall:\n\t" + "data8 @fptr(afs_syscall)\n\t" + ".skip 8"); +} + +asmlinkage long +afs_xsetgroups_stub(int r0, int r1, long r2, long r3, long r4, long gp) +{ + __asm__ __volatile__("alloc r42 = ar.pfs, 8, 3, 6, 0\n\t" + "mov r41 = b0\n\t" /* save rp */ + "mov out0 = in0\n\t" + "mov out1 = in1\n\t" + "mov out2 = in2\n\t" + "mov out3 = in3\n\t" + "mov out4 = in4\n\t" + "mov out5 = gp\n\t" /* save gp */ + ";;\n" + ".L2:\n\t" + "mov r3 = ip\n\t" + ";;\n\t" + "addl r15=.fptr_afs_xsetgroups - .L2,r3\n\t" + ";;\n\t" + "ld8 r15=[r15]\n\t" + ";;\n\t" + "ld8 r16=[r15],8\n\t" + ";;\n\t" + "ld8 gp=[r15]\n\t" + "mov b6=r16\n\t" + "br.call.sptk.many b0 = b6\n\t" + ";;\n\t" + "mov ar.pfs = r42\n\t" + "mov b0 = r41\n\t" + "mov gp = r48\n\t" /* restore gp */ + "br.ret.sptk.many b0\n" + ".fptr_afs_xsetgroups:\n\t" + "data8 @fptr(afs_xsetgroups)\n\t" + ".skip 8"); +} + +struct fptr { + void *ip; + unsigned long gp; +}; + +#endif /* AFS_IA64_LINUX20_ENV */ + + + +/**********************************************************************/ +/********************* System Call Initialization *********************/ +/**********************************************************************/ + +int osi_syscall_init(void) +{ +/***** IA64 *****/ +#ifdef AFS_IA64_LINUX20_ENV + /* This needs to be first because we are declaring variables, and + * also because the handling of syscall pointers is bizarre enough + * that we want to special-case even the "common" part. + */ + unsigned long kernel_gp = 0; + static struct fptr sys_setgroups; + + afs_sys_call_table = osi_find_syscall_table(0); + if (afs_sys_call_table) { + +#if !defined(AFS_LINUX24_ENV) + /* XXX no sys_settimeofday on IA64? */ +#endif + + /* check we aren't already loaded */ + /* XXX this can't be right */ + if (SYSCALL2POINTER afs_sys_call_table[_S(__NR_afs_syscall)] + == afs_syscall) { + printf("AFS syscall entry point already in use!\n"); + return -EBUSY; + } + + /* setup AFS entry point */ + afs_ni_syscall = afs_sys_call_table[_S(__NR_afs_syscall)]; + afs_sys_call_table[_S(__NR_afs_syscall)] = + POINTER2SYSCALL((struct fptr *)afs_syscall_stub)->ip; + + /* setup setgroups */ + sys_setgroupsp = (void *)&sys_setgroups; + + ((struct fptr *)sys_setgroupsp)->ip = + SYSCALL2POINTER afs_sys_call_table[_S(__NR_setgroups)]; + ((struct fptr *)sys_setgroupsp)->gp = kernel_gp; + + afs_sys_call_table[_S(_NR_setgroups)] = + POINTER2SYSCALL((struct fptr *)afs_xsetgroups_stub)->ip; + } + + /* XXX no 32-bit syscalls on IA64? */ + + +/***** COMMON (except IA64) *****/ +#else /* !AFS_IA64_LINUX20_ENV */ + + afs_sys_call_table = osi_find_syscall_table(0); + if (afs_sys_call_table) { +#if !defined(AFS_LINUX24_ENV) + sys_settimeofdayp = + SYSCALL2POINTER afs_sys_call_table[_S(__NR_settimeofday)]; +#endif /* AFS_LINUX24_ENV */ + + /* check we aren't already loaded */ + if (SYSCALL2POINTER afs_sys_call_table[_S(__NR_afs_syscall)] + == afs_syscall) { + printf("AFS syscall entry point already in use!\n"); + return -EBUSY; + } + + /* setup AFS entry point */ + afs_ni_syscall = afs_sys_call_table[_S(__NR_afs_syscall)]; + afs_sys_call_table[_S(__NR_afs_syscall)] = POINTER2SYSCALL afs_syscall; + + /* setup setgroups */ + sys_setgroupsp = SYSCALL2POINTER afs_sys_call_table[_S(__NR_setgroups)]; + afs_sys_call_table[_S(__NR_setgroups)] = POINTER2SYSCALL afs_xsetgroups; + +#if defined(__NR_setgroups32) + /* setup setgroups32 */ + sys_setgroups32p = SYSCALL2POINTER afs_sys_call_table[__NR_setgroups32]; + afs_sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32; +#endif + } +#endif /* !AFS_IA64_LINUX20_ENV */ + + +/***** AMD64 *****/ +#ifdef AFS_AMD64_LINUX20_ENV + afs_ia32_sys_call_table = osi_find_syscall_table(1); + if (afs_ia32_sys_call_table) { + /* setup AFS entry point for IA32 */ + ia32_ni_syscall = afs_ia32_sys_call_table[__NR_ia32_afs_syscall]; + afs_ia32_sys_call_table[__NR_ia32_afs_syscall] = + POINTER2SYSCALL afs_syscall; + + /* setup setgroups for IA32 */ + sys32_setgroupsp = + SYSCALL2POINTER afs_ia32_sys_call_table[__NR_ia32_setgroups]; + afs_ia32_sys_call_table[__NR_ia32_setgroups] = + POINTER2SYSCALL afs32_xsetgroups; + +#if AFS_LINUX24_ENV + /* setup setgroups32 for IA32 */ + sys32_setgroups32p = + SYSCALL2POINTER afs_ia32_sys_call_table[__NR_ia32_setgroups32]; + afs_ia32_sys_call_table[__NR_ia32_setgroups32] = + POINTER2SYSCALL afs32_xsetgroups32; +#endif /* __NR_ia32_setgroups32 */ + } +#endif /* AFS_AMD64_LINUX20_ENV */ + + +/***** PPC64 *****/ +#ifdef AFS_PPC64_LINUX20_ENV + /* XXX no 32-bit syscalls on PPC64? */ +#endif + + +/***** SPARC64 *****/ +#ifdef AFS_SPARC64_LINUX20_ENV + afs_sys_call_table32 = osi_find_syscall_table(1); + if (afs_sys_call_table32) { + /* setup AFS entry point for 32-bit SPARC */ + afs_ni_syscall32 = afs_sys_call_table32[__NR_afs_syscall]; + afs_sys_call_table32[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall32; + + /* setup setgroups for 32-bit SPARC */ + sys32_setgroupsp = SYSCALL2POINTER afs_sys_call_table32[__NR_setgroups]; + afs_sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs32_xsetgroups; + +#ifdef AFS_LINUX24_ENV + /* setup setgroups32 for 32-bit SPARC */ + sys32_setgroups32p = + SYSCALL2POINTER afs_sys_call_table32[__NR_setgroups32]; + afs_sys_call_table32[__NR_setgroups32] = + POINTER2SYSCALL afs32_xsetgroups32; +#endif + } +#endif /* AFS_SPARC64_LINUX20_ENV */ + return 0; +} + + + +/**********************************************************************/ +/************************ System Call Cleanup *************************/ +/**********************************************************************/ + +void osi_syscall_clean(void) +{ +/***** COMMON *****/ + if (afs_sys_call_table) { + /* put back the AFS entry point */ + afs_sys_call_table[_S(__NR_afs_syscall)] = afs_ni_syscall; + + /* put back setgroups */ +#if defined(AFS_IA64_LINUX20_ENV) + afs_sys_call_table[_S(__NR_setgroups)] = + POINTER2SYSCALL((struct fptr *)sys_setgroupsp)->ip; +#else /* AFS_IA64_LINUX20_ENV */ + afs_sys_call_table[_S(__NR_setgroups)] = + POINTER2SYSCALL sys_setgroupsp; +#endif + +#if defined(__NR_setgroups32) && !defined(AFS_IA64_LINUX20_ENV) + /* put back setgroups32 */ + afs_sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p; +#endif + } + + +/***** IA64 *****/ +#ifdef AFS_IA64_LINUX20_ENV + /* XXX no 32-bit syscalls on IA64? */ +#endif + + +/***** AMD64 *****/ +#ifdef AFS_AMD64_LINUX20_ENV + if (afs_ia32_sys_call_table) { + /* put back AFS entry point for IA32 */ + afs_ia32_sys_call_table[__NR_ia32_afs_syscall] = + POINTER2SYSCALL ia32_ni_syscall; + + /* put back setgroups for IA32 */ + afs_ia32_sys_call_table[__NR_ia32_setgroups] = + POINTER2SYSCALL sys32_setgroupsp; + +#ifdef AFS_LINUX24_ENV + /* put back setgroups32 for IA32 */ + afs_ia32_sys_call_table[__NR_ia32_setgroups32] = + POINTER2SYSCALL sys32_setgroups32p; +#endif + } +#endif + + +/***** PPC64 *****/ +#ifdef AFS_PPC64_LINUX20_ENV + /* XXX no 32-bit syscalls on PPC64? */ +#endif + + +/***** SPARC64 *****/ +#ifdef AFS_SPARC64_LINUX20_ENV + if (afs_sys_call_table32) { + /* put back AFS entry point for 32-bit SPARC */ + afs_sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32; + + /* put back setgroups for IA32 */ + afs_sys_call_table32[__NR_setgroups] = + POINTER2SYSCALL sys32_setgroupsp; + +#ifdef AFS_LINUX24_ENV + /* put back setgroups32 for IA32 */ + afs_sys_call_table32[__NR_setgroups32] = + POINTER2SYSCALL sys32_setgroups32p; +#endif + } +#endif +} diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c index e1567948b..828fc2d6a 100644 --- a/src/afs/LINUX/osi_vfsops.c +++ b/src/afs/LINUX/osi_vfsops.c @@ -16,7 +16,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.1 2004/12/07 06:12:13 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/LINUX/osi_vfsops.c,v 1.29.2.2 2005/02/21 01:13:08 shadow Exp $"); #define __NO_VERSION__ /* don't define kernel_version in module.h */ #include /* early to avoid printf->printk mapping */ @@ -34,7 +34,7 @@ RCSID struct vcache *afs_globalVp = 0; struct vfs *afs_globalVFS = 0; #if defined(AFS_LINUX24_ENV) -struct nameidata afs_cacheNd; +struct vfsmount *afs_cacheMnt; #endif int afs_was_mounted = 0; /* Used to force reload if mount/unmount/mount */ @@ -336,7 +336,7 @@ afs_put_super(struct super_block *sbp) afs_globalVp = 0; afs_shutdown(); #if defined(AFS_LINUX24_ENV) - path_release(&afs_cacheNd); + mntput(afs_cacheMnt); #endif osi_linux_verify_alloced_memory(); diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 56e58fd68..f0d0a2bbc 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -22,7 +22,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.8 2004/12/17 14:43:23 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v 1.81.2.12 2005/02/21 01:13:24 shadow Exp $"); #include "afs/sysincludes.h" #include "afsincludes.h" @@ -518,6 +518,9 @@ afs_linux_mmap(struct file *fp, struct vm_area_struct *vmap) if (!code) code = afs_VerifyVCache(vcp, &treq); + if (!code && (vcp->states & CRO) && + (vmap->vm_file->f_flags & (FWRITE | FTRUNC))) + code = EACCES; if (code) code = -code; @@ -587,29 +590,18 @@ afs_linux_open(struct inode *ip, struct file *fp) return -code; } -/* afs_Close is called from release, since release is used to handle all - * file closings. In addition afs_linux_flush is called from sys_close to - * handle flushing the data back to the server. The kicker is that we could - * ignore flush completely if only sys_close took it's return value from - * fput. See afs_linux_flush for notes on interactions between release and - * flush. - */ static int afs_linux_release(struct inode *ip, struct file *fp) { - int code = 0; - cred_t *credp = crref(); struct vcache *vcp = ITOAFS(ip); + cred_t *credp = crref(); + int code = 0; #ifdef AFS_LINUX24_ENV lock_kernel(); #endif AFS_GLOCK(); - if (vcp->flushcnt) { - vcp->flushcnt--; /* protected by AFS global lock. */ - } else { - code = afs_close(vcp, fp->f_flags, credp); - } + code = afs_close(vcp, fp->f_flags, credp); AFS_GUNLOCK(); #ifdef AFS_LINUX24_ENV unlock_kernel(); @@ -687,37 +679,34 @@ afs_linux_lock(struct file *fp, int cmd, struct file_lock *flp) } /* afs_linux_flush - * flush is called from sys_close. We could ignore it, but sys_close return - * code comes from flush, not release. We need to use release to keep - * the vcache open count correct. Note that flush is called before release - * (via fput) in sys_close. vcp->flushcnt is a bit of ugliness to avoid - * races and also avoid calling afs_close twice when closing the file. - * If we merely checked for opens > 0 in afs_linux_release, then if an - * new open occurred when storing back the file, afs_linux_release would - * incorrectly close the file and decrement the opens count. Calling afs_close - * on the just flushed file is wasteful, since the background daemon will - * execute the code that finally decides there is nothing to do. + * essentially the same as afs_fsync() but we need to get the return + * code for the sys_close() here, not afs_linux_release(), so call + * afs_StoreAllSegments() with AFS_LASTSTORE */ int afs_linux_flush(struct file *fp) { + struct vrequest treq; struct vcache *vcp = ITOAFS(FILE_INODE(fp)); - int code = 0; - cred_t *credp; + cred_t *credp = crref(); + int code; - /* Only do this on the last close of the file pointer. */ -#if defined(AFS_LINUX24_ENV) - if (atomic_read(&fp->f_count) > 1) -#else - if (fp->f_count > 1) -#endif - return 0; + AFS_GLOCK(); - credp = crref(); + code = afs_InitReq(&treq, credp); + if (code) + goto out; - AFS_GLOCK(); - code = afs_close(vcp, fp->f_flags, credp); - vcp->flushcnt++; /* protected by AFS global lock. */ + ObtainSharedLock(&vcp->lock, 535); + if (vcp->execsOrWriters > 0) { + UpgradeSToWLock(&vcp->lock, 536); + code = afs_StoreAllSegments(vcp, &treq, AFS_SYNC | AFS_LASTSTORE); + ConvertWToSLock(&vcp->lock); + } + code = afs_CheckCode(code, &treq, 54); + ReleaseSharedLock(&vcp->lock); + +out: AFS_GUNLOCK(); crfree(credp); @@ -1047,7 +1036,6 @@ afs_linux_create(struct inode *dip, struct dentry *dp, int mode) #endif dp->d_op = &afs_dentry_operations; - dp->d_time = jiffies; d_instantiate(dp, ip); } @@ -1118,7 +1106,6 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp) ip->i_op = &afs_symlink_iops; #endif } - dp->d_time = jiffies; dp->d_op = &afs_dentry_operations; d_add(dp, AFSTOI(vcp)); @@ -1277,7 +1264,6 @@ afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode) tvcp->v.v_fop = &afs_dir_fops; #endif dp->d_op = &afs_dentry_operations; - dp->d_time = jiffies; d_instantiate(dp, AFSTOI(tvcp)); } @@ -1331,8 +1317,10 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp, cred_t *credp = crref(); const char *oldname = olddp->d_name.name; const char *newname = newdp->d_name.name; + struct dentry *rehash = NULL; #if defined(AFS_LINUX26_ENV) + /* Prevent any new references during rename operation. */ lock_kernel(); #endif /* Remove old and new entries from name hash. New one will change below. @@ -1341,25 +1329,28 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp, * cases. Let another lookup put things right, if need be. */ #if defined(AFS_LINUX26_ENV) - if (!d_unhashed(olddp)) - d_drop(olddp); - if (!d_unhashed(newdp)) + if (!d_unhashed(newdp)) { d_drop(newdp); + rehash = newdp; + } #else - if (!list_empty(&olddp->d_hash)) - d_drop(olddp); - if (!list_empty(&newdp->d_hash)) + if (!list_empty(&newdp->d_hash)) { d_drop(newdp); + rehash = newdp; + } +#endif + +#if defined(AFS_LINUX24_ENV) + if (atomic_read(&olddp->d_count) > 1) + shrink_dcache_parent(olddp); #endif + AFS_GLOCK(); code = afs_rename(ITOAFS(oldip), oldname, ITOAFS(newip), newname, credp); AFS_GUNLOCK(); - if (!code) { - /* update time so it doesn't expire immediately */ - newdp->d_time = jiffies; - d_move(olddp, newdp); - } + if (rehash) + d_rehash(rehash); #if defined(AFS_LINUX26_ENV) unlock_kernel(); diff --git a/src/afs/OBSD/osi_sleep.c b/src/afs/OBSD/osi_sleep.c index 20caa89fe..2db795f31 100644 --- a/src/afs/OBSD/osi_sleep.c +++ b/src/afs/OBSD/osi_sleep.c @@ -1,5 +1,5 @@ /* - * $Id: osi_sleep.c,v 1.7 2003/07/15 23:14:25 shadow Exp $ + * $Id: osi_sleep.c,v 1.7.2.1 2005/01/31 04:18:25 shadow Exp $ */ /* @@ -45,7 +45,7 @@ such damages. #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/OBSD/osi_sleep.c,v 1.7 2003/07/15 23:14:25 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/OBSD/osi_sleep.c,v 1.7.2.1 2005/01/31 04:18:25 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afs/afsincludes.h" /* Afs-based standard headers */ @@ -54,13 +54,6 @@ RCSID static char waitV; -void -afs_osi_InitWaitHandle(struct afs_osi_WaitHandle *achandle) -{ - AFS_STATCNT(osi_InitWaitHandle); - achandle->proc = NULL; -} - /* cancel osi_Wait */ void afs_osi_CancelWait(struct afs_osi_WaitHandle *achandle) diff --git a/src/afs/OBSD/osi_vnodeops.c b/src/afs/OBSD/osi_vnodeops.c index 440a3da79..1a80e1b47 100644 --- a/src/afs/OBSD/osi_vnodeops.c +++ b/src/afs/OBSD/osi_vnodeops.c @@ -3,7 +3,7 @@ * Original NetBSD version for Transarc afs by John Kohl * OpenBSD version by Jim Rees * - * $Id: osi_vnodeops.c,v 1.18 2004/07/27 14:39:31 rees Exp $ + * $Id: osi_vnodeops.c,v 1.18.2.1 2005/01/31 04:18:25 shadow Exp $ */ /* @@ -99,7 +99,7 @@ NONINFRINGEMENT. #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/OBSD/osi_vnodeops.c,v 1.18 2004/07/27 14:39:31 rees Exp $"); + ("$Header: /cvs/openafs/src/afs/OBSD/osi_vnodeops.c,v 1.18.2.1 2005/01/31 04:18:25 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afs/afsincludes.h" /* Afs-based standard headers */ @@ -894,6 +894,14 @@ afs_nbsd_reclaim(void *v) int haveGlock = ISAFS_GLOCK(); int haveVlock = CheckLock(&afs_xvcache); +#if 0 + printf("reclaim usecount %d\n", vp->v_usecount); + /* OK, there are no internal vrefCounts, so there shouldn't + * be any more refs here. */ + vp->v_data = NULL; /* remove from vnode */ + avc->v = NULL; /* also drop the ptr to vnode */ + return 0; +#else if (!haveGlock) AFS_GLOCK(); if (!haveVlock) @@ -909,6 +917,7 @@ afs_nbsd_reclaim(void *v) if (!haveGlock) AFS_GUNLOCK(); return code; +#endif } int diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index 40ec6d436..867eae399 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -24,7 +24,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.27.2.3 2004/12/07 06:12:13 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_attrs.c,v 1.27.2.4 2005/01/31 04:23:36 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -398,16 +398,14 @@ afs_VAttrToAS(register struct vcache *avc, register struct vattr *av, #if defined(AFS_AIX_ENV) /* Boy, was this machine dependent bogosity hard to swallow????.... */ if (av->va_mode != -1) { -#else -#if defined(AFS_LINUX22_ENV) +#elif defined(AFS_LINUX22_ENV) if (av->va_mask & ATTR_MODE) { -#else -#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) +#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (av->va_mask & AT_MODE) { +#elif defined(AFS_XBSD_ENV) + if (av->va_mode != (mode_t)VNOVAL) { #else if (av->va_mode != ((unsigned short)-1)) { -#endif -#endif #endif mask |= AFS_SETMODE; as->UnixModeBits = av->va_mode & 0xffff; @@ -419,40 +417,36 @@ afs_VAttrToAS(register struct vcache *avc, register struct vattr *av, } #if defined(AFS_LINUX22_ENV) if (av->va_mask & ATTR_GID) { -#else -#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) +#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (av->va_mask & AT_GID) { -#else -#if (defined(AFS_HPUX_ENV) || defined(AFS_SUN_ENV)) +#elif (defined(AFS_HPUX_ENV) || defined(AFS_SUN_ENV)) #if defined(AFS_HPUX102_ENV) if (av->va_gid != GID_NO_CHANGE) { #else if (av->va_gid != ((unsigned short)-1)) { #endif +#elif defined(AFS_XBSD_ENV) + if (av->va_gid != (gid_t)VNOVAL) { #else if (av->va_gid != -1) { -#endif -#endif /* AFS_SUN5_ENV */ #endif /* AFS_LINUX22_ENV */ mask |= AFS_SETGROUP; as->Group = av->va_gid; } #if defined(AFS_LINUX22_ENV) if (av->va_mask & ATTR_UID) { -#else -#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) +#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (av->va_mask & AT_UID) { -#else -#if (defined(AFS_HPUX_ENV) || defined(AFS_SUN_ENV)) +#elif (defined(AFS_HPUX_ENV) || defined(AFS_SUN_ENV)) #if defined(AFS_HPUX102_ENV) if (av->va_uid != UID_NO_CHANGE) { +#elif defined(AFS_XBSD_ENV) + if (av->va_uid != (uid_t)VNOVAL) { #else if (av->va_uid != ((unsigned short)-1)) { #endif #else if (av->va_uid != -1) { -#endif -#endif /* AFS_SUN5_ENV */ #endif /* AFS_LINUX22_ENV */ mask |= AFS_SETOWNER; as->Owner = av->va_uid; @@ -544,20 +538,14 @@ afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, */ #if defined(AFS_LINUX22_ENV) if (attrs->va_mask & ATTR_SIZE) { -#else -#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) +#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (attrs->va_mask & AT_SIZE) { -#else -#ifdef AFS_OSF_ENV +#elif defined(AFS_OSF_ENV) || defined(AFS_XBSD_ENV) if (attrs->va_size != VNOVAL) { -#else -#ifdef AFS_AIX41_ENV +#elif defined(AFS_AIX41_ENV) if (attrs->va_size != -1) { #else if (attrs->va_size != ~0) { -#endif -#endif -#endif #endif if (!afs_AccessOK(avc, PRSFS_WRITE, &treq, DONT_CHECK_MODE_BITS)) { code = EACCES; @@ -582,16 +570,12 @@ afs_setattr(OSI_VC_DECL(avc), register struct vattr *attrs, #endif #if defined(AFS_LINUX22_ENV) if (attrs->va_mask & ATTR_SIZE) { -#else -#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) +#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) if (attrs->va_mask & AT_SIZE) { -#else -#if defined(AFS_OSF_ENV) +#elif defined(AFS_OSF_ENV) || defined(AFS_XBSD_ENV) if (attrs->va_size != VNOVAL) { -#else /* AFS_OSF_ENV */ +#else if (attrs->va_size != -1) { -#endif -#endif #endif afs_size_t tsize = attrs->va_size; ObtainWriteLock(&avc->lock, 128); diff --git a/src/afs/VNOPS/afs_vnop_create.c b/src/afs/VNOPS/afs_vnop_create.c index d69d9966a..b0dac04aa 100644 --- a/src/afs/VNOPS/afs_vnop_create.c +++ b/src/afs/VNOPS/afs_vnop_create.c @@ -17,7 +17,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.16.2.3 2004/11/09 17:15:04 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_create.c,v 1.16.2.4 2005/01/31 03:49:15 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -30,10 +30,6 @@ RCSID * I think we can get away without it, but I'm not sure. Note that * afs_setattr is called in here for truncation. */ -#ifdef AFS_OSF_ENV -int -afs_create(struct nameidata *ndp, struct vattr *attrs) -#else /* AFS_OSF_ENV */ #ifdef AFS_SGI64_ENV int afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, int flags, @@ -44,17 +40,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, enum vcexcl aexcl, int amode, struct vcache **avcp, struct AFS_UCRED *acred) #endif /* AFS_SGI64_ENV */ -#endif /* AFS_OSF_ENV */ { -#ifdef AFS_OSF_ENV - register struct vcache *adp = VTOAFS(ndp->ni_dvp); - char *aname = ndp->ni_dent.d_name; - enum vcexcl aexcl = NONEXCL; /* XXX - create called properly */ - int amode = 0; /* XXX - checked in higher level */ - struct vcache **avcp = (struct vcache **)&(ndp->ni_vp); - struct ucred *acred = ndp->ni_cred; -#endif - afs_int32 origCBs, origZaps, finalZaps; struct vrequest treq; register afs_int32 code; @@ -311,43 +297,33 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, (tc, code, &adp->fid, &treq, AFS_STATS_FS_RPCIDX_CREATEFILE, SHARED_LOCK, NULL)); -#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) - if (code == EEXIST && aexcl == NONEXCL) { - /* This lookup was handled in the common vn_open code in the - * vnode layer */ - if (tdc) { - ReleaseSharedLock(&tdc->lock); - afs_PutDCache(tdc); - } - ReleaseWriteLock(&adp->lock); - goto done; - } -#else /* AFS_OSF_ENV */ + if (code == EEXIST && #ifdef AFS_SGI64_ENV - if (code == EEXIST && !(flags & VEXCL)) { + !(flags & VEXCL) #else /* AFS_SGI64_ENV */ - if (code == EEXIST && aexcl == NONEXCL) { -#endif /* AFS_SGI64_ENV */ + aexcl == NONEXCL +#endif + ) { /* if we get an EEXIST in nonexcl mode, just do a lookup */ if (tdc) { ReleaseSharedLock(&tdc->lock); afs_PutDCache(tdc); } ReleaseWriteLock(&adp->lock); +#if !(defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)) #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) #if defined(AFS_SGI64_ENV) - code = - afs_lookup(VNODE_TO_FIRST_BHV((vnode_t *) adp), aname, avcp, NULL, - 0, NULL, acred); + code = afs_lookup(VNODE_TO_FIRST_BHV((vnode_t *) adp), aname, avcp, + NULL, 0, NULL, acred); #else code = afs_lookup(adp, aname, avcp, NULL, 0, NULL, acred); #endif /* AFS_SGI64_ENV */ #else /* SUN5 || SGI */ code = afs_lookup(adp, aname, avcp, acred); #endif /* SUN5 || SGI */ +#endif /* !(AFS_OSF_ENV || AFS_DARWIN_ENV) */ goto done; } -#endif /* AFS_OSF_ENV */ if (code) { if (code < 0) { ObtainWriteLock(&afs_xcbhash, 488); @@ -475,10 +451,6 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, code = afs_CheckCode(code, &treq, 20); done2: -#ifdef AFS_OSF_ENV - afs_PutVCache(adp); -#endif /* AFS_OSF_ENV */ - return code; } diff --git a/src/afs/VNOPS/afs_vnop_dirops.c b/src/afs/VNOPS/afs_vnop_dirops.c index 46c5778e3..9874d4bf7 100644 --- a/src/afs/VNOPS/afs_vnop_dirops.c +++ b/src/afs/VNOPS/afs_vnop_dirops.c @@ -21,7 +21,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_dirops.c,v 1.14.2.3 2004/11/09 17:15:04 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_dirops.c,v 1.14.2.4 2005/01/31 03:49:15 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -36,24 +36,9 @@ extern afs_rwlock_t afs_xcbhash; /* don't set CDirty in here because RPC is called synchronously */ int -#ifdef AFS_OSF_ENV -afs_mkdir(ndp, attrs) - struct nameidata *ndp; - struct vattr *attrs; +afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, + register struct vcache **avcp, struct AFS_UCRED *acred) { - register struct vcache *adp = VTOAFS(ndp->ni_dvp); - char *aname = ndp->ni_dent.d_name; - register struct vcache **avcp = (struct vcache **)&(ndp->ni_vp); - struct ucred *acred = ndp->ni_cred; -#else /* AFS_OSF_ENV */ -afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred) - OSI_VC_DECL(adp); - register struct vcache **avcp; - char *aname; - struct vattr *attrs; - struct AFS_UCRED *acred; -{ -#endif struct vrequest treq; register afs_int32 code; register struct conn *tc; @@ -172,34 +157,19 @@ afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred) afs_PutFakeStat(&fakestate); code = afs_CheckCode(code, &treq, 26); done2: -#ifdef AFS_OSF_ENV - AFS_RELE(ndp->ni_dvp); -#endif /* AFS_OSF_ENV */ return code; } int -#ifdef AFS_OSF_ENV -afs_rmdir(ndp) - struct nameidata *ndp; -{ - register struct vcache *adp = VTOAFS(ndp->ni_dvp); - char *aname = ndp->ni_dent.d_name; - struct ucred *acred = ndp->ni_cred; -#else /* AFS_OSF_ENV */ /* don't set CDirty in here because RPC is called synchronously */ #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) -afs_rmdir(OSI_VC_ARG(adp), aname, cdirp, acred) - struct vnode *cdirp; +afs_rmdir(OSI_VC_DECL(adp), char *aname, struct vnode *cdirp, + struct AFS_UCRED *acred) #else -afs_rmdir(adp, aname, acred) +afs_rmdir(OSI_VC_DECL(adp), char *aname, struct AFS_UCRED *acred) #endif - OSI_VC_DECL(adp); - char *aname; - struct AFS_UCRED *acred; { -#endif struct vrequest treq; register struct dcache *tdc; register struct vcache *tvc = NULL; @@ -336,9 +306,5 @@ afs_rmdir(adp, aname, acred) afs_PutFakeStat(&fakestate); code = afs_CheckCode(code, &treq, 27); done2: -#ifdef AFS_OSF_ENV - afs_PutVCache(adp); - afs_PutVCache(ndp->ni_vp); -#endif /* AFS_OSF_ENV */ return code; } diff --git a/src/afs/VNOPS/afs_vnop_fid.c b/src/afs/VNOPS/afs_vnop_fid.c index 739f05529..d00b88099 100644 --- a/src/afs/VNOPS/afs_vnop_fid.c +++ b/src/afs/VNOPS/afs_vnop_fid.c @@ -18,7 +18,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_fid.c,v 1.11.2.1 2004/08/25 07:09:35 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_fid.c,v 1.11.2.2 2005/01/31 03:49:15 shadow Exp $"); #if !defined(AFS_DUX40_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_OBSD_ENV) #include "afs/sysincludes.h" /* Standard vendor system headers */ @@ -67,20 +67,15 @@ int afs_iauth_initd = 0; extern int afs_NFSRootOnly; /* 1 => only allow NFS mounts of /afs. */ -int #if !defined(AFS_DEC_ENV) && !defined(AFS_ATHENA_ENV) +int #ifdef AFS_AIX41_ENV -afs_fid(OSI_VC_ARG(avc), fidpp, credp) - struct ucred *credp; +afs_fid(OSI_VC_DECL(avc), struct fid *fidpp, struct ucred *credp) +#elif defined(AFS_OSF_ENV) || defined(AFS_SUN54_ENV) +afs_fid(OSI_VC_DECL(avc), struct fid *fidpp) #else -afs_fid(OSI_VC_ARG(avc), fidpp) +afs_fid(OSI_VC_DECL(avc), struct fid **fidpp) #endif /* AFS_AIX41_ENV */ - OSI_VC_DECL(avc); -#if defined(AFS_AIX_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SUN54_ENV) - struct fid *fidpp; -#else - struct fid **fidpp; -#endif { struct SmallFid Sfid; long addr[2]; diff --git a/src/afs/VNOPS/afs_vnop_link.c b/src/afs/VNOPS/afs_vnop_link.c index b16de16ee..8a01e0f74 100644 --- a/src/afs/VNOPS/afs_vnop_link.c +++ b/src/afs/VNOPS/afs_vnop_link.c @@ -17,7 +17,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_link.c,v 1.15.2.3 2004/11/09 17:15:04 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_link.c,v 1.15.2.4 2005/01/31 03:49:15 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -32,15 +32,6 @@ extern afs_rwlock_t afs_xcbhash; * RPC is called synchronously. */ int -#ifdef AFS_OSF_ENV -afs_link(avc, ndp) - struct vcache *avc; - struct nameidata *ndp; -{ - struct vcache *adp = VTOAFS(ndp->ni_dvp); - char *aname = ndp->ni_dent.d_name; - struct ucred *acred = ndp->ni_cred; -#else /* AFS_OSF_ENV */ #if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) afs_link(OSI_VC_ARG(adp), avc, aname, acred) #else @@ -51,7 +42,6 @@ afs_link(avc, OSI_VC_ARG(adp), aname, acred) char *aname; struct AFS_UCRED *acred; { -#endif struct vrequest treq; register struct dcache *tdc; register afs_int32 code; @@ -170,8 +160,5 @@ afs_link(avc, OSI_VC_ARG(adp), aname, acred) afs_PutFakeStat(&vfakestate); afs_PutFakeStat(&dfakestate); done2: -#ifdef AFS_OSF_ENV - afs_PutVCache(adp); -#endif /* AFS_OSF_ENV */ return code; } diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index 89b455abe..454ce382a 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -18,7 +18,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.50.2.5 2004/12/07 06:12:13 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_lookup.c,v 1.50.2.6 2005/01/31 03:49:15 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -1077,36 +1077,16 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp) static int AFSDOBULK = 1; int -#ifdef AFS_OSF_ENV -afs_lookup(adp, ndp) - struct vcache *adp; - struct nameidata *ndp; -{ - char aname[MAXNAMLEN + 1]; /* XXX */ - struct vcache **avcp = (struct vcache **)&(ndp->ni_vp); - struct ucred *acred = ndp->ni_cred; - int wantparent = ndp->ni_nameiop & WANTPARENT; - int opflag = ndp->ni_nameiop & OPFLAG; -#else /* AFS_OSF_ENV */ -#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) -afs_lookup(OSI_VC_ARG(adp), aname, avcp, pnp, flags, rdir, acred) - struct pathname *pnp; - int flags; - struct vnode *rdir; -#else -#if defined(UKERNEL) -afs_lookup(adp, aname, avcp, acred, flags) - int flags; +#ifdef AFS_OSF_ENV +afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED *acred, int opflag, int wantparent) +#elif defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) +afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct pathname *pnp, int flags, struct vnode *rdir, struct AFS_UCRED *acred) +#elif defined(UKERNEL) +afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED *acred, int flags) #else -afs_lookup(adp, aname, avcp, acred) -#endif /* UKERNEL */ -#endif /* SUN5 || SGI */ - OSI_VC_DECL(adp); - struct vcache **avcp; - char *aname; - struct AFS_UCRED *acred; -{ +afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, struct AFS_UCRED *acred) #endif +{ struct vrequest treq; char *tname = NULL; register struct vcache *tvc = 0; @@ -1131,8 +1111,6 @@ afs_lookup(adp, aname, avcp, acred) #ifdef AFS_OSF_ENV ndp->ni_dvp = AFSTOV(adp); - memcpy(aname, ndp->ni_ptr, ndp->ni_namelen); - aname[ndp->ni_namelen] = '\0'; #endif /* AFS_OSF_ENV */ #if defined(AFS_DARWIN_ENV) diff --git a/src/afs/VNOPS/afs_vnop_remove.c b/src/afs/VNOPS/afs_vnop_remove.c index 067a08327..20431e394 100644 --- a/src/afs/VNOPS/afs_vnop_remove.c +++ b/src/afs/VNOPS/afs_vnop_remove.c @@ -21,7 +21,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.31.2.5 2004/12/13 19:35:05 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_remove.c,v 1.31.2.6 2005/01/31 03:49:15 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -217,20 +217,11 @@ char *Tnam1; /* Note that we don't set CDirty here, this is OK because the unlink * RPC is called synchronously */ int -#ifdef AFS_OSF_ENV -afs_remove(ndp) - struct nameidata *ndp; -{ - register struct vcache *adp = VTOAFS(ndp->ni_dvp); - char *aname = ndp->ni_dent.d_name; - struct ucred *acred = ndp->ni_cred; -#else /* AFS_OSF_ENV */ afs_remove(OSI_VC_ARG(adp), aname, acred) OSI_VC_DECL(adp); char *aname; struct AFS_UCRED *acred; { -#endif struct vrequest treq; register struct dcache *tdc; struct VenusFid unlinkFid; @@ -250,7 +241,6 @@ afs_remove(OSI_VC_ARG(adp), aname, acred) if ((code = afs_InitReq(&treq, acred))) { #ifdef AFS_OSF_ENV - afs_PutVCache(adp); afs_PutVCache(tvc); #endif return code; @@ -261,7 +251,6 @@ afs_remove(OSI_VC_ARG(adp), aname, acred) if (code) { afs_PutFakeStat(&fakestate); #ifdef AFS_OSF_ENV - afs_PutVCache(adp); afs_PutVCache(tvc); #endif return code; @@ -272,26 +261,14 @@ afs_remove(OSI_VC_ARG(adp), aname, acred) code = afs_DynrootVOPRemove(adp, acred, aname); afs_PutFakeStat(&fakestate); #ifdef AFS_OSF_ENV - afs_PutVCache(adp); afs_PutVCache(tvc); #endif return code; } -#if 0 - if (adp->mvstat == 2) { - afs_PutFakeStat(&fakestate); -#ifdef AFS_OSF_ENV - afs_PutVCache(adp); - afs_PutVCache(tvc); -#endif - return EISDIR; - } -#endif if (strlen(aname) > AFSNAMEMAX) { afs_PutFakeStat(&fakestate); #ifdef AFS_OSF_ENV - afs_PutVCache(adp); afs_PutVCache(tvc); #endif return ENAMETOOLONG; @@ -301,7 +278,6 @@ afs_remove(OSI_VC_ARG(adp), aname, acred) #ifdef AFS_OSF_ENV tvc = VTOAFS(ndp->ni_vp); /* should never be null */ if (code) { - afs_PutVCache(adp); afs_PutVCache(tvc); afs_PutFakeStat(&fakestate); return afs_CheckCode(code, &treq, 22); @@ -320,7 +296,6 @@ afs_remove(OSI_VC_ARG(adp), aname, acred) */ if (adp->states & CRO) { #ifdef AFS_OSF_ENV - afs_PutVCache(adp); afs_PutVCache(tvc); #endif code = EROFS; @@ -434,9 +409,6 @@ afs_remove(OSI_VC_ARG(adp), aname, acred) } else { code = afsremove(adp, tdc, tvc, aname, acred, &treq); } -#ifdef AFS_OSF_ENV - afs_PutVCache(adp); -#endif /* AFS_OSF_ENV */ afs_PutFakeStat(&fakestate); return code; } diff --git a/src/afs/VNOPS/afs_vnop_rename.c b/src/afs/VNOPS/afs_vnop_rename.c index 2fa7af9af..fb583f521 100644 --- a/src/afs/VNOPS/afs_vnop_rename.c +++ b/src/afs/VNOPS/afs_vnop_rename.c @@ -18,7 +18,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_rename.c,v 1.16.2.3 2004/11/09 17:15:04 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_rename.c,v 1.16.2.4 2005/01/31 03:49:15 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -359,28 +359,12 @@ afsrename(struct vcache *aodp, char *aname1, struct vcache *andp, } int -#ifdef AFS_OSF_ENV -afs_rename(fndp, tndp) - struct nameidata *fndp, *tndp; -{ - struct vcache *aodp = VTOAFS(fndp->ni_dvp); - char *aname1 = fndp->ni_dent.d_name; - struct vcache *andp = VTOAFS(tndp->ni_dvp); - char *aname2 = tndp->ni_dent.d_name; - struct ucred *acred = tndp->ni_cred; -#else /* AFS_OSF_ENV */ #if defined(AFS_SGI_ENV) -afs_rename(OSI_VC_ARG(aodp), aname1, andp, aname2, npnp, acred) - struct pathname *npnp; +afs_rename(OSI_VC_DECL(aodp), char *aname1, struct vcache *andp, achar *name2, struct pathname *npnp, struct AFS_UCRED *acred) #else -afs_rename(OSI_VC_ARG(aodp), aname1, andp, aname2, acred) +afs_rename(OSI_VC_DECL(aodp), char *aname1, struct vcache *andp, char *aname2, struct AFS_UCRED *acred) #endif - OSI_VC_DECL(aodp); - struct vcache *andp; - char *aname1, *aname2; - struct AFS_UCRED *acred; { -#endif register afs_int32 code; struct afs_fakestat_state ofakestate; struct afs_fakestat_state nfakestate; @@ -402,14 +386,6 @@ afs_rename(OSI_VC_ARG(aodp), aname1, andp, aname2, acred) done: afs_PutFakeStat(&ofakestate); afs_PutFakeStat(&nfakestate); -#ifdef AFS_OSF_ENV - AFS_RELE(tndp->ni_dvp); - if (tndp->ni_vp != NULL) { - AFS_RELE(tndp->ni_vp); - } - AFS_RELE(fndp->ni_dvp); - AFS_RELE(fndp->ni_vp); -#endif /* AFS_OSF_ENV */ code = afs_CheckCode(code, &treq, 25); return code; } diff --git a/src/afs/VNOPS/afs_vnop_symlink.c b/src/afs/VNOPS/afs_vnop_symlink.c index d0adc8b57..4c192d68c 100644 --- a/src/afs/VNOPS/afs_vnop_symlink.c +++ b/src/afs/VNOPS/afs_vnop_symlink.c @@ -22,7 +22,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_symlink.c,v 1.19.2.3 2004/11/09 17:15:04 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_symlink.c,v 1.19.2.4 2005/01/31 03:49:15 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -42,16 +42,6 @@ extern afs_rwlock_t afs_xcbhash; /* don't set CDirty in here because RPC is called synchronously */ int afs_symlink -#ifdef AFS_OSF_ENV - (ndp, attrs, atargetName) - struct nameidata *ndp; - struct vattr *attrs; - register char *atargetName; -{ - register struct vcache *adp = VTOAFS(ndp->ni_dvp); - char *aname = ndp->ni_dent.d_name; - struct ucred *acred = ndp->ni_cred; -#else /* AFS_OSF_ENV */ (OSI_VC_ARG(adp), aname, attrs, atargetName, acred) OSI_VC_DECL(adp); char *atargetName; @@ -59,7 +49,6 @@ int afs_symlink struct vattr *attrs; struct AFS_UCRED *acred; { -#endif afs_uint32 now = 0; struct vrequest treq; afs_int32 code; @@ -236,9 +225,6 @@ int afs_symlink afs_PutVolume(volp, READ_LOCK); code = afs_CheckCode(code, &treq, 31); done2: -#ifdef AFS_OSF_ENV - AFS_RELE(ndp->ni_dvp); -#endif /* AFS_OSF_ENV */ return code; } diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index 7b24a01ef..2ce8671fb 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -21,7 +21,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.36.2.2 2004/12/07 06:12:14 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/VNOPS/afs_vnop_write.c,v 1.36.2.3 2005/01/31 03:49:15 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -714,9 +714,7 @@ afs_DoPartialWrite(register struct vcache *avc, struct vrequest *areq) return code; } - - -#if !defined (AFS_AIX_ENV) && !defined (AFS_HPUX_ENV) && !defined (AFS_SUN5_ENV) && !defined(AFS_SGI_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV) +#ifdef AFS_OSF_ENV #ifdef AFS_DUX50_ENV #define vno_close(X) vn_close((X), 0, NOCRED) #elif defined(AFS_DUX40_ENV) @@ -770,12 +768,8 @@ afs_closex(register struct file *afd) afd->f_flag &= ~(FSHLOCK | FEXLOCK); code = vno_close(afd); if (flags) -#if defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SUN_ENV) && !defined(AFS_SUN5_ENV) HandleFlock(tvc, LOCK_UN, &treq, u.u_procp->p_pid, 1 /*onlymine */ ); -#else - HandleFlock(tvc, LOCK_UN, &treq, 0, 1 /*onlymine */ ); -#endif #ifdef AFS_DEC_ENV grele((struct gnode *)tvc); #else @@ -993,27 +987,17 @@ afs_close(OSI_VC_ARG(avc), aflags, acred) int #ifdef AFS_OSF_ENV -afs_fsync(avc, fflags, acred, waitfor) - int fflags; - int waitfor; +afs_fsync(OSI_VC_DECL(avc), int fflags, struct AFS_UCRED *acred, int waitfor) #else /* AFS_OSF_ENV */ #if defined(AFS_SGI_ENV) || defined(AFS_SUN53_ENV) -afs_fsync(OSI_VC_ARG(avc), flag, acred +afs_fsync(OSI_VC_DECL(avc), int flag, struct AFS_UCRED *acred #ifdef AFS_SGI65_ENV - , start, stop -#endif + , off_t start, off_t stop +#endif /* AFS_SGI65_ENV */ ) -#else -afs_fsync(avc, acred) -#endif -#endif -OSI_VC_DECL(avc); - struct AFS_UCRED *acred; -#if defined(AFS_SGI_ENV) || defined(AFS_SUN53_ENV) - int flag; -#ifdef AFS_SGI65_ENV - off_t start, stop; -#endif +#else /* !OSF && !SUN53 && !SGI */ +afs_fsync(OSI_VC_DECL(avc), struct AFS_UCRED *acred) +#endif #endif { register afs_int32 code; diff --git a/src/afs/afs.h b/src/afs/afs.h index c5087c62a..c509db780 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -43,7 +43,7 @@ extern int afs_shuttingdown; #if defined(AFS_HPUX102_ENV) #define AFS_FLOCK k_flock #else -#if defined(AFS_SUN56_ENV) || (defined(AFS_LINUX24_ENV) && !defined(AFS_PPC64_LINUX26_ENV) && !defined(AFS_AMD64_LINUX26_ENV) && !defined(AFS_IA64_LINUX26_ENV)) +#if defined(AFS_SUN56_ENV) || (defined(AFS_LINUX24_ENV) && !defined(AFS_PPC64_LINUX26_ENV) && !defined(AFS_AMD64_LINUX26_ENV) && !defined(AFS_IA64_LINUX26_ENV) && !defined(AFS_S390X_LINUX26_ENV)) #define AFS_FLOCK flock64 #else #define AFS_FLOCK flock @@ -562,19 +562,13 @@ struct SimpleLocks { #define VREFCOUNT_SET(v, c) atomic_set(&((vnode_t *) v)->v_count, c) #define VREFCOUNT_DEC(v) atomic_dec(&((vnode_t *) v)->v_count) #define VREFCOUNT_INC(v) atomic_inc(&((vnode_t *) v)->v_count) -#define DLOCK() spin_lock(&dcache_lock) -#define DUNLOCK() spin_unlock(&dcache_lock) -#define DGET(d) dget_locked(d) -#define DCOUNT(d) atomic_read(&(d)->d_count) #else #define VREFCOUNT(v) ((v)->vrefCount) #define VREFCOUNT_SET(v, c) (v)->vrefCount = c; #define VREFCOUNT_DEC(v) (v)->vrefCount--; #define VREFCOUNT_INC(v) (v)->vrefCount++; -#define DLOCK() -#define DUNLOCK() -#define DGET(d) dget(d) -#define DCOUNT(d) ((d)->d_count) +#define d_unhash(d) list_empty(&(d)->d_hash) +#define dget_locked(d) dget(d) #endif #define AFS_MAXDV 0x7fffffff /* largest dataversion number */ @@ -702,7 +696,6 @@ struct vcache { struct dcache *dchint; } h1; #ifdef AFS_LINUX22_ENV - u_short flushcnt; /* Number of flushes which haven't released yet. */ u_short mapcnt; /* Number of mappings of this file. */ #endif #if defined(AFS_SGI_ENV) @@ -1195,7 +1188,8 @@ struct afs_fakestat_state { extern int afs_fakestat_enable; struct buffer { - struct dcache *fid; + afs_int32 fid; /* is adc->index, the cache file number */ + afs_inode_t inode; /* is adc->f.inode, the inode number of the cache file */ afs_int32 page; afs_int32 accesstime; struct buffer *hashNext; diff --git a/src/afs/afs_buffer.c b/src/afs/afs_buffer.c index c193fe2e1..af0ae5045 100644 --- a/src/afs/afs_buffer.c +++ b/src/afs/afs_buffer.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_buffer.c,v 1.16.2.2 2004/11/09 17:14:57 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_buffer.c,v 1.16.2.3 2005/01/31 04:18:41 shadow Exp $"); #include "afs/sysincludes.h" #include "afsincludes.h" @@ -63,7 +63,7 @@ RCSID /* page hash table size - this is pretty intertwined with pHash */ #define PHSIZE (PHPAGEMASK + PHFIDMASK + 1) /* the pHash macro */ -#define pHash(fid,page) ((((afs_int32)((fid)->f.inode)) & PHFIDMASK) \ +#define pHash(fid,page) ((((afs_int32)(fid)) & PHFIDMASK) \ | (page & PHPAGEMASK)) #ifdef dirty @@ -88,7 +88,7 @@ static int nbuffers; static afs_int32 timecounter; /* Prototypes for static routines */ -static struct buffer *afs_newslot(struct dcache * afid, afs_int32 apage, +static struct buffer *afs_newslot(struct dcache *adc, afs_int32 apage, register struct buffer *lp); static int dinit_flag = 0; @@ -130,7 +130,8 @@ DInit(int abuffers) #endif /* Fill in each buffer with an empty indication. */ tb = &Buffers[i]; - dirp_Zap(tb->fid); + tb->fid = 0; + tb->inode = 0; tb->accesstime = 0; tb->lockers = 0; #if AFS_USEBUFFERS @@ -150,7 +151,7 @@ DInit(int abuffers) } void * -DRead(register struct dcache * fid, register int page) +DRead(register struct dcache *adc, register int page) { /* Read a page from the disk. */ register struct buffer *tb, *tb2; @@ -160,7 +161,7 @@ DRead(register struct dcache * fid, register int page) AFS_STATCNT(DRead); MObtainWriteLock(&afs_bufferLock, 256); -#define bufmatch(tb) (tb->page == page && dirp_Eq(tb->fid, fid)) +#define bufmatch(tb) (tb->page == page && tb->fid == adc->index) #define buf_Front(head,parent,p) {(parent)->hashNext = (p)->hashNext; (p)->hashNext= *(head);*(head)=(p);} /* this apparently-complicated-looking code is simply an example of @@ -169,7 +170,7 @@ DRead(register struct dcache * fid, register int page) * of larger code size. This could be simplified by better use of * macros. */ - if ((tb = phTable[pHash(fid, page)])) { + if ((tb = phTable[pHash(adc->index, page)])) { if (bufmatch(tb)) { MObtainWriteLock(&tb->lock, 257); ReleaseWriteLock(&afs_bufferLock); @@ -180,7 +181,7 @@ DRead(register struct dcache * fid, register int page) return tb->data; } else { register struct buffer **bufhead; - bufhead = &(phTable[pHash(fid, page)]); + bufhead = &(phTable[pHash(adc->index, page)]); while ((tb2 = tb->hashNext)) { if (bufmatch(tb2)) { buf_Front(bufhead, tb, tb2); @@ -216,7 +217,7 @@ DRead(register struct dcache * fid, register int page) * is at least the oldest buffer on one particular hash chain, so it's * a pretty good place to start looking for the truly oldest buffer. */ - tb = afs_newslot(fid, page, (tb ? tb : tb2)); + tb = afs_newslot(adc, page, (tb ? tb : tb2)); if (!tb) { MReleaseWriteLock(&afs_bufferLock); return NULL; @@ -224,19 +225,21 @@ DRead(register struct dcache * fid, register int page) MObtainWriteLock(&tb->lock, 260); MReleaseWriteLock(&afs_bufferLock); tb->lockers++; - if (page * AFS_BUFFER_PAGESIZE >= fid->f.chunkBytes) { - dirp_Zap(tb->fid); + if (page * AFS_BUFFER_PAGESIZE >= adc->f.chunkBytes) { + tb->fid = 0; + tb->inode = 0; tb->lockers--; MReleaseWriteLock(&tb->lock); return NULL; } - tfile = afs_CFileOpen(fid->f.inode); + tfile = afs_CFileOpen(adc->f.inode); code = afs_CFileRead(tfile, tb->page * AFS_BUFFER_PAGESIZE, tb->data, AFS_BUFFER_PAGESIZE); afs_CFileClose(tfile); if (code < AFS_BUFFER_PAGESIZE) { - dirp_Zap(tb->fid); + tb->fid = 0; + tb->inode = 0; tb->lockers--; MReleaseWriteLock(&tb->lock); return NULL; @@ -273,7 +276,7 @@ FixupBucket(register struct buffer *ap) /* lp is pointer to a fairly-old buffer */ static struct buffer * -afs_newslot(struct dcache * afid, afs_int32 apage, register struct buffer *lp) +afs_newslot(struct dcache *adc, afs_int32 apage, register struct buffer *lp) { /* Find a usable buffer slot */ register afs_int32 i; @@ -340,7 +343,8 @@ afs_newslot(struct dcache * afid, afs_int32 apage, register struct buffer *lp) } if (lp->dirty) { - tfile = afs_CFileOpen(lp->fid->f.inode); + /* see DFlush for rationale for not getting and locking the dcache */ + tfile = afs_CFileOpen(lp->inode); afs_CFileWrite(tfile, lp->page * AFS_BUFFER_PAGESIZE, lp->data, AFS_BUFFER_PAGESIZE); lp->dirty = 0; @@ -349,7 +353,8 @@ afs_newslot(struct dcache * afid, afs_int32 apage, register struct buffer *lp) } /* Now fill in the header. */ - dirp_Cpy(lp->fid, afid); /* set this */ + lp->fid = adc->index; + lp->inode = adc->f.inode; lp->page = apage; lp->accesstime = timecounter++; FixupBucket(lp); /* move to the right hash bucket */ @@ -432,7 +437,7 @@ DVOffset(register void *ap) * method of DRead... */ void -DZap(struct dcache * fid) +DZap(struct dcache *adc) { register int i; /* Destroy all buffers pertaining to a particular fid. */ @@ -442,10 +447,11 @@ DZap(struct dcache * fid) MObtainReadLock(&afs_bufferLock); for (i = 0; i <= PHPAGEMASK; i++) - for (tb = phTable[pHash(fid, i)]; tb; tb = tb->hashNext) - if (dirp_Eq(tb->fid, fid)) { + for (tb = phTable[pHash(adc->index, i)]; tb; tb = tb->hashNext) + if (tb->fid == adc->index) { MObtainWriteLock(&tb->lock, 262); - dirp_Zap(tb->fid); + tb->fid = 0; + tb->inode = 0; tb->dirty = 0; MReleaseWriteLock(&tb->lock); } @@ -469,7 +475,18 @@ DFlush(void) tb->lockers++; MReleaseReadLock(&afs_bufferLock); if (tb->dirty) { - tfile = afs_CFileOpen(tb->fid->f.inode); + /* it seems safe to do this I/O without having the dcache + * locked, since the only things that will update the data in + * a directory are the buffer package, which holds the relevant + * tb->lock while doing the write, or afs_GetDCache, which + * DZap's the directory while holding the dcache lock. + * It is not possible to lock the dcache or even call + * afs_GetDSlot to map the index to the dcache since the dir + * package's caller has some dcache object locked already (so + * we cannot lock afs_xdcache). In addition, we cannot obtain + * a dcache lock while holding the tb->lock of the same file + * since that can deadlock with DRead/DNew */ + tfile = afs_CFileOpen(tb->inode); afs_CFileWrite(tfile, tb->page * AFS_BUFFER_PAGESIZE, tb->data, AFS_BUFFER_PAGESIZE); tb->dirty = 0; /* Clear the dirty flag */ @@ -484,20 +501,24 @@ DFlush(void) } void * -DNew(register struct dcache * fid, register int page) +DNew(register struct dcache *adc, register int page) { /* Same as read, only do *not* even try to read the page, since it probably doesn't exist. */ register struct buffer *tb; AFS_STATCNT(DNew); MObtainWriteLock(&afs_bufferLock, 264); - if ((tb = afs_newslot(fid, page, NULL)) == 0) { + if ((tb = afs_newslot(adc, page, NULL)) == 0) { MReleaseWriteLock(&afs_bufferLock); return 0; } /* extend the chunk, if needed */ - if ((page + 1) * AFS_BUFFER_PAGESIZE > fid->f.chunkBytes) { - afs_AdjustSize(fid, (page + 1) * AFS_BUFFER_PAGESIZE); - afs_WriteDCache(fid, 1); + /* Do it now, not in DFlush or afs_newslot when the data is written out, + * since now our caller has adc->lock writelocked, and we can't acquire + * that lock (or even map from a fid to a dcache) in afs_newslot or + * DFlush due to lock hierarchy issues */ + if ((page + 1) * AFS_BUFFER_PAGESIZE > adc->f.chunkBytes) { + afs_AdjustSize(adc, (page + 1) * AFS_BUFFER_PAGESIZE); + afs_WriteDCache(adc, 1); } MObtainWriteLock(&tb->lock, 265); MReleaseWriteLock(&afs_bufferLock); diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 36aede0df..e2e9dfd0a 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.74.2.3 2004/12/07 06:12:11 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_call.c,v 1.74.2.5 2005/02/21 01:15:34 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -1096,7 +1096,7 @@ struct iparam32 { }; -#if defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV)) +#if defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)) static void iparam32_to_iparam(const struct iparam32 *src, struct iparam *dst) { @@ -1139,21 +1139,31 @@ copyin_iparam(caddr_t cmarg, struct iparam *dst) } #endif /* AFS_SUN57_64BIT_ENV */ -#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV) +#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) struct iparam32 dst32; #ifdef AFS_SPARC64_LINUX24_ENV if (current->thread.flags & SPARC_FLAG_32BIT) #elif defined(AFS_SPARC64_LINUX20_ENV) if (current->tss.flags & SPARC_FLAG_32BIT) + +#elif defined(AFS_AMD64_LINUX26_ENV) + if (test_thread_flag(TIF_IA32)) #elif defined(AFS_AMD64_LINUX20_ENV) if (current->thread.flags & THREAD_IA32) + +#elif defined(AFS_PPC64_LINUX26_ENV) + if (current->thread_info->flags & _TIF_32BIT) #elif defined(AFS_PPC64_LINUX20_ENV) if (current->thread.flags & PPC_FLAG_32BIT) + +#elif defined(AFS_S390X_LINUX26_ENV) + if (test_thread_flag(TIF_31BIT)) #elif defined(AFS_S390X_LINUX20_ENV) if (current->thread.flags & S390_FLAG_31BIT) + #else -#error Not done for this linux version +#error iparam32 not done for this linux platform #endif { AFS_COPYIN(cmarg, (caddr_t) & dst32, sizeof dst32, code); @@ -2617,10 +2627,10 @@ afs_icl_LogFreeUse(register struct afs_icl_log *logp) ObtainWriteLock(&logp->lock, 189); if (--logp->setCount == 0) { /* no more users -- free it (but keep log structure around) */ - afs_osi_Free(logp->datap, sizeof(afs_int32) * logp->logSize); #ifdef KERNEL_HAVE_PIN unpin((char *)logp->datap, sizeof(afs_int32) * logp->logSize); #endif + afs_osi_Free(logp->datap, sizeof(afs_int32) * logp->logSize); logp->firstUsed = logp->firstFree = 0; logp->logElements = 0; logp->datap = NULL; @@ -2643,10 +2653,10 @@ afs_icl_LogSetSize(register struct afs_icl_log *logp, afs_int32 logSize) logp->logElements = 0; /* free and allocate a new one */ - afs_osi_Free(logp->datap, sizeof(afs_int32) * logp->logSize); #ifdef KERNEL_HAVE_PIN unpin((char *)logp->datap, sizeof(afs_int32) * logp->logSize); #endif + afs_osi_Free(logp->datap, sizeof(afs_int32) * logp->logSize); logp->datap = (afs_int32 *) afs_osi_Alloc(sizeof(afs_int32) * logSize); #ifdef KERNEL_HAVE_PIN @@ -2670,7 +2680,10 @@ afs_icl_ZapLog(register struct afs_icl_log *logp) /* found the dude we want to remove */ *lpp = logp->nextp; osi_FreeSmallSpace(logp->name); - osi_FreeSmallSpace(logp->datap); +#ifdef KERNEL_HAVE_PIN + unpin((char *)logp->datap, sizeof(afs_int32) * logp->logSize); +#endif + afs_osi_Free(logp->datap, sizeof(afs_int32) * logp->logSize); osi_FreeSmallSpace(logp); break; /* won't find it twice */ } @@ -2928,10 +2941,10 @@ afs_icl_ZapSet(register struct afs_icl_set *setp) /* found the dude we want to remove */ *lpp = setp->nextp; osi_FreeSmallSpace(setp->name); - afs_osi_Free(setp->eventFlags, ICL_DEFAULTEVENTS); #ifdef KERNEL_HAVE_PIN unpin((char *)setp->eventFlags, ICL_DEFAULTEVENTS); #endif + afs_osi_Free(setp->eventFlags, ICL_DEFAULTEVENTS); for (i = 0; i < ICL_LOGSPERSET; i++) { if ((tlp = setp->logs[i])) afs_icl_LogReleNL(tlp); diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index bda8bc5e7..6789dd755 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -14,7 +14,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_dcache.c,v 1.42.2.4 2004/12/07 06:12:11 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_dcache.c,v 1.42.2.7 2005/02/21 01:15:21 shadow Exp $"); #include "afs/sysincludes.h" /*Standard vendor system headers */ #include "afsincludes.h" /*AFS-based standard headers */ @@ -1301,8 +1301,9 @@ afs_UFSCacheStoreProc(register struct rx_call *acall, struct osi_file *afile, (*abytesXferredP) += code; #endif /* AFS_NOSTATS */ if (code != got) { + code = rx_Error(acall); osi_FreeLargeSpace(tbuffer); - return -33; + return code ? code : -33; } alen -= got; /* diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index 169dbaad3..279ccbfcc 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_memcache.c,v 1.15.2.1 2004/12/07 06:12:11 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_memcache.c,v 1.15.2.2 2005/02/21 01:15:21 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #ifndef AFS_LINUX22_ENV @@ -383,8 +383,9 @@ afs_MemCacheStoreProc(register struct rx_call *acall, code = rx_WritevAlloc(acall, tiov, &tnio, RX_MAXIOVECS, tlen); RX_AFS_GLOCK(); if (code <= 0) { + code = rx_Error(acall); osi_FreeSmallSpace(tiov); - return -33; + return code ? code : -33; } tlen = code; code = afs_MemReadvBlk(mceP, offset, tiov, tnio, tlen); @@ -399,8 +400,9 @@ afs_MemCacheStoreProc(register struct rx_call *acall, (*abytesXferredP) += code; #endif /* AFS_NOSTATS */ if (code != tlen) { + code = rx_Error(acall); osi_FreeSmallSpace(tiov); - return -33; + return code ? code : -33; } offset += tlen; alen -= tlen; diff --git a/src/afs/afs_osi.c b/src/afs/afs_osi.c index d50d87843..1305ccce1 100644 --- a/src/afs/afs_osi.c +++ b/src/afs/afs_osi.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.48.2.1 2004/12/07 06:12:11 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_osi.c,v 1.48.2.3 2005/01/31 04:25:32 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -850,30 +850,38 @@ afs_osi_TraverseProcTable(void) #endif #if defined(AFS_LINUX22_ENV) +extern rwlock_t tasklist_lock __attribute__((weak)); void afs_osi_TraverseProcTable() { struct task_struct *p; - -#ifdef EXPORTED_TASKLIST_LOCK - read_lock(&tasklist_lock); -#endif + if (&tasklist_lock) + read_lock(&tasklist_lock); #ifdef DEFINED_FOR_EACH_PROCESS for_each_process(p) if (p->pid) { +#ifdef STRUCT_TASK_STRUCT_HAS_EXIT_STATE + if (p->exit_state) + continue; +#else if (p->state & TASK_ZOMBIE) continue; +#endif afs_GCPAGs_perproc_func(p); } #else for_each_task(p) if (p->pid) { +#ifdef STRUCT_TASK_STRUCT_HAS_EXIT_STATE + if (p->exit_state) + continue; +#else if (p->state & TASK_ZOMBIE) continue; +#endif afs_GCPAGs_perproc_func(p); } #endif -#ifdef EXPORTED_TASKLIST_LOCK - read_unlock(&tasklist_lock); -#endif + if (&tasklist_lock) + read_unlock(&tasklist_lock); } #endif diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 9471ba8e1..9eeb47a8e 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -183,15 +183,6 @@ typedef struct { typedef struct timeval osi_timeval_t; #endif /* AFS_SGI61_ENV */ -/* - * The following three routines provide the fid routines used by the buffer - * and directory packages. - */ -#define dirp_Zap(afid) ((afid) = 0) -#define dirp_Eq(afid, bfid) ((afid) == (bfid)) -#define dirp_Cpy(dfid,sfid) ((dfid) = (sfid)) - - /* * osi_ThreadUnique() should yield a value that can be found in ps * output in order to draw correspondences between ICL traces and what diff --git a/src/afs/afs_osi_pag.c b/src/afs/afs_osi_pag.c index b978da154..df057e9dd 100644 --- a/src/afs/afs_osi_pag.c +++ b/src/afs/afs_osi_pag.c @@ -23,7 +23,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_osi_pag.c,v 1.21.2.2 2004/11/09 17:09:39 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_osi_pag.c,v 1.21.2.3 2005/01/31 04:19:20 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ @@ -189,7 +189,7 @@ afs_setpag(void) #if defined(AFS_SUN5_ENV) struct AFS_UCRED **acred = *credpp; #elif defined(AFS_OBSD_ENV) - struct AFS_UCRED **acred = p->p_ucred; + struct AFS_UCRED **acred = &p->p_ucred; #else struct AFS_UCRED **acred = NULL; #endif @@ -285,7 +285,7 @@ afs_setpag_val(int pagval) #if defined(AFS_SUN5_ENV) struct AFS_UCRED **acred = *credp; #elif defined(AFS_OBSD_ENV) - struct AFS_UCRED **acred = p->p_ucred; + struct AFS_UCRED **acred = &p->p_ucred; #else struct AFS_UCRED **acred = NULL; #endif diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index dc2a66e72..8055f5cbe 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -11,7 +11,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.81.2.4 2004/12/07 06:12:11 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_pioctl.c,v 1.81.2.8 2005/02/21 01:15:34 shadow Exp $"); #include "afs/sysincludes.h" /* Standard vendor system headers */ #ifdef AFS_OBSD_ENV @@ -195,7 +195,7 @@ static int (*(CpioctlSw[])) () = { #define PSetClientContext 99 /* Special pioctl to setup caller's creds */ int afs_nobody = NFS_NOBODY; -#if (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV)) +#if (defined(AFS_AIX51_ENV) && defined(AFS_64BIT_KERNEL)) || defined(AFS_HPUX_64BIT_ENV) || defined(AFS_SUN57_64BIT_ENV) || (defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64)) || (defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)) static void afs_ioctl32_to_afs_ioctl(const struct afs_ioctl32 *src, struct afs_ioctl *dst) { @@ -260,25 +260,31 @@ copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst) } #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */ -#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) && !defined(AFS_AMD64_LINUX20_ENV) +#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) struct afs_ioctl32 dst32; #ifdef AFS_SPARC64_LINUX24_ENV if (current->thread.flags & SPARC_FLAG_32BIT) #elif defined(AFS_SPARC64_LINUX20_ENV) if (current->tss.flags & SPARC_FLAG_32BIT) + +#elif defined(AFS_AMD64_LINUX26_ENV) + if (test_thread_flag(TIF_IA32)) #elif defined(AFS_AMD64_LINUX20_ENV) if (current->thread.flags & THREAD_IA32) + +#elif defined(AFS_PPC64_LINUX26_ENV) + if (current->thread_info->flags & _TIF_32BIT) #elif defined(AFS_PPC64_LINUX20_ENV) -#ifdef AFS_PPC64_LINUX26_ENV - if (current->thread_info->flags & _TIF_32BIT) -#else /*Linux 2.6*/ - if (current->thread.flags & PPC_FLAG_32BIT) -#endif + if (current->thread.flags & PPC_FLAG_32BIT) + +#elif defined(AFS_S390X_LINUX26_ENV) + if (test_thread_flag(TIF_31BIT)) #elif defined(AFS_S390X_LINUX20_ENV) if (current->thread.flags & S390_FLAG_31BIT) + #else -#error Not done for this linux type +#error pioctl32 not done for this linux #endif { AFS_COPYIN(cmarg, (caddr_t) & dst32, sizeof dst32, code); @@ -1119,62 +1125,64 @@ afs_HandlePioctl(struct vnode *avp, afs_int32 acom, if (inSize > MAXPIOCTLTOKENLEN || inSize < 0 || ablob->out_size < 0) return E2BIG; + /* Note that we use osi_Alloc for large allocs and osi_AllocLargeSpace for small ones */ if (inSize > AFS_LRALLOCSIZ) { - inData = osi_AllocLargeSpace(inSize+1); + inData = osi_Alloc(inSize + 1); } else { - inData = osi_AllocLargeSpace(AFS_LRALLOCSIZ); + inData = osi_AllocLargeSpace(AFS_LRALLOCSIZ); } if (!inData) - return ENOMEM; + return ENOMEM; if (inSize > 0) { AFS_COPYIN(ablob->in, inData, inSize, code); inData[inSize] = '\0'; } else code = 0; if (code) { - if (inSize > AFS_LRALLOCSIZ) { - osi_Free(inData, inSize+1); - } else { - osi_FreeLargeSpace(inData); - } - afs_PutFakeStat(&fakestate); - return code; + if (inSize > AFS_LRALLOCSIZ) { + osi_Free(inData, inSize + 1); + } else { + osi_FreeLargeSpace(inData); + } + afs_PutFakeStat(&fakestate); + return code; } - if (function == 8 && device == 'V') { /* PGetTokens */ - outSizeMax = MAXPIOCTLTOKENLEN; - outData = osi_Alloc(outSizeMax); + if (function == 8 && device == 'V') { /* PGetTokens */ + outSizeMax = MAXPIOCTLTOKENLEN; + outData = osi_Alloc(outSizeMax); } else { - outSizeMax = AFS_LRALLOCSIZ; - outData = osi_AllocLargeSpace(AFS_LRALLOCSIZ); + outSizeMax = AFS_LRALLOCSIZ; + outData = osi_AllocLargeSpace(AFS_LRALLOCSIZ); } if (!outData) { - if (inSize > AFS_LRALLOCSIZ) { - osi_Free(inData, inSize+1); - } else { - osi_FreeLargeSpace(inData); - } - return ENOMEM; + if (inSize > AFS_LRALLOCSIZ) { + osi_Free(inData, inSize + 1); + } else { + osi_FreeLargeSpace(inData); + } + afs_PutFakeStat(&fakestate); + return ENOMEM; } outSize = 0; code = (*pioctlSw[function]) (avc, function, &treq, inData, outData, inSize, &outSize, acred); if (inSize > AFS_LRALLOCSIZ) { - osi_Free(inData, inSize+1); + osi_Free(inData, inSize + 1); } else { - osi_FreeLargeSpace(inData); + osi_FreeLargeSpace(inData); } if (code == 0 && ablob->out_size > 0) { - if (outSize > ablob->out_size) { - code = E2BIG; /* data wont fit in user buffer */ - } else if (outSize) { - AFS_COPYOUT(outData, ablob->out, outSize, code); - } + if (outSize > ablob->out_size) { + code = E2BIG; /* data wont fit in user buffer */ + } else if (outSize) { + AFS_COPYOUT(outData, ablob->out, outSize, code); + } } if (outSizeMax > AFS_LRALLOCSIZ) { - osi_Free(outData, outSizeMax); + osi_Free(outData, outSizeMax); } else { - osi_FreeLargeSpace(outData); + osi_FreeLargeSpace(outData); } afs_PutFakeStat(&fakestate); return afs_CheckCode(code, &treq, 41); @@ -2762,8 +2770,8 @@ DECL_PIOCTL(PSetSysName) return error; } } else { - foundname = num; - strcpy(outname, (*sysnamelist)[0]); + foundname = num; + strcpy(outname, (*sysnamelist)[0]); } afs_PutUser(au, READ_LOCK); } else { @@ -3770,21 +3778,22 @@ DECL_PIOCTL(PCallBackAddr) struct unixuser *tu; struct srvAddr **addrs; - /*AFS_STATCNT(PCallBackAddr);*/ - if ( !afs_resourceinit_flag ) /* afs deamons havn't started yet */ - return EIO; /* Inappropriate ioctl for device */ + /*AFS_STATCNT(PCallBackAddr); */ + if (!afs_resourceinit_flag) /* afs deamons havn't started yet */ + return EIO; /* Inappropriate ioctl for device */ if (!afs_osi_suser(acred)) return EACCES; - if ( ainSize < sizeof(afs_int32) ) + if (ainSize < sizeof(afs_int32)) return EINVAL; memcpy(&addr, ain, sizeof(afs_int32)); ObtainReadLock(&afs_xinterface); - for ( i=0; (unsigned short)i < afs_cb_interface.numberOfInterfaces; i++) { - if (afs_cb_interface.addr_in[i] == addr) break; + for (i = 0; (unsigned short)i < afs_cb_interface.numberOfInterfaces; i++) { + if (afs_cb_interface.addr_in[i] == addr) + break; } ReleaseWriteLock(&afs_xinterface); @@ -3792,65 +3801,65 @@ DECL_PIOCTL(PCallBackAddr) if (afs_cb_interface.addr_in[i] != addr) return EINVAL; - ObtainReadLock(&afs_xserver); /* Necessary? */ + ObtainReadLock(&afs_xserver); /* Necessary? */ ObtainReadLock(&afs_xsrvAddr); srvAddrCount = 0; - for (i=0;inext_bkt) { - srvAddrCount++; - } + for (i = 0; i < NSERVERS; i++) { + for (sa = afs_srvAddrs[i]; sa; sa = sa->next_bkt) { + srvAddrCount++; + } } addrs = afs_osi_Alloc(srvAddrCount * sizeof(*addrs)); j = 0; - for (i=0;inext_bkt) { - if (j >= srvAddrCount) break; - addrs[j++] = sa; - } + for (i = 0; i < NSERVERS; i++) { + for (sa = afs_srvAddrs[i]; sa; sa = sa->next_bkt) { + if (j >= srvAddrCount) + break; + addrs[j++] = sa; + } } ReleaseReadLock(&afs_xsrvAddr); ReleaseReadLock(&afs_xserver); - for (i=0; iserver; - if (!ts) - continue; - - /* vlserver has no callback conn */ - if (sa->sa_portal == AFS_VLPORT) { - continue; - } - - if (!ts->cell) /* not really an active server, anyway, it must */ - continue; /* have just been added by setsprefs */ - - /* get a connection, even if host is down; bumps conn ref count */ - tu = afs_GetUser(areq->uid, ts->cell->cellNum, SHARED_LOCK); - tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cellNum, tu, - 1/*force*/, 1/*create*/, SHARED_LOCK); - afs_PutUser(tu, SHARED_LOCK); - if (!tc) + for (i = 0; i < j; i++) { + sa = addrs[i]; + ts = sa->server; + if (!ts) continue; - if ((sa->sa_flags & SRVADDR_ISDOWN) || afs_HaveCallBacksFrom(ts)) { - if (sa->sa_flags & SRVADDR_ISDOWN) { - rx_SetConnDeadTime(tc->id, 3); - } + /* vlserver has no callback conn */ + if (sa->sa_portal == AFS_VLPORT) { + continue; + } + + if (!ts->cell) /* not really an active server, anyway, it must */ + continue; /* have just been added by setsprefs */ + /* get a connection, even if host is down; bumps conn ref count */ + tu = afs_GetUser(areq->uid, ts->cell->cellNum, SHARED_LOCK); + tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cellNum, tu, + 1 /*force */ , 1 /*create */ , SHARED_LOCK); + afs_PutUser(tu, SHARED_LOCK); + if (!tc) + continue; + + if ((sa->sa_flags & SRVADDR_ISDOWN) || afs_HaveCallBacksFrom(ts)) { + if (sa->sa_flags & SRVADDR_ISDOWN) { + rx_SetConnDeadTime(tc->id, 3); + } #ifdef RX_ENABLE_LOCKS - AFS_GUNLOCK(); + AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS */ code = RXAFS_CallBackRxConnAddr(tc->id, &addr); #ifdef RX_ENABLE_LOCKS - AFS_GLOCK(); + AFS_GLOCK(); #endif /* RX_ENABLE_LOCKS */ } - afs_PutConn(tc, SHARED_LOCK); /* done with it now */ - } /* Outer loop over addrs */ + afs_PutConn(tc, SHARED_LOCK); /* done with it now */ + } /* Outer loop over addrs */ #endif /* UKERNEL */ return 0; } diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index 8da25423d..ac5b6b85b 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -14,7 +14,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_segments.c,v 1.16.2.4 2004/12/07 06:12:12 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_segments.c,v 1.16.2.5 2005/02/21 01:15:21 shadow Exp $"); #include "afs/sysincludes.h" /*Standard vendor system headers */ #include "afsincludes.h" /*AFS-based standard headers */ @@ -60,8 +60,8 @@ afs_StoreMini(register struct vcache *avc, struct vrequest *areq) do { tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); if (tc) { - RX_AFS_GUNLOCK(); retry: + RX_AFS_GUNLOCK(); tcall = rx_NewCall(tc->id); RX_AFS_GLOCK(); /* Set the client mod time since we always want the file @@ -104,17 +104,16 @@ afs_StoreMini(register struct vcache *avc, struct vrequest *areq) #endif /* AFS_64BIT_CLIENT */ if (code == 0) { code = EndRXAFS_StoreData(tcall, &OutStatus, &tsync); -#ifdef AFS_64BIT_CLIENT - if (code == RXGEN_OPCODE) { - afs_serverSetNo64Bit(tc); - code = rx_EndCall(tcall, code); - goto retry; - } -#endif /* AFS_64BIT_CLIENT */ } code = rx_EndCall(tcall, code); RX_AFS_GLOCK(); XSTATS_END_TIME; +#ifdef AFS_64BIT_CLIENT + if (code == RXGEN_OPCODE && !afs_serverHasNo64Bit(tc)) { + afs_serverSetNo64Bit(tc); + goto retry; + } +#endif /* AFS_64BIT_CLIENT */ } else code = -1; } while (afs_Analyze @@ -508,14 +507,8 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, shouldwake, &lp1, &lp2); #endif /* AFS_NOSTATS */ afs_CFileClose(tfile); -#ifdef AFS_64BIT_CLIENT - if (code == RXGEN_OPCODE) { - afs_serverSetNo64Bit(tc); - goto restart; - } -#endif /* AFS_64BIT_CLIENT */ if ((tdc->f.chunkBytes < afs_OtherCSize) - && (i < (nchunks - 1))) { + && (i < (nchunks - 1)) && code == 0) { int bsent, tlen, sbytes = afs_OtherCSize - tdc->f.chunkBytes; char *tbuffer = @@ -567,6 +560,12 @@ afs_StoreAllSegments(register struct vcache *avc, struct vrequest *areq, if (code2) code = code2; } +#ifdef AFS_64BIT_CLIENT + if (code == RXGEN_OPCODE && !afs_serverHasNo64Bit(tc)) { + afs_serverSetNo64Bit(tc); + goto restart; + } +#endif /* AFS_64BIT_CLIENT */ } while (afs_Analyze (tc, code, &avc->fid, areq, AFS_STATS_FS_RPCIDX_STOREDATA, SHARED_LOCK, diff --git a/src/afs/afs_server.c b/src/afs/afs_server.c index d54d91287..50060d99b 100644 --- a/src/afs/afs_server.c +++ b/src/afs/afs_server.c @@ -33,7 +33,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_server.c,v 1.33.2.3 2004/12/07 06:12:40 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_server.c,v 1.33.2.5 2005/02/21 01:12:38 shadow Exp $"); #include "afs/stds.h" #include "afs/sysincludes.h" /* Standard vendor system headers */ @@ -499,7 +499,6 @@ afs_CheckServers(int adown, struct cell *acellp) afs_int32 i, j; afs_int32 code; afs_int32 start, end = 0, delta; - afs_int32 m_error; osi_timeval_t tv; struct unixuser *tu; char tbuffer[CVBS]; @@ -508,7 +507,7 @@ afs_CheckServers(int adown, struct cell *acellp) struct conn **conns; int nconns; struct rx_connection **rxconns; - afs_int32 *conntimer, *deltas; + afs_int32 *conntimer, *deltas, *results; AFS_STATCNT(afs_CheckServers); @@ -546,6 +545,7 @@ afs_CheckServers(int adown, struct cell *acellp) rxconns = (struct rx_connection **)afs_osi_Alloc(j * sizeof(struct rx_connection *)); conntimer = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32)); deltas = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32)); + results = (afs_int32 *)afs_osi_Alloc(j * sizeof (afs_int32)); for (i = 0; i < j; i++) { deltas[i] = 0; @@ -604,9 +604,9 @@ afs_CheckServers(int adown, struct cell *acellp) tc = conns[multi_i]; sa = tc->srvr; if (conntimer[multi_i] == 0) - rx_SetConnDeadTime(tc->id, AFS_RXDEADTIME); + rx_SetConnDeadTime(tc->id, afs_rx_deadtime); end = osi_Time(); - m_error=multi_error; + results[multi_i]=multi_error; if ((start == end) && !multi_error) deltas[multi_i] = end - tv.tv_sec; @@ -617,7 +617,7 @@ afs_CheckServers(int adown, struct cell *acellp) tc = conns[i]; sa = tc->srvr; - if (( m_error >= 0 ) && (sa->sa_flags & SRVADDR_ISDOWN) && (tc->srvr == sa)) { + if (( results[i] >= 0 ) && (sa->sa_flags & SRVADDR_ISDOWN) && (tc->srvr == sa)) { /* server back up */ print_internet_address("afs: file server ", sa, " is back up", 2); @@ -631,7 +631,7 @@ afs_CheckServers(int adown, struct cell *acellp) afs_osi_Wakeup(&afs_waitForever); } } else { - if (m_error < 0) { + if (results[i] < 0) { /* server crashed */ afs_ServerDown(sa); ForceNewConnections(sa); /* multi homed clients */ @@ -713,6 +713,7 @@ afs_CheckServers(int adown, struct cell *acellp) afs_osi_Free(rxconns, j * sizeof(struct rx_connection *)); afs_osi_Free(conntimer, j * sizeof(afs_int32)); afs_osi_Free(deltas, j * sizeof(afs_int32)); + afs_osi_Free(results, j * sizeof(afs_int32)); } /*afs_CheckServers*/ diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 9208fbd4e..3b7549c27 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -39,7 +39,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.65.2.4 2004/10/18 17:43:50 shadow Exp $"); + ("$Header: /cvs/openafs/src/afs/afs_vcache.c,v 1.65.2.10 2005/02/21 01:12:53 shadow Exp $"); #include "afs/sysincludes.h" /*Standard vendor system headers */ #include "afsincludes.h" /*AFS-based standard headers */ @@ -557,153 +557,6 @@ afs_RemoveVCB(struct VenusFid *afid) MReleaseWriteLock(&afs_xvcb); } -#if defined(AFS_LINUX22_ENV) && !defined(AFS_LINUX26_ENV) - -static void -__shrink_dcache_parent(struct dentry *parent) -{ - struct dentry *this_parent = parent; - struct list_head *next; - int found = 0; - LIST_HEAD(afs_dentry_unused); - - repeat: - next = this_parent->d_subdirs.next; - resume: - while (next != &this_parent->d_subdirs) { - struct list_head *tmp = next; - struct dentry *dentry = list_entry(tmp, struct dentry, d_child); - next = tmp->next; - if (!DCOUNT(dentry)) { - list_del(&dentry->d_lru); - list_add(&dentry->d_lru, afs_dentry_unused.prev); - found++; - } - /* - * Descend a level if the d_subdirs list is non-empty. - */ - if (!list_empty(&dentry->d_subdirs)) { - this_parent = dentry; - goto repeat; - } - } - /* - * All done at this level ... ascend and resume the search. - */ - if (this_parent != parent) { - next = this_parent->d_child.next; - this_parent = this_parent->d_parent; - goto resume; - } - - for (;;) { - struct dentry *dentry; - struct list_head *tmp; - - tmp = afs_dentry_unused.prev; - - if (tmp == &afs_dentry_unused) - break; -#ifdef AFS_LINUX24_ENV - list_del_init(tmp); -#else - list_del(tmp); - INIT_LIST_HEAD(tmp); -#endif /* AFS_LINUX24_ENV */ - dentry = list_entry(tmp, struct dentry, d_lru); - -#ifdef AFS_LINUX24_ENV - /* Unused dentry with a count? */ - if (DCOUNT(dentry)) - BUG(); -#endif - DGET(dentry); -#ifdef AFS_LINUX24_ENV - list_del_init(&dentry->d_hash); /* d_drop */ -#else - list_del(&dentry->d_hash); - INIT_LIST_HEAD(&dentry->d_hash); -#endif /* AFS_LINUX24_ENV */ - DUNLOCK(); - dput(dentry); - DLOCK(); - if (!--found) - break; - } -} - -/* afs_TryFlushDcacheChildren -- Shakes loose vcache references held by - * children of the dentry - * - * LOCKS -- Called with afs_xvcache write locked. Drops and reaquires - * AFS_GLOCK, so it can call dput, which may call iput, but - * keeps afs_xvcache exclusively. - * - * Tree traversal algorithm from fs/dcache.c: select_parent() - */ -static void -afs_TryFlushDcacheChildren(struct vcache *tvc) -{ - struct inode *ip = AFSTOI(tvc); - struct dentry *this_parent; - struct list_head *next; - struct list_head *cur; - struct list_head *head = &ip->i_dentry; - struct dentry *dentry; - - AFS_GUNLOCK(); - restart: -#ifndef old_vcache_scheme - DLOCK(); - cur = head; - while ((cur = cur->next) != head) { - dentry = list_entry(cur, struct dentry, d_alias); - - if (!list_empty(&dentry->d_hash) && !list_empty(&dentry->d_subdirs)) - __shrink_dcache_parent(dentry); - - if (!DCOUNT(dentry)) { - DGET(dentry); -#ifdef AFS_LINUX24_ENV - list_del_init(&dentry->d_hash); /* d_drop */ -#else - list_del(&dentry->d_hash); - INIT_LIST_HEAD(&dentry->d_hash); -#endif /* AFS_LINUX24_ENV */ - DUNLOCK(); - dput(dentry); - goto restart; - } - } - DUNLOCK(); - AFS_GLOCK(); -#else - restart: - DLOCK(); - cur = head; - while ((cur = cur->next) != head) { - dentry = list_entry(cur, struct dentry, d_alias); - - afs_Trace3(afs_iclSetp, CM_TRACE_TRYFLUSHDCACHECHILDREN, - ICL_TYPE_POINTER, ip, ICL_TYPE_STRING, - dentry->d_parent->d_name.name, ICL_TYPE_STRING, - dentry->d_name.name); - - if (!DCOUNT(dentry)) { - AFS_GUNLOCK(); - DGET(dentry); - DUNLOCK(); - d_drop(dentry); - dput(dentry); - AFS_GLOCK(); - goto restart; - } - } - DUNLOCK(); -#endif -} -#endif /* AFS_LINUX22_ENV && !AFS_LINUX26_ENV */ - /* * afs_NewVCache * @@ -839,22 +692,41 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) } #elif defined(AFS_LINUX22_ENV) if (tvc != afs_globalVp && VREFCOUNT(tvc) && tvc->opens == 0) { -#if defined(AFS_LINUX26_ENV) struct dentry *dentry; struct list_head *cur, *head = &(AFSTOI(tvc))->i_dentry; + AFS_FAST_HOLD(tvc); AFS_GUNLOCK(); - cur=head; + +restart: +#if defined(AFS_LINUX24_ENV) + spin_lock(&dcache_lock); +#endif + cur = head; while ((cur = cur->next) != head) { dentry = list_entry(cur, struct dentry, d_alias); - if (!d_unhashed(dentry) && - !list_empty(&dentry->d_subdirs)) - shrink_dcache_parent(dentry); - } - d_prune_aliases(AFSTOI(tvc)); - AFS_GLOCK(); -#else - afs_TryFlushDcacheChildren(tvc); + + if (d_unhashed(dentry)) + continue; + + dget_locked(dentry); + +#if defined(AFS_LINUX24_ENV) + spin_unlock(&dcache_lock); #endif + if (d_invalidate(dentry) == -EBUSY) { + dput(dentry); + /* perhaps lock and try to continue? (use cur as head?) */ + goto inuse; + } + dput(dentry); + goto restart; + } +#if defined(AFS_LINUX24_ENV) + spin_unlock(&dcache_lock); +#endif + inuse: + AFS_GLOCK(); + AFS_FAST_RELE(tvc); } #endif @@ -1080,6 +952,9 @@ afs_NewVCache(struct VenusFid *afid, struct server *serverp) #endif ip->i_sb = afs_globalVFS; put_inode_on_dummy_list(ip); +#ifdef STRUCT_INODE_HAS_I_SB_LIST + list_add(&ip->i_sb_list, &ip->i_sb->s_inodes); +#endif } #endif @@ -2895,6 +2770,17 @@ afs_vcacheInit(int astatSize) LOCK_INIT(&afs_xvcb, "afs_xvcb"); #if !defined(AFS_OSF_ENV) +#ifdef AFS_LINUX26_ENV + printf("old style would have needed %d contiguous bytes\n", astatSize * + sizeof(struct vcache)); + Initial_freeVCList = freeVCList = tvp = (struct vcache *) + afs_osi_Alloc(sizeof(struct vcache)); + for (i = 0; i < astatSize; i++) { + tvp->nextfree = (struct vcache *) afs_osi_Alloc(sizeof(struct vcache)); + tvp = tvp->nextfree; + } + tvp->nextfree = NULL; +#else /* Allocate and thread the struct vcache entries */ tvp = (struct vcache *)afs_osi_Alloc(astatSize * sizeof(struct vcache)); memset((char *)tvp, 0, sizeof(struct vcache) * astatSize); @@ -2909,7 +2795,7 @@ afs_vcacheInit(int astatSize) pin((char *)tvp, astatSize * sizeof(struct vcache)); /* XXX */ #endif #endif - +#endif #if defined(AFS_SGI_ENV) for (i = 0; i < astatSize; i++) { @@ -3019,12 +2905,25 @@ shutdown_vcache(void) } afs_cbrSpace = 0; +#ifdef AFS_LINUX26_ENV + { + struct vcache *tvp = Initial_freeVCList; + while (tvp) { + struct vcache *next = tvp->nextfree; + + afs_osi_Free(tvp, sizeof(struct vcache)); + tvp = next; + } + } +#else #ifdef KERNEL_HAVE_PIN unpin(Initial_freeVCList, afs_cacheStats * sizeof(struct vcache)); #endif #if !defined(AFS_OSF_ENV) afs_osi_Free(Initial_freeVCList, afs_cacheStats * sizeof(struct vcache)); #endif +#endif + #if !defined(AFS_OSF_ENV) freeVCList = Initial_freeVCList = 0; #endif diff --git a/src/afs/sysincludes.h b/src/afs/sysincludes.h index b0dcf2170..d592679ae 100644 --- a/src/afs/sysincludes.h +++ b/src/afs/sysincludes.h @@ -84,10 +84,12 @@ struct xfs_inode_info { #include #include #include +#include #include #include #include #include +#include #include #include #include diff --git a/src/afsd/Makefile.in b/src/afsd/Makefile.in index f729e2c38..3d0c6dbee 100644 --- a/src/afsd/Makefile.in +++ b/src/afsd/Makefile.in @@ -72,7 +72,7 @@ dest: ${DEST}/root.client/usr/vice/etc/afsd ${DEST}/etc/vsys ${INSTALL} -f ${srcdir}/afs.rc.solaris.2.7 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\ sun*_58 ) \ ${INSTALL} -f ${srcdir}/afs.rc.solaris.2.8 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\ - sun*_59 ) \ + sun*_59 | sun*_510 ) \ ${INSTALL} -f ${srcdir}/afs.rc.solaris.2.9 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\ sun4x_5? ) \ ${INSTALL} -f ${srcdir}/afs.rc.solaris.2_5 ${DEST}/root.client/usr/vice/etc/modload/afs.rc ;;\ diff --git a/src/afsd/afs.rc.solaris.2.9 b/src/afsd/afs.rc.solaris.2.9 index b4c91e0f5..2f6d28555 100644 --- a/src/afsd/afs.rc.solaris.2.9 +++ b/src/afsd/afs.rc.solaris.2.9 @@ -62,6 +62,9 @@ fi ## If sparcv9 then the location of the afs and nfs extensions differ case `/bin/isalist` in + *amd64* ) + nfssrv=/kernel/misc/amd64/nfssrv + afs=/kernel/fs/amd64/afs ;; *sparcv9* ) nfssrv=/kernel/misc/sparcv9/nfssrv afs=/kernel/fs/sparcv9/afs ;; diff --git a/src/afsd/afsd.c b/src/afsd/afsd.c index d30001982..c8fd61631 100644 --- a/src/afsd/afsd.c +++ b/src/afsd/afsd.c @@ -56,7 +56,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.43.2.1 2004/12/07 18:25:08 shadow Exp $"); + ("$Header: /cvs/openafs/src/afsd/afsd.c,v 1.43.2.2 2005/01/31 04:09:51 shadow Exp $"); #define VFS 1 @@ -1932,7 +1932,9 @@ mainproc(as, arock) if (afsd_debug) printf("%s: Calling AFSOP_VOLUMEINFO: volume info file is '%s'\n", rn, fullpn_VolInfoFile); - call_syscall(AFSOP_VOLUMEINFO, fullpn_VolInfoFile); + /* once again, meaningless for a memory-based cache. */ + if (!(cacheFlags & AFSCALL_INIT_MEMCACHE)) + call_syscall(AFSOP_VOLUMEINFO, fullpn_VolInfoFile); /* * Pass the kernel the name of the afs logging file holding the volume diff --git a/src/cf/linux-test3.m4 b/src/cf/linux-test3.m4 index b710eb3e7..f8c2151f5 100644 --- a/src/cf/linux-test3.m4 +++ b/src/cf/linux-test3.m4 @@ -116,7 +116,7 @@ CPPFLAGS="$save_CPPFLAGS"]) AC_DEFUN([LINUX_KERNEL_PAGE_FOLLOW_LINK],[ AC_MSG_CHECKING(for page_follow_link_light vs page_follow_link) save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -Werror-implicit-function-declaration -D__KERNEL__ $CPPFLAGS" AC_CACHE_VAL(ac_cv_linux_kernel_page_follow_link, [ AC_TRY_COMPILE( @@ -126,5 +126,5 @@ AC_TRY_COMPILE( ], ac_cv_linux_kernel_page_follow_link=yes, ac_cv_linux_kernel_page_follow_link=no)]) -AC_MSG_RESULT($ac_cv_linux_kernel_page_follow_page) +AC_MSG_RESULT($ac_cv_linux_kernel_page_follow_link) CPPFLAGS="$save_CPPFLAGS"]) diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 08e0c974b..4da0611b0 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -188,23 +188,6 @@ AC_MSG_RESULT($ac_cv_linux_exports_sys_wait4) CPPFLAGS="$save_CPPFLAGS"]) -AC_DEFUN([LINUX_EXPORTS_TASKLIST_LOCK], [ -AC_MSG_CHECKING(for exported tasklist_lock) -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" -AC_CACHE_VAL(ac_cv_linux_exports_tasklist_lock, -[ -AC_TRY_COMPILE( -[#include ], -[#ifndef __ver_tasklist_lock -#error tasklist_lock not exported -#endif], -ac_cv_linux_exports_tasklist_lock=yes, -ac_cv_linux_exports_tasklist_lock=no)]) -AC_MSG_RESULT($ac_cv_linux_exports_tasklist_lock) -CPPFLAGS="$save_CPPFLAGS"]) - - AC_DEFUN([LINUX_FS_STRUCT_INODE_HAS_I_CDEV], [ AC_MSG_CHECKING(for i_cdev in struct inode) save_CPPFLAGS="$CPPFLAGS" @@ -301,6 +284,22 @@ AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_security) CPPFLAGS="$save_CPPFLAGS"]) +AC_DEFUN([LINUX_FS_STRUCT_INODE_HAS_I_SB_LIST], [ +AC_MSG_CHECKING(for i_sb_list in struct inode) +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +AC_CACHE_VAL(ac_cv_linux_fs_struct_inode_has_i_sb_list, +[ +AC_TRY_COMPILE( +[#include ], +[struct inode _inode; +printf("%d\n", _inode.i_sb_list);], +ac_cv_linux_fs_struct_inode_has_i_sb_list=yes, +ac_cv_linux_fs_struct_inode_has_i_sb_list=no)]) +AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_sb_list) +CPPFLAGS="$save_CPPFLAGS"]) + + AC_DEFUN([LINUX_RECALC_SIGPENDING_ARG_TYPE],[ AC_MSG_CHECKING(for recalc_sigpending arg type) save_CPPFLAGS="$CPPFLAGS" @@ -392,3 +391,48 @@ ac_cv_linux_sched_struct_task_struct_has_sighand=yes, ac_cv_linux_sched_struct_task_struct_has_sighand=no)]) AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_sighand) CPPFLAGS="$save_CPPFLAGS"]) + +AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_RLIM], [ +AC_MSG_CHECKING(for rlim in struct task_struct) +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_rlim, +[ +AC_TRY_COMPILE( +[#include ], +[struct task_struct _tsk; +printf("%d\n", _tsk.rlim);], +ac_cv_linux_sched_struct_task_struct_has_rlim=yes, +ac_cv_linux_sched_struct_task_struct_has_rlim=no)]) +AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_rlim) +CPPFLAGS="$save_CPPFLAGS"]) + +AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM], [ +AC_MSG_CHECKING(for signal->rlim in struct task_struct) +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_signal_rlim, +[ +AC_TRY_COMPILE( +[#include ], +[struct task_struct _tsk; +printf("%d\n", _tsk.signal->rlim);], +ac_cv_linux_sched_struct_task_struct_has_signal_rlim=yes, +ac_cv_linux_sched_struct_task_struct_has_signal_rlim=no)]) +AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_signal_rlim) +CPPFLAGS="$save_CPPFLAGS"]) + +AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_EXIT_STATE], [ +AC_MSG_CHECKING(for exit_state in struct task_struct) +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS" +AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_exit_state, +[ +AC_TRY_COMPILE( +[#include ], +[struct task_struct _tsk; +printf("%d\n", _tsk.exit_state);], +ac_cv_linux_sched_struct_task_struct_has_exit_state=yes, +ac_cv_linux_sched_struct_task_struct_has_exit_state=no)]) +AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_exit_state) +CPPFLAGS="$save_CPPFLAGS"]) diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4 index 2adcb09eb..d1c930037 100644 --- a/src/cf/osconf.m4 +++ b/src/cf/osconf.m4 @@ -195,7 +195,7 @@ case $AFS_SYSNAME in YACC="byacc" ;; - *nbsd2*) + *nbsd2*|*nbsd3*) LEX="flex -l" MT_CFLAGS='${XCFLAGS} -DAFS_PTHREAD_ENV -D_REENTRANT ' MT_LIBS="-lpthread" # XXX -pthread soon @@ -414,21 +414,7 @@ case $AFS_SYSNAME in EXTRA_VLIBOBJS="fstab.o" ;; - ppc_linux22) - INSTALL="install" - KERN_OPTMZ=-O2 - LEX="flex -l" - MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' - MT_LIBS="-lpthread" - PAM_CFLAGS="-O2 -Dlinux -DLINUX_PAM -fPIC" - SHLIB_LDFLAGS="-shared -Xlinker -x" - TXLIBS="-lncurses" - XCFLAGS="-O2 -D_LARGEFILE64_SOURCE" - YACC="bison -y" - SHLIB_LINKER="${MT_CC} -shared" - ;; - - ppc_linux24) + ppc_linux*) KERN_OPTMZ=-O2 LEX="flex -l" MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}' @@ -503,7 +489,7 @@ case $AFS_SYSNAME in SHLIB_LINKER="${MT_CC} -shared" ;; - s390_linux24) + s390_linux24|s390_linux26) CC="gcc" CCOBJ="gcc" LD="ld" @@ -520,7 +506,7 @@ case $AFS_SYSNAME in SHLIB_LINKER="${MT_CC} -shared" ;; - s390x_linux24) + s390x_linux24|s390x_linux26) CC="gcc" CCOBJ="gcc" LD="ld" @@ -786,7 +772,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -807,7 +793,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -828,7 +814,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" @@ -849,7 +835,7 @@ case $AFS_SYSNAME in SHLIB_CFLAGS="-KPIC" SHLIB_LDFLAGS="-G -Bsymbolic" TXLIBS="-lcurses" - XCFLAGS64='${XCFLAGS} -xarch=v9' + XCFLAGS64='${XCFLAGS} -xarch=amd64' XCFLAGS="-dy -Bdynamic" XLIBELFA="-lelf" XLIBKVM="-lkvm" diff --git a/src/config/NTMakefile.i386_nt40 b/src/config/NTMakefile.i386_nt40 index 5b23feee5..3cc52e9a0 100644 --- a/src/config/NTMakefile.i386_nt40 +++ b/src/config/NTMakefile.i386_nt40 @@ -80,7 +80,7 @@ LIB = $(AFSDEV_LIB) #define used in WinNT/2000 installation and program version display AFSPRODUCT_VER_MAJOR=1 AFSPRODUCT_VER_MINOR=3 -AFSPRODUCT_VER_PATCH=7700 +AFSPRODUCT_VER_PATCH=7701 AFSPRODUCT_VER_BUILD=0 # For MSI installer, each major release should have a different GUID diff --git a/src/config/afs_args.h b/src/config/afs_args.h index e28eae5ff..4c2a8f458 100644 --- a/src/config/afs_args.h +++ b/src/config/afs_args.h @@ -191,6 +191,14 @@ struct afsprocdata { long param1; long syscall; }; + +struct afsprocdata32 { + unsigned int param4; + unsigned int param3; + unsigned int param2; + unsigned int param1; + unsigned int syscall; +}; #endif diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index 25e000471..470ddf04d 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -154,6 +154,7 @@ #define SYS_NAME_ID_s390x_linux2 1903 #define SYS_NAME_ID_s390x_linux22 1904 #define SYS_NAME_ID_s390x_linux24 1905 +#define SYS_NAME_ID_s390x_linux26 1906 #define SYS_NAME_ID_alpha_linux_2 2000 #define SYS_NAME_ID_alpha_linux_22 2001 @@ -198,6 +199,7 @@ #define SYS_NAME_ID_sparc64_nbsd20 2523 #define SYS_NAME_ID_macppc_nbsd20 2524 #define SYS_NAME_ID_i386_nbsd21 2525 +#define SYS_NAME_ID_i386_nbsd30 2526 #define SYS_NAME_ID_i386_obsd31 2600 #define SYS_NAME_ID_i386_obsd32 2601 @@ -221,6 +223,8 @@ #define SYS_NAME_ID_ppc64_linux24 2902 #define SYS_NAME_ID_ppc64_linux26 2903 +#define SYS_NAME_ID_amd64_fbsd_53 3008 + /* * Placeholder to keep system-wide standard flags since this file is included by all * files (i.e in afs/param.h) diff --git a/src/config/afsconfig.h.in b/src/config/afsconfig.h.in index bb71731f4..3ee6df59e 100644 --- a/src/config/afsconfig.h.in +++ b/src/config/afsconfig.h.in @@ -269,9 +269,6 @@ /* define if your linux kernel exports sys_wait4 */ #undef EXPORTED_SYS_WAIT4 -/* define if your linux kernel exports tasklist_lock */ -#undef EXPORTED_TASKLIST_LOCK - /* define if completion_h exists */ #undef COMPLETION_H_EXISTS @@ -305,6 +302,9 @@ /* define if you struct inode has i_security */ #undef STRUCT_INODE_HAS_I_SECURITY +/* define if you struct inode has i_sb_list */ +#undef STRUCT_INODE_HAS_I_SB_LIST + /* define if your struct inode has data_buffers */ #undef STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS @@ -338,6 +338,15 @@ /* define if your struct task_struct has sig */ #undef STRUCT_TASK_STRUCT_HAS_SIG +/* define if your struct task_struct has rlim */ +#undef STRUCT_TASK_STRUCT_HAS_RLIM + +/* define if your struct task_struct has signal->rlim */ +#undef STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM + +/* define if your struct task_struct has exit_state */ +#undef STRUCT_TASK_STRUCT_HAS_EXIT_STATE + /* define if you have a struct buf */ #undef HAVE_STRUCT_BUF diff --git a/src/config/make_libafs_tree.pl b/src/config/make_libafs_tree.pl index dcd08eb89..f29d40f6d 100644 --- a/src/config/make_libafs_tree.pl +++ b/src/config/make_libafs_tree.pl @@ -63,7 +63,7 @@ finddepth(\&find_libafsdep, $projdir); # # Manual actions # -©it("$projdir/configure-libafs", "$treedir/configure-libafs"); +©it("$projdir/configure-libafs", "$treedir/configure"); ©it("$projdir/Makefile-libafs.in", "$treedir/Makefile.in"); system("$objdir/src/config/config", diff --git a/src/config/param.amd64_fbsd_53.h b/src/config/param.amd64_fbsd_53.h new file mode 100644 index 000000000..79f229d70 --- /dev/null +++ b/src/config/param.amd64_fbsd_53.h @@ -0,0 +1,202 @@ +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#ifndef UKERNEL +/* This section for kernel libafs compiles only */ + +#ifndef IGNORE_STDS_H +#include +#endif + +#define AFS_XBSD_ENV 1 /* {Free,Open,Net}BSD */ +#define AFS_X86_XBSD_ENV 1 + +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 +#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ +#define AFS_FBSD_ENV 1 +#define AFS_FBSD40_ENV 1 +#define AFS_FBSD42_ENV 1 +#define AFS_FBSD43_ENV 1 +#define AFS_FBSD44_ENV 1 +#define AFS_FBSD45_ENV 1 +#define AFS_FBSD46_ENV 1 +#define AFS_FBSD47_ENV 1 +#define AFS_FBSD50_ENV 1 +#define AFS_FBSD51_ENV 1 +#define AFS_FBSD52_ENV 1 +#define AFS_FBSD53_ENV 1 +#define AFS_X86_FBSD_ENV 1 +#define AFS_X86_FBSD40_ENV 1 +#define AFS_X86_FBSD42_ENV 1 +#define AFS_X86_FBSD43_ENV 1 +#define AFS_X86_FBSD46_ENV 1 +#define AFS_X86_FBSD47_ENV 1 +#define AFS_X86_FBSD50_ENV 1 +#define AFS_X86_ENV 1 +#define AFS_NONFSTRANS 1 +#define FTRUNC O_TRUNC + +#define IUPD 0x0010 +#define IACC 0x0020 +#define ICHG 0x0040 +#define IMOD 0x0080 + +#define IN_LOCK(ip) lockmgr(&ip->i_lock, LK_EXCLUSIVE, \ + NULL, curproc) +#define IN_UNLOCK(ip) lockmgr(&ip->i_lock, LK_RELEASE, \ + NULL, curproc) + +#include + +#define AFS_VM_RDWR_ENV 1 +#define AFS_VFS_ENV 1 +#define AFS_VFSINCL_ENV 1 +#define AFS_GREEDY43_ENV 1 +#define AFS_ENV 1 + +#define AFS_SYSCALL 339 +#define AFS_MOUNT_AFS "afs" + +#ifndef MOUNT_UFS +#define MOUNT_UFS "ufs" +#endif + +#ifndef MOUNT_AFS +#define MOUNT_AFS AFS_MOUNT_AFS +#endif +#define SYS_NAME "amd64_fbsd_53" +#define SYS_NAME_ID SYS_NAME_ID_amd64_fbsd_53 + +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't supports statvfs */ + +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */ + +#define AFSLITTLE_ENDIAN 1 + +/* Extra kernel definitions (from kdefs file) */ +#ifdef _KERNEL +#define AFS_GLOBAL_SUNLOCK 1 +#define AFS_VFS34 1 /* What is VFS34??? */ +#define AFS_SHORTGID 0 /* are group id's short? */ +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_resid uio_resid +#define AFS_UIOSYS UIO_SYSSPACE +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES CLBYTES +#define osi_GetTime(x) microtime(x) +#define AFS_KALLOC(x) osi_fbsd_alloc((x), 1) +#undef AFS_KALLOC_NOSLEEP +#define AFS_KALLOC_NOSLEEP(x) osi_fbsd_alloc((x), 0) +#define AFS_KFREE(x,y) osi_fbsd_free((x)) +#define v_count v_usecount +#define v_vfsp v_mount +#define vfs_bsize mnt_stat.f_bsize +#define vfs_fsid mnt_stat.f_fsid +#define va_nodeid va_fileid +#define vfs_vnodecovered mnt_vnodecovered +#define direct dirent +#define vnode_t struct vnode + +#ifndef MUTEX_DEFAULT +#define MUTEX_DEFAULT 0 +#endif /* MUTEX_DEFAULT */ + +#ifndef SSYS +#define SSYS 0x00002 +#endif /* SSYS */ + +#define p_rcred p_ucred + +#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) +enum vcexcl { NONEXCL, EXCL }; + +#ifdef KERNEL +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif +#endif /* KERNEL */ + +#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */ +#endif /* _KERNEL */ + +#else /* !defined(UKERNEL) */ + +/* This section for user space compiles only */ + +#define UKERNEL 1 /* user space kernel */ +#define AFS_ENV 1 +#define AFS_VFSINCL_ENV 1 +#define AFS_USR_FBSD40_ENV 1 +#define AFS_USR_FBSD42_ENV 1 +#define AFS_USR_FBSD43_ENV 1 +#define AFS_USR_FBSD44_ENV 1 +#define AFS_USR_FBSD45_ENV 1 +#define AFS_USR_FBSD46_ENV 1 +#define AFS_USR_FBSD47_ENV 1 +#define AFS_USR_FBSD50_ENV 1 +#define AFS_USR_FBSD51_ENV 1 +#define AFS_USR_FBSD52_ENV 1 +#define AFS_USR_FBSD53_ENV 1 +#define AFS_USR_FBSD_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 339 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#define AFS_64BIT_ENV 1 +#define AFS_64BITPOINTER_ENV 1 +#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + +/* Machine / Operating system information */ +#include +#define SYS_NAME "i386_fbsd_53" +#define SYS_NAME_ID SYS_NAME_ID_i386_fbsd_53 + +#define AFSLITTLE_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 1 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS 1 +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define VATTR_NULL usr_vattr_null + +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* !defined(UKERNEL) */ + +#endif /* AFS_PARAM_H */ diff --git a/src/config/param.i386_nbsd30.h b/src/config/param.i386_nbsd30.h new file mode 100644 index 000000000..3281d5a6a --- /dev/null +++ b/src/config/param.i386_nbsd30.h @@ -0,0 +1,21 @@ +#ifndef AFS_I386_PARAM_H +#define AFS_I386_PARAM_H + +#define AFS_X86_XBSD_ENV 1 +#define AFS_X86_ENV 1 +#define AFSLITTLE_ENDIAN 1 + +#define SYS_NAME "i386_nbsd30" +#define SYS_NAME_ID SYS_NAME_ID_i386_nbsd30 + +#ifndef UKERNEL +/* This section for kernel libafs compiles only */ + +#else /* !defined(UKERNEL) */ + +/* This section for user space compiles only */ + +#endif /* !defined(UKERNEL) */ + +#endif /* AFS_I386_PARAM_H */ + diff --git a/src/config/param.ia64_linux26.h b/src/config/param.ia64_linux26.h index db9a29c42..6fcbda30c 100644 --- a/src/config/param.ia64_linux26.h +++ b/src/config/param.ia64_linux26.h @@ -50,13 +50,17 @@ #include #ifdef CONFIG_SMP -#undef CONFIG_SMP +#ifndef AFS_SMP +#define AFS_SMP 1 +#endif #endif /* Using "AFS_SMP" to map to however many #define's are required to get * MP to compile for Linux */ #ifdef AFS_SMP +#ifndef CONFIG_SMP #define CONFIG_SMP 1 +#endif #ifndef __SMP__ #define __SMP__ #endif diff --git a/src/config/param.nbsd30.h b/src/config/param.nbsd30.h new file mode 100644 index 000000000..85c0b5113 --- /dev/null +++ b/src/config/param.nbsd30.h @@ -0,0 +1,158 @@ +/* NetBSD shared section */ + +#ifndef AFS_PARAM_COMMON_H +#define AFS_PARAM_COMMON_H 1 + +#define AFS_64BIT_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ +#define AFS_64BIT_CLIENT 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 210 + +#ifndef MOUNT_AFS +#define MOUNT_AFS AFS_MOUNT_AFS +#endif + +#define AFS_XBSD_ENV 1 /* {Free,Open,Net}BSD */ + +#define AFS_NBSD_ENV 1 +#define AFS_NBSD15_ENV 1 +#define AFS_NBSD16_ENV 1 +#define AFS_NBSD20_ENV 1 +#define AFS_NONFSTRANS 1 +#define AFS_KERBEROS_ENV 1 + +#define AFS_VFSINCL_ENV 1 + +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ + +#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) && !defined(IGNORE_STDS_H) +#define AFS_HAVE_STATVFS 1 /* System supports statvfs */ +#endif + +#ifndef UKERNEL + +#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) && !defined(IGNORE_STDS_H) +#include +#endif + +#define FTRUNC O_TRUNC + +#define IUPD 0x0010 +#define IACC 0x0020 +#define ICHG 0x0040 +#define IMOD 0x0080 + +#define IN_LOCK(ip) lockmgr(&ip->i_lock, LK_EXCLUSIVE, \ + NULL, curproc) +#define IN_UNLOCK(ip) lockmgr(&ip->i_lock, LK_RELEASE, \ + NULL, curproc) + +#include + +#define AFS_VM_RDWR_ENV 1 +#define AFS_VFS_ENV 1 +#define AFS_GREEDY43_ENV 1 + +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */ + +/* Extra kernel definitions (from kdefs file) */ +#ifdef _KERNEL +#define AFS_GLOBAL_SUNLOCK 1 +#define AFS_VFS34 1 /* What is VFS34??? */ +#define AFS_SHORTGID 1 /* are group id's short? */ +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_resid uio_resid +#define AFS_UIOSYS UIO_SYSSPACE +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES CLBYTES +#define osi_GetTime(x) microtime(x) +#define AFS_KALLOC(x) kalloc(x) +#define AFS_KFREE(x,y) kfree(x,y) +#define v_count v_usecount +#define v_vfsp v_mount +#define vfs_bsize mnt_stat.f_bsize +#define vfs_fsid mnt_stat.f_fsid +#define va_nodeid va_fileid +#define vfs_vnodecovered mnt_vnodecovered +#define direct dirent +#define vnode_t struct vnode + +#ifndef MUTEX_DEFAULT +#define MUTEX_DEFAULT 0 +#endif /* MUTEX_DEFAULT */ + +#ifndef SSYS +#define SSYS 0x00002 +#endif /* SSYS */ + +#define p_rcred p_ucred + +#define VN_RELE(vp) vrele(((struct vnode *)(vp))) +#define VN_HOLD(vp) VREF(((struct vnode *)(vp))) + +#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) && !defined(IGNORE_STDS_H) +enum vcexcl { NONEXCL, EXCL }; + +#ifdef KERNEL +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif +#endif /* KERNEL */ + +#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ && !defined(IGNORE_STDS_H) */ +#endif /* _KERNEL */ + +#else /* !defined(UKERNEL) */ + + +/* This section for user space compiles only */ + +#define UKERNEL 1 /* user space kernel */ + +#include + +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS UIO_SYSSPACE +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define VATTR_NULL usr_vattr_null + +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif + +#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) && !defined(IGNORE_STDS_H) +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#endif /* !defined(UKERNEL) */ + +#endif /* AFS_PARAM_COMMON_H */ diff --git a/src/config/param.s390x_linux26.h b/src/config/param.s390x_linux26.h new file mode 100644 index 000000000..f4cc8931b --- /dev/null +++ b/src/config/param.s390x_linux26.h @@ -0,0 +1,173 @@ +#ifndef UKERNEL +/* This section for kernel libafs compiles only */ + +/* + * 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 + */ + + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously s390 specific, use that + * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2" + * in the sysname is the current version of the client. This takes into + * account the perferred OS user space configuration as well as the kernel. + */ + +#define AFS_LINUX20_ENV 1 +#define AFS_LINUX22_ENV 1 +#define AFS_LINUX24_ENV 1 +#define AFS_LINUX26_ENV 1 +#define AFS_S390_LINUX20_ENV 1 +#define AFS_S390_LINUX22_ENV 1 +#define AFS_S390_LINUX24_ENV 1 +#define AFS_S390X_LINUX20_ENV 1 +#define AFS_S390X_LINUX22_ENV 1 +#define AFS_S390X_LINUX24_ENV 1 +#define AFS_S390X_LINUX26_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 137 +#define AFS_64BIT_ENV 1 +#define AFS_64BITPOINTER_ENV 1 +#define AFS_64BIT_CLIENT 1 +#define AFS_64BIT_KERNEL 1 +#define AFS_LINUX_64BIT_KERNEL 1 +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ + +#if defined(__KERNEL__) && !defined(KDUMP_KERNEL) +#include + +#include +#ifdef CONFIG_SMP +#ifndef AFS_SMP +#define AFS_SMP 1 +#endif +#endif +/* Using "AFS_SMP" to map to however many #define's are required to get + * MP to compile for Linux + */ +#ifdef AFS_SMP +#ifndef CONFIG_SMP +#define CONFIG_SMP 1 +#endif +#ifndef __SMP__ +#define __SMP__ +#endif +#define AFS_GLOBAL_SUNLOCK +#endif +extern unsigned long __per_cpu_offset[NR_CPUS]; +extern SYSCALLTYPE sys_call_table_emu[] __attribute__((weak)); +#endif /* __KERNEL__ && !DUMP_KERNEL */ + +#include + +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ + +/* Machine / Operating system information */ +#define SYS_NAME "s390x_linux26" +#define SYS_NAME_ID SYS_NAME_ID_s390x_linux26 +#define AFSBIG_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#ifdef KERNEL +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif +#endif /* KERNEL */ + +#endif /* AFS_PARAM_H */ + +#else /* !defined(UKERNEL) */ + +/* This section for user space compiles only */ + +/* + * 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 + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously s390 specific, use that + * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2" + * in the sysname is the current version of the client. This takes into + * account the perferred OS user space configuration as well as the kernel. + */ + +#define UKERNEL 1 /* user space kernel */ +#define AFS_ENV 1 +#define AFS_USR_LINUX20_ENV 1 +#define AFS_USR_LINUX22_ENV 1 +#define AFS_USR_LINUX24_ENV 1 +#define AFS_USR_LINUX26_ENV 1 +#define AFS_S390X_LINUX20_ENV 1 +#define AFS_S390X_LINUX22_ENV 1 +#define AFS_S390X_LINUX24_ENV 1 +#define AFS_S390X_LINUX26_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 137 +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 +#define AFS_64BITPOINTER_ENV 1 +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#include + +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + + +/* Machine / Operating system information */ +#define SYS_NAME "s390x_linux26" +#define SYS_NAME_ID SYS_NAME_ID_s390x_linux26 +#define AFSBIG_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS 1 +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define VATTR_NULL usr_vattr_null + +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif + +#endif /* AFS_PARAM_H */ + +#endif /* !defined(UKERNEL) */ diff --git a/src/config/param.sun4x_510.h b/src/config/param.sun4x_510.h index 50b18dbb4..a32158527 100644 --- a/src/config/param.sun4x_510.h +++ b/src/config/param.sun4x_510.h @@ -113,9 +113,6 @@ #define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP) #define AFS_KFREE kmem_free #define VATTR_NULL vattr_null -#define memset(A, B, S) bzero(A, S) -#define memcpy(B, A, S) bcopy(A, B, S) -#define memcmp(A, B, S) bcmp(A, B, S) #endif /* KERNEL */ #define AFS_DIRENT #ifndef CMSERVERPREF diff --git a/src/config/param.sunx86_510.h b/src/config/param.sunx86_510.h index 95be22342..629fd3246 100644 --- a/src/config/param.sunx86_510.h +++ b/src/config/param.sunx86_510.h @@ -97,7 +97,7 @@ * AFS_SYSCALL32 is used to protect the ILP32 syscall interface * AFS_64BIT_ENV is for use of 64 bit inode numbers */ -#if defined(__sparcv9) +#if defined(__amd64) #define AFS_SUN57_64BIT_ENV 1 #define AFS_64BIT_INO 1 #endif @@ -117,9 +117,6 @@ #define AFS_KALLOC_NOSLEEP(n) kmem_alloc(n, KM_NOSLEEP) #define AFS_KFREE kmem_free #define VATTR_NULL vattr_null -#define memset(A, B, S) bzero(A, S) -#define memcpy(B, A, S) bcopy(A, B, S) -#define memcmp(A, B, S) bcmp(A, B, S) #endif /* KERNEL */ #define AFS_DIRENT #ifndef CMSERVERPREF @@ -133,15 +130,6 @@ /* This section for user space compiles only */ -/* - * 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 - */ - #ifndef AFS_PARAM_H #define AFS_PARAM_H @@ -156,6 +144,12 @@ #define AFS_ENV 1 #define AFS_USR_SUN5_ENV 1 #define AFS_USR_SUN6_ENV 1 +#define AFS_USR_SUN7_ENV 1 +#define AFS_USR_SUN8_ENV 1 +#define AFS_USR_SUN9_ENV 1 + +#define AFS_64BIT_ENV 1 + #include @@ -170,9 +164,9 @@ #define AFS_MOUNT_AFS 1 /* Machine / Operating system information */ -#define sys_sun4x_55 1 -#define SYS_NAME "sun4x_55" -#define SYS_NAME_ID SYS_NAME_ID_sun4x_55 +#define sys_sunx86_510 1 +#define SYS_NAME "sunx86_510" +#define SYS_NAME_ID SYS_NAME_ID_sunx86_510 #define AFSLITTLE_ENDIAN 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ #define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ diff --git a/src/libafs/Makefile.common.in b/src/libafs/Makefile.common.in index 8be95e21f..9ee7e74f3 100644 --- a/src/libafs/Makefile.common.in +++ b/src/libafs/Makefile.common.in @@ -387,6 +387,10 @@ osi_debug.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_debug.c $(CRULE_OPT) osi_module.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_module.c $(CRULE_NOOPT) +osi_probe.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_probe.c + $(CRULE_NOOPT) +osi_syscall.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_syscall.c + $(CRULE_NOOPT) osi_sysctl.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_sysctl.c $(CRULE_NOOPT) osi_alloc.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_alloc.c diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in index 211dd1008..193570622 100644 --- a/src/libafs/MakefileProto.LINUX.in +++ b/src/libafs/MakefileProto.LINUX.in @@ -18,7 +18,9 @@ AFS_OS_OBJS = \ osi_file.o \ osi_misc.o \ osi_module.o \ + osi_probe.o \ osi_sleep.o \ + osi_syscall.o \ osi_sysctl.o \ osi_vfsops.o \ osi_vm.o \ @@ -64,7 +66,7 @@ DEFINES = $(COMMON_DEFINES) CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char DEFINES = $(COMMON_DEFINES) -D__s390__ - + CCFLAGS = $(COMMON_KERN_CFLAGS) -fsigned-char DEFINES = $(COMMON_DEFINES) -D__s390x__ @@ -158,9 +160,9 @@ ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}: ln -fs ${LINUX_KERNEL_PATH}/arch/um/include/sysdep ln -fs ${LINUX_KERNEL_PATH}/include/asm-x86_64 asm - + ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390 asm - + ln -fs ${LINUX_KERNEL_PATH}/include/asm-s390x asm ln -fs ${LINUX_KERNEL_PATH}/include/asm-ppc asm diff --git a/src/libafs/MakefileProto.SOLARIS.in b/src/libafs/MakefileProto.SOLARIS.in index ae3886a9f..a5295d7ce 100644 --- a/src/libafs/MakefileProto.SOLARIS.in +++ b/src/libafs/MakefileProto.SOLARIS.in @@ -30,13 +30,16 @@ DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT #LD = /usr/ccs/bin/ld #LORDER = /usr/ccs/bin/lorder #CC = /opt/SUNWspro/bin/cc -KDEFS= -Dsun4c -DSUN4C_60 -DNFSCLIENT -DSYSACCT -DOLDSCSI -DVDDRV -D_KERNEL \ - -DSYSV -dn ${ARCH_DEFS} +KDEFS= -D_KERNEL -DSYSV -dn ${ARCH_DEFS} - + KDEFS_32 = KDEFS_64 = -xarch=v9 + +KDEFS_32 = +KDEFS_64 = -xarch=amd64 -xmodel=kernel + CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(DEFINES) $(KDEFS) $(KOPTS) ${DBUG} diff --git a/src/lwp/Makefile.in b/src/lwp/Makefile.in index c88ab6e9f..8345e01aa 100644 --- a/src/lwp/Makefile.in +++ b/src/lwp/Makefile.in @@ -59,6 +59,11 @@ process.o : process.s process.i386.s process.c ${CCOBJ} -DIGNORE_STDS_H -E -I${srcdir} -I${TOP_INCDIR} process.S > process.ss ; \ ${AS} process.ss -o process.o ; \ $(RM) -f process.S ;;\ + amd64_*bsd*) \ + cp ${srcdir}/process.amd64.s process.S ; \ + ${CCOBJ} -DIGNORE_STDS_H -E -I${srcdir} -I${TOP_INCDIR} process.S > process.ss ; \ + ${AS} process.ss -o process.o ; \ + $(RM) -f process.S ;;\ ncrx86_* | sunx86_*) \ /usr/ccs/lib/cpp -P -D__sun -D__i386 -DIGNORE_STDS_H -I${TOP_INCDIR} -I${srcdir} ${srcdir}/process.i386.s process.ss; \ ${AS} -o process.o process.ss; \ diff --git a/src/lwp/iomgr.c b/src/lwp/iomgr.c index 0d0b65a4f..78740bc99 100644 --- a/src/lwp/iomgr.c +++ b/src/lwp/iomgr.c @@ -36,7 +36,7 @@ #include #include -RCSID("$Header: /cvs/openafs/src/lwp/iomgr.c,v 1.13 2004/07/08 05:16:57 shadow Exp $"); +RCSID("$Header: /cvs/openafs/src/lwp/iomgr.c,v 1.13.2.1 2005/02/21 01:13:50 shadow Exp $"); #include #include @@ -536,10 +536,11 @@ static int IOMGR(void *dummy) iomgr_timeout.tv_sec = 100000000; iomgr_timeout.tv_usec = 0; } -#ifdef AFS_NT40_ENV +#if defined(AFS_NT40_ENV) || defined(AFS_LINUX24_ENV) /* On NT, signals don't interrupt a select call. So this can potentially * lead to long wait times before a signal is honored. To avoid this we * dont do select() for longer than IOMGR_MAXWAITTIME (5 secs) */ + /* Whereas Linux seems to sometimes "lose" signals */ if (iomgr_timeout.tv_sec > (IOMGR_MAXWAITTIME - 1)) { iomgr_timeout.tv_sec = IOMGR_MAXWAITTIME; iomgr_timeout.tv_usec = 0; @@ -640,11 +641,12 @@ static int IOMGR(void *dummy) /* Real timeout only if signal handler hasn't set iomgr_timeout to zero. */ -#ifdef AFS_NT40_ENV +#if defined(AFS_NT40_ENV) || defined(AFS_LINUX24_ENV) /* On NT, real timeout only if above and if iomgr_timeout * interval is equal to timeout interval (i.e., not adjusted * to check for pseudo-signals). */ + /* And also for Linux as above */ if (iomgr_timeout.tv_sec != timeout.tv_sec || iomgr_timeout.tv_usec != timeout.tv_usec) { /* signal check interval timed out; not real timeout */ diff --git a/src/lwp/lwp.c b/src/lwp/lwp.c index 14dda48e2..c75183984 100644 --- a/src/lwp/lwp.c +++ b/src/lwp/lwp.c @@ -17,7 +17,7 @@ #include #include -RCSID("$Header: /cvs/openafs/src/lwp/lwp.c,v 1.27.2.2 2004/12/13 19:40:19 shadow Exp $"); +RCSID("$Header: /cvs/openafs/src/lwp/lwp.c,v 1.27.2.3 2005/01/31 04:20:00 shadow Exp $"); #include #include @@ -121,7 +121,7 @@ static purge_dead_pcbs(); struct QUEUE { PROCESS head; int count; -} runnable[MAX_PRIORITIES], blocked; +} runnable[MAX_PRIORITIES], blocked, qwaiting; /* Invariant for runnable queues: The head of each queue points to the currently running process if it is in that queue, or it points to the next process in that queue that should run. */ /* Offset of stack field within pcb -- used by stack checking stuff */ @@ -242,7 +242,7 @@ LWP_QWait(void) { register PROCESS tp; (tp = lwp_cpptr)->status = QWAITING; - lwp_remove(tp, &runnable[tp->priority]); + move(tp, &runnable[tp->priority], &qwaiting); Set_LWP_RC(); return LWP_SUCCESS; } @@ -253,7 +253,7 @@ LWP_QSignal(pid) { if (pid->status == QWAITING) { pid->status = READY; - insert(pid, &runnable[pid->priority]); + move(pid, &qwaiting, &runnable[pid->priority]); return LWP_SUCCESS; } else return LWP_ENOWAIT; @@ -561,6 +561,9 @@ Dump_Processes(void) for_all_elts(x, blocked, { Dump_One_Process(x);} ) + for_all_elts(x, qwaiting, { + Dump_One_Process(x);} + ) } else printf("***LWP: LWP support not initialized\n"); return 0; @@ -601,6 +604,8 @@ LWP_InitializeProcessSupport(int priority, PROCESS * pid) } blocked.head = NULL; blocked.count = 0; + qwaiting.head = NULL; + qwaiting.count = 0; lwp_init = (struct lwp_ctl *)malloc(sizeof(struct lwp_ctl)); temp = (PROCESS) malloc(sizeof(struct lwp_pcb)); if (lwp_init == NULL || temp == NULL) @@ -659,6 +664,9 @@ LWP_TerminateProcessSupport(void) ) for_all_elts(cur, blocked, { Free_PCB(cur);} + ) + for_all_elts(cur, qwaiting, { + Free_PCB(cur);} ) free(lwp_init); lwp_init = NULL; @@ -784,7 +792,9 @@ Delete_PCB(register PROCESS pid) lwp_remove(pid, (pid->blockflag || pid->status == WAITING || pid->status == - DESTROYED ? &blocked : &runnable[pid->priority])); + DESTROYED ? &blocked : + (pid->status == QWAITING) ? &qwaiting : + &runnable[pid->priority])); LWPANCHOR.processcnt--; return 0; } @@ -811,6 +821,9 @@ Dump_One_Process(PROCESS pid) case DESTROYED: printf("DESTROYED"); break; + case QWAITING: + printf("QWAITING"); + break; default: printf("unknown"); } @@ -870,7 +883,13 @@ Dispatcher(void) printf(" \"%s\"", p->name); } ) - puts("]"); + puts("]"); + printf("[Qwaiting (%d):", qwaiting.count); + for_all_elts(p, qwaiting, { + printf(" \"%s\"", p->name); + } + ) + puts("]"); } #endif diff --git a/src/lwp/lwp.h b/src/lwp/lwp.h index 1e62cae93..f9139e44b 100644 --- a/src/lwp/lwp.h +++ b/src/lwp/lwp.h @@ -389,8 +389,14 @@ extern int LWP_WaitProcess(char *event); extern PROCESS LWP_ThreadId(void); #endif +#ifdef AFS_LINUX24_ENV +/* max time we are allowed to spend in a select call on Linux to avoid + lost signal issues */ +#define IOMGR_MAXWAITTIME 60 /* seconds */ +#else /* max time we are allowed to spend in a select call on NT */ #define IOMGR_MAXWAITTIME 5 /* seconds */ +#endif /* max time we spend on a select in a Win95 DOS box */ #define IOMGR_WIN95WAITTIME 5000 /* microseconds */ diff --git a/src/lwp/process.amd64.s b/src/lwp/process.amd64.s new file mode 100644 index 000000000..e33dfc3e4 --- /dev/null +++ b/src/lwp/process.amd64.s @@ -0,0 +1,161 @@ +/* $Id: process.amd64.s,v 1.1.2.1 2005/02/21 01:12:10 shadow Exp $ */ + +/* + * Copyright (c) 2003,2005 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#undef RCSID + +/* x86_64 Assembly + * + * By Harald Barth after looking + * at Derek Atkins' i386 routines and realizing that + * there were some differences and it was not enough + * just renaming the registers. + */ + +#ifdef HAVE_MACHINE_ASM_H +#include +#endif + +#include + + .file "process.s" + .data + .text + +/* + * struct savearea { + * char *topstack; + * } + */ + + .set topstack,0 + +/* + * savecontext(int (*f)(), struct savearea *area1, char *newsp) + */ + +/* + * In spite of passing arguments in registers, gcc first copies the content of the + * registers onto the stack. I do not know why gcc does this, but for now I mimic + * gcc's behaviour. Here are the offsets the arguments are copied to. + */ + .set f,-8 + .set area1,-16 + .set newsp,-24 + +.globl _C_LABEL(PRE_Block) +.globl _C_LABEL(savecontext) + +ENTRY(savecontext) + pushq %rbp /* The frame setup is just like gcc */ + movq %rsp,%rbp + subq $32, %rsp /* make room for args on the stack */ + movq %rdi, f(%rbp) /* (3*8=24 but increments seem to */ + movq %rsi, area1(%rbp) /* i multiples of 24, so 32 it is) */ + movq %rdx, newsp(%rbp) /* and copy them there. */ + + movl $1,_C_LABEL(PRE_Block) /* Do not allow any interrupts */ + + pushq %rsp /* Push all registers onto the stack */ + pushq %rax /* Probably not _all_ are necessary */ + pushq %rcx /* but better one too much than one */ + pushq %rdx /* forgotten */ + pushq %rbx + pushq %rbp + pushq %rsi + pushq %rdi + pushq %r8 + pushq %r9 + pushq %r10 + pushq %r11 + pushq %r12 + pushq %r13 + pushq %r14 + pushq %r15 /* Btw, the pusha instruction is no more */ + + movq area1(%rbp),%rax /* rax = base of savearea */ + movq %rsp,topstack(%rax) /* area->topstack = rsp */ + movq newsp(%rbp),%rax /* rax = new sp */ + cmpq $0,%rax + je L1 /* if new sp is 0 then dont change rsp */ + movq %rax,%rsp /* Change rsp to the new sp */ +L1: + jmp *f(%rbp) /* jump to function pointer passed in arg */ + +/* Shouldnt be here....*/ + call _C_LABEL(abort) + +/* + * returnto(struct savearea *area2) + */ + +/* Offset where we put arg - se savecontext */ + .set area2,-8 + +.globl _C_LABEL(returnto) + +ENTRY(returnto) + pushq %rbp /* New frame, gcc style */ + movq %rsp, %rbp /* See savecontext above */ + subq $16, %rsp /* Make room for 2 args */ + movq %rdi, area2(%rbp) /* use room to copy 1 arg */ + movq area2(%rbp),%rax /* rax = area2 */ + movq topstack(%rax),%rsp /* restore rsp from place relative rbp*/ + + popq %r15 /* Restore regs */ + popq %r14 + popq %r13 + popq %r12 + popq %r11 + popq %r10 + popq %r9 + popq %r8 + popq %rdi + popq %rsi + popq %rbp + popq %rbx + popq %rdx + popq %rcx + popq %rax + popq %rsp /* See savecontext */ + + movl $0,_C_LABEL(PRE_Block) /* clear it up... */ + addq $32, %rsp /* We did rsp-32 above, correct that */ + popq %rbp + ret + +/* We never should get here, put in emergency brake as in i386 code */ + pushq $1234 + call _C_LABEL(abort) + diff --git a/src/packaging/Debian/kern-sysname b/src/packaging/Debian/kern-sysname index 6c51c9b31..00964eb6d 100644 --- a/src/packaging/Debian/kern-sysname +++ b/src/packaging/Debian/kern-sysname @@ -11,8 +11,15 @@ i[3456]86) esac ;; ia64) - echo ia64_linux24 -;; + case $KVERS in + 2.4*) + echo ia64_linux24 + ;; + 2.6*) + echo ia64_linux26 + ;; + esac + ;; alpha) case $KVERS in 2.2*) diff --git a/src/packaging/MacOS/OpenAFS.Info.plist b/src/packaging/MacOS/OpenAFS.Info.plist index cc8391dc7..9c3e19aeb 100644 --- a/src/packaging/MacOS/OpenAFS.Info.plist +++ b/src/packaging/MacOS/OpenAFS.Info.plist @@ -3,13 +3,13 @@ CFBundleGetInfoString - OpenAFS 1.3.77 + OpenAFS 1.3.79 CFBundleIdentifier org.openafs.OpenAFS.pkg CFBundleName OpenAFS CFBundleShortVersionString - 1.3.77 + 1.3.79 IFMajorVersion 1 IFMinorVersion diff --git a/src/packaging/MacOS/OpenAFS.info b/src/packaging/MacOS/OpenAFS.info index 180675660..85ee3c42b 100644 --- a/src/packaging/MacOS/OpenAFS.info +++ b/src/packaging/MacOS/OpenAFS.info @@ -1,5 +1,5 @@ Title OpenAFS -Version 1.3.77 +Version 1.3.79 Description The OpenAFS distributed filesystem. This package installs an almost-ready-to-run client for OpenAFS. see http://www.openafs.org for more information. DefaultLocation / Diskname (null) diff --git a/src/ptserver/Makefile.in b/src/ptserver/Makefile.in index 13bfef2d1..303545234 100644 --- a/src/ptserver/Makefile.in +++ b/src/ptserver/Makefile.in @@ -14,7 +14,7 @@ INCLS=${TOP_INCDIR}/ubik.h \ ${TOP_INCDIR}/rx/xdr.h \ ${TOP_INCDIR}/afs/keys.h \ ${TOP_INCDIR}/afs/cellconfig.h \ - ptserver.h ptclient.h ptint.h pterror.h map.h + ptserver.h ptclient.h ptuser.h ptint.h pterror.h map.h LINCLS=${TOP_INCDIR}/ubik.h \ ${TOP_INCDIR}/lock.h \ @@ -23,7 +23,7 @@ LINCLS=${TOP_INCDIR}/ubik.h \ ${TOP_INCDIR}/rx/rxkad.h \ ${TOP_INCDIR}/afs/auth.h \ ${TOP_INCDIR}/afs/cellconfig.h \ - ptclient.h ptint.h pterror.h + ptclient.h ptuser.h ptint.h pterror.h LIBS=${TOP_LIBDIR}/libubik.a \ ${TOP_LIBDIR}/libauth.a \ @@ -49,6 +49,7 @@ depinstall: \ ${TOP_INCDIR}/afs/print.h \ ${TOP_INCDIR}/afs/prserver.h \ ${TOP_INCDIR}/afs/ptclient.h \ + ${TOP_INCDIR}/afs/ptuser.h \ ${TOP_INCDIR}/afs/pterror.h \ ${TOP_INCDIR}/afs/ptint.h \ ${TOP_INCDIR}/afs/ptserver.h @@ -170,6 +171,7 @@ install: \ ${DESTDIR}${includedir}/afs/print.h \ ${DESTDIR}${includedir}/afs/prserver.h \ ${DESTDIR}${includedir}/afs/ptclient.h \ + ${DESTDIR}${includedir}/afs/ptuser.h \ ${DESTDIR}${includedir}/afs/pterror.h \ ${DESTDIR}${includedir}/afs/ptint.h \ ${DESTDIR}${includedir}/afs/ptserver.h @@ -213,6 +215,9 @@ ${DEST}/include/afs/pterror.h: pterror.h ${DEST}/include/afs/ptclient.h: ptclient.h ${INSTALL} $? $@ +${DEST}/include/afs/ptuser.h: ptuser.h + ${INSTALL} $? $@ + # # Misc. targets # @@ -270,9 +275,15 @@ ${TOP_INCDIR}/afs/prserver.h: ptserver.h ${DESTDIR}${includedir}/afs/ptclient.h: ptclient.h ${INSTALL} $? $@ +${DESTDIR}${includedir}/afs/ptuser.h: ptuser.h + ${INSTALL} $? $@ + ${TOP_INCDIR}/afs/ptclient.h: ptclient.h ${INSTALL} $? $@ +${TOP_INCDIR}/afs/ptuser.h: ptuser.h + ${INSTALL} $? $@ + ${DESTDIR}${includedir}/afs/pterror.h: pterror.h ${INSTALL} $? $@ @@ -303,6 +314,7 @@ dest: \ ${DEST}/include/afs/print.h \ ${DEST}/include/afs/prserver.h \ ${DEST}/include/afs/ptclient.h \ + ${DEST}/include/afs/ptuser.h \ ${DEST}/include/afs/pterror.h \ ${DEST}/include/afs/ptint.h \ ${DEST}/include/afs/ptserver.h diff --git a/src/ptserver/NTMakefile b/src/ptserver/NTMakefile index 78b75ea68..fda01a4b2 100644 --- a/src/ptserver/NTMakefile +++ b/src/ptserver/NTMakefile @@ -21,7 +21,8 @@ INCFILES =\ $(INCFILEDIR)\afs\ptint.h \ $(INCFILEDIR)\afs\pterror.h \ ptopcodes.h \ - $(INCFILEDIR)\afs\ptclient.h + $(INCFILEDIR)\afs\ptclient.h \ + $(INCFILEDIR)\afs\ptuser.h ############################################################################ # build afsprot.lib diff --git a/src/ptserver/ptuser.c b/src/ptserver/ptuser.c index bacdbe657..dc1ccff25 100644 --- a/src/ptserver/ptuser.c +++ b/src/ptserver/ptuser.c @@ -15,7 +15,7 @@ #endif RCSID - ("$Header: /cvs/openafs/src/ptserver/ptuser.c,v 1.16.2.1 2004/10/18 07:12:04 shadow Exp $"); + ("$Header: /cvs/openafs/src/ptserver/ptuser.c,v 1.16.2.2 2005/01/31 03:58:39 shadow Exp $"); #if defined(UKERNEL) #include "afs/sysincludes.h" @@ -29,6 +29,7 @@ RCSID #include "afs/cellconfig.h" #include "afs/afsutil.h" #include "afs/ptclient.h" +#include "afs/ptuser.h" #include "afs/pterror.h" #else /* defined(UKERNEL) */ #include @@ -54,6 +55,7 @@ RCSID #include #include #include "ptclient.h" +#include "ptuser.h" #include "pterror.h" #endif /* defined(UKERNEL) */ diff --git a/src/ptserver/ptuser.h b/src/ptserver/ptuser.h new file mode 100644 index 000000000..90d23838e --- /dev/null +++ b/src/ptserver/ptuser.h @@ -0,0 +1,44 @@ +/* + * 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 + */ + +#ifndef PTUSER_H +#define PTUSER_H + +#include "afs/ptint.h" + +afs_int32 pr_Initialize(afs_int32 secLevel, char *confDir, char *cell); +int pr_End(void); +int pr_CreateUser(char name[PR_MAXNAMELEN], afs_int32 *id); +int pr_CreateGroup(char name[PR_MAXNAMELEN], char owner[PR_MAXNAMELEN], afs_int32 *id); +int pr_Delete(char *name); +int pr_DeleteByID(afs_int32 id); +int pr_AddToGroup(char *user, char *group); +int pr_RemoveUserFromGroup(char *user, char *group); +int pr_NameToId(namelist *names, idlist *ids); +int pr_SNameToId(char name[PR_MAXNAMELEN], afs_int32 *id); +int pr_IdToName(idlist *ids, namelist *names); +int pr_SIdToName(afs_int32 id, char name[PR_MAXNAMELEN]); +int pr_GetCPS(afs_int32 id, prlist *CPS); +int pr_GetCPS2(afs_int32 id, afs_int32 host, prlist *CPS); +int pr_GetHostCPS(afs_int32 host, prlist *CPS); +int pr_ListMembers(char *group, namelist *lnames); +int pr_ListOwned(afs_int32 oid, namelist *lnames, afs_int32 *moreP); +int pr_IDListMembers(afs_int32 gid, namelist *lnames); +int pr_ListEntry(afs_int32 id, struct prcheckentry *aentry); +afs_int32 pr_ListEntries(int flag, afs_int32 startindex, afs_int32 *nentries, struct prlistentries **entries, afs_int32 *nextstartindex); +int pr_CheckEntryByName(char *name, afs_int32 *id, char *owner, char *creator); +int pr_CheckEntryById(char *name, afs_int32 id, char *owner, char *creator); +int pr_ChangeEntry(char *oldname, char *newname, afs_int32 *newid, char *newowner); +int pr_IsAMemberOf(char *uname, char *gname, afs_int32 *flag); +int pr_ListMaxUserId(afs_int32 *mid); +int pr_SetMaxUserId(afs_int32 mid); +int pr_ListMaxGroupId(afs_int32 *mid); +int pr_SetMaxGroupId(afs_int32 mid); +afs_int32 pr_SetFieldsEntry(afs_int32 id, afs_int32 mask, afs_int32 flags, afs_int32 ngroups, afs_int32 nusers); +#endif /* PTUSER_H */ \ No newline at end of file diff --git a/src/rx/LINUX/rx_knet.c b/src/rx/LINUX/rx_knet.c index 035f6ed31..e636b8891 100644 --- a/src/rx/LINUX/rx_knet.c +++ b/src/rx/LINUX/rx_knet.c @@ -16,7 +16,7 @@ #include "afs/param.h" RCSID - ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.23.2.4 2004/12/07 06:10:11 shadow Exp $"); + ("$Header: /cvs/openafs/src/rx/LINUX/rx_knet.c,v 1.23.2.5 2005/01/31 04:25:34 shadow Exp $"); #include #ifdef AFS_LINUX22_ENV @@ -194,20 +194,18 @@ osi_NetReceive(osi_socket so, struct sockaddr_in *from, struct iovec *iov, return code; } - +extern rwlock_t tasklist_lock __attribute__((weak)); void osi_StopListener(void) { struct task_struct *listener; extern int rxk_ListenerPid; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - read_lock(&tasklist_lock); -#endif + if (&tasklist_lock) + read_lock(&tasklist_lock); listener = find_task_by_pid(rxk_ListenerPid); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - read_unlock(&tasklist_lock); -#endif + if (&tasklist_lock) + read_unlock(&tasklist_lock); while (rxk_ListenerPid) { flush_signals(listener); force_sig(SIGKILL, listener); diff --git a/src/rx/rx.c b/src/rx/rx.c index 685b6078f..8e78dc0a5 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -17,7 +17,7 @@ #endif RCSID - ("$Header: /cvs/openafs/src/rx/rx.c,v 1.58.2.4 2004/12/07 06:10:05 shadow Exp $"); + ("$Header: /cvs/openafs/src/rx/rx.c,v 1.58.2.6 2005/01/31 04:14:45 shadow Exp $"); #ifdef KERNEL #include "afs/sysincludes.h" @@ -2673,6 +2673,9 @@ rxi_ReceivePacket(register struct rx_packet *np, osi_socket socket, MUTEX_ENTER(&conn->conn_data_lock); conn->refCount--; MUTEX_EXIT(&conn->conn_data_lock); + MUTEX_ENTER(&rx_stats_mutex); + rx_stats.nBusies++; + MUTEX_EXIT(&rx_stats_mutex); return tp; } rxi_KeepAliveOn(call); @@ -5032,6 +5035,9 @@ rxi_Start(struct rxevent *event, register struct rx_call *call, if (!(call->flags & RX_CALL_TQ_BUSY)) { call->flags |= RX_CALL_TQ_BUSY; do { +#endif /* AFS_GLOBAL_RXLOCK_KERNEL */ + restart: +#ifdef AFS_GLOBAL_RXLOCK_KERNEL call->flags &= ~RX_CALL_NEED_START; #endif /* AFS_GLOBAL_RXLOCK_KERNEL */ nXmitPackets = 0; @@ -5085,7 +5091,12 @@ rxi_Start(struct rxevent *event, register struct rx_call *call, /* Transmit the packet if it needs to be sent. */ if (!clock_Lt(&now, &p->retryTime)) { if (nXmitPackets == maxXmitPackets) { - osi_Panic("rxi_Start: xmit list overflowed"); + rxi_SendXmitList(call, xmitList, nXmitPackets, + istack, &now, &retryTime, + resending); + osi_Free(xmitList, maxXmitPackets * + sizeof(struct rx_packet *)); + goto restart; } xmitList[nXmitPackets++] = p; } diff --git a/src/rx/rx.h b/src/rx/rx.h index e34ff3ecf..03c035e32 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -804,7 +804,8 @@ struct rx_stats { /* General rx statistics */ int ignorePacketDally; /* packets dropped because call is in dally state */ int receiveCbufPktAllocFailures; int sendCbufPktAllocFailures; - int spares[5]; + int nBusies; + int spares[4]; }; /* structures for debug input and output packets */ diff --git a/src/rx/rx_globals.h b/src/rx/rx_globals.h index b47f4a8a1..48774f00f 100644 --- a/src/rx/rx_globals.h +++ b/src/rx/rx_globals.h @@ -249,16 +249,15 @@ EXT struct rx_stats rx_stats; EXT struct rx_peer **rx_peerHashTable; EXT struct rx_connection **rx_connHashTable; EXT struct rx_connection *rx_connCleanup_list INIT(0); -EXT afs_uint32 rx_hashTableSize INIT(256); /* Power of 2 */ -EXT afs_uint32 rx_hashTableMask INIT(255); /* One less than rx_hashTableSize */ +EXT afs_uint32 rx_hashTableSize INIT(257); /* Prime number */ #ifdef RX_ENABLE_LOCKS EXT afs_kmutex_t rx_peerHashTable_lock; EXT afs_kmutex_t rx_connHashTable_lock; #endif /* RX_ENABLE_LOCKS */ -#define CONN_HASH(host, port, cid, epoch, type) ((((cid)>>RX_CIDSHIFT)&rx_hashTableMask)) +#define CONN_HASH(host, port, cid, epoch, type) ((((cid)>>RX_CIDSHIFT)%rx_hashTableSize)) -#define PEER_HASH(host, port) ((host ^ port) & rx_hashTableMask) +#define PEER_HASH(host, port) ((host ^ port) % rx_hashTableSize) /* Forward definitions of internal procedures */ #define rxi_ChallengeOff(conn) rxevent_Cancel((conn)->challengeEvent, (struct rx_call*)0, 0); diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c index 6972fac87..2948abcfa 100644 --- a/src/rx/rx_packet.c +++ b/src/rx/rx_packet.c @@ -15,7 +15,7 @@ #endif RCSID - ("$Header: /cvs/openafs/src/rx/rx_packet.c,v 1.35.2.3 2004/12/07 06:10:06 shadow Exp $"); + ("$Header: /cvs/openafs/src/rx/rx_packet.c,v 1.35.2.7 2005/01/31 04:34:46 shadow Exp $"); #ifdef KERNEL #if defined(UKERNEL) @@ -191,7 +191,9 @@ rx_SlowReadPacket(struct rx_packet * packet, unsigned int offset, int resid, j = MIN(resid, packet->wirevec[i].iov_len - (offset - l)); memcpy(out, (char *)(packet->wirevec[i].iov_base) + (offset - l), j); resid -= j; - l += packet->wirevec[i].iov_len; + out += j; + l += packet->wirevec[i].iov_len; + offset = l; i++; } @@ -231,7 +233,9 @@ rx_SlowWritePacket(struct rx_packet * packet, int offset, int resid, char *in) j = MIN(resid, packet->wirevec[i].iov_len - (offset - l)); memcpy(b, in, j); resid -= j; + in += j; l += packet->wirevec[i].iov_len; + offset = l; i++; } diff --git a/src/rx/rx_prototypes.h b/src/rx/rx_prototypes.h index bfdd1b4bd..823b02232 100644 --- a/src/rx/rx_prototypes.h +++ b/src/rx/rx_prototypes.h @@ -274,6 +274,8 @@ extern void rx_ReleaseCachedConnection(struct rx_connection *conn); /* rx_event.c */ +extern int rxevent_nFree; +extern int rxevent_nPosted; #if 0 extern struct rxevent *rxevent_Post(struct clock *when, void (*func) (struct rxevent * event, diff --git a/src/rx/rxdebug.c b/src/rx/rxdebug.c index 169d6f8bd..f3cba3d6d 100644 --- a/src/rx/rxdebug.c +++ b/src/rx/rxdebug.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/rx/rxdebug.c,v 1.15.2.3 2004/12/07 06:06:50 shadow Exp $"); + ("$Header: /cvs/openafs/src/rx/rxdebug.c,v 1.15.2.4 2005/01/31 04:23:17 shadow Exp $"); #include #include @@ -256,7 +256,7 @@ MainCommand(as, arock) withRxStats = (supportedDebugValues & RX_SERVER_DEBUG_RX_STATS); withWaiters = (supportedDebugValues & RX_SERVER_DEBUG_WAITER_CNT); withIdleThreads = (supportedDebugValues & RX_SERVER_DEBUG_IDLE_THREADS); - withIdleThreads = (supportedDebugValues & RX_SERVER_DEBUG_WAITED_CNT); + withWaited = (supportedDebugValues & RX_SERVER_DEBUG_WAITED_CNT); withPeers = (supportedDebugValues & RX_SERVER_DEBUG_ALL_PEER); printf("Free packets: %d, packet reclaims: %d, calls: %d, used FDs: %d\n", diff --git a/src/sys/Makefile.in b/src/sys/Makefile.in index 497e4133f..456a0fb44 100644 --- a/src/sys/Makefile.in +++ b/src/sys/Makefile.in @@ -57,7 +57,7 @@ syscall.o: syscall.s $(RM) -f syscall.ss syscall.i;; \ hp_ux11? ) \ touch syscall.o;; \ - i386_*bsd*|*nbsd*) \ + amd64_fbsd*|i386_*bsd*|*nbsd*) \ touch syscall.o;; \ *) \ /lib/cpp ${SFLAGS} ${srcdir}/syscall.s syscall.ss; \ diff --git a/src/sys/pioctl_nt.c b/src/sys/pioctl_nt.c index 5c204e41f..059a4e93a 100644 --- a/src/sys/pioctl_nt.c +++ b/src/sys/pioctl_nt.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/sys/pioctl_nt.c,v 1.18.2.5 2004/12/07 06:15:58 shadow Exp $"); + ("$Header: /cvs/openafs/src/sys/pioctl_nt.c,v 1.18.2.7 2005/01/31 04:09:37 shadow Exp $"); #include #include @@ -199,6 +199,8 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) FILE_FLAG_WRITE_THROUGH, NULL); fflush(stdout); if (fh == INVALID_HANDLE_VALUE) { + int gonext = 0; + gle = GetLastError(); if (gle && ioctlDebug ) { char buf[4096]; @@ -246,18 +248,22 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n", szPath,szUser,res); } + gonext = 1; + } - sprintf(szPath, "\\\\%s\\all", szClient); - res = WNetAddConnection2(&nr,NULL,szUser,0); - if (res) { - if ( ioctlDebug ) { - fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n", - szPath,szUser,res); - } - goto next_attempt; + sprintf(szPath, "\\\\%s\\all", szClient); + res = WNetAddConnection2(&nr,NULL,szUser,0); + if (res) { + if ( ioctlDebug ) { + fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n", + szPath,szUser,res); } + gonext = 1; } + if (gonext) + goto next_attempt; + fh = CreateFile(tbuffer, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, NULL); @@ -301,16 +307,16 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n", szPath,szUser,res); } + } - sprintf(szPath, "\\\\%s\\all", szClient); - res = WNetAddConnection2(&nr,NULL,szUser,0); - if (res) { - if ( ioctlDebug ) { - fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n", - szPath,szUser,res); - } - return -1; + sprintf(szPath, "\\\\%s\\all", szClient); + res = WNetAddConnection2(&nr,NULL,szUser,0); + if (res) { + if ( ioctlDebug ) { + fprintf(stderr, "pioctl WNetAddConnection2(%s,%s) failed: 0x%X\r\n", + szPath,szUser,res); } + return -1; } fh = CreateFile(tbuffer, GENERIC_READ | GENERIC_WRITE, @@ -337,6 +343,8 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep) } return -1; } + } else { + return -1; } } diff --git a/src/ubik/remote.c b/src/ubik/remote.c index 7ad1d3030..0c5758e58 100644 --- a/src/ubik/remote.c +++ b/src/ubik/remote.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/ubik/remote.c,v 1.12.2.1 2004/08/25 07:09:43 shadow Exp $"); + ("$Header: /cvs/openafs/src/ubik/remote.c,v 1.12.2.2 2005/02/21 01:15:27 shadow Exp $"); #include #ifdef AFS_NT40_ENV @@ -30,6 +30,7 @@ RCSID #include #include #include +#include #define UBIK_INTERNALS #include "ubik.h" diff --git a/src/venus/fstrace.c b/src/venus/fstrace.c index 926ed14c1..a1b7909fd 100644 --- a/src/venus/fstrace.c +++ b/src/venus/fstrace.c @@ -14,7 +14,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/venus/fstrace.c,v 1.16 2003/09/24 19:26:54 shadow Exp $"); + ("$Header: /cvs/openafs/src/venus/fstrace.c,v 1.16.2.1 2005/01/31 04:14:08 shadow Exp $"); #include #include @@ -2115,7 +2115,7 @@ icl_TailKernel(outFilep, logname, waitTime) afs_syscall(call, parm0, parm1, parm2, parm3, parm4, parm5, parm6) long call, parm0, parm1, parm2, parm3, parm4, parm5, parm6; { - int code; + int code, rval; #ifdef AFS_LINUX20_ENV #if defined AFS_LINUX_64BIT_KERNEL long long eparm[4]; @@ -2133,9 +2133,13 @@ afs_syscall(call, parm0, parm1, parm2, parm3, parm4, parm5, parm6) #endif /* Linux can only handle 5 arguments in the actual syscall. */ if (call == AFSCALL_ICL) { - code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, eparm); + rval = proc_afs_syscall(call, parm0, parm1, parm2, eparm, &code); + if (rval) + code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, eparm); } else { - code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, parm3); + rval = proc_afs_syscall(call, parm0, parm1, parm2, parm3, &code); + if (rval) + code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, parm3); } #if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) /* on sparc this function returns none value, so do it myself */ diff --git a/src/vfsck/setup.c b/src/vfsck/setup.c index c21865dd4..f936ce9cf 100644 --- a/src/vfsck/setup.c +++ b/src/vfsck/setup.c @@ -19,7 +19,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/vfsck/setup.c,v 1.10.2.1 2004/08/25 07:22:22 shadow Exp $"); + ("$Header: /cvs/openafs/src/vfsck/setup.c,v 1.10.2.2 2005/01/31 04:12:57 shadow Exp $"); #include #define VICE @@ -743,7 +743,11 @@ readsb(listerr) */ altsblock.fs_fsbtodb = sblock.fs_fsbtodb; #ifdef AFS_NEWCG_ENV -# ifndef AFS_SUN59_ENV +# if defined(AFS_SUN59_ENV) && defined(FS_SI_OK) + /* fs_interleave replaced with fs_si and FS_SI_OK defined in */ + /* ufs_fs.h version 2.63 don't need to compare either */ + altsblock.fs_si = sblock.fs_si; +# else altsblock.fs_interleave = sblock.fs_interleave; # endif altsblock.fs_npsect = sblock.fs_npsect; diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index ee5b2a450..91069fb93 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -29,7 +29,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.1 2004/10/28 20:47:23 shadow Exp $"); + ("$Header: /cvs/openafs/src/viced/afsfileprocs.c,v 1.81.2.3 2005/01/31 04:14:50 shadow Exp $"); #include #include @@ -483,11 +483,21 @@ CheckVnode(AFSFid * fid, Volume ** volptr, Vnode ** vptr, int lock) /* I'm not really worried about when we restarted, I'm */ /* just worried about when the first VBUSY was returned. */ TM_GetTimeOfDay(&restartedat, 0); + if (busyonrst) { + FS_LOCK; + afs_perfstats.fs_nBusies++; + FS_UNLOCK; + } return (busyonrst ? VBUSY : VRESTARTING); } else { struct timeval now; TM_GetTimeOfDay(&now, 0); if ((now.tv_sec - restartedat.tv_sec) < (11 * 60)) { + if (busyonrst) { + FS_LOCK; + afs_perfstats.fs_nBusies++; + FS_UNLOCK; + } return (busyonrst ? VBUSY : VRESTARTING); } else { return (VRESTARTING); @@ -2308,13 +2318,13 @@ SRXAFS_FetchData64(struct rx_call * acall, struct AFSFid * Fid, afs_int64 Pos, #ifdef AFS_64BIT_ENV #ifndef AFS_LARGEFILE_ENV if (Pos + Len > 0x7fffffff) - return E2BIG; + return EFBIG; #endif /* !AFS_LARGEFILE_ENV */ tPos = (afs_sfsize_t) Pos; tLen = (afs_sfsize_t) Len; #else /* AFS_64BIT_ENV */ if (Pos.high || Len.high) - return E2BIG; + return EFBIG; tPos = Pos.low; tLen = Len.low; #endif /* AFS_64BIT_ENV */ @@ -3121,14 +3131,14 @@ SRXAFS_StoreData64(struct rx_call * acall, struct AFSFid * Fid, #ifdef AFS_64BIT_ENV #ifndef AFS_LARGEFILE_ENV if (FileLength > 0x7fffffff) - return E2BIG; + return EFBIG; #endif /* !AFS_LARGEFILE_ENV */ tPos = (afs_fsize_t) Pos; tLength = (afs_fsize_t) Length; tFileLength = (afs_fsize_t) FileLength; #else /* AFS_64BIT_ENV */ if (FileLength.high) - return E2BIG; + return EFBIG; tPos = Pos.low; tLength = Length.low; tFileLength = FileLength.low; @@ -5640,7 +5650,8 @@ FillPerfValues(struct afs_PerfStats *a_perfP) a_perfP->host_ClientBlocks = CEBlocks; a_perfP->sysname_ID = afs_perfstats.sysname_ID; - + a_perfP->rx_nBusies = (afs_int32) rx_stats.nBusies; + a_perfP->fs_nBusies = afs_perfstats.fs_nBusies; } /*FillPerfValues */ diff --git a/src/viced/callback.c b/src/viced/callback.c index 585f8aa04..3acbc5184 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -83,7 +83,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/viced/callback.c,v 1.55.2.4 2004/11/09 17:17:49 shadow Exp $"); + ("$Header: /cvs/openafs/src/viced/callback.c,v 1.55.2.5 2005/01/31 04:10:43 shadow Exp $"); #include #include /* for malloc() */ @@ -1552,21 +1552,21 @@ CleanupTimedOutCallBacks_r(void) } static struct host *lih_host; -static int lih_host_held = 0; +static int lih_host_held; static int lih_r(register struct host *host, register int held, register struct host *hostp) { - lih_host_held = 0; if (host->cblist && ((hostp && host != hostp) || (!held && !h_OtherHolds_r(host))) && (!lih_host || host->ActiveCall < lih_host->ActiveCall)) { + if (lih_host != NULL && lih_host_held) { + h_Release_r(lih_host); + } lih_host = host; - } - if (!held) { + lih_host_held = !held; held = 1; - lih_host_held = 1; } return held; } @@ -1594,13 +1594,15 @@ GetSomeSpace_r(struct host *hostp, int locked) h_Enumerate_r(lih_r, hp2, (char *)hp1); hp = lih_host; if (hp) { + /* set in lih_r! private copy before giving up H_LOCK */ + int lih_host_held2=lih_host_held; cbstuff.GSS4++; if (!ClearHostCallbacks_r(hp, 0 /* not locked or held */ )) { - if (lih_host_held) + if (lih_host_held2) h_Release_r(hp); return 0; } - if (lih_host_held) + if (lih_host_held2) h_Release_r(hp); hp2 = hp->next; } else { diff --git a/src/viced/fs_stats.h b/src/viced/fs_stats.h index fe13b539f..1e0309e03 100644 --- a/src/viced/fs_stats.h +++ b/src/viced/fs_stats.h @@ -123,10 +123,13 @@ struct afs_PerfStats { */ afs_int32 sysname_ID; /*Unique hardware/OS identifier */ + afs_int32 rx_nBusies; /*Ttl VBUSYs sent to shed load */ + afs_int32 fs_nBusies; /*Ttl VBUSYs sent during restart/vol clone */ + /* * Spares */ - afs_int32 spare[31]; + afs_int32 spare[29]; }; #if FS_STATS_DETAILED diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 907458333..906f23356 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -11,7 +11,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.33.2.1 2004/11/09 17:13:45 shadow Exp $"); + ("$Header: /cvs/openafs/src/volser/vsprocs.c,v 1.33.2.3 2005/01/31 04:34:47 shadow Exp $"); #include #include diff --git a/src/xstat/xstat_fs_test.c b/src/xstat/xstat_fs_test.c index 7fb4ab6d6..46e91ddfb 100644 --- a/src/xstat/xstat_fs_test.c +++ b/src/xstat/xstat_fs_test.c @@ -17,7 +17,7 @@ #include RCSID - ("$Header: /cvs/openafs/src/xstat/xstat_fs_test.c,v 1.8 2003/07/15 23:17:52 shadow Exp $"); + ("$Header: /cvs/openafs/src/xstat/xstat_fs_test.c,v 1.8.2.1 2005/01/31 04:14:51 shadow Exp $"); #include "xstat_fs.h" /*Interface for xstat_fs module */ #include /*Command line interpreter */ @@ -246,8 +246,10 @@ PrintOverallPerfInfo(struct afs_PerfStats *a_ovP) printf("\t%10d rx_nClientConns\n", a_ovP->rx_nClientConns); printf("\t%10d rx_nPeerStructs\n", a_ovP->rx_nPeerStructs); printf("\t%10d rx_nCallStructs\n", a_ovP->rx_nCallStructs); - printf("\t%10d rx_nFreeCallStructs\n\n", a_ovP->rx_nFreeCallStructs); + printf("\t%10d rx_nFreeCallStructs\n", a_ovP->rx_nFreeCallStructs); + printf("\t%10d rx_nBusies\n\n", a_ovP->rx_nBusies); + printf("\t%10d fs_nBusies\n\n", a_ovP->fs_nBusies); /* * Host module fields. */ -- 2.39.5