]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Merge changes from 1.0.3 to 1.0.4
authorSam Hartman <hartmans@debian.org>
Mon, 23 Apr 2001 19:39:26 +0000 (19:39 +0000)
committerSam Hartman <hartmans@debian.org>
Mon, 23 Apr 2001 19:39:26 +0000 (19:39 +0000)
30 files changed:
src/Makefile
src/afs/LINUX/osi_file.c
src/afs/LINUX/osi_misc.c
src/afs/LINUX/osi_module.c
src/afs/LINUX/osi_vnodeops.c
src/afs/UKERNEL/sysincludes.h
src/afs/VNOPS/afs_vnop_readdir.c
src/afs/afs.h
src/afs/afs_call.c
src/afs/afs_osi.h
src/afs/afs_pioctl.c
src/afs/exporter.h
src/afsd/Makefile
src/config/Makefile.i386_linux22
src/config/Makefile.i386_linux24
src/config/Makefile.ppc_linux24
src/config/Makefile.sparc64_linux22
src/config/Makefile.sparc_linux22
src/libafs/Makefile.common
src/libafs/MakefileProto.LINUX
src/lwp/lwp.c
src/lwp/preempt.c
src/lwp/process.c
src/rx/rx.c
src/util/dirpath.c
src/util/dirpath.h
src/venus/Makefile
src/venus/fstrace.c
src/vol/partition.c
src/volser/volmain.c

index 7b7e85cdc57fa233e55d5e3eb297b578674a2910..594ca5f65f58ace4e95033ad9517c1c56341703b 100644 (file)
@@ -19,6 +19,10 @@ COMPILE_PART1=cd obj; cd
 COMPILE_PART2=; $(MAKE) install SYS_NAME=${SYS_NAME} DESTDIR=$(shell pwd)/${SYS_NAME}/dest/ SRCDIR=$(shell pwd)/${SYS_NAME}/dest/
 MKDIR_IF_NEEDED=[ -d $$1 ] || mkdir -p $$1
 
+# Enable build+install of obsolete and insecure packages
+# Set to anything other than YES, or comment out to disable the build
+WITH_DEPRECATED=YES
+
 # To compile AFS from scratch in the src tree run "make SYS_NAME=<type>".
 #   This recursively calls "make install ..." and does not depend on the
 #   existence of any non-standard programs.
@@ -68,7 +72,7 @@ comerr: basics util
 cmd: basics comerr
        ${COMPILE_PART1} cmd ${COMPILE_PART2}
        @case ${SYS_NAME} in \
-       sgi_6* | sun4x_57 | sun4x_58 | hp_ux11* | sparc64_linux* ) \
+       sgi_6* | sun4x_57 | sun4x_58 | hp_ux11* | sparc64_linux* | alpha_linux* ) \
                ${COMPILE_PART1} cmd ${COMPILE_PART2} install64 ;; \
        esac
 
@@ -180,7 +184,7 @@ viced: project vlserver audit
 
 tviced: project viced vlserver libafsrpc libafsauthent
        case ${SYS_NAME} in \
-       alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux*) \
+       alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110) \
                ${COMPILE_PART1} tviced  ${COMPILE_PART2} ;; \
        *) \
                echo Not building MT viced for ${SYS_NAME} ;; \
@@ -201,7 +205,7 @@ null: project
 
 gtx: project null auth # kauth rxkad ?
        case ${SYS_NAME} in \
-         rs_aix* | sun4x_5? | sgi_6? | *linux*) \
+         rs_aix* | sun4x_5? | sgi_6? | *linux* | ppc_darwin* | *fbsd*) \
                rm -f ${DESTDIR}lib/afs/libtermlib.a; \
                ln -s libnull.a ${DESTDIR}lib/afs/libtermlib.a; \
                ${COMPILE_PART1} gtx ${COMPILE_PART2};; \
@@ -217,28 +221,9 @@ fsprobe: project util fsint
 scout: project gtx fsprobe
        ${COMPILE_PART1} scout ${COMPILE_PART2}
 
-mpp: project
-       ${COMPILE_PART1} mpp ${COMPILE_PART2}
-
-package: project mpp
-       ${COMPILE_PART1} package ${COMPILE_PART2}
-
-package.files: package
-       ${DESTDIR}/bin/makepkgfiles afs.dev
-
 uss: des kauth project rx vlserver vol
        ${COMPILE_PART1} uss ${COMPILE_PART2}
 
-ntp: project volser
-       case ${SYS_NAME} in \
-         sun4x_58 ) echo skipping ntp for ${SYS_NAME} ;; \
-         *linux* ) echo skipping ntp for ${SYS_NAME} ;; \
-         * ) ${COMPILE_PART1} ntp ${COMPILE_PART2} ;; \
-       esac
-
-#convert: project ntp
-#      ${COMPILE_PART1} convert ${COMPILE_PART2}
-
 bozo: project ntp audit
        ${COMPILE_PART1} bozo ${COMPILE_PART2}
 
@@ -251,11 +236,7 @@ bozo: project ntp audit
 vfsck: minproject vol
        set -x; \
        case ${SYS_NAME} in \
-       sgi_* | *linux*) \
-               echo skip vfsck for ${SYS_NAME} ;; \
-       rs_aix42)       \
-               echo skip vfsck for ${SYS_NAME} ;; \
-       sun4x_58 )  \
+       sgi_* | *linux* | rs_aix42 | ppc_darwin* | hp_ux* | *fbsd* ) \
                echo skip vfsck for ${SYS_NAME} ;; \
         * ) \
                ${COMPILE_PART1} vfsck ${COMPILE_PART2} ;; \
@@ -273,46 +254,14 @@ login: project kauth rxkad
                ${COMPILE_PART1} sia ${COMPILE_PART2} ;; \
        sun4x_55 ) \
                 ${COMPILE_PART1} login ${COMPILE_PART2} ;; \
-       sun4x_* | hp_ux11* | *linux* ) \
+       sun4x_* | hp_ux11* | *linux* | *fbsd* ) \
                ${COMPILE_PART1} pam ${COMPILE_PART2} ;; \
+       ppc_darwin* ) \
+               echo Skipping login for ${SYS_NAME} ;; \
        * ) \
                ${COMPILE_PART1} login ${COMPILE_PART2} ;; \
        esac
 
-ftpd43+: project kauth rxkad
-       case ${SYS_NAME} in \
-       rs_aix* | sun4x_55 | *linux*) \
-               ${COMPILE_PART1} ftpd43+ ${COMPILE_PART2} ;; \
-       * )     echo skip ftpd43+ for ${SYS_NAME} ;; \
-       esac
-
-inetd: project kauth rxkad
-       ${COMPILE_PART1} inetd ${COMPILE_PART2} 
-
-rsh: project inetd
-       ${COMPILE_PART1} rsh ${COMPILE_PART2} 
-
-rlogind: project rsh ftpd43+ login
-       case ${SYS_NAME} in \
-       rs_aix*) \
-               ${COMPILE_PART1} rlogind ${COMPILE_PART2} ;; \
-       * )     echo skipping rlogind for ${SYS_NAME} ;; \
-       esac
-
-sgistuff: project rlogind
-       case ${SYS_NAME} in \
-       sgi_* ) ${COMPILE_PART1} sgistuff ${COMPILE_PART2} ;; \
-       * )     echo skipping sgistuff for ${SYS_NAME} ;; \
-       esac
-
-rcp: project rsh inetd
-       case ${SYS_NAME} in \
-       sgi_* ) echo skip rcp for ${SYS_NAME} ;; \
-       *)      ${COMPILE_PART1} rcp ${COMPILE_PART2} ;; \
-       esac
-
-allrcmds: project rcp rlogind
-
 KERNELDIR= \
   afs \
   dir \
@@ -346,7 +295,13 @@ libafs: minproject libafs_setup  ${KERNELDIR}
        ${COMPILE_PART1} libafs ${COMPILE_PART2}
 
 libuafs: minproject libuafs_setup ${UKERNELDIR}
-       ${COMPILE_PART1} libuafs ${COMPILE_PART2}
+       set -x; \
+       case ${SYS_NAME} in \
+       hp_ux102* ) \
+               echo Skipping libuafs for ${SYS_NAME} ;; \
+       * ) \
+               ${COMPILE_PART1} libuafs ${COMPILE_PART2} ;; \
+       esac
 
 afsweb: minproject kauth dauth 
        ${COMPILE_PART1} afsweb ${COMPILE_PART2}
@@ -374,7 +329,7 @@ butc: project bubasics butm budb bucoord cmd
 
 tbutc: project bubasics butm budb bucoord cmd butc
        case ${SYS_NAME} in \
-       alpha_dux*|sgi_*|sun4x_*|rs_aix4*|*linux*|hp_ux*) \
+       alpha_dux*|sgi_*|sun4x_*|rs_aix4*|*linux*|hp_ux110) \
                ${COMPILE_PART1} tbutc ${COMPILE_PART2} ;; \
        *) \
                echo Not building MT butc for ${SYS_NAME} ;; \
@@ -392,6 +347,9 @@ xstat: project
 afsmonitor: project gtx xstat
        ${COMPILE_PART1} afsmonitor ${COMPILE_PART2}
 
+#
+# Washtool internal targets
+#
 ircs: project
        case ${SYS_NAME} in \
        sgi_* ) \
@@ -412,12 +370,22 @@ tests: rxtests ubiktests
 
 # pthread based user space RX library
 libafsrpc: rx rxkad des
-       ${COMPILE_PART1} libafsrpc  ${COMPILE_PART2}
+       case ${SYS_NAME} in \
+       alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110) \
+       ${COMPILE_PART1} libafsrpc  ${COMPILE_PART2} ;; \
+       *) \
+               echo Not building MT libafsrpc for ${SYS_NAME} ;; \
+       esac
 
 libafsauthent: ubik auth kauth libafsrpc
-       ${COMPILE_PART1} libafsauthent  ${COMPILE_PART2}
+       case ${SYS_NAME} in \
+       alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110) \
+       ${COMPILE_PART1} libafsauthent  ${COMPILE_PART2} ;; \
+       *) \
+               echo Not building MT libafsrpc for ${SYS_NAME} ;; \
+       esac
 
-libadmin: libafsauthent bozo
+libadmin_real: 
        ${COMPILE_PART1} libadmin ${COMPILE_PART2}
        ${COMPILE_PART1} libadmin/adminutil ${COMPILE_PART2}
        ${COMPILE_PART1} libadmin/vos ${COMPILE_PART2}
@@ -428,7 +396,18 @@ libadmin: libafsauthent bozo
        ${COMPILE_PART1} libadmin/cfg ${COMPILE_PART2}
        ${COMPILE_PART1} libadmin/test ${COMPILE_PART2}
        ${COMPILE_PART1} libadmin/samples ${COMPILE_PART2}
-
+libadmin: libafsauthent bozo
+       case ${SYS_NAME} in \
+       alpha_dux*|sgi_*|sun4x_*|rs_aix*|*linux*|hp_ux110) \
+                       $(MAKE) libadmin_real SYS_NAME=$(SYS_NAME) \
+                       WASHTOOL="$(WASHTOOL)" \
+                       COMPILE_PART1="$(COMPILE_PART1)" \
+                       COMPILE_PART2="$(COMPILE_PART2)" \
+                       SRCDIR=$(SRCDIR) DESTDIR=$(DESTDIR) \
+                       DBG_DEFS=$(DBG_DEFS) ;; \
+       *) \
+               echo Not building MT libadmin for ${SYS_NAME} ;; \
+       esac
 finale: project cmd comerr afsd allrcmds butc tbutc  libuafs audit kauth log package \
        ptserver scout bu_utils ubik uss bozo vfsck volser \
        venus update xstat afsmonitor dauth tests libafsrpc \
@@ -450,12 +429,16 @@ libafs_setup: config minproject export
                MKAFS_OSTYPE=HPUX;; \
        *linux*) \
                MKAFS_OSTYPE=LINUX;; \
+       *fbsd*) \
+               MKAFS_OSTYPE=FBSD;; \
        rs_aix* ) \
                MKAFS_OSTYPE=AIX;; \
        sgi_* ) \
                MKAFS_OSTYPE=IRIX;; \
        sun4x_5* ) \
                MKAFS_OSTYPE=SOLARIS;; \
+       ppc_darwin* ) \
+               MKAFS_OSTYPE=DARWIN;; \
        * ) \
                echo WARNING: No MakefileProto for sys ${SYS_NAME} ; \
        esac; \
@@ -471,6 +454,8 @@ libuafs_setup: config minproject export
                MKAFS_OSTYPE=HPUX;; \
        *linux*) \
                MKAFS_OSTYPE=LINUX;; \
+       *fbsd*) \
+               MKAFS_OSTYPE=FBSD;; \
        rs_aix* ) \
                MKAFS_OSTYPE=AIX;; \
        sun4x_5* ) \
@@ -479,6 +464,8 @@ libuafs_setup: config minproject export
                MKAFS_OSTYPE=DUX;; \
        sgi_6* ) \
                MKAFS_OSTYPE=IRIX;; \
+       ppc_darwin* ) \
+               MKAFS_OSTYPE=DARWIN;; \
        * ) \
                echo WARNING: No MakefileProto for sys ${SYS_NAME} ; \
        esac; \
@@ -486,8 +473,9 @@ libuafs_setup: config minproject export
 
 # "COMPILE_PART1=${COMPILE_PART1}" "COMPILE_PART2=${COMPILE_PART2}" SYS_NAME=${SYS_NAME} ;; 
 
+TARGET=finale
 install:
-       $(MAKE) finale "SYS_NAME=${SYS_NAME}" "WASHTOOL=${WASHTOOL}" \
+       $(MAKE) $(TARGET) "SYS_NAME=${SYS_NAME}" "WASHTOOL=${WASHTOOL}" \
                "COMPILE_PART1=${COMPILE_PART1}" \
                "COMPILE_PART2=${COMPILE_PART2}" \
                 DESTDIR=`pwd`/${SYS_NAME}/dest/ \
@@ -533,3 +521,88 @@ links:
        for file in `find [!NW]* -type f -print` ; do \
                /bin/ln -s `pwd`/$${file} $${here}/obj/$${file} ; \
        done;
+
+#
+# Below targets are all deprecated, insecure, or obsolte, 
+# see README.OBSOLETE and README.INSECURE for more info
+#
+
+mpp: project
+       @case ${WITH_DEPRECATED} in \
+       YES)    ${COMPILE_PART1} mpp ${COMPILE_PART2} ;; \
+       *)      echo skipping deprecated target: mpp ;; \
+       esac
+
+package: project mpp
+       @case ${WITH_DEPRECATED} in \
+       YES)    ${COMPILE_PART1} package ${COMPILE_PART2} ;; \
+       *)      echo skipping deprecated target: package ;; \
+       esac
+
+package.files: package
+       @case ${WITH_DEPRECATED} in \
+       YES)    ${DESTDIR}/bin/makepkgfiles afs.dev ;; \
+       *)      echo skipping deprecated target: package.files ;; \
+       esac
+
+ntp: project volser
+       @case ${WITH_DEPRECATED} in \
+       YES)    case ${SYS_NAME} in \
+               sun4x_58 | *linux* | *fbsd* | ppc_darwin* ) echo skipping ntp for ${SYS_NAME} ;; \
+               * ) ${COMPILE_PART1} ntp ${COMPILE_PART2} ;; \
+               esac ;; \
+       *)      echo skipping deprecated target: ntp ;; \
+       esac
+
+sgistuff: project rlogind
+       @case ${WITH_DEPRECATED} in \
+       YES)    case ${SYS_NAME} in \
+               sgi_* ) ${COMPILE_PART1} sgistuff ${COMPILE_PART2} ;; \
+               * ) echo skipping sgistuff for ${SYS_NAME} ;; \
+               esac ;; \
+       *)      echo skipping deprecated target: sgistuff ;; \
+       esac
+
+ftpd43+: project kauth rxkad
+       @case ${WITH_DEPRECATED} in \
+       YES)    case ${SYS_NAME} in \
+               rs_aix* | sun4x_55 | *linux*) \
+                       ${COMPILE_PART1} ftpd43+ ${COMPILE_PART2} ;; \
+               *) echo skip ftpd43+ for ${SYS_NAME} ;; \
+               esac ;; \
+       *)      echo skipping deprecated target: ftpd43+ ;; \
+       esac
+
+inetd: project kauth rxkad
+       @case ${WITH_DEPRECATED} in \
+       YES)    ${COMPILE_PART1} inetd ${COMPILE_PART2} ;; \
+       *)      echo skipping deprecated target: inetd ;; \
+       esac
+
+rsh: project inetd
+       @case ${WITH_DEPRECATED} in \
+       YES)    ${COMPILE_PART1} rsh ${COMPILE_PART2} ;; \
+       *)      echo skipping deprecated target: rsh ;; \
+       esac
+
+rlogind: project rsh ftpd43+ login
+       @case ${WITH_DEPRECATED} in \
+       YES)    case ${SYS_NAME} in \
+               rs_aix*) ${COMPILE_PART1} rlogind ${COMPILE_PART2} ;; \
+               *) echo skipping rlogind for ${SYS_NAME} ;; \
+               esac ;; \
+       *)      echo skipping deprecated target: rlogind ;; \
+       esac
+
+rcp: project rsh inetd
+       @case ${WITH_DEPRECATED} in \
+       YES)    case ${SYS_NAME} in \
+               sgi_* ) echo skip rcp for ${SYS_NAME} ;; \
+               *)      ${COMPILE_PART1} rcp ${COMPILE_PART2} ;; \
+               esac ;; \
+       *)      echo skipping deprecated target: rcp ;; \
+       esac
+
+allrcmds: project rcp rlogind
+
+
index 8571795cc8c99d58ee52321f0d19171587e45579..d2b90dfd92e77ffa045f596f5b4aaf295a7c1ac4 100644 (file)
@@ -132,8 +132,14 @@ osi_UFSTruncate(afile, asize)
     lock_kernel();
     code = inode_change_ok(inode, &newattrs);
     if (!code)
+#ifdef INODE_SETATTR_NOT_VOID
+       code = inode_setattr(inode, &newattrs);
+#else
        inode_setattr(inode, &newattrs);
+#endif
     unlock_kernel();
+    if (!code)
+       truncate_inode_pages(&inode->i_data, asize);
 #else
     if (inode->i_sb->s_op && inode->i_sb->s_op->notify_change) {
        code = inode->i_sb->s_op->notify_change(&afile->dentry, &newattrs);
index e40af34af5fb0685987df7eda054dd399e4f99f7..87ef735c5448937d2f284ed7550b37fcf8773e0c 100644 (file)
@@ -302,7 +302,13 @@ void osi_linux_free_inode_pages(void)
 #else
            if (ip->i_nrpages) {
 #endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+               truncate_inode_pages(&ip->i_data, 0);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,15)
+               truncate_inode_pages(ip, 0);
+#else
                invalidate_inode_pages(ip);
+#endif
 #if defined(AFS_LINUX24_ENV)
                if (ip->i_data.nrpages) {
 #else
@@ -411,7 +417,9 @@ void check_bad_parent(struct dentry *dp)
                 ICL_TYPE_POINTER, avc,
                 ICL_TYPE_POINTER, dp);
     }
-    
+    if (avc)
+       AFS_RELE(avc);
+    crfree(credp);
   } /* if bad parent */
  
   return;
index c3c29b5297b1e91315262fba7e3994cfc1cbb735..608012740172bd0d81aa063eb03b852de146c8b5 100644 (file)
 
 
 asmlinkage int (*sys_settimeofdayp)(struct timeval *tv, struct timezone *tz);
+#if !defined(AFS_ALPHA_LINUX20_ENV)
 asmlinkage int (*sys_socketcallp)(int call, long *args);
+#endif /* no socketcall on alpha */
 asmlinkage int (*sys_killp)(int pid, int signal);
 asmlinkage int (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist);
 
+#ifdef AFS_SPARC64_LINUX20_ENV
 extern unsigned int sys_call_table[];  /* changed to uint because SPARC64 has syscaltable of 32bit items */
+#else
+extern void * sys_call_table[]; /* safer for other linuces */
+#endif
 extern struct file_system_type afs_file_system;
 
 static long get_page_offset(void);
@@ -42,8 +48,12 @@ unsigned long afs_linux_page_offset = 0; /* contains the PAGE_OFFSET value */
 /* Since sys_ni_syscall is not exported, I need to cache it in order to restore
  * it.
  */
+#ifdef AFS_SPARC64_LINUX20_ENV
 static unsigned int afs_ni_syscall = 0;
-
+#else
+static void* afs_ni_syscall = 0;
+#endif
 #ifdef AFS_SPARC64_LINUX20_ENV
 static unsigned int afs_ni_syscall32 = 0;
 asmlinkage int (*sys_setgroupsp32)(int gidsetsize, __kernel_gid_t32 *grouplist);
@@ -63,29 +73,42 @@ __asm__ __volatile__ ("
 }
 #endif
 
+#if defined(AFS_LINUX24_ENV)
+asmlinkage int (*sys_setgroups32p)(int gidsetsize, __kernel_gid32_t *grouplist);
+#endif 
+
+#ifdef AFS_SPARC64_LINUX20_ENV
 #define POINTER2SYSCALL (unsigned int)(unsigned long)
 #define SYSCALL2POINTER (void *)(long)
+#else
+#define POINTER2SYSCALL (void *)
+#define SYSCALL2POINTER (void *)
+#endif
 
 int init_module(void)
 {
     extern int afs_syscall();
     extern int afs_xsetgroups();
-#ifdef AFS_SPARC64_LINUX20_ENV
+#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_LINUX24_ENV)
     extern int afs_xsetgroups32();
 #endif
 
     /* obtain PAGE_OFFSET value */
     afs_linux_page_offset = get_page_offset();
 
+#ifndef AFS_S390_LINUX22_ENV
     if (afs_linux_page_offset == 0) {
         /* couldn't obtain page offset so can't continue */
         printf("afs: Unable to obtain PAGE_OFFSET. Exiting..");
         return -EIO;
     }
+#endif
 
     /* Initialize pointers to kernel syscalls. */
     sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday];
+#if !defined(AFS_ALPHA_LINUX20_ENV)
     sys_socketcallp = SYSCALL2POINTER sys_call_table[__NR_socketcall];
+#endif /* no socketcall on alpha */
     sys_killp = SYSCALL2POINTER sys_call_table[__NR_kill];
 
     /* setup AFS entry point. */
@@ -112,6 +135,10 @@ int init_module(void)
     sys_setgroupsp32 = SYSCALL2POINTER sys_call_table32[__NR_setgroups];
     sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups32;
 #endif
+#if defined(__NR_setgroups32)
+    sys_setgroups32p = SYSCALL2POINTER sys_call_table[__NR_setgroups32];
+    sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32;
+#endif
 
     return 0;
 }
@@ -126,7 +153,9 @@ void cleanup_module(void)
     sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp32;
     sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32;
 #endif
-
+#if defined(__NR_setgroups32)
+    sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p;
+#endif
     unregister_filesystem(&afs_file_system);
 
     osi_linux_free_inode_pages(); /* Invalidate all pages using AFS inodes. */
@@ -137,7 +166,7 @@ void cleanup_module(void)
 
 static long get_page_offset(void)
 {
-#if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV)
+#if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV)
     return PAGE_OFFSET;
 #else
     struct task_struct *p;
index 72209cc1a30d66c072d33bfd14f2435b4d1d6554..8223ea992acce8c954989ab713979403bbd9d21e 100644 (file)
@@ -231,7 +231,39 @@ tagain:
 
        /* filldir returns -EINVAL when the buffer is full. */
 #ifdef AFS_LINUX24_ENV
-       code = (*filldir)(dirbuf, de->name, len, offset, ino, DT_UNKNOWN);
+        {
+             unsigned int type=DT_UNKNOWN;
+             struct VenusFid afid;
+             struct vcache *tvc;
+             int vtype;
+             afid.Cell=avc->fid.Cell;
+             afid.Fid.Volume=avc->fid.Fid.Volume;
+             afid.Fid.Vnode=ntohl(de->fid.vnode);
+             afid.Fid.Unique=ntohl(de->fid.vunique);
+             if ((avc->states & CForeign) == 0 &&
+                 (ntohl(de->fid.vnode) & 1)) {
+                  type=DT_DIR;
+             } else if ((tvc=afs_FindVCache(&afid,0,0,0,0))) {
+                  if (tvc->mvstat) {
+                       type=DT_DIR;
+                  } else if (((tvc->states) & (CStatd|CTruth))) {
+                       /* CTruth will be set if the object has 
+                        *ever* been statd */
+                       vtype=vType(tvc);
+                       if (vtype == VDIR)
+                            type=DT_DIR;
+                       else if (vtype == VREG)
+                            type=DT_REG;
+                       /* Don't do this until we're sure it can't be a mtpt */
+                       /* else if (vtype == VLNK)
+                          type=DT_LNK; */
+                       /* what other types does AFS support? */
+                  }
+                 /* clean up from afs_FindVCache */
+                 afs_PutVCache(tvc, WRITE_LOCK);
+             }
+             code = (*filldir)(dirbuf, de->name, len, offset, ino, type);
+        }
 #else
        code = (*filldir)(dirbuf, de->name, len, offset, ino); 
 #endif
@@ -619,15 +651,6 @@ static int afs_linux_revalidate(struct dentry *dp)
     lock_kernel();
 #endif
 
-    /* If it's a negative dentry, then there's nothing to do. */
-    if (!vcp) {
-#ifdef AFS_LINUX24_ENV
-        unlock_kernel();
-#endif
-       AFS_GUNLOCK();
-       return 0;
-    }
-
     /* Make this a fast path (no crref), since it's called so often. */
     if (vcp->states & CStatd) {
         if (*dp->d_name.name != '/' && vcp->mvstat == 2) /* root vnode */
@@ -654,62 +677,15 @@ static int afs_linux_revalidate(struct dentry *dp)
     return -code ;
 }
 
-/* Validate a dentry. Return 0 if unchanged, 1 if VFS layer should re-evaluate.
- * In kernels 2.2.10 and above, we are passed an additional flags var which
- * may have either the LOOKUP_FOLLOW OR LOOKUP_DIRECTORY set in which case
- * we are advised to follow the entry if it is a link or to make sure that 
- * it is a directory. But since the kernel itself checks these possibilities
- * later on, we shouldn't have to do it until later. Perhaps in the future..
- */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10)
 static int afs_linux_dentry_revalidate(struct dentry *dp, int flags)
 #else
 static int afs_linux_dentry_revalidate(struct dentry *dp)
 #endif
 {
-    int code;
-    cred_t *credp;
-    struct vrequest treq;
-    struct vcache *vcp = (struct vcache*)dp->d_inode;
-
-    AFS_GLOCK();
-#ifdef AFS_LINUX24_ENV
-    lock_kernel();
-#endif
-
-    /* If it's a negative dentry, then there's nothing to do. */
-    if (!vcp) {
-#ifdef AFS_LINUX24_ENV
-       unlock_kernel();
-#endif
-       AFS_GUNLOCK();
-       return 0;
-    }
-
-    /* Make this a fast path (no crref), since it's called so often. */
-    if (vcp->states & CStatd) {
-        if (*dp->d_name.name != '/' && vcp->mvstat == 2) /* root vnode */
-           check_bad_parent(dp); /* check and correct mvid */
-       vcache2inode(vcp);
-#ifdef AFS_LINUX24_ENV
-       unlock_kernel();
-#endif
-       AFS_GUNLOCK();
-       return 0;
-    }
-
-    credp = crref();
-    code = afs_InitReq(&treq, credp);
-    if (!code)
-       code = afs_VerifyVCache(vcp, &treq);
-
-#ifdef AFS_LINUX24_ENV
-    unlock_kernel();
-#endif
-    AFS_GUNLOCK();
-    crfree(credp);
-
-    return 1;
+    /* Force revalidation as this may be a different client than the
+       one which caused an entry to get cached */
+    return 0;
 }
 
 /* afs_dentry_iput */
@@ -789,6 +765,9 @@ int afs_linux_create(struct inode *dip, struct dentry *dp, int mode)
 #endif
 
        dp->d_op = afs_dops;
+        /* This DV is probably wrong, unfortunately, Perhaps we should 
+           VerifyVCache the directory  */
+        dp->d_time=hgetlo(((struct vcache *)dip)->m.DataVersion);
        d_instantiate(dp, ip);
     }
 
@@ -835,6 +814,8 @@ int afs_linux_lookup(struct inode *dip, struct dentry *dp)
            ip->i_op = &afs_symlink_iops;
 #endif
     }
+    /* directory ought to be stat'd here.... */
+    dp->d_time=hgetlo(((struct vcache *)dip)->m.DataVersion);
     dp->d_op = afs_dops;
     d_add(dp, (struct inode*)vcp);
 
@@ -900,9 +881,13 @@ int afs_linux_unlink(struct inode *dip, struct dentry *dp)
     AFS_GUNLOCK();
     if (!code) {
        d_delete(dp);
-       if (putback)
+       if (putback) {
+           /* This DV is probably wrong, unfortunately, Perhaps we should 
+              VerifyVCache the directory  */
+            dp->d_time=hgetlo(((struct vcache *)dip)->m.DataVersion);
            d_add(dp, NULL); /* means definitely does _not_ exist */
     }
+    }
     crfree(credp);
     return -code;
 }
@@ -949,6 +934,9 @@ int afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode)
        tvcp->v.v_fop = &afs_dir_fops;
 #endif
        dp->d_op = afs_dops;
+        /* This DV is probably wrong, unfortunately, Perhaps we should 
+           VerifyVCache the directory  */
+        dp->d_time=hgetlo(((struct vcache *)dip)->m.DataVersion);
        d_instantiate(dp, (struct inode*)tvcp);
     }
     AFS_GUNLOCK();
@@ -1008,8 +996,13 @@ int afs_linux_rename(struct inode *oldip, struct dentry *olddp,
                      newname, credp);
     AFS_GUNLOCK();
 
-    if (!code)
+    if (!code) {
+        /* update time so it doesn't expire immediately */
+        /* This DV is probably wrong, unfortunately, Perhaps we should 
+           VerifyVCache the directory  */
+        newdp->d_time=hgetlo(((struct vcache *)newdp->d_parent->d_inode)->m.DataVersion);
        d_move(olddp, newdp);
+    }
 
     crfree(credp);
     return -code;
@@ -1099,7 +1092,13 @@ int afs_linux_readpage(struct file *fp, struct page *pp)
 {
     int code;
     cred_t *credp = crref();
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    char *address;
+    loff_t offset = pp->index << PAGE_CACHE_SHIFT;
+#else
     ulong address = afs_linux_page_address(pp);
+    loff_t offset = pageoff(pp);
+#endif
     uio_t tuio;
     struct iovec iovec;
     struct inode *ip = FILE_INODE(fp);
@@ -1111,26 +1110,22 @@ int afs_linux_readpage(struct file *fp, struct page *pp)
               ICL_TYPE_POINTER, pp,
               ICL_TYPE_INT32, cnt,
               ICL_TYPE_INT32, 99999); /* not a possible code value */
-    atomic_add(1, &pp->count);
-#if defined(AFS_LINUX24_ENV)
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    address = kmap(pp);
     ClearPageError(pp);
+
+    lock_kernel();
 #else
+    atomic_add(1, &pp->count);
     set_bit(PG_locked, &pp->flags); /* other bits? See mm.h */
     clear_bit(PG_error, &pp->flags);
 #endif
 
-#if defined(AFS_LINUX24_ENV)
-    setup_uio(&tuio, &iovec, (char*)address, pp->index << PAGE_CACHE_SHIFT,
-             PAGESIZE, UIO_READ, AFS_UIOSYS);
-#else
-    setup_uio(&tuio, &iovec, (char*)address, pageoff(pp), PAGESIZE,
+    setup_uio(&tuio, &iovec, (char*)address, offset, PAGESIZE,
              UIO_READ, AFS_UIOSYS);
-#endif
-#if defined(AFS_LINUX24_ENV)
-    lock_kernel();
-#endif
     code = afs_rdwr((struct vcache*)ip, &tuio, UIO_READ, 0, credp);
-#if defined(AFS_LINUX24_ENV)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     unlock_kernel();
 #endif
 
@@ -1138,23 +1133,22 @@ int afs_linux_readpage(struct file *fp, struct page *pp)
        if (tuio.uio_resid) /* zero remainder of page */
            memset((void*)(address+(PAGESIZE-tuio.uio_resid)), 0,
                   tuio.uio_resid);
-#if defined(AFS_LINUX24_ENV)
-#ifndef __powerpc__
-        flush_dcache_page(pp);
-#endif
-        SetPageUptodate(pp);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+       flush_dcache_page(pp);
+       SetPageUptodate(pp);
 #else
        set_bit(PG_uptodate, &pp->flags);
 #endif
     }
 
-#if defined(AFS_LINUX24_ENV)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    kunmap(pp);
     UnlockPage(pp);
 #else
     clear_bit(PG_locked, &pp->flags);
     wake_up(&pp->wait);
-#endif
     free_page(address);
+#endif
 
     crfree(credp);
     afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE,
@@ -1192,7 +1186,6 @@ do_it:
     AFS_GUNLOCK();
     SetPageUptodate(pp);
     UnlockPage(pp);
-    /* kunmap(pp); */
     if (status == offset)
        return 0;
     else
@@ -1245,21 +1238,23 @@ int afs_linux_writepage_sync(struct inode *ip, struct page *pp,
                         unsigned int count)
 {
     struct vcache *vcp = (struct vcache *) ip;
-    u8 *page_addr = (u8*) afs_linux_page_address(pp);
+    char *buffer;
+    loff_t base;
     int code = 0;
     cred_t *credp;
     uio_t tuio;
     struct iovec iovec;
     int f_flags = 0;
 
+    buffer = kmap(pp) + offset;
+    base = (pp->index << PAGE_CACHE_SHIFT) + offset;
+
     credp = crref();
     afs_Trace4(afs_iclSetp, CM_TRACE_UPDATEPAGE, ICL_TYPE_POINTER, vcp,
               ICL_TYPE_POINTER, pp,
               ICL_TYPE_INT32, atomic_read(&pp->count),
               ICL_TYPE_INT32, 99999);
-    setup_uio(&tuio, &iovec, page_addr + offset,
-             (pp->index << PAGE_CACHE_SHIFT) + offset, count,
-             UIO_WRITE, AFS_UIOSYS);
+    setup_uio(&tuio, &iovec, buffer, base, count, UIO_WRITE, AFS_UIOSYS);
 
     code = afs_write(vcp, &tuio, f_flags, credp, 0);
 
@@ -1272,6 +1267,7 @@ int afs_linux_writepage_sync(struct inode *ip, struct page *pp,
               ICL_TYPE_INT32, code);
 
     crfree(credp);
+    kunmap(pp);
 
     return code;
 }
@@ -1309,7 +1305,7 @@ int afs_linux_updatepage(struct file *fp, struct page *pp,
               ICL_TYPE_POINTER, pp,
               ICL_TYPE_INT32, atomic_read(&pp->count),
               ICL_TYPE_INT32, 99999);
-    setup_uio(&tuio, &iovec, page_addr + offset, pageoff(pp) + offset, count,
+    setup_uio(&tuio, &iovec, page_addr + offset, pp->offset + offset, count,
              UIO_WRITE, AFS_UIOSYS);
 
     code = afs_write(vcp, &tuio, fp->f_flags, credp, 0);
@@ -1333,16 +1329,16 @@ int afs_linux_updatepage(struct file *fp, struct page *pp,
 #if defined(AFS_LINUX24_ENV)
 static int afs_linux_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to)
 {
-    long status;
+    int code;
 
     AFS_GLOCK();
     lock_kernel();
-    status = afs_linux_updatepage(file, page, offset, to-offset);
+    code = afs_linux_updatepage(file, page, offset, to-offset);
     unlock_kernel();
     AFS_GUNLOCK();
     kunmap(page);
 
-    return status;
+    return code;
 }
 
 static int afs_linux_prepare_write(struct file *file, struct page *page,
@@ -1451,18 +1447,22 @@ static int afs_symlink_filler(struct file *file, struct page *page)
     AFS_GLOCK();
     lock_kernel();
     code = afs_linux_ireadlink(ip, p, PAGE_SIZE, AFS_UIOSYS);
-    unlock_kernel();
-    AFS_GUNLOCK();
 
     if (code<0)
            goto fail;
     p[code] = '\0';            /* null terminate? */
+    unlock_kernel();
+    AFS_GUNLOCK();
+
     SetPageUptodate(page);
     kunmap(page);
     UnlockPage(page);
     return 0;
 
 fail:
+    unlock_kernel();
+    AFS_GUNLOCK();
+
     SetPageError(page);
     kunmap(page);
     UnlockPage(page);
index 6b4d953fd8c3acc3d4a0359274f7eb0057d35cae..367b6e20bb0402d898733141ad5e49749548f36b 100644 (file)
@@ -11,7 +11,9 @@
 #define __AFS_SYSINCLUDESH__ 1
 
 #include  <stdio.h>
+#if !defined(AFS_USR_DARWIN_ENV) && !defined(AFS_USR_FBSD_ENV) /* must be included after KERNEL undef'd */
 #include  <errno.h>
+#endif
 #include  <stdlib.h>
 #include  <string.h>
 #include  <unistd.h>
 #define FREAD                  0x0001
 #endif /* AFS_USR_LINUX22_ENV */
 
+#if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV)
+#ifdef KERNEL
+#undef KERNEL
+#define AFS_USR_UNDEF_KERNEL_ENV 1
+#endif
+#include  <errno.h>
+#include  <sys/param.h>
+#include  <sys/types.h>
+#include  <sys/socket.h>
+#include  <net/if.h>
+#include  <sys/file.h>
+#include  <sys/ioctl.h>
+#include  <sys/stat.h>
+#include  <sys/fcntl.h>
+#include  <sys/uio.h>
+#include  <netinet/in.h>
+#include  <netdb.h>
+#include  <arpa/inet.h>
+#ifndef O_SYNC
+#define O_SYNC O_FSYNC
+#endif
+#endif /* AFS_USR_DARWIN_ENV || AFS_USR_FBSD_ENV */
+
 /* glibc 2.2 has pthread_attr_setstacksize */
 #if defined(AFS_LINUX22_ENV) || defined(AFS_USR_LINUX22_ENV) && (__GLIBC_MINOR__ < 2)
 #define pthread_attr_setstacksize(a,b) 0
 #undef socket
 #endif /* AFS_USR_SGI_ENV */
 
+#if defined(AFS_USR_DARWIN_ENV) || defined(AFS_USR_FBSD_ENV)
+#undef if_mtu
+#undef if_metric
+#endif
+
 #define mount                  usr_mount
 #define fs                     usr_fs
 #define uio                    usr_uio
@@ -1296,7 +1326,9 @@ struct min_direct {
 struct usr_ucred {
        unsigned long           cr_ref;
        long                    cr_uid;
+#if !defined(AFS_USR_FBSD_ENV)
        long                    cr_gid;
+#endif
        long                    cr_ruid;
        long                    cr_rgid;
        long                    cr_suid;
index 54a70a3319cac5f6009eb60a9f07d08be79d5860..8b13566aafb54ebef52ed92ced1237b93f3ced1f 100644 (file)
@@ -136,6 +136,12 @@ struct irix5_min_dirent {     /* miniature dirent structure */
 #else
 struct min_direct {    /* miniature direct structure */
                        /* If struct direct changes, this must too */
+#ifdef AFS_DARWIN_ENV
+    afs_uint32  d_fileno;
+    u_short     d_reclen;
+    u_char      d_type;
+    u_char      d_namlen;
+#else   
 #ifdef AFS_SUN5_ENV
     afs_uint32 d_fileno;
     afs_int32  d_off;
@@ -151,6 +157,7 @@ struct min_direct { /* miniature direct structure */
     u_short    d_reclen;
     u_short    d_namlen;
 #endif
+#endif
 };
 #endif /* AFS_SGI_ENV */
 
@@ -337,6 +344,9 @@ int                 off;
 #if defined(AFS_SUN_ENV) || defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV)
     sdirEntry.d_off = off;
 #endif
+#if defined(AFS_DARWIN_ENV)
+    sdirEntry.d_type=DT_UNKNOWN;
+#endif
 
 #if defined(AFS_SGI_ENV)
     AFS_UIOMOVE(&sdirEntry, DIRENTBASESIZE, UIO_READ, auio, code);
@@ -409,7 +419,7 @@ void afs_bulkstat_send( avc, req )
  * It has to do with 'offset' (seek locations).
 */
 
-#if    defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
 afs_readdir(OSI_VC_ARG(avc), auio, acred, eofp)
     int *eofp;
 #else
@@ -466,7 +476,7 @@ afs_readdir(OSI_VC_ARG(avc), auio, acred)
 #endif /* AFS_SGI61_ENV */
 #endif /* defined(AFS_SGI53_ENV) */
 
-#if    defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
     /* Not really used by the callee so we ignore it for now */
     if (eofp) *eofp = 0;
 #endif
index 12e3a5a365831563e65694c02652719c54a063b8..4f80931dd7ccc4d2e459d09556005432cda89dfa 100644 (file)
@@ -509,7 +509,11 @@ struct SimpleLocks {
 #define VPageCleaning 0x2      /* Solaris - Cache Trunc Daemon sez keep out */
 
 #define        CPSIZE      2
+#if !defined(AFS_FBSD_ENV)
 #define        vrefCount   v.v_count
+#else
+#define vrefCount   v.v_usecount
+#endif /* AFS_FBSD_ENV */
 
 #define        AFS_MAXDV   0x7fffffff      /* largest dataversion number */
 #define        AFS_NOTRUNC 0x7fffffff      /* largest dataversion number */
@@ -557,7 +561,7 @@ struct vcache {
      * Do not try to get the vcache lock when the vlock is held */
     afs_rwlock_t vlock;
 #endif /* defined(AFS_SUN5_ENV) */
-#if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV)
+#if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_DARWIN_ENV)
 #if    defined(AFS_SUN5_ENV)
     krwlock_t rwlock;
     struct cred *credp;
@@ -572,6 +576,9 @@ struct vcache {
 #endif
 #ifdef AFS_AIX_ENV
     int ownslock;      /* pid of owner of excl lock, else 0 - defect 3083 */
+#endif
+#ifdef AFS_DARWIN_ENV
+    struct lock__bsd__      rwlock;
 #endif
     afs_int32 parentVnode;                     /* Parent dir, if a file. */
     afs_int32 parentUnique;
@@ -974,9 +981,15 @@ extern void shutdown_osifile();
   (((avc)->states & CStatd) ? (vcache2inode(avc), 0) : \
    afs_VerifyVCache2((avc),areq))
 #else
+#ifdef AFS_DARWIN_ENV
+#define afs_VerifyVCache(avc, areq)  \
+  (((avc)->states & CStatd) ? (osi_VM_Setup(avc), 0) : \
+   afs_VerifyVCache2((avc),areq))
+#else
 #define afs_VerifyVCache(avc, areq)  \
   (((avc)->states & CStatd) ? 0 : afs_VerifyVCache2((avc),areq))
 #endif
+#endif
 
 #define DO_STATS 1  /* bits used by FindVCache */
 #define DO_VLRU 2
@@ -1062,5 +1075,31 @@ extern int afs_norefpanic;
 #define VN_UNLOCK(vp)           simple_unlock(&(vp)->v_lock)
 #endif
 
+/* get a file's serial number from a vnode */
+#ifndef afs_vnodeToInumber
+#if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
+#define afs_vnodeToInumber(V) VnodeToIno(V)
+#else
+#ifdef AFS_DECOSF_ENV
+#define afs_vnodeToInumber(V) osi_vnodeToInumber(V)
+#else
+#define afs_vnodeToInumber(V) (VTOI(V)->i_number)
+#endif /* AFS_DECOSF_ENV */
+#endif /* AFS_SGI62_ENV */
+#endif
+
+/* get a file's device number from a vnode */
+#ifndef afs_vnodeToDev
+#if defined(AFS_SGI62_ENV) || defined(AFS_HAVE_VXFS) || defined(AFS_DARWIN_ENV)
+#define afs_vnodeToDev(V) VnodeToDev(V)
+#else
+#ifdef AFS_DECOSF_ENV
+#define afs_vnodeToDev(V) osi_vnodeToDev(V)
+#else
+#define afs_vnodeToDev(V) (VTOI(V)->i_dev)
+#endif /* AFS_DECOSF_ENV */
+#endif /* AFS_SGI62_ENV */
+#endif
+
 #endif /* _AFS_H_ */
 
index 27beb93b8c3b2b04eb065829eded9ac1df6f4fd2..930b294fee6b60b8008ec653d39f14d57536cef4 100644 (file)
@@ -42,7 +42,8 @@ char afs_rootVolumeName[64]="";
 struct afs_icl_set *afs_iclSetp = (struct afs_icl_set*)0;
 struct afs_icl_set *afs_iclLongTermSetp = (struct afs_icl_set*)0;
 
-#if    defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX22_ENV)
+#if    defined(AFS_GLOBAL_SUNLOCK) && !defined(AFS_HPUX_ENV) && !defined(AFS_AIX41_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
+
 kmutex_t afs_global_lock;
 kmutex_t afs_rxglobal_lock;
 
@@ -53,6 +54,10 @@ long afs_global_owner;
 
 #if defined(AFS_OSF_ENV)
 simple_lock_data_t afs_global_lock;
+#elif defined(AFS_DARWIN_ENV)
+struct lock__bsd__ afs_global_lock;
+#endif
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
 thread_t afs_global_owner;
 #endif /* AFS_OSF_ENV */
 
@@ -127,7 +132,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
     if (!afs_suser() && (parm != AFSOP_GETMTU)
        && (parm != AFSOP_GETMASK)) {
       /* only root can run this code */
-#if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
        setuerror(EACCES);
        return(EACCES);
 #else
@@ -197,7 +202,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
        while (afs_initState < AFSOP_START_AFS) 
            afs_osi_Sleep(&afs_initState);
 
-#if defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV)
+#if defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV)
        temp = AFS_MINBUFFERS;  /* Should fix this soon */
 #else
        temp = ((afs_bufferpages * NBPG)>>11);  /* number of 2k buffers we could get from all of the buffer space */
@@ -286,7 +291,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
        struct afsop_cell tcell;
        char *tbuffer = osi_AllocSmallSpace(AFS_SMALLOCSIZ), *lcnamep = 0;
        char *tbuffer1 = osi_AllocSmallSpace(AFS_SMALLOCSIZ), *cnamep = 0;
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV)
+#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV)
        size_t bufferSize;      
 #else /* AFS_SGI61_ENV */
        u_int bufferSize;       
@@ -324,7 +329,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
        while (afs_initState < AFSOP_START_BKG) afs_osi_Sleep(&afs_initState);
        AFS_COPYIN((char *)parm2, (caddr_t) &cparms, sizeof(cparms), code);
        if (code) {
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined (AFS_SGI64_ENV) || defined(AFS_LINUX20_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined (AFS_SGI64_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV)
            goto out;
 #else
            setuerror(code);
@@ -370,7 +375,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
        code = afs_InitCacheFile((char *) 0, ainode);
     }
     else if (parm == AFSOP_ROOTVOLUME) {
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV)
+#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV)
        size_t bufferSize;
 #else /* AFS_SGI61_ENV */
        u_int bufferSize;
@@ -388,7 +393,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
     else if (parm == AFSOP_CACHEFILE || parm == AFSOP_CACHEINFO ||
              parm == AFSOP_VOLUMEINFO || parm == AFSOP_AFSLOG) {
        char *tbuffer = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV)
+#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV)
        size_t bufferSize;
 #else /* AFS_SGI61_ENV */
        u_int bufferSize;
@@ -496,7 +501,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
 #endif /* AFS_SGI62_ENV && !AFS_SGI65_ENV */
 #endif /* AFS_SGI53_ENV */
     else if (parm == AFSOP_SHUTDOWN) {
-#if    defined(AFS_OSF_ENV)
+#if    defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
        extern struct mount *afs_globalVFS;
 #else  /* AFS_OSF_ENV */
        extern struct vfs *afs_globalVFS;
@@ -519,7 +524,7 @@ long parm, parm2, parm3, parm4, parm5, parm6;
       afs_vfs_mount(parm2, parm3, parm4, parm5);
 #endif /* AFS_HPUX100_ENV */
 #else /* defined(AFS_HPUX_ENV) */
-#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV)
+#if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV)
       code = EINVAL;
 #else
       setuerror(EINVAL);
@@ -816,14 +821,15 @@ copyin_iparam(caddr_t cmarg, struct iparam *dst)
        }
 #endif /* AFS_SUN57_64BIT_ENV */
 
-#if defined(AFS_LINUX_64BIT_KERNEL)
+#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV)
        struct iparam32 dst32;
 
 #ifdef AFS_SPARC64_LINUX20_ENV
-       if (current->tss.flags & SPARC_FLAG_32BIT) {
+       if (current->tss.flags & SPARC_FLAG_32BIT) 
 #else
 #error Not done for this linux version
-#endif
+#endif /* AFS_SPARC64_LINUX20_ENV */
+       {
                AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code);
                if (!code)
                        iparam32_to_iparam(&dst32, dst);
@@ -872,7 +878,7 @@ Afs_syscall (uap, rvp)
 {
     int *retval = &rvp->r_val1;
 #else /* AFS_SUN5_ENV */
-#if    defined(AFS_OSF_ENV)
+#if    defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
 afs3_syscall(p, args, retval)
        struct proc *p;
        void *args;
@@ -1010,7 +1016,7 @@ Afs_syscall ()
        mutex_exit(&procp->p_crlock);
 #else
        AFS_GLOCK();
-#if    defined(AFS_OSF_ENV)
+#if    defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
        code = afs_setpag(p, args, retval);
 #else  /* AFS_OSF_ENV */
        code = afs_setpag();
@@ -1021,8 +1027,12 @@ Afs_syscall ()
        AFS_GLOCK();
 #ifdef AFS_SUN5_ENV
         code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4, rvp, CRED());
+#else
+#ifdef AFS_DARWIN_ENV
+        code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4, p->p_cred->pc_ucred);
 #else
        code = afs_syscall_pioctl(uap->parm1, uap->parm2, uap->parm3, uap->parm4);
+#endif
 #endif
        AFS_GUNLOCK();
     } else if (uap->syscall == AFSCALL_ICREATE) {
@@ -1030,7 +1040,7 @@ Afs_syscall ()
 
        code = copyin_iparam((char *)uap->parm3, &iparams);
        if (code) {
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
            setuerror(code);
 #endif
        } else
@@ -1039,7 +1049,7 @@ Afs_syscall ()
                                   iparams.param3, iparams.param4, rvp, CRED());
 #else
        code =  afs_syscall_icreate(uap->parm1, uap->parm2, iparams.param1, iparams.param2,
-#ifdef AFS_OSF_ENV
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
                                   iparams.param3, iparams.param4, retval);
 #else
                                   iparams.param3, iparams.param4);
@@ -1049,7 +1059,7 @@ Afs_syscall ()
 #ifdef AFS_SUN5_ENV
        code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3, rvp, CRED());
 #else
-#ifdef AFS_OSF_ENV
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
        code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3, retval);
 #else
        code = afs_syscall_iopen(uap->parm1, uap->parm2, uap->parm3);
@@ -1078,13 +1088,13 @@ Afs_syscall ()
        }
 #else
         if (code) {
-#if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV)
+#if !defined(AFS_SUN5_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV)
            setuerror(code);
 #endif
         }
 #endif /* !AFS_LINUX20_ENV */
     } else {
-#if defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV)
+#if defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV)
        code = EINVAL;
 #else
         setuerror(EINVAL);
@@ -1276,7 +1286,7 @@ Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval)
     register afs_int32 code;
     struct afs_icl_log *logp;
     struct afs_icl_set *setp;
-#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV)
+#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV)
     size_t temp;
 #else /* AFS_SGI61_ENV */
     afs_uint32 temp;
@@ -1292,7 +1302,7 @@ Afscall_icl(long opcode, long p1, long p2, long p3, long p4, long *retval)
     }
 #else
     if (!afs_suser()) {        /* only root can run this code */
-#if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV)
+#if !defined(AFS_SGI_ENV) && !defined(AFS_OSF_ENV) && !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV)
        setuerror(EACCES);
        return EACCES;
 #else
index 9676fb344b9c14ceab385276036281004870bc35..54063e62073f3feea83bdb4a0655d6d2cf2e635a 100644 (file)
@@ -109,11 +109,17 @@ extern void  osi_FreeLargeSpace(void *x);
 /*
  * Vnode related macros
  */
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+extern int (**afs_vnodeop_p)();
+#define IsAfsVnode(vc)      ((vc)->v_op == afs_vnodeop_p)
+#define SetAfsVnode(vc)     (vc)->v_op = afs_vnodeop_p
+#else
 extern struct vnodeops *afs_ops;
-#define        vType(vc)           (vc)->v.v_type
-#define        vSetType(vc,type)   (vc)->v.v_type = (type)
 #define        IsAfsVnode(vc)      ((vc)->v_op == afs_ops)
 #define        SetAfsVnode(vc)     (vc)->v_op = afs_ops
+#endif
+#define        vType(vc)           (vc)->v.v_type
+#define        vSetType(vc,type)   (vc)->v.v_type = (type)
 #define        vSetVfsp(vc,vfsp)   (vc)->v.v_vfsp = (vfsp)
 
 #ifdef AFS_SGI65_ENV
@@ -230,7 +236,13 @@ typedef struct timeval osi_timeval_t;
  * (Also, of course, the vnode is assumed to be one of ours.  Can't use this
  * macro for V-file vnodes.)
  */
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+/* Bare refcount manipulation would probably work on this platform, but just
+   calling VREF does not */
+#define AFS_FAST_HOLD(vp) osi_vnhold((vp),0)
+#else
 #define AFS_FAST_HOLD(vp) VN_HOLD(&(vp)->v)
+#endif
 #define AFS_FAST_RELE(vp) AFS_RELE(&(vp)->v)
 
 /*
@@ -270,7 +282,7 @@ typedef struct timeval osi_timeval_t;
                AFS_GLOCK();                                    \
        } while(0)
 
-#ifdef AFS_OSF_ENV
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
 #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)                       \
        do {                                                    \
            int haveGlock = ISAFS_GLOCK();                      \
@@ -281,7 +293,7 @@ typedef struct timeval osi_timeval_t;
            if (haveGlock)                                      \
                AFS_GLOCK();                                    \
        } while(0)
-#else /* AFS_OSF_ENV */
+#else /* AFS_OSF_ENV || AFS_FBSD_ENV */
 #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)                       \
        do {                                                    \
            int haveGlock = ISAFS_GLOCK();                      \
@@ -291,7 +303,7 @@ typedef struct timeval osi_timeval_t;
            if (haveGlock)                                      \
                AFS_GLOCK();                                    \
        } while(0)
-#endif /* AFS_OSF_ENV */
+#endif /* AFS_OSF_ENV || AFS_FBSD_ENV */
 
 #else /* AFS_GLOBAL_SUNLOCK */
 
@@ -310,18 +322,18 @@ typedef struct timeval osi_timeval_t;
            CODE = copyout((SRC),(DST),(LEN));                  \
        } while(0)
 
-#ifdef AFS_OSF_ENV
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
 #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)                       \
        do {                                                    \
            (UIO)->uio_rw = (RW);                               \
            CODE = uiomove((SRC),(LEN),(UIO));                  \
        } while(0)
-#else /* AFS_OSF_ENV */
+#else /* AFS_OSF_ENV || AFS_FBSD_ENV */
 #define AFS_UIOMOVE(SRC,LEN,RW,UIO,CODE)                       \
        do {                                                    \
            CODE = uiomove((SRC),(LEN),(RW),(UIO));             \
        } while(0)
-#endif /* AFS_OSF_ENV */
+#endif /* AFS_OSF_ENV || AFS_FBSD_ENV */
 
 #endif /* AFS_GLOBAL_SUNLOCK */
 
index d4d00375e8a2ec252e67e18b176f7f437e44a82f..80a81546149030bc10e8bf126bad98b5d78055a2 100644 (file)
@@ -196,14 +196,15 @@ copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst)
        }
 #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */
 
-#if defined(AFS_LINUX_64BIT_KERNEL)
+#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV)
        struct afs_ioctl32 dst32;
 
 #ifdef AFS_SPARC64_LINUX20_ENV
-       if (current->tss.flags & SPARC_FLAG_32BIT) {
+       if (current->tss.flags & SPARC_FLAG_32BIT) 
 #else
 #error Not done for this linux type
-#endif
+#endif /* AFS_SPARC64_LINUX20_ENV */
+         {
                AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code);
                if (!code)
                        afs_ioctl32_to_afs_ioctl(&dst32, dst);
@@ -380,6 +381,18 @@ afs_xioctl (p, args, retval)
         caddr_t arg;
     } *uap = (struct a *)args;
 #else /* AFS_OSF_ENV */
+#ifdef AFS_DARWIN_ENV
+struct ioctl_args {
+        int fd;
+        u_long com;
+        caddr_t arg;
+};
+afs_xioctl(p, uap, retval) 
+        struct proc *p; 
+        register struct ioctl_args *uap;
+        register_t *retval;
+{
+#else
 #ifdef AFS_LINUX22_ENV
 struct afs_ioctl_sys {
     unsigned int com;
@@ -398,11 +411,12 @@ afs_xioctl ()
        caddr_t arg;
       } *uap = (struct a *)u.u_ap;
 #endif /* AFS_LINUX22_ENV */
+#endif /* AFS_DARWIN_ENV */
 #endif /* AFS_OSF_ENV */
 #endif /* AFS_SUN5_ENV */
 #endif
 #ifndef AFS_LINUX22_ENV
-#if    defined(AFS_AIX32_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV)
+#if    defined(AFS_AIX32_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
       struct file *fd;
 #else
       register struct file *fd;
@@ -412,6 +426,10 @@ afs_xioctl ()
       register int ioctlDone = 0, code = 0;
       
       AFS_STATCNT(afs_xioctl);
+#ifdef AFS_DARWIN_ENV
+        if ((code=fdgetf(p, uap->fd, &fd)))
+           return code;
+#else
 #ifdef AFS_LINUX22_ENV
     ua.com = com;
     ua.arg = arg;
@@ -447,6 +465,7 @@ afs_xioctl ()
 #endif
 #endif
 #endif
+#endif
 #endif
       
       /* first determine whether this is any sort of vnode */
@@ -483,6 +502,9 @@ afs_xioctl ()
            if (code) {
              osi_FreeSmallSpace(datap);
              AFS_GUNLOCK();
+#ifdef AFS_DARWIN_ENV
+              return code;
+#else 
 #if    defined(AFS_SUN5_ENV)
 #ifdef AFS_SUN54_ENV
              releasef(uap->fd);
@@ -509,6 +531,7 @@ afs_xioctl ()
              return;
 #endif
 #endif
+#endif
 #endif
            }
            code = HandleIoctl(tvc, uap->com, datap);
@@ -552,6 +575,9 @@ afs_xioctl ()
 #endif
           code = ioctl(uap, rvp);
 #else
+#if defined(AFS_DARWIN_ENV)
+        return ioctl(p, uap, retval);
+#else
 #ifdef  AFS_OSF_ENV
          code = ioctl(p, args, retval);
 #ifdef AFS_OSF30_ENV
@@ -567,6 +593,7 @@ afs_xioctl ()
 #endif
 #endif
 #endif
+#endif
 #endif
       }
 #ifdef AFS_SUN5_ENV
@@ -581,7 +608,7 @@ afs_xioctl ()
 #ifdef AFS_LINUX22_ENV
       return -code;
 #else
-#if    !defined(AFS_OSF_ENV)
+#if    !defined(AFS_OSF_ENV) && !defined(AFS_DARWIN_ENV)
       if (!getuerror())
          setuerror(code);
 #if    defined(AFS_AIX32_ENV) && !defined(AFS_AIX41_ENV)
@@ -592,7 +619,7 @@ afs_xioctl ()
 #endif
 #endif /* AFS_LINUX22_ENV */
 #endif /* AFS_SUN5_ENV */
-#ifdef AFS_OSF_ENV
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
       return (code);
 #endif
     }
@@ -644,8 +671,28 @@ afs_pioctl(p, args, retval)
 
 extern struct mount *afs_globalVFS;
 #else  /* AFS_OSF_ENV */
+#ifdef AFS_DARWIN_ENV
+afs_pioctl(p, args, retval)
+        struct proc *p;
+        void *args;
+        int *retval;
+{
+    struct a {
+        char    *path;
+        int     cmd;
+        caddr_t cmarg;
+        int     follow; 
+    } *uap = (struct a *) args;
+    
+    AFS_STATCNT(afs_pioctl);
+    return (afs_syscall_pioctl(uap->path, uap->cmd, uap->cmarg, uap->follow, p->p_cred->pc_ucred));
+}   
+
+extern struct mount *afs_globalVFS;
+#else   /* AFS_OSF_ENV */
 extern struct vfs *afs_globalVFS;
 #endif
+#endif
 
 /* macro to avoid adding any more #ifdef's to pioctl code. */
 #if defined(AFS_LINUX22_ENV) || defined(AFS_AIX41_ENV)
@@ -659,10 +706,15 @@ afs_syscall_pioctl(path, com, cmarg, follow, rvp, credp)
     rval_t *rvp;
     struct AFS_UCRED *credp;
 #else
+#ifdef AFS_DARWIN_ENV
+afs_syscall_pioctl(path, com, cmarg, follow, credp)
+    struct AFS_UCRED *credp;
+#else
 afs_syscall_pioctl(path, com, cmarg, follow)
+#endif
 #endif
     char *path;
-    int        com;
+    unsigned int       com;
     caddr_t cmarg;
     int        follow;
 {
@@ -685,7 +737,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
 #ifndef        AFS_SUN5_ENV
     if (! _VALIDVICEIOCTL(com)) {
        PIOCTL_FREE_CRED();
-#ifdef AFS_OSF_ENV
+#if defined(AFS_OSF_ENV) || defined(AFS_DARWIN_ENV)
         return EINVAL;
 #else  /* AFS_OSF_ENV */
 #if defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
@@ -700,7 +752,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
     code = copyin_afs_ioctl(cmarg, &data);
     if (code) {
        PIOCTL_FREE_CRED();
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
        return (code);
 #else
        setuerror(code);
@@ -708,9 +760,9 @@ afs_syscall_pioctl(path, com, cmarg, follow)
 #endif
   }
     if ((com & 0xff) == PSetClientContext) {
-#ifdef AFS_LINUX22_ENV
+#if defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
        return EINVAL; /* Not handling these yet. */
-#endif
+#else
 #if    defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV)
        code = HandleClientContext(&data, &com, &foreigncreds, credp);
 #else
@@ -723,20 +775,21 @@ afs_syscall_pioctl(path, com, cmarg, follow)
        code = HandleClientContext(&data, &com, &foreigncreds, u.u_cred);
 #endif /* AFS_SGI_ENV */
 #endif
+#endif
 #endif
       if (code) {
          if (foreigncreds) {
              crfree(foreigncreds);
          }
          PIOCTL_FREE_CRED();
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
          return (code);
 #else
          return (setuerror(code), code);
 #endif
       }
     } 
-#ifndef AFS_LINUX22_ENV
+#if !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
     if (foreigncreds) {
       /*
        * We could have done without temporary setting the u.u_cred below
@@ -773,7 +826,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
     if ((com & 0xff) == 15) {
       /* special case prefetch so entire pathname eval occurs in helper process.
         otherwise, the pioctl call is essentially useless */
-#if    defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
        code =  Prefetch(path, &data, follow,
                         foreigncreds ? foreigncreds : credp);
 #else
@@ -787,7 +840,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
 #endif /* AFS_SGI64_ENV */
 #endif /* AFS_HPUX101_ENV */
 #endif
-#ifndef AFS_LINUX22_ENV
+#if !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
        if (foreigncreds) {
 #ifdef AFS_AIX41_ENV
            crset(tmpcred);     /* restore original credentials */
@@ -808,7 +861,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
        }
 #endif /* AFS_LINUX22_ENV */
        PIOCTL_FREE_CRED();
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
        return (code);
 #else
        return (setuerror(code), code);
@@ -830,7 +883,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
 #endif /* AFS_AIX41_ENV */
        AFS_GLOCK();
        if (code) {
-#ifndef AFS_LINUX22_ENV
+#if !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
            if (foreigncreds) {
 #ifdef AFS_AIX41_ENV
                crset(tmpcred); /* restore original credentials */
@@ -851,7 +904,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
            }
 #endif /* AFS_LINUX22_ENV */
            PIOCTL_FREE_CRED();
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
            return (code);
 #else
            return(setuerror(code), code);
@@ -906,7 +959,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
       code = afs_HandlePioctl(vp, com, &data, follow, &credp);
       }
 #else
-#ifdef AFS_LINUX22_ENV
+#if defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
       code = afs_HandlePioctl(vp, com, &data, follow, &credp);
 #else
       code = afs_HandlePioctl(vp, com, &data, follow, &u.u_cred);
@@ -916,7 +969,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
 #endif /* AFS_AIX41_ENV */
 #endif /* AFS_SUN5_ENV */
     } else {
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
        code = EINVAL;  /* not in /afs */
 #else
        setuerror(EINVAL);
@@ -929,7 +982,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
 #endif
     }
 
-#ifndef AFS_LINUX22_ENV
+#if !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV)
     if (foreigncreds) {
 #ifdef AFS_AIX41_ENV
        crset(tmpcred);
@@ -957,7 +1010,7 @@ afs_syscall_pioctl(path, com, cmarg, follow)
 #endif
     }
     PIOCTL_FREE_CRED();
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
     return (code);
 #else
     if (!getuerror())  
@@ -1368,10 +1421,17 @@ static PGCPAGs(avc, afun, areq, ain, aout, ainSize, aoutSize, acred)
     afs_PutCell(tcell, READ_LOCK);
     if (set_parent_pag) {
        int pag;
+#ifdef AFS_DARWIN_ENV
+        struct proc *p=current_proc(); /* XXX */
+        uprintf("Process %d (%s) tried to change pags in PSetTokens\n",
+                p->p_pid, p->p_comm);
+        if (!setpag(p, acred, -1, &pag, 1)) {
+#else   
 #ifdef AFS_OSF_ENV
        if (!setpag(u.u_procp, acred, -1, &pag, 1)) {   /* XXX u.u_procp is a no-op XXX */
 #else
        if (!setpag(acred, -1, &pag, 1)) {
+#endif
 #endif
            afs_InitReq(&treq, *acred);
            areq = &treq;
@@ -1502,10 +1562,16 @@ static PSetVolumeStatus(avc, afun, areq, ain, aout, ainSize, aoutSize)
     cp = ain;
     bcopy(cp, (char *)&volstat, sizeof(AFSFetchVolumeStatus));
     cp += sizeof(AFSFetchVolumeStatus);
+    if (strlen(cp) >= sizeof(volName))
+       return E2BIG;
     strcpy(volName, cp);
     cp += strlen(volName)+1;
+    if (strlen(cp) >= sizeof(offLineMsg))
+       return E2BIG;
     strcpy(offLineMsg, cp);
     cp +=  strlen(offLineMsg)+1;
+    if (strlen(cp) >= sizeof(motd))
+       return E2BIG;
     strcpy(motd, cp);
     storeStat.Mask = 0;
     if (volstat.MinQuota != -1) {
@@ -1969,7 +2035,11 @@ struct AFS_UCRED *acred;
 {
     register char *tp;
     register afs_int32 code;
+#if defined(AFS_SGI61_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_DARWIN_ENV)
+    size_t bufferSize;
+#else
     u_int bufferSize;
+#endif
 
     AFS_STATCNT(Prefetch);
     if (!apath) return EINVAL;
@@ -2470,8 +2540,12 @@ struct AFS_UCRED *acred;
            if (tvc->fid.Fid.Volume == volume && tvc->fid.Cell == cell) {
 #if    defined(AFS_SGI_ENV) || defined(AFS_ALPHA_ENV)  || defined(AFS_SUN5_ENV)  || defined(AFS_HPUX_ENV)
                VN_HOLD((struct vnode *)tvc);
+#else
+#if defined(AFS_DARWIN_ENV)
+               osi_vnhold(tvc, 0);
 #else
                tvc->vrefCount++;
+#endif
 #endif
                ReleaseReadLock(&afs_xvcache);
 #if    defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_SUN5_ENV)
@@ -2618,7 +2692,7 @@ register struct AFS_UCRED *acred;
     AFS_STATCNT(PSetSysName);
     if (!afs_globalVFS) {
       /* Afsd is NOT running; disable it */
-#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV)
+#if    defined(AFS_SUN5_ENV) || defined(AFS_OSF_ENV) || defined(AFS_SGI64_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV)
        return (EINVAL);
 #else
        return (setuerror(EINVAL), EINVAL);
index 974cf8e3f937557ea994ab4a6dfc6a38ebeb3dc2..fa3745cacbcbcd03635a895dc21bbd1caf21490c 100644 (file)
 #define        AFS_XLATOR_MAGIC        0x87654321
 #endif
 
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#define AFS_NFSXLATORREQ(cred) 0
+#else
 #ifdef AFS_OSF_ENV
 #define        AFS_NFSXLATORREQ(cred)    ((cred)->cr_ruid == NFSXLATOR_CRED)
 #else
 #define        AFS_NFSXLATORREQ(cred)    ((cred)->cr_rgid == NFSXLATOR_CRED)
 #endif
+#endif
 
 struct exporterops {
     int            (*export_reqhandler)();
index 69ed4094eec1e1f065fd2c8712137a56f4ac69fa..3d62e43f80fe82787b369c5cf20bef820ca9f13d 100644 (file)
@@ -12,14 +12,13 @@ DESTDIR = DEST/
 SRCDIR = DEST/
 
 SOURCES = afsd.c sys.c
-INSTALL = ${SRCDIR}bin/install
-INSTALLro = ${SRCDIR}bin/install -m 644
-INSTALLex = ${SRCDIR}bin/install -m 755
 
 COMPONENT=afsd
 include ../config/Makefile.${SYS_NAME}
 include ../config/Makefile.version
 
+INSTALLro = ${INSTALL} -m 644
+INSTALLex = ${INSTALL} -m 755
 CFLAGS = -g -I${SRCDIR}include ${XCFLAGS}
 LDFLAGS = -g ${XLDFLAGS}
 
@@ -38,8 +37,6 @@ AFSLIBS=$(SRCDIR)lib/afs/libauth.a ${SRCDIR}lib/afs/libcmd.a $(SRCDIR)lib/afs/li
 
 afsd: afsd.o $(AFSLIBS)
        case ${SYS_NAME} in \
-       rs_aix*) \
-               ${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} ;; \
        sgi_61 | sgi_62 | sgi_63) \
                ${CC} ${CFLAGS} -g -o afsd afsd.o $(NON_SHARED) $(LDFLAGS) $(AFSLIBS) ${XLIBS} /usr/lib/libdwarf.a /usr/lib/libelf.a ;; \
        sgi_64 | sgi_65 ) \
@@ -102,8 +99,19 @@ install: all
                 hp?00_ux10? ) \
                        ${INSTALL} afs.rc.hpux10 ${DESTDIR}root.client/usr/vice/etc/dkload/afs.rc ;;\
                *linux* ) \
-                       ${INSTALLex} -f afs.rc.linux ${DESTDIR}root.client/usr/vice/etc/afs.rc; \
-                       ${INSTALL} afs.conf.linux ${DESTDIR}root.client/usr/vice/etc/afs.conf ;; \
+                       ${INSTALLex}  afs.rc.linux ${DESTDIR}root.client/usr/vice/etc/afs.rc; \
+                       ${INSTALL}  afs.conf.linux ${DESTDIR}root.client/usr/vice/etc/afs.conf ;; \
+               ppc_darwin*) \
+                       mkdir -p ${DESTDIR}root.client/usr/vice/etc/afs.kext/Contents/MacOS ;\
+                       ${INSTALL} -f afs.ppc_darwin.plist ${DESTDIR}root.client/usr/vice/etc/afs.kext/Contents/Info.plist ; \
+                       ${INSTALLex} -f afs.rc.darwin ${DESTDIR}root.client/usr/vice/etc/afs.rc ; \
+                       ${INSTALL} -f afs.rc.darwin.plist ${DESTDIR}root.client/usr/vice/etc/StartupParameters.plist ;; \
+               *fbsd*) \
+                       mkdir -p ${DESTDIR}root.client/usr/vice/etc/afs.rc; \
+                       ${INSTALL} -f afs.rc.fbsd ${DESTDIR}root.client/usr/vice/etc/afs.rc.fbsd ;; \
                * )  \
                        echo No rc scripts installed for ${SYS_NAME} ;; \
        esac
+
+
+
index d66c1efd8bbf4e81f4ede97d1a5d902e089b59ac..bd716ea93bdddc81c8090a2e1ef6336c9fcf9ea0 100644 (file)
@@ -39,13 +39,13 @@ XLIBS=
 AR=ar
 AS=as
 CP=cp
-INSTALL=install 
 LD=ld   
 MT_CC=cc
 MV=mv
 RANLIB=ranlib
 RM=rm
-WASHTOOL=${SRCDIR}bin/washtool
+WASHTOOL=${DESTDIR}bin/washtool
+INSTALL=install
 #
 # Other OS specific requirements
 #
index a789a230b525f7e7f4f9d34a4300bf8f46ed21c8..1c226570941083e66a0230eb5799be0911db4ed0 100644 (file)
@@ -30,13 +30,13 @@ XLIBS=
 AR=ar
 AS=as
 CP=cp
-INSTALL=install 
 LD=ld
 MT_CC=cc
 MV=mv
 RANLIB=ranlib
 RM=rm
-WASHTOOL=${SRCDIR}bin/washtool
+WASHTOOL=${DESTDIR}bin/washtool
+INSTALL=install
 #
 # Other OS specific requirements
 #
index fa14ecb8fad43beb76fbf9a6e2464d21b5562337..1c226570941083e66a0230eb5799be0911db4ed0 100644 (file)
@@ -30,13 +30,13 @@ XLIBS=
 AR=ar
 AS=as
 CP=cp
-INSTALL=install
 LD=ld
 MT_CC=cc
 MV=mv
 RANLIB=ranlib
 RM=rm
-WASHTOOL=${SRCDIR}bin/washtool
+WASHTOOL=${DESTDIR}bin/washtool
+INSTALL=install
 #
 # Other OS specific requirements
 #
index 65e4f2b30c161b59110d8e1a3e1223c6068b70ab..fe13b0596ca0ff4ebf75f613a46f22a50606de99 100644 (file)
@@ -34,13 +34,13 @@ XLIBS=
 AR=ar
 AS=as
 CP=cp
-INSTALL=${SRCDIR}bin/install
 LD=ld   
 MT_CC=cc
 MV=mv
 RANLIB=ranlib
 RM=rm
-WASHTOOL=${SRCDIR}bin/washtool
+WASHTOOL=${DESTDIR}bin/washtool
+INSTALL=${DESTDIR}bin/install
 #
 # Other OS specific requirements
 #
index b95ae5fcfaa3ec1df6ceac47ed4cfce7ed8f083e..94547bb77c93787a594c023f2fd845ab1178e5fa 100644 (file)
@@ -34,13 +34,13 @@ XLIBS=
 AR=ar
 AS=as
 CP=cp
-INSTALL=install
 LD=ld   
 MT_CC=cc
 MV=mv
 RANLIB=ranlib
 RM=rm
-WASHTOOL=${SRCDIR}bin/washtool
+WASHTOOL=${DESTDIR}bin/washtool
+INSTALL=install
 #
 # Other OS specific requirements
 #
index 5eb4e8b3300b66958a56ab7cfee90832761c117e..69d301123088c0d7b89786033ef454443b68be2f 100644 (file)
@@ -10,7 +10,6 @@
 SHELL=/bin/sh
 DESTDIR = DEST/
 SRCDIR = DEST/
-INSTALL = install
 INCLUDE= -I.  -I/usr/include
 Aobj=COMMON
 Dobj=DYNEL
index 428bd45441f47e7e894a2f906f6ef918607b5d71..32568492ba5fe939ecd023fb2e865cd6684c3d23 100644 (file)
@@ -38,11 +38,14 @@ LD = ld
 # -Wall
 <i386_linux22 i386_linux24>
 CCFLAGS =   -O2 -fomit-frame-pointer \
-       -fno-strength-reduce -pipe -m486 -malign-loops=2 -malign-jumps=2 \
+       -fno-strength-reduce -pipe -march=i486 -malign-loops=2 -malign-jumps=2 \
        -malign-functions=2
-DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
+DEFINES = -D__KERNEL__  -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} ${KDEFINES}
+<alpha_linux_22 alpha_linux_24>
+CCFLAGS = -O2 -fomit-frame-pointer -fno-strength-reduce -pipe -mno-fp-regs -ffixed-8
+DEFINES = -D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
 <s390_linux22 s390_linux24>
-CCFLAGS =   -O2 -fomit-frame-pointer -fno-strength-reduce \
+CCFLAGS =   -O -fomit-frame-pointer -fno-strength-reduce \
        -fno-strict-aliasing -fsigned-char 
 DEFINES = -D__KERNEL__  -D__s390__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
 
@@ -71,6 +74,9 @@ CFLAGS = $(CCFLAGS) $(DEFINES) $(INCLUDES)
 KOBJ = MODLOAD
 MPS = MP SP
 
+# To pick up anything we might have missed
+include Makefile.extradefs
+
 # COMPDIRS is called in Makefile.common to do the actual builds.
 COMPDIRS=linux_compdirs
 
@@ -86,6 +92,9 @@ setup:
                        mkdir -p $${KDIR}; \
                        ln -fs ../Makefile $${KDIR}/Makefile ; \
                        ln -fs ../Makefile.common $${KDIR}/Makefile.common; \
+<i386_linux22 i386_linux24>
+                       sh ./redhat.sh ${LINUX_VERS} $${KDIR}/Makefile.extradefs; \
+<all>
                done \
        done
        
@@ -109,8 +118,12 @@ ${COMPDIRS}:
                rm -f sys; \
                ln -s $${IDIR} sys; \
                rm -f asm; \
+<alpha_linux_22 alpha_linux_24>
+               ln -s ${LINUX_SRCDIR}$$v/include/asm-alpha asm ; \
 <i386_linux22 i386_linux24>
                ln -s ${LINUX_SRCDIR}/include/asm-i386 asm ; \
+<s390_linux22 s390_linux24>
+               ln -s ${LINUX_SRCDIR}/include/asm-s390 asm ; \
 <ppc_linux22 ppc_linux24>
                ln -s ${LINUX_SRCDIR}/include/asm-ppc asm ; \
 <sparc_linux22 sparc_linux24>
@@ -122,14 +135,14 @@ ${COMPDIRS}:
                        KDIR=${KOBJ}-$$m ; \
                        echo Building in directory: $${KDIR} ; \
                        if [ "$$m" = "MP" ] ; then \
-                               SMP_DEF="-DAFS_SMP" ; \
+                               SMP_DEF="-DAFS_SMP -D__BOOT_KERNEL_SMP=1 -D__BOOT_KERNEL_UP=0 -D__SMP__" ; \
                                TARG="libafs.mp" ; \
                        else  \
-                               SMP_DEF="" ; \
+                               SMP_DEF="-D__BOOT_KERNEL_SMP=0 -D__BOOT_KERNEL_UP=1 -U__SMP__" ; \
                                TARG=libafs ; \
                        fi ; \
                        cd $${KDIR} ; \
-                       $(MAKE) DESTDIR=${DESTDIR} SMP_DEF=$${SMP_DEF} $${TARG} CLIENT="" || exit $$?; \
+                       $(MAKE) DESTDIR=${DESTDIR} SMP_DEF="$${SMP_DEF}" $${TARG} CLIENT= || exit $$?; \
                        cd ../ ; \
                done \
        done
index a70dfa6b531192952b40e46f26b5dc74acfd2893..1a40ca8ac96648e679017dc78b9c0d2b6b77acd3 100644 (file)
@@ -39,7 +39,7 @@ extern char* getenv();
 extern void *malloc(int size);
 extern void *realloc(void *ptr, int size);
 #endif
-#if defined(AFS_OSF_ENV) || defined(AFS_LINUX20_ENV)
+#if defined(AFS_OSF_ENV) || defined(AFS_S390_LINUX20_ENV)
 extern int PRE_Block;  /* from preempt.c */
 #else
 extern char PRE_Block; /* from preempt.c */
@@ -343,7 +343,7 @@ int LWP_CreateProcess(ep, stacksize, priority, parm, name, pid)
 #ifdef __hp9000s800
        savecontext(Create_Process_Part2, &temp2->context, stackptr+MINFRAME);
 #else
-#ifdef AFS_SGI62_ENV
+#if defined(AFS_SGI62_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
        /* Need to have the sp on an 8-byte boundary for storing doubles. */
        savecontext(Create_Process_Part2, &temp2->context,
                    stackptr+stacksize-16); /* 16 = 2 * jmp_buf_type*/
@@ -485,7 +485,7 @@ int LWP_DestroyProcess(pid)         /* destroy a lightweight process */
            savecontext(Dispatcher, &(temp -> context),
                        &(LWPANCHOR.dsptchstack[MINFRAME]));
 #else
-#ifdef AFS_SGI62_ENV
+#if defined(AFS_SGI62_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
            savecontext(Dispatcher, &(temp -> context),
                        &(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-8]));
 #else
index e2bcc61d25dee2a0b48cb86d1283bb92a0603764..0b2bf529e77d55b34124498bdb5901d1ee51d27e 100644 (file)
@@ -17,7 +17,7 @@
 \*******************************************************************/
 #include <afs/param.h>
 
-#ifdef AFS_LINUX20_ENV
+#if defined(AFS_LINUX20_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
 int PRE_Block = 0;
 #else
 #include <sys/time.h>
index 56c020a635de09bde48a95a516cf56dd4a23d616..32aa938699c8e02eb6fbb3d4b52da2d760abf743 100644 (file)
@@ -44,9 +44,16 @@ extern char PRE_Block;             /* used in lwp.c and process.s */
 #elif   defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV)
 #define LWP_SP 0
 #define LWP_FP 1
+#elif defined(AFS_ALPHA_LINUX20_ENV)
+#define LWP_SP 8
+#define LWP_FP 7
 #else
 #error Unsupported linux LWP system type.
 #endif
+#elif   defined(AFS_X86_FBSD_ENV)
+#define LWP_SP 4
+#elif   defined(AFS_DARWIN_ENV)
+#define LWP_SP 16
 #else
      Need offset to SP in jmp_buf for this platform.
 #endif
@@ -62,8 +69,12 @@ extern char PRE_Block;             /* used in lwp.c and process.s */
 typedef __uint64_t jmp_buf_type;
 #endif
 #else
+#ifdef AFS_ALPHA_LINUX20_ENV
+typedef long jmp_buf_type;
+#else
 typedef int jmp_buf_type;
-#endif
+#endif /*AFS_ALPHA_LINUX20_ENV*/
+#endif /*SGI*/
 
 static jmp_buf jmp_tmp;
 static char    (*EP)();
index f8ef0f0a7ac37905f6965b66efda36162b3c8203..ae6e505a59a98225f193e55c47f18b7bc925d078 100644 (file)
@@ -95,6 +95,9 @@ extern afs_int32 afs_termState;
 extern afs_uint32 LWP_ThreadId();
 #endif /* RXDEBUG */
 
+int (*registerProgram)() = 0;
+int (*swapNameProgram)() = 0;
+
 #ifdef AFS_GLOBAL_RXLOCK_KERNEL
 struct rx_tq_debug {
     afs_int32 rxi_start_aborted; /* rxi_start awoke after rxi_Send in error. */
@@ -252,7 +255,7 @@ void rxi_StartUnlocked();
 ** pretty good that the next packet coming in is from the same connection 
 ** as the last packet, since we're send multiple packets in a transmit window.
 */
-struct rx_connection *rxLastConn; 
+struct rx_connection *rxLastConn = 0
 
 #ifdef RX_ENABLE_LOCKS
 /* The locking hierarchy for rx fine grain locking is composed of five
@@ -618,7 +621,7 @@ void rxi_StartServerProcs(nExistingProcs)
 void rx_StartServer(donateMe)
 {
     register struct rx_service *service;
-    register int i;
+    register int i, nProcs;
     SPLVAR;
     clock_NewTime();
 
@@ -652,7 +655,26 @@ void rx_StartServer(donateMe)
     AFS_RXGUNLOCK();
     USERPRI;
 
-    if (donateMe) rx_ServerProc(); /* Never returns */
+    if (donateMe) {
+#ifndef AFS_NT40_ENV
+#ifndef KERNEL
+       int code;
+        char name[32];
+#ifdef AFS_PTHREAD_ENV
+        pid_t pid;
+        pid = pthread_self();
+#else /* AFS_PTHREAD_ENV */
+        PROCESS pid;
+        code = LWP_CurrentProcess(&pid);
+#endif /* AFS_PTHREAD_ENV */
+
+        sprintf(name,"srv_%d", ++nProcs);
+       if (registerProgram)
+            (*registerProgram)(pid, name);
+#endif /* KERNEL */
+#endif /* AFS_NT40_ENV */
+       rx_ServerProc(); /* Never returns */
+    }
     return;
 }
 
@@ -3151,7 +3173,7 @@ nextloop:;
     } else if (call->nSoftAcks > (u_short)rxi_SoftAckRate) {
        rxevent_Cancel(call->delayedAckEvent, call, RX_CALL_REFCOUNT_DELAY);
        np = rxi_SendAck(call, np, seq, serial, flags,
-                        RX_ACK_DELAY, istack);
+                        RX_ACK_IDLE, istack);
     } else if (call->nSoftAcks) {
        clock_GetTime(&when);
        if (haveLast && !(flags & RX_CLIENT_INITIATED)) {
@@ -3267,13 +3289,17 @@ struct rx_packet *rxi_ReceiveAckPacket(call, np, istack)
        if (tp->header.seq >= first) break;
        call->tfirst = tp->header.seq + 1;
        if (tp->header.serial == serial) {
-         rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
+         /* Use RTT if not delayed by client. */
+         if (ap->reason != RX_ACK_DELAY)
+             rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
 #ifdef ADAPT_WINDOW
          rxi_ComputeRate(peer, call, tp, np, ap->reason);
 #endif
        }
-       else if ((tp->firstSerial == serial)) {
-         rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
+       else if (tp->firstSerial == serial) {
+           /* Use RTT if not delayed by client. */
+           if (ap->reason != RX_ACK_DELAY)
+               rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
 #ifdef ADAPT_WINDOW
          rxi_ComputeRate(peer, call, tp, np, ap->reason);
 #endif
@@ -3334,13 +3360,17 @@ struct rx_packet *rxi_ReceiveAckPacket(call, np, istack)
 #endif /* RX_ENABLE_LOCKS */
 #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
        if (tp->header.serial == serial) {
-         rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
+           /* Use RTT if not delayed by client. */
+           if (ap->reason != RX_ACK_DELAY)
+               rxi_ComputeRoundTripTime(tp, &tp->timeSent, peer);
 #ifdef ADAPT_WINDOW
          rxi_ComputeRate(peer, call, tp, np, ap->reason);
 #endif
        }
        else if ((tp->firstSerial == serial)) {
-         rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
+           /* Use RTT if not delayed by client. */
+           if (ap->reason != RX_ACK_DELAY)
+               rxi_ComputeRoundTripTime(tp, &tp->firstSent, peer);
 #ifdef ADAPT_WINDOW
          rxi_ComputeRate(peer, call, tp, np, ap->reason);
 #endif
@@ -3820,7 +3850,7 @@ register struct rx_call **newcallp;
        if (call->flags & RX_CALL_CLEARED) {
            /* send an ack now to start the packet flow up again */
            call->flags &= ~RX_CALL_CLEARED;
-           rxi_SendAck(call, 0, 0, 0, 0, RX_ACK_DELAY, 0);
+           rxi_SendAck(call, 0, 0, 0, 0, RX_ACK_IDLE, 0);
        }
 #ifdef RX_ENABLE_LOCKS
        CV_SIGNAL(&sq->cv);
@@ -4447,7 +4477,7 @@ struct rx_packet *rxi_SendAck(call, optionalPacket, seq, serial, pflags, reason,
 }
 
 /* Send all of the packets in the list in single datagram */
-static void rxi_SendList(call, list, len, istack, moreFlag, now, retryTime)
+static void rxi_SendList(call, list, len, istack, moreFlag, now, retryTime, resending)
   struct rx_call *call;
   struct rx_packet **list;
   int len;
@@ -4455,6 +4485,7 @@ static void rxi_SendList(call, list, len, istack, moreFlag, now, retryTime)
   int moreFlag;
   struct clock *now;
   struct clock *retryTime;
+  int resending;
 {
     int i;
     int requestAck = 0;
@@ -4464,6 +4495,7 @@ static void rxi_SendList(call, list, len, istack, moreFlag, now, retryTime)
 
     MUTEX_ENTER(&peer->peer_lock);
     peer->nSent += len;
+    if (resending) peer->reSends += len;
     MUTEX_ENTER(&rx_stats_mutex);
     rx_stats.dataPacketsSent += len;
     MUTEX_EXIT(&rx_stats_mutex);
@@ -4517,6 +4549,7 @@ static void rxi_SendList(call, list, len, istack, moreFlag, now, retryTime)
 
        MUTEX_ENTER(&peer->peer_lock);
        peer->nSent++;
+       if (resending) peer->reSends++;
        MUTEX_ENTER(&rx_stats_mutex);
        rx_stats.dataPacketsSent++;
        MUTEX_EXIT(&rx_stats_mutex);
@@ -4565,13 +4598,14 @@ static void rxi_SendList(call, list, len, istack, moreFlag, now, retryTime)
  * We always keep the last list we should have sent so we
  * can set the RX_MORE_PACKETS flags correctly.
  */
-static void rxi_SendXmitList(call, list, len, istack, now, retryTime)
+static void rxi_SendXmitList(call, list, len, istack, now, retryTime, resending)
   struct rx_call *call;
   struct rx_packet **list;
   int len;
   int istack;
   struct clock *now;
   struct clock *retryTime;
+  int resending;
 {
     int i, cnt, lastCnt = 0;
     struct rx_packet **listP, **lastP = 0;
@@ -4585,7 +4619,7 @@ static void rxi_SendXmitList(call, list, len, istack, now, retryTime)
                || list[i]->acked
                || list[i]->length > RX_JUMBOBUFFERSIZE)) {
            if (lastCnt > 0) {
-               rxi_SendList(call, lastP, lastCnt, istack, 1, now, retryTime);
+               rxi_SendList(call, lastP, lastCnt, istack, 1, now, retryTime, resending);
                /* If the call enters an error state stop sending, or if
                 * we entered congestion recovery mode, stop sending */
                if (call->error || (call->flags & RX_CALL_FAST_RECOVER_WAIT))
@@ -4608,7 +4642,7 @@ static void rxi_SendXmitList(call, list, len, istack, now, retryTime)
                || list[i]->length != RX_JUMBOBUFFERSIZE) {
                if (lastCnt > 0) {
                    rxi_SendList(call, lastP, lastCnt, istack, 1,
-                                now, retryTime);
+                                now, retryTime, resending);
                    /* If the call enters an error state stop sending, or if
                     * we entered congestion recovery mode, stop sending */
                    if (call->error || (call->flags&RX_CALL_FAST_RECOVER_WAIT))
@@ -4643,17 +4677,17 @@ static void rxi_SendXmitList(call, list, len, istack, now, retryTime)
        }
        if (lastCnt > 0) {
            rxi_SendList(call, lastP, lastCnt, istack, morePackets,
-                        now, retryTime);
+                        now, retryTime, resending);
            /* If the call enters an error state stop sending, or if
             * we entered congestion recovery mode, stop sending */
            if (call->error || (call->flags & RX_CALL_FAST_RECOVER_WAIT))
                return;
        }
        if (morePackets) {
-           rxi_SendList(call, listP, cnt, istack, 0, now, retryTime);
+           rxi_SendList(call, listP, cnt, istack, 0, now, retryTime, resending);
        }
     } else if (lastCnt > 0) {
-       rxi_SendList(call, lastP, lastCnt, istack, 0, now, retryTime);
+       rxi_SendList(call, lastP, lastCnt, istack, 0, now, retryTime, resending);
     }
 }
 
@@ -4688,6 +4722,7 @@ void rxi_Start(event, call, istack)
     int nXmitPackets;
     int maxXmitPackets;
     struct rx_packet **xmitList;
+    int resending = 0;
 
     /* If rxi_Start is being called as a result of a resend event,
      * then make sure that the event pointer is removed from the call
@@ -4696,6 +4731,7 @@ void rxi_Start(event, call, istack)
     if (event && event == call->resendEvent) {
        CALL_RELE(call, RX_CALL_REFCOUNT_RESEND);
        call->resendEvent = NULL;
+       resending = 1;
        if (queue_IsEmpty(&call->tq)) {
            /* Nothing to do */
            return;
@@ -4845,7 +4881,7 @@ void rxi_Start(event, call, istack)
         * ready to send. Now we loop to send the packets */
        if (nXmitPackets > 0) {
            rxi_SendXmitList(call, xmitList, nXmitPackets, istack,
-                            &now, &retryTime);
+                            &now, &retryTime, resending);
        }
        osi_Free(xmitList, maxXmitPackets * sizeof(struct rx_packet *));
 
@@ -5265,10 +5301,21 @@ void rxi_ComputeRoundTripTime(p, sentp, peer)
 {
        struct clock thisRtt, *rttp = &thisRtt;
 
+#if defined(AFS_ALPHA_LINUX22_ENV) && defined(AFS_PTHREAD_ENV) && !defined(KERNEL)
+       /* making year 2038 bugs to get this running now - stroucki */
+       struct timeval temptime;
+#endif
       register int rtt_timeout;
       static char id[]="@(#)adaptive RTO";
 
-    clock_GetTime(rttp);
+#if defined(AFS_ALPHA_LINUX20_ENV) && defined(AFS_PTHREAD_ENV) && !defined(KERNEL)
+      /* yet again. This was the worst Heisenbug of the port - stroucki */
+      clock_GetTime(&temptime);
+      rttp->sec=(afs_int32)temptime.tv_sec;
+      rttp->usec=(afs_int32)temptime.tv_usec;
+#else
+      clock_GetTime(rttp);
+#endif
     if (clock_Lt(rttp, sentp)) {
       clock_Zero(rttp);
       return;     /* somebody set the clock back, don't count this time. */
index 5d6f3018c05390c4c0af1f3316ab813284b1c420..b39b3a88298f572e6eb72cd2f756be52edb7d311 100644 (file)
@@ -29,6 +29,9 @@ static pthread_once_t dirInit_once = PTHREAD_ONCE_INIT;
 #include <windows.h>
 #include <WINNT\afssw.h>
 #endif
+#ifdef AFS_DARWIN_ENV
+#include <unistd.h>
+#endif
 
 /* local vars */
 /* static storage for path strings */
@@ -156,6 +159,11 @@ static void initDirPathArray(void)
     strcpy(afsSrvDirPath, AFSDIR_CANONICAL_SERVER_AFS_DIRPATH);
 
     /* setup the root client directory path */
+#ifdef AFS_DARWIN_ENV
+    if (access(AFSDIR_ALTERNATE_CLIENT_VICE_DIRPATH, F_OK) == 0)
+        strcpy(afsClntDirPath, AFSDIR_ALTERNATE_CLIENT_VICE_DIRPATH);
+    else 
+#endif
     strcpy(afsClntDirPath, AFSDIR_CANONICAL_CLIENT_VICE_DIRPATH);
 
     /* setup top level dirpath; valid for both server and client */
index 876a92edc0f87c445d6fb19de4e878c2305ea30a..5142dff15b5816d957739664df98fae0dcb365a5 100644 (file)
@@ -167,6 +167,10 @@ ConstructLocalLogPath(const char *cpath,
 #define AFSDIR_CANONICAL_USR_DIRPATH            "/usr"
 #define AFSDIR_CANONICAL_SERVER_AFS_DIRPATH     "/etc/openafs"
 #define AFSDIR_CANONICAL_CLIENT_VICE_DIRPATH    "/etc/openafs"
+#ifdef AFS_DARWIN_ENV
+#define AFSDIR_ALTERNATE_CLIENT_VICE_DIRPATH    "/var/db/openafs"
+#endif
+
 
 #define AFSDIR_CANONICAL_SERVER_BIN_DIRPATH \
  "/usr/lib/openafs/" AFSDIR_BIN_DIR
index e16e0cdf350a9872a903c87c248a06e220d46349..c58f90bed97a043d9f40f4dc30d42fa63a560cbf 100644 (file)
@@ -10,8 +10,7 @@ COMPONENT=venus
 LINUX_VERS=dummy
 include ../config/Makefile.${SYS_NAME}
 
-INSTALL = ${DESTDIR}bin/install
-INSTALLex = ${DESTDIR}bin/install -m 755
+INSTALLex = ${INSTALL} -m 755
 CCXPG2= /usr/xpg2bin/cc
 
 CFLAGS = ${OPTMZ} -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS}
@@ -77,7 +76,7 @@ ${DESTDIR}bin/cmdebug: cmdebug
 #      set -x; \
 #      case ${SYS_NAME} in \
 #      sgi_6? ) \
-#              ${INSTALLex} -f kdump.sh.sgi_ipnos $@; \
+#              ${INSTALLex} kdump.sh.sgi_ipnos $@; \
 #              ln -fs kdump ${DESTDIR}etc/kdump32; \
 #              ln -fs kdump.IP20 ${DESTDIR}etc/kdump.IP22; \
 #              ln -fs kdump.IP20 ${DESTDIR}etc/kdump.IP32; \
@@ -85,19 +84,54 @@ ${DESTDIR}bin/cmdebug: cmdebug
 #              do ${INSTALL} -s $$f ${DESTDIR}etc/$$f || exit $$? ; \
 #              done ;; \
 #      sun4x_57 ) \
-#              ${INSTALLex} -f kdump.sh.solaris7 $@; \
+#              ${INSTALLex} kdump.sh.solaris7 $@; \
 #              ${INSTALL} -s -f $? ${DESTDIR}etc/kdump32;; \
 #      *linux* ) \
 #              for lv in ${LINUX_VERS}; do \
 #                      ${INSTALL} -s kdump-$$lv ${DESTDIR}etc/kdump-$$lv ; \
 #              done ;; \
 #      hp_ux11* ) \
-#              ${INSTALLex} -f kdump.sh.hp_ux11 $@; \
+#              ${INSTALLex} kdump.sh.hp_ux11 $@; \
 #              ${INSTALL} -s -f $? ${DESTDIR}etc/kdump32;; \
 #      *) \
 #              ${INSTALL} -s $? $@ ;; \
 #      esac
 
+${DESTDIR}etc/kdump: kdump
+       -set -x; \
+       case ${SYS_NAME} in \
+       sgi_6? ) \
+               ${INSTALLex}  kdump.sh.sgi_ipnos $@; \
+               ln -fs kdump ${DESTDIR}etc/kdump32; \
+               ln -fs kdump.IP20 ${DESTDIR}etc/kdump.IP22; \
+               ln -fs kdump.IP20 ${DESTDIR}etc/kdump.IP32; \
+               for f in kdump.IP??; \
+               do ${INSTALL} -s $$f ${DESTDIR}etc/$$f || exit $$? ; \
+               done ;; \
+       sun4x_57 ) \
+               ${INSTALLex} kdump.sh.solaris7 $@; \
+               ${INSTALL} -s -f $? ${DESTDIR}etc/kdump32;; \
+       *linux* ) \
+               for lv in ${LINUX_VERS}; do \
+                       ${INSTALL} -s kdump-$$lv ${DESTDIR}etc/kdump-$$lv ; \
+               done ;; \
+       hp_ux11* ) \
+               ${INSTALLex} kdump.sh.hp_ux11 $@; \
+               ${INSTALL} -s -f $? ${DESTDIR}etc/kdump32;; \
+       *) \
+               ${INSTALL} -s $? $@ ;; \
+       esac
+
+${DESTDIR}etc/kdump64: kdump64
+       -set -x; \
+       case ${SYS_NAME} in \
+       sun4x_57 | hp_ux11* ) \
+               ${INSTALL} -s $? $@ ;;\
+       * ) \
+               echo skipping kdump64 for ${SYS_NAME} ;; \
+       esac
+from
+r
 
 
 install: all ${DESTDIR}bin/fs ${DESTDIR}root.server/usr/afs/bin/fs \
@@ -153,8 +187,12 @@ cmdebug: cmdebug.o ${CMLIBS}
        $(CC) -o cmdebug cmdebug.o ${CFLAGS} ${CMLIBS} ${XLIBS}
 
 kdump.o: kdump.c ${INCLS} AFS_component_version_number.c
-       set -x; \
+       -set -x; \
        case ${SYS_NAME} in \
+               alpha_linux* ) \
+                       for lv in ${LINUX_VERS}; do \
+                               ${CC} -g -I${LINUX_SRCDIR}$$lv/include -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS} -mno-fp-regs -ffixed-8 -o kdump-$$lv.o -c kdump.c ; \
+                               done ;; \
                *linux* ) \
                        for lv in ${LINUX_VERS}; do \
                                ${CC} -g -I${LINUX_SRCDIR}$$lv/include -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS} -o kdump-$$lv.o -c kdump.c ; \
@@ -188,14 +226,14 @@ kdump.o: kdump.c ${INCLS} AFS_component_version_number.c
        esac ;
 
 kdump64.o : kdump.c ${INCLS} AFS_component_version_number.c
-       set -x; \
+       -set -x; \
        case ${SYS_NAME} in \
        sun4x_57 | hp_ux11* ) \
                ${CC} -g -I${DESTDIR}include -I${SRCDIR}include ${XCFLAGS64} -o kdump64.o -c kdump.c ;; \
        esac
 
 kdump:  kdump.o
-       set -x; \
+       -set -x; \
        case ${SYS_NAME} in \
        sun4c_51 | sun4c_52 | sun4m_51 | sun4m_52 | sun4c_53 | sun4m_53 | sun4_53 | sun4_54 | sun4c_54 | sun4m_54 | sunx86_54) \
                ${CC} -g -o kdump kdump.o ${DESTDIR}lib/afs/libcmd.a  ${DESTDIR}lib/afs/util.a /usr/lib/libkvm.a -lelf ${XLIBS} ;; \
@@ -233,7 +271,7 @@ kdump:  kdump.o
 ## kdump to read from 64 bit kernel dumps
 
 kdump64 : kdump64.o
-       set -x; \
+       -set -x; \
        case ${SYS_NAME} in \
        sun4x_57 | hp_ux11* )  \
                ${CC} -g ${XCFLAGS64} -o kdump64 kdump64.o ${DESTDIR}lib/afs/libcmd64.a ${XLIBELFA}  ${XLIBKVM} ${XLIBS} ;; \
index 08c983559942f59ddc6f58a9c40acd0caa37196b..e7541e2fb8ecccefc78cdd794e47e541a5de7233 100644 (file)
@@ -13,7 +13,7 @@
 #include <afs/param.h>
 #include <stdio.h>
 #include <sys/types.h>
-#if !defined(AFS_SUN3_ENV) && !defined(sys_vax_ul43)
+#if !defined(AFS_SUN3_ENV) && !defined(sys_vax_ul43) && !defined(AFS_DARWIN_ENV)
 #include <time.h>
 /*#ifdef       AFS_AIX_ENV*/
 #include <sys/time.h>
index 2a0d9603ec6d2366fd23a537c1fa5e6a12b7db85..ab012faee426642574e8ed9774866f7b796c8e45 100644 (file)
@@ -10,6 +10,7 @@
 #ifndef lint
 #endif
 /*
+
        System:         VICE-TWO
        Module:         partition.c
        Institution:    The Information Technology Center, Carnegie-Mellon University
 #include <winioctl.h>
 #else
 #include <sys/param.h>
-
+#include <sys/types.h>
 #if AFS_HAVE_STATVFS
 #include <sys/statvfs.h>
 #endif /* AFS_HAVE_STATVFS */
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#include <sys/mount.h>
+#endif
 
 #if !defined(AFS_SGI_ENV)
 #ifdef AFS_OSF_ENV
 #ifdef AFS_SUN5_ENV
 #include <sys/fs/ufs_fs.h>
 #else
+#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
+#include <ufs/ufs/dinode.h>
+#include <ufs/ffs/fs.h>
+#else
 #include <ufs/fs.h>
 #endif
+#endif
 #else /* AFS_VFSINCL_ENV */
-#if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX22_ENV)
+#if !defined(AFS_AIX_ENV) && !defined(AFS_LINUX22_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_FBSD_ENV)
 #include <sys/fs.h>
 #endif
 #endif /* AFS_VFSINCL_ENV */
 #include "ntops.h"
 #else
 #include "namei_ops.h"
-#endif
+#if defined(AFS_SGI_ENV)
+#include <sys/dir.h>
+#else
+#include <dirent.h>
+#endif /* AFS_SGI_ENV */
+#endif /* AFS_NT40_ENV */
 #endif /* AFS_NAMEI_ENV */
 #include "vnode.h"
 #include "volume.h"
@@ -226,6 +241,9 @@ int VCheckPartition(part, devname)
      char *devname;
 {
     struct stat status;
+#if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV)
+    char AFSIDatPath[MAXPATHLEN];
+#endif
 
     /* Only keep track of "/vicepx" partitions since it can get hairy
      * when NFS mounts are involved.. */
@@ -249,6 +267,33 @@ int VCheckPartition(part, devname)
     }
 #endif
 
+#if !defined(AFS_LINUX20_ENV) && !defined(AFS_NT40_ENV)
+    strcpy(AFSIDatPath, part);
+    strcat(AFSIDatPath, "/AFSIDat");
+#ifdef AFS_NAMEI_ENV
+    if (stat(AFSIDatPath, &status) < 0) {
+       DIR *dirp;
+       struct dirent *dp;
+
+       dirp = opendir(part);
+       assert(dirp);
+       while (dp = readdir(dirp)) {
+           if (dp->d_name[0] == 'V') {
+               Log("This program is compiled with AFS_NAMEI_ENV, but partition %s seems to contain volumes which don't use the namei-interface; aborting\n", part);
+               closedir(dirp);
+               return -1;
+           }
+       }
+       closedir(dirp);
+    }
+#else /* AFS_NAMEI_ENV */
+    if (stat(AFSIDatPath, &status) == 0) {
+       Log("This program is compiled without AFS_NAMEI_ENV, but partition %s seems to contain volumes which use the namei-interface; aborting\n", part);
+       return -1;
+    }
+#endif /* AFS_NAMEI_ENV */f
+#endif
+
 #ifdef AFS_SGI_XFS_IOPS_ENV
     if (VerifyXFSInodeSize(part, status.st_fstype) < 0)
        return -1;
@@ -409,7 +454,7 @@ int VAttachPartitions(void)
 
 }
 #endif
-#ifdef AFS_DUX40_ENV
+#if defined(AFS_DUX40_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
 int VAttachPartitions(void)
 {
     int errors = 0;
index 0ae13bb5cffba6c3d68bcb795fd1870747a268f3..bdddc9cf8d0c5ea3b874e8a827d0f0b671066fd7 100644 (file)
@@ -274,11 +274,24 @@ char **argv; {
        else if (strcmp(argv[code], "-enable_process_stats")==0) {
            rx_enableProcessRPCStats();
        }
+#ifndef AFS_NT40_ENV
+       else if (strcmp(argv[code], "-syslog")==0) {
+           /* set syslog logging flag */
+           serverLogSyslog = 1;
+       } 
+       else if (strncmp(argv[code], "-syslog=", 8)==0) {
+           serverLogSyslog = 1;
+           serverLogSyslogFacility = atoi(argv[code]+8);
+       }
+#endif
        else {
            printf("volserver: unrecognized flag '%s'\n", argv[code]);
 usage:
            printf("Usage: volserver [-log] [-p <number of processes>] "
                   "[-udpsize <size of socket buffer in bytes>] "
+#ifndef AFS_NT40_ENV
+                  "[-syslog[=FACILITY]] "
+#endif
                   /* "[-enable_peer_stats] [-enable_process_stats] " */
                   "[-help]\n");
            VS_EXIT(1);