From: Ed Moy Date: Fri, 24 Oct 2003 07:25:58 +0000 (+0000) Subject: macos103-20031024 X-Git-Tag: openafs-devel-1_3_50~38 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=e2e93aa8920c0b1bfc672a555a59eb4e15dbeaae macos103-20031024 FIXES 2325 support for macos 10.3 for 1.2.10 --- diff --git a/Makefile.in b/Makefile.in index e6e4d07..9acc7c5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,6 +4,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config @@ -61,7 +63,7 @@ dest_only_libafs: only_libafs dest_dirs packages: dest @case ${SYS_NAME} in \ - ppc_darwin* ) \ + *_darwin_* ) \ ${COMPILE_PART1} packaging/MacOS && sh ./buildpkg.sh ${DEST} ;; \ hp_ux110 ) \ ${COMPILE_PART1} packaging/HP-UX && swpackage -s psf-1.2.10-transarc-paths-11.00 ;; \ @@ -217,6 +219,10 @@ tviced: cmd comerr viced vlserver libafsrpc libafsauthent case ${SYS_NAME} in \ alpha_dux*|sgi_*|sun*_5*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*fbsd*|*nbsd2*) \ ${COMPILE_PART1} tviced ${COMPILE_PART2} ;; \ + *_darwin_[1-6][0-9]) \ + echo Not building MT viced for ${SYS_NAME} ;; \ + *_darwin_*) \ + ${COMPILE_PART1} tviced ${COMPILE_PART2} ;; \ *) \ echo Not building MT viced for ${SYS_NAME} ;; \ esac @@ -237,7 +243,7 @@ null: cmd comerr ${TOP_LIBDIR}/libtermlib.a: $(RM) -f ${TOP_LIBDIR}/libtermlib.a case ${SYS_NAME} in \ - rs_aix* | sun4x_* | sunx86_* | sgi_6? | *linux* | ppc_darwin* | *fbsd* | ia64_hpux*) \ + rs_aix* | sun4x_* | sunx86_* | sgi_6? | *linux* | *_darwin* | *fbsd* | ia64_hpux*) \ ln -s libnull.a ${TOP_LIBDIR}/libtermlib.a ;; \ *) \ ln -s /usr/lib/libtermlib.a ${TOP_LIBDIR}/libtermlib.a ;; \ @@ -261,7 +267,7 @@ bozo: cmd comerr ntp audit vfsck: vol set -x; \ case ${SYS_NAME} in \ - sgi_* | *linux* | rs_aix42 | ppc_darwin* | hp_ux* | ia64_hpux* | *fbsd* | *_obsd* | *_nbsd* | sun*_4* | rs_aix5* ) \ + sgi_* | *linux* | rs_aix42 | *_darwin* | hp_ux* | ia64_hpux* | *fbsd* | *_obsd* | *_nbsd* | sun*_4* | rs_aix5* ) \ echo skip vfsck for ${SYS_NAME} ;; \ * ) \ ${COMPILE_PART1} vfsck ${COMPILE_PART2} ;; \ @@ -288,7 +294,7 @@ login: cmd comerr kauth rxkad else \ echo Skipping pam for ${SYS_NAME} ; \ fi ;; \ - ppc_darwin* | *_obsd* | *_nbsd* | hp_ux* | rs_aix5* ) \ + *_darwin* | *_obsd* | *_nbsd* | hp_ux* | rs_aix5* ) \ echo Skipping login for ${SYS_NAME} ;; \ * ) \ ${COMPILE_PART1} login ${COMPILE_PART2} ;; \ @@ -433,6 +439,10 @@ libafsrpc: rx rxkad des case ${SYS_NAME} in \ alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*fbsd*|*nbsd2*) \ ${COMPILE_PART1} libafsrpc ${COMPILE_PART2} ;; \ + *_darwin_[1-6][0-9]) \ + echo Not building MT libafsrpc for ${SYS_NAME} ;; \ + *_darwin_*) \ + ${COMPILE_PART1} libafsrpc ${COMPILE_PART2} ;; \ *) \ echo Not building MT libafsrpc for ${SYS_NAME} ;; \ esac @@ -441,8 +451,12 @@ libafsauthent: ubik auth kauth libafsrpc case ${SYS_NAME} in \ alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*|*fbsd*|*nbsd2*) \ ${COMPILE_PART1} libafsauthent ${COMPILE_PART2} ;; \ + *_darwin_[1-6][0-9]) \ + echo Not building MT libafsauthent for ${SYS_NAME} ;; \ + *_darwin_*) \ + ${COMPILE_PART1} libafsauthent ${COMPILE_PART2} ;; \ *) \ - echo Not building MT libafsrpc for ${SYS_NAME} ;; \ + echo Not building MT libafsauthent for ${SYS_NAME} ;; \ esac # pthread based user space RX library @@ -463,7 +477,7 @@ shlibafsauthent: ubik auth kauth shlibafsrpc alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*) \ ${COMPILE_PART1} shlibafsauthent ${COMPILE_PART2} ;; \ *) \ - echo Not building shared libafsrpc for ${SYS_NAME} ;; \ + echo Not building shared libafsauthent for ${SYS_NAME} ;; \ esac libadmin_real: @@ -482,6 +496,10 @@ libadmin: libafsauthent bozo case ${SYS_NAME} in \ alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*) \ $(MAKE) libadmin_real ;; \ + *_darwin_[1-6][0-9]) \ + echo Not building MT libadmin for ${SYS_NAME} ;; \ + *_darwin_*) \ + $(MAKE) libadmin_real ;; \ *) \ echo Not building MT libadmin for ${SYS_NAME} ;; \ esac @@ -782,7 +800,7 @@ package.files: package ntp: project volser @case ${WITH_OBSOLETE} in \ YES) case ${SYS_NAME} in \ - sun4x_58 | sunx86_* | *linux* | *fbsd* | ppc_darwin* | *nbsd*) echo skipping ntp for ${SYS_NAME} ;; \ + sun4x_58 | sunx86_* | *linux* | *fbsd* | *_darwin* | *nbsd*) echo skipping ntp for ${SYS_NAME} ;; \ * ) ${COMPILE_PART1} ntp ${COMPILE_PART2} ;; \ esac ;; \ *) echo skipping deprecated target: ntp ;; \ diff --git a/src/afs/DARWIN/osi_vfsops.c b/src/afs/DARWIN/osi_vfsops.c index 69f27e0..846bf24 100644 --- a/src/afs/DARWIN/osi_vfsops.c +++ b/src/afs/DARWIN/osi_vfsops.c @@ -1,3 +1,6 @@ +/* + * Portions Copyright (c) 2003 Apple Computer, Inc. All rights reserved. + */ #include #include @@ -11,6 +14,8 @@ RCSID #include #include #include +#include +#include "../afs/sysctl.h" struct vcache *afs_globalVp = 0; struct mount *afs_globalVFS = 0; @@ -283,13 +288,35 @@ afs_sync(mp, waitfor, cred, p) return 0; } -int -afs_sysctl() +u_int32_t afs_darwin_realmodes = 0; + +int afs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen, struct proc *p) { + int error; + + switch (name[0]) { + case AFS_SC_ALL: + /* nothing defined */ + break; + case AFS_SC_DARWIN: + if (namelen < 3) + return ENOENT; + switch (name[1]) { + case AFS_SC_DARWIN_ALL: + switch (name[2]) { + case AFS_SC_DARWIN_ALL_REALMODES: + return sysctl_int(oldp, oldlenp, newp, newlen, + &afs_darwin_realmodes); + } + break; + /* darwin version specific sysctl's goes here */ + } + break; + } return EOPNOTSUPP; } - typedef (*PFI) (); extern int vfs_opv_numops; /* The total number of defined vnode operations */ extern struct vnodeopv_desc afs_vnodeop_opv_desc; diff --git a/src/afs/DARWIN/osi_vnodeops.c b/src/afs/DARWIN/osi_vnodeops.c index b9389ec..d51c10c 100644 --- a/src/afs/DARWIN/osi_vnodeops.c +++ b/src/afs/DARWIN/osi_vnodeops.c @@ -1,3 +1,6 @@ +/* + * Portions Copyright (c) 2003 Apple Computer, Inc. All rights reserved. + */ #include #include @@ -10,6 +13,9 @@ RCSID #include #include #include +#if defined(AFS_DARWIN70_ENV) +#include +#endif /* defined(AFS_DARWIN70_ENV) */ int afs_vop_lookup(struct vop_lookup_args *); int afs_vop_create(struct vop_create_args *); @@ -36,7 +42,9 @@ int afs_vop_rmdir(struct vop_rmdir_args *); int afs_vop_symlink(struct vop_symlink_args *); int afs_vop_readdir(struct vop_readdir_args *); int afs_vop_readlink(struct vop_readlink_args *); +#if !defined(AFS_DARWIN70_ENV) extern int ufs_abortop(struct vop_abortop_args *); +#endif /* !defined(AFS_DARWIN70_ENV) */ int afs_vop_inactive(struct vop_inactive_args *); int afs_vop_reclaim(struct vop_reclaim_args *); int afs_vop_lock(struct vop_lock_args *); @@ -90,9 +98,13 @@ struct vnodeopv_entry_desc afs_vnodeop_entries[] = { {&vop_symlink_desc, afs_vop_symlink}, /* symlink */ {&vop_readdir_desc, afs_vop_readdir}, /* readdir */ {&vop_readlink_desc, afs_vop_readlink}, /* readlink */ +#if defined(AFS_DARWIN70_ENV) + { &vop_abortop_desc, nop_abortop }, /* abortop */ +#else /* ! defined(AFS_DARWIN70_ENV) */ /* Yes, we use the ufs_abortop call. It just releases the namei * buffer stuff */ {&vop_abortop_desc, ufs_abortop}, /* abortop */ +#endif /* defined(AFS_DARWIN70_ENV) */ {&vop_inactive_desc, afs_vop_inactive}, /* inactive */ {&vop_reclaim_desc, afs_vop_reclaim}, /* reclaim */ {&vop_lock_desc, afs_vop_lock}, /* lock */ @@ -277,17 +289,37 @@ afs_vop_open(ap) * } */ *ap; { int error; - struct vcache *vc = VTOAFS(ap->a_vp); + struct vnode *vp = ap->a_vp; + struct vcache *vc = VTOAFS(vp); +#ifdef AFS_DARWIN14_ENV + int didhold = 0; + /*---------------------------------------------------------------- + * osi_VM_TryReclaim() removes the ubcinfo of a vnode, but that vnode + * can later be passed to vn_open(), which will skip the call to + * ubc_hold(), and when the ubcinfo is later added, the ui_refcount + * will be off. So we compensate by calling ubc_hold() ourselves + * when ui_refcount is less than 2. If an error occurs in afs_open() + * we must call ubc_rele(), which is what vn_open() would do if it + * was able to call ubc_hold() in the first place. + *----------------------------------------------------------------*/ + if (vp->v_type == VREG && !(vp->v_flag & VSYSTEM) + && vp->v_ubcinfo->ui_refcount < 2) + didhold = ubc_hold(vp); +#endif /* AFS_DARWIN14_ENV */ AFS_GLOCK(); error = afs_open(&vc, ap->a_mode, ap->a_cred); #ifdef DIAGNOSTIC - if (AFSTOV(vc) != ap->a_vp) + if (AFSTOV(vc) != vp) panic("AFS open changed vnode!"); #endif afs_BozonLock(&vc->pvnLock, vc); osi_FlushPages(vc, ap->a_cred); afs_BozonUnlock(&vc->pvnLock, vc); AFS_GUNLOCK(); +#ifdef AFS_DARWIN14_ENV + if (error && didhold) + ubc_rele(vp); +#endif /* AFS_DARWIN14_ENV */ return error; } @@ -1298,6 +1330,17 @@ afs_vop_pathconf(ap) case _PC_PIPE_BUF: return EINVAL; break; +#if defined(AFS_DARWIN70_ENV) + case _PC_NAME_CHARS_MAX: + *ap->a_retval = NAME_MAX; + break; + case _PC_CASE_SENSITIVE: + *ap->a_retval = 1; + break; + case _PC_CASE_PRESERVING: + *ap->a_retval = 1; + break; +#endif /* defined(AFS_DARWIN70_ENV) */ default: return EINVAL; } diff --git a/src/afs/Makefile.in b/src/afs/Makefile.in index 7c7c020..d31ce8d 100644 --- a/src/afs/Makefile.in +++ b/src/afs/Makefile.in @@ -4,6 +4,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config @@ -11,7 +13,7 @@ include @TOP_OBJDIR@/src/config/Makefile.config all: depinstall depinstall: ${TOP_INCDIR}/afs/afs.h ${TOP_INCDIR}/afs/osi_inode.h ${TOP_INCDIR}/afs/afs_stats.h \ - ${TOP_INCDIR}/afs/exporter.h ${TOP_INCDIR}/afs/nfsclient.h afszcm.cat AFS_component_version_number.c ${TOP_INCDIR}/afs/unified_afs.h + ${TOP_INCDIR}/afs/exporter.h ${TOP_INCDIR}/afs/nfsclient.h afszcm.cat AFS_component_version_number.c ${TOP_INCDIR}/afs/unified_afs.h ${TOP_INCDIR}/afs/sysctl.h case ${SYS_NAME} in \ pmax_ul43 | pmax_ul43a) \ ${INSTALL} longc_procs.h ${TOP_INCDIR}/afs ;; \ @@ -33,13 +35,13 @@ afszcm.cat: afs_trace.msf /usr/etc/gencat afszcm.cat afs_trace.msf ;; \ *_linux* | *_umlinux* ) \ gencat --new afszcm.cat afs_trace.msf ;; \ - ppc_darwin* | i386_fbsd*) \ + *_darwin_* | i386_fbsd*) \ echo No gencat for ${SYS_NAME} ;; \ * ) \ gencat afszcm.cat afs_trace.msf ;; \ esac -install: ${DESTDIR}${includedir}/afs/afs.h ${DESTDIR}${includedir}/afs/osi_inode.h ${DESTDIR}${includedir}/afs/afs_stats.h ${DESTDIR}${includedir}/afs/exporter.h ${DESTDIR}${includedir}/afs/nfsclient.h ${DESTDIR}${includedir}/afs/unified_afs.h +install: ${DESTDIR}${includedir}/afs/afs.h ${DESTDIR}${includedir}/afs/osi_inode.h ${DESTDIR}${includedir}/afs/afs_stats.h ${DESTDIR}${includedir}/afs/exporter.h ${DESTDIR}${includedir}/afs/nfsclient.h ${DESTDIR}${includedir}/afs/unified_afs.h ${DESTDIR}${includedir}/afs/sysctl.h case ${SYS_NAME} in \ pmax_ul43 | pmax_ul43a) \ ${INSTALL} longc_procs.h ${DESTDIR}${includedir}/afs ;; \ @@ -91,11 +93,20 @@ ${DEST}/include/afs/afs_stats.h: afs_stats.h ${DESTDIR}${includedir}/afs/afs_stats.h: afs_stats.h ${INSTALL} $? $@ - ${TOP_INCDIR}/afs/afs_stats.h: afs_stats.h ${INSTALL} $? $@ +${DEST}/include/afs/sysctl.h: sysctl.h + ${INSTALL} $? $@ + +${DESTDIR}${includedir}/afs/sysctl.h: sysctl.h + ${INSTALL} $? $@ + +${TOP_INCDIR}/afs/sysctl.h: sysctl.h + ${INSTALL} $? $@ + + ${DEST}/include/afs/exporter.h: exporter.h ${INSTALL} $? $@ @@ -118,13 +129,13 @@ ${TOP_INCDIR}/afs/nfsclient.h: nfsclient.h ${INSTALL} $? $@ -dest: ${DEST}/include/afs/afs.h ${DEST}/include/afs/osi_inode.h ${DEST}/include/afs/afs_stats.h ${DEST}/include/afs/exporter.h ${DEST}/include/afs/nfsclient.h ${DEST}/include/afs/unified_afs.h +dest: ${DEST}/include/afs/afs.h ${DEST}/include/afs/osi_inode.h ${DEST}/include/afs/afs_stats.h ${DEST}/include/afs/exporter.h ${DEST}/include/afs/nfsclient.h ${DEST}/include/afs/unified_afs.h ${DEST}/include/afs/sysctl.h case ${SYS_NAME} in \ pmax_ul43 | pmax_ul43a) \ ${INSTALL} longc_procs.h ${DEST}/include/afs ;; \ esac case ${SYS_NAME} in \ - next_mach30 | vax_ul43 | ppc_darwin* | i386_fbsd* ) \ + next_mach30 | vax_ul43 | *_darwin* | i386_fbsd* ) \ echo skipping afszcm.cat install for ${SYS_NAME} ;; \ * ) \ ${INSTALL} afszcm.cat ${DEST}/root.client/usr/vice/etc/C ;; \ diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index 9dd48f8..c669955 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -68,20 +70,26 @@ afs_CopyOutAttrs(register struct vcache *avc, register struct vattr *attrs) attrs->va_mode &= ~(VSUID | VSGID); } #if defined(AFS_DARWIN_ENV) - /* Mac OS X uses the mode bits to determine whether a file or directory - * is accessible, and believes them, even though under AFS they're almost - * assuredly wrong, especially if the local uid does not match the AFS - * ID. So we set the mode bits conservatively. - */ - if (S_ISDIR(attrs->va_mode)) { - /* all access bits need to be set for directories, since even - * a mode 0 directory can still be used normally. - */ - attrs->va_mode |= ACCESSPERMS; - } else { - /* for other files, replicate the user bits to group and other */ - mode_t ubits = (attrs->va_mode & S_IRWXU) >> 6; - attrs->va_mode |= ubits | (ubits << 3); + { + extern u_int32_t afs_darwin_realmodes; + if (!afs_darwin_realmodes) { + /* Mac OS X uses the mode bits to determine whether a file or + * directory is accessible, and believes them, even though under + * AFS they're almost assuredly wrong, especially if the local uid + * does not match the AFS ID. So we set the mode bits + * conservatively. + */ + if (S_ISDIR(attrs->va_mode)) { + /* all access bits need to be set for directories, since even + * a mode 0 directory can still be used normally. + */ + attrs->va_mode |= ACCESSPERMS; + } else { + /* for other files, replicate the user bits to group and other */ + mode_t ubits = (attrs->va_mode & S_IRWXU) >> 6; + attrs->va_mode |= ubits | (ubits << 3); + } + } } #endif /* AFS_DARWIN_ENV */ attrs->va_uid = fakedir ? 0 : avc->m.Owner; @@ -96,7 +104,11 @@ afs_CopyOutAttrs(register struct vcache *avc, register struct vattr *attrs) #ifdef AFS_OSF_ENV attrs->va_fsid = avc->v.v_mount->m_stat.f_fsid.val[0]; #else +#ifdef AFS_DARWIN70_ENV + attrs->va_fsid = avc->v.v_mount->mnt_stat.f_fsid.val[0]; +#else /* ! AFS_DARWIN70_ENV */ attrs->va_fsid = 1; +#endif /* AFS_DARWIN70_ENV */ #endif #endif #endif /* AFS_SUN56_ENV */ diff --git a/src/afs/sysctl.h b/src/afs/sysctl.h new file mode 100644 index 0000000..5af1e2f --- /dev/null +++ b/src/afs/sysctl.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef AFS_SYSCTL_H +#define AFS_SYSCTL_H + +/* top level AFS names */ +#define AFS_SC_ALL 0 +#define AFS_SC_DARWIN 1 + +/* AFS_SC_ALL: platform-independent sysctls */ + /* nothing defined */ + +/* AFS_SC_DARWIN: darwin-specific sysctls */ +#define AFS_SC_DARWIN_ALL 0 +#define AFS_SC_DARWIN_12 1 +#define AFS_SC_DARWIN_13 2 +#define AFS_SC_DARWIN_14 3 +#define AFS_SC_DARWIN_60 4 +#define AFS_SC_DARWIN_70 5 + +/* AFS_SC_DARWIN_ALL: darwin version-independent sysctls */ +#define AFS_SC_DARWIN_ALL_REALMODES 1 + +/* AFS_SC_DARWIN_12: darwin 1.2 sysctls */ + /* nothing defined */ + +/* AFS_SC_DARWIN_13: darwin 1.3 sysctls */ + /* nothing defined */ + +/* AFS_SC_DARWIN_14: darwin 1.4 sysctls */ + /* nothing defined */ + +/* AFS_SC_DARWIN_60: darwin 6.x sysctls */ + /* nothing defined */ + +/* AFS_SC_DARWIN_70: darwin 7.x sysctls */ + /* nothing defined */ + +#endif /* AFS_SYSCTL_H */ diff --git a/src/afsd/Makefile.in b/src/afsd/Makefile.in index a1d2a90..f729e2c 100644 --- a/src/afsd/Makefile.in +++ b/src/afsd/Makefile.in @@ -91,7 +91,7 @@ dest: ${DEST}/root.client/usr/vice/etc/afsd ${DEST}/etc/vsys *linux* ) \ ${INSTALL} -f ${srcdir}/afs.rc.linux -m 755 ${DEST}/root.client/usr/vice/etc/afs.rc; \ ${INSTALL} -f ${srcdir}/afs.conf.linux ${DEST}/root.client/usr/vice/etc/afs.conf ;; \ - ppc_darwin*) \ + *_darwin*) \ ${INSTALL} -f ${srcdir}/afs.rc.darwin -m 755 ${DEST}/root.client/usr/vice/etc/afs.rc ; \ ${INSTALL} -f ${srcdir}/afs.rc.darwin.plist ${DEST}/root.client/usr/vice/etc/StartupParameters.plist ;; \ *fbsd*) \ diff --git a/src/afsd/afs.rc.darwin b/src/afsd/afs.rc.darwin index ed95303..269734e 100644 --- a/src/afsd/afs.rc.darwin +++ b/src/afsd/afs.rc.darwin @@ -5,6 +5,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. . /etc/rc.common @@ -102,6 +104,14 @@ echo "Starting afsd" $AFSD $OPTIONS # +# Call afssettings (if it exists) to set customizable parameters +# +if [ -x $VICEETC/config/afssettings ]; then + sleep 2 + $VICEETC/config/afssettings +fi + +# # Run package to update the disk # if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then diff --git a/src/afsd/afs.rc.darwin.plist b/src/afsd/afs.rc.darwin.plist index 4c05dd1..5e3054e 100644 --- a/src/afsd/afs.rc.darwin.plist +++ b/src/afsd/afs.rc.darwin.plist @@ -1,7 +1,7 @@ { Description = "OpenAFS network file system"; Provides = ("AFS"); - Requires = ("Resolver"); + Requires = ("Resolver", "Disks"); OrderPreference = "None"; Messages = { diff --git a/src/afsmonitor/afsmonitor.c b/src/afsmonitor/afsmonitor.c index 252e91d..10be1b7 100644 --- a/src/afsmonitor/afsmonitor.c +++ b/src/afsmonitor/afsmonitor.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -275,7 +277,7 @@ extern char *cm_categories[]; /* cache manager data category names */ -#ifndef AFS_FBSD_ENV +#if !defined(AFS_FBSD_ENV) && !defined(AFS_DARWIN70_ENV) /* strcasestr(): Return first occurence of pattern s2 in s1, case insensitive. diff --git a/src/butc/Makefile.in b/src/butc/Makefile.in index b34df9a..d7bc516 100644 --- a/src/butc/Makefile.in +++ b/src/butc/Makefile.in @@ -4,6 +4,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config @@ -84,6 +86,11 @@ install: @case ${SYS_NAME} in \ alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix4*|*linux*|hp_ux*) \ echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \ + *_darwin_[1-6][0-9]) \ + echo ${INSTALL} butc ${DEST}/etc/butc ; \ + ${INSTALL} butc ${DEST}/etc/butc ;; \ + *_darwin_*) \ + echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \ *) \ echo ${INSTALL} butc ${DESTDIR}${sbindir}/butc ; \ ${INSTALL} butc ${DESTDIR}${sbindir}/butc ;; \ @@ -95,6 +102,11 @@ dest: @case ${SYS_NAME} in \ alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix4*|*linux*|hp_ux*) \ echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \ + *_darwin_[1-6][0-9]) \ + echo ${INSTALL} butc ${DESTDIR}${sbindir}/butc ; \ + ${INSTALL} butc ${DESTDIR}${sbindir}/butc ;; \ + *_darwin_*) \ + echo "Don't install butc for ${SYS_NAME} (will install from tbutc)" ;; \ *) \ echo ${INSTALL} butc ${DEST}/etc/butc ; \ ${INSTALL} butc ${DEST}/etc/butc ;; \ diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4 index 4e25b64..71e550a 100644 --- a/src/cf/osconf.m4 +++ b/src/cf/osconf.m4 @@ -363,6 +363,19 @@ case $AFS_SYSNAME in TXLIBS="-lncurses" ;; + ppc_darwin_70) + AFSD_LDFLAGS="-F/System/Library/PrivateFrameworks -framework DiskArbitration" + LEX="lex -l" + MT_CFLAGS='-DAFS_PTHREAD_ENV -D_REENTRANT ${XCFLAGS}' + KROOT= + KINCLUDES='-I$(KROOT)/System/Library/Frameworks/Kernel.framework/Headers' + LWP_OPTMZ="-O2" + REGEX_OBJ="regex.o" + XCFLAGS="-no-cpp-precomp" + TXLIBS="-lncurses" + EXTRA_VLIBOBJS="fstab.o" + ;; + ppc_linux22) INSTALL="install" KERN_OPTMZ=-O2 diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index eece058..3249c17 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -53,6 +55,7 @@ #define SYS_NAME_ID_ppc_darwin_13 504 #define SYS_NAME_ID_ppc_darwin_14 505 #define SYS_NAME_ID_ppc_darwin_60 506 +#define SYS_NAME_ID_ppc_darwin_70 507 #define SYS_NAME_ID_next_mach20 601 #define SYS_NAME_ID_next_mach30 602 diff --git a/src/config/param.ppc_darwin_70.h b/src/config/param.ppc_darwin_70.h new file mode 100644 index 0000000..e0cb9c0 --- /dev/null +++ b/src/config/param.ppc_darwin_70.h @@ -0,0 +1,134 @@ +#ifndef UKERNEL +/* This section for kernel libafs compiles only */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#define AFS_ENV 1 +#define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_PPC_ENV 1 +#define AFS_VFSINCL_ENV 1 + +#include + +#define AFS_DARWIN_ENV +#define AFS_DARWIN13_ENV +#define AFS_DARWIN14_ENV +#define AFS_DARWIN60_ENV +#define AFS_DARWIN70_ENV +#define AFS_NONFSTRANS +#define AFS_SYSCALL 230 +#define AFS_NAMEI_ENV 1 + +/* File system entry (used if mount.h doesn't define MOUNT_AFS */ +#define AFS_MOUNT_AFS "afs" + +/* Machine / Operating system information */ +#define sys_ppc_darwin_12 1 +#define sys_ppc_darwin_13 1 +#define sys_ppc_darwin_14 1 +#define sys_ppc_darwin_60 1 +#define sys_ppc_darwin_70 1 +#define SYS_NAME "ppc_darwin_70" +#define SYS_NAME_ID SYS_NAME_ID_ppc_darwin_70 +#define AFSBIG_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ + +#define AFS_GCPAGS 1 /* if nonzero, garbage collect PAGs */ +#define RXK_LISTENER_ENV 1 + +#ifdef KERNEL +#undef MACRO_BEGIN +#undef MACRO_END +#include +#define AFS_GLOBAL_SUNLOCK 1 +#define AFS_VFS34 1 /* What is VFS34??? */ +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_resid uio_resid +#define AFS_UIOSYS UIO_SYSSPACE +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES CLBYTES +#define osi_GetTime(x) microtime(x) +#define AFS_KALLOC(x) kalloc(x) +#define AFS_KFREE(x,y) kfree(x,y) +#define v_count v_usecount +#define v_vfsp v_mount +#define vfs_bsize mnt_stat.f_bsize +#define vfs_fsid mnt_stat.f_fsid +#define va_nodeid va_fileid +#define vfs_vnodecovered mnt_vnodecovered +#define direct dirent +#define vnode_t struct vnode + +#define VN_RELE(vp) vrele(((struct vnode *)(vp))) +#define VN_HOLD(vp) VREF(((struct vnode *)(vp))) +#define BIND_8_COMPAT + +#endif +#endif /* AFS_PARAM_H */ + +#else /* !defined(UKERNEL) */ + +/* This section for user space compiles only */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#define AFS_VFSINCL_ENV 1 /* NOBODY uses this.... */ +#define AFS_ENV 1 +#define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ +#define AFS_PPC_ENV 1 + +#include +#define AFS_USERSPACE_ENV +#define AFS_USR_DARWIN_ENV +#define AFS_USR_DARWIN13_ENV +#define AFS_USR_DARWIN14_ENV +#define AFS_USR_DARWIN60_ENV +#define AFS_USR_DARWIN70_ENV +#define AFS_NONFSTRANS +#define AFS_SYSCALL 230 + +/* File system entry (used if mount.h doesn't define MOUNT_AFS */ +#define AFS_MOUNT_AFS "afs" + +/* Machine / Operating system information */ +#define sys_ppc_darwin_12 1 +#define sys_ppc_darwin_13 1 +#define sys_ppc_darwin_14 1 +#define sys_ppc_darwin_60 1 +#define sys_ppc_darwin_70 1 +#define SYS_NAME "ppc_darwin_70" +#define SYS_NAME_ID SYS_NAME_ID_ppc_darwin_70 +#define AFSBIG_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ + +#define AFS_UIOSYS UIO_SYSSPACE +#define AFS_UIOUSER UIO_USERSPACE + +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define RXK_LISTENER_ENV 1 + +#define AFS_VFS34 1 /* What is VFS34??? */ +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_resid uio_resid +#define AFS_UIOSYS UIO_SYSSPACE +#define AFS_UIOUSER UIO_USERSPACE +#define VATTR_NULL usr_vattr_null + +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif + +#define BIND_8_COMPAT +#endif /* AFS_PARAM_H */ + +#endif /* !defined(UKERNEL) */ diff --git a/src/libadmin/samples/cm_client_config.c b/src/libadmin/samples/cm_client_config.c index 54d2402..48ec357 100644 --- a/src/libadmin/samples/cm_client_config.c +++ b/src/libadmin/samples/cm_client_config.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/cm_list_cells.c b/src/libadmin/samples/cm_list_cells.c index d914932..6a32cec 100644 --- a/src/libadmin/samples/cm_list_cells.c +++ b/src/libadmin/samples/cm_list_cells.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/cm_local_cell.c b/src/libadmin/samples/cm_local_cell.c index 1adf7e4..a814ac3 100644 --- a/src/libadmin/samples/cm_local_cell.c +++ b/src/libadmin/samples/cm_local_cell.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/cm_server_prefs.c b/src/libadmin/samples/cm_server_prefs.c index 2fb0400..cdae973 100644 --- a/src/libadmin/samples/cm_server_prefs.c +++ b/src/libadmin/samples/cm_server_prefs.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/rxdebug_basic_stats.c b/src/libadmin/samples/rxdebug_basic_stats.c index 90b9508..6289eee 100644 --- a/src/libadmin/samples/rxdebug_basic_stats.c +++ b/src/libadmin/samples/rxdebug_basic_stats.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/rxdebug_conns.c b/src/libadmin/samples/rxdebug_conns.c index 36493e4..00e00f6 100644 --- a/src/libadmin/samples/rxdebug_conns.c +++ b/src/libadmin/samples/rxdebug_conns.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/rxdebug_peers.c b/src/libadmin/samples/rxdebug_peers.c index 73619c8..c0a3a3d 100644 --- a/src/libadmin/samples/rxdebug_peers.c +++ b/src/libadmin/samples/rxdebug_peers.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/rxdebug_rx_stats.c b/src/libadmin/samples/rxdebug_rx_stats.c index 4e31876..d4d230e 100644 --- a/src/libadmin/samples/rxdebug_rx_stats.c +++ b/src/libadmin/samples/rxdebug_rx_stats.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -34,6 +36,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/rxdebug_supported_stats.c b/src/libadmin/samples/rxdebug_supported_stats.c index 488a821..0d5062d 100644 --- a/src/libadmin/samples/rxdebug_supported_stats.c +++ b/src/libadmin/samples/rxdebug_supported_stats.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/rxdebug_version.c b/src/libadmin/samples/rxdebug_version.c index ede3d25..d88aea0 100644 --- a/src/libadmin/samples/rxdebug_version.c +++ b/src/libadmin/samples/rxdebug_version.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/rxstat_clear_peer.c b/src/libadmin/samples/rxstat_clear_peer.c index e4ae12a..7c4de27 100644 --- a/src/libadmin/samples/rxstat_clear_peer.c +++ b/src/libadmin/samples/rxstat_clear_peer.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + extern int RXSTATS_ClearPeerRPCStats(); void diff --git a/src/libadmin/samples/rxstat_clear_process.c b/src/libadmin/samples/rxstat_clear_process.c index bfdc2ff..b17eb6d 100644 --- a/src/libadmin/samples/rxstat_clear_process.c +++ b/src/libadmin/samples/rxstat_clear_process.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + extern int RXSTATS_ClearProcessRPCStats(); void diff --git a/src/libadmin/samples/rxstat_disable_peer.c b/src/libadmin/samples/rxstat_disable_peer.c index 5deeac5..2690e34 100644 --- a/src/libadmin/samples/rxstat_disable_peer.c +++ b/src/libadmin/samples/rxstat_disable_peer.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + extern int RXSTATS_DisablePeerRPCStats(); void diff --git a/src/libadmin/samples/rxstat_disable_process.c b/src/libadmin/samples/rxstat_disable_process.c index 88e663c..1012a5d 100644 --- a/src/libadmin/samples/rxstat_disable_process.c +++ b/src/libadmin/samples/rxstat_disable_process.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + extern int RXSTATS_DisableProcessRPCStats(); void diff --git a/src/libadmin/samples/rxstat_enable_peer.c b/src/libadmin/samples/rxstat_enable_peer.c index 4dd2c49..8b6929e 100644 --- a/src/libadmin/samples/rxstat_enable_peer.c +++ b/src/libadmin/samples/rxstat_enable_peer.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + extern int RXSTATS_EnablePeerRPCStats(); void diff --git a/src/libadmin/samples/rxstat_enable_process.c b/src/libadmin/samples/rxstat_enable_process.c index 6f575df..3fc2c94 100644 --- a/src/libadmin/samples/rxstat_enable_process.c +++ b/src/libadmin/samples/rxstat_enable_process.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + extern int RXSTATS_EnableProcessRPCStats(); void diff --git a/src/libadmin/samples/rxstat_get_peer.c b/src/libadmin/samples/rxstat_get_peer.c index cc2cec7..3b25040 100644 --- a/src/libadmin/samples/rxstat_get_peer.c +++ b/src/libadmin/samples/rxstat_get_peer.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -34,6 +36,13 @@ RCSID #include #include #include + +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + #include #include #define FSINT_COMMON_XG diff --git a/src/libadmin/samples/rxstat_get_process.c b/src/libadmin/samples/rxstat_get_process.c index 779f6c2..0eb31bd 100644 --- a/src/libadmin/samples/rxstat_get_process.c +++ b/src/libadmin/samples/rxstat_get_process.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -34,6 +36,13 @@ RCSID #include #include #include + +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + #include #include #define FSINT_COMMON_XG diff --git a/src/libadmin/samples/rxstat_get_version.c b/src/libadmin/samples/rxstat_get_version.c index b8f2c27..c49d89e 100644 --- a/src/libadmin/samples/rxstat_get_version.c +++ b/src/libadmin/samples/rxstat_get_version.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + void Usage() { diff --git a/src/libadmin/samples/rxstat_query_peer.c b/src/libadmin/samples/rxstat_query_peer.c index 27872d8..2845f3a 100644 --- a/src/libadmin/samples/rxstat_query_peer.c +++ b/src/libadmin/samples/rxstat_query_peer.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + extern int RXSTATS_QueryPeerRPCStats(); void diff --git a/src/libadmin/samples/rxstat_query_process.c b/src/libadmin/samples/rxstat_query_process.c index 105ab6a..2017a4b 100644 --- a/src/libadmin/samples/rxstat_query_process.c +++ b/src/libadmin/samples/rxstat_query_process.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -25,6 +27,12 @@ RCSID #include #include +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ + extern int RXSTATS_QueryProcessRPCStats(); void diff --git a/src/libadmin/test/afscp.c b/src/libadmin/test/afscp.c index fb1b124..48259b6 100644 --- a/src/libadmin/test/afscp.c +++ b/src/libadmin/test/afscp.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* Test driver for admin functions. */ @@ -45,6 +47,11 @@ RCSID void *cellHandle; void *tokenHandle; +#ifdef AFS_DARWIN_ENV +pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* AFS_DARWIN_ENV */ /* * Before processing any command, process the common arguments and diff --git a/src/libafs/MakefileProto.DARWIN.in b/src/libafs/MakefileProto.DARWIN.in index dfaabc2..ff05253 100644 --- a/src/libafs/MakefileProto.DARWIN.in +++ b/src/libafs/MakefileProto.DARWIN.in @@ -33,6 +33,8 @@ AFS_OS_NONFSOBJS = osi_vfsops.o KDEFS= DBUG = DEFINES= -D_KERNEL -DKERNEL -DKERNEL_PRIVATE -DDIAGNOSTIC -DUSE_SELECT -DMACH_USER_API -DMACH_KERNEL + +KOPTS=-static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch KOPTS=-no-cpp-precomp -static -fno-common -finline -fno-keep-inline-functions -force_cpusubtype_ALL -msoft-float -mlong-branch diff --git a/src/libafs/afs.ppc_darwin_70.plist.in b/src/libafs/afs.ppc_darwin_70.plist.in new file mode 100644 index 0000000..09fb063 --- /dev/null +++ b/src/libafs/afs.ppc_darwin_70.plist.in @@ -0,0 +1,31 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + afs + CFBundleIdentifier + org.openafs.filesystems.afs + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + afs + CFBundlePackageType + KEXT + CFBundleShortVersionString + 1.2.10 + CFBundleSignature + ???? + CFBundleVersion + 1.2.10 + OSBundleLibraries + + com.apple.kernel.bsd + 6.9.9 + com.apple.kernel.mach + 6.9.9 + + + diff --git a/src/libafsrpc/Makefile.in b/src/libafsrpc/Makefile.in index d3c77a2..bb7b05d 100644 --- a/src/libafsrpc/Makefile.in +++ b/src/libafsrpc/Makefile.in @@ -4,6 +4,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. # This is a pthread safe library containing rx, rxkad and des. @@ -335,7 +337,7 @@ syscall.o: ${SYS}/syscall.s /usr/ccs/lib/cpp ${SFLAGS} ${SYS}/syscall.s syscall.ss; \ as -o syscall.o syscall.ss; \ $(RM) syscall.ss;; \ - sgi_* | ppc_darwin* ) \ + sgi_* | *_darwin_* ) \ ${CC} ${CFLAGS} -c ${SYS}/syscall.s;; \ alpha_dux?? ) \ ${AS} -P ${CFLAGS} -D_NO_PROTO -DMACH -DOSF -nostdinc -traditional -DASSEMBLER ${SYS}/syscall.s; \ diff --git a/src/lwp/Makefile.in b/src/lwp/Makefile.in index f68b441..ca0d1cd 100644 --- a/src/lwp/Makefile.in +++ b/src/lwp/Makefile.in @@ -4,6 +4,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config @@ -45,7 +47,7 @@ process.o : process.s process.i386.s process.c /lib/cpp -P -I${TOP_INCDIR} ${srcdir}/process.s >process.ss; \ ${AS} -ahlns process.ss -o process.o >process.lst; \ $(RM) process.ss ;; \ - ppc_darwin* ) \ + *_darwin* ) \ $(CC) ${LWP_DBG} ${LWP_OPTMZ} -c ${XCFLAGS} -I${TOP_INCDIR} ${srcdir}/process.s;; \ i386_*bsd*) \ echo foo ; \ diff --git a/src/packaging/MacOS/Makefile b/src/packaging/MacOS/Makefile new file mode 100644 index 0000000..42cf315 --- /dev/null +++ b/src/packaging/MacOS/Makefile @@ -0,0 +1,33 @@ +# Copyright (c) 2003 Apple Computer, Inc. All rights reserved. +# +# @APPLE_LICENSE_HEADER_START@ +# +# This file contains Original Code and/or Modifications of Original Code +# as defined in and that are subject to the Apple Public Source License +# Version 2.0 (the 'License'). You may not use this file except in +# compliance with the License. Please obtain a copy of the License at +# http://www.opensource.apple.com/apsl/ and read it before using this +# file. +# +# The Original Code and all software distributed under the License are +# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER +# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, +# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. +# Please see the License for the specific language governing rights and +# limitations under the License. +# +# @APPLE_LICENSE_HEADER_END@ + +AFSINCLUDE = /Library/OpenAFS/Tools/include +CFLAGS = -O -I$(AFSINCLUDE) +LIBS = -framework Foundation +ALL = afssettings + +all: $(ALL) + +afssettings : afssettings.m + cc $(CFLAGS) -o $@ $^ $(LIBS) + +clean: + @rm -f *.o $(ALL) diff --git a/src/packaging/MacOS/OpenAFS.Description.plist b/src/packaging/MacOS/OpenAFS.Description.plist new file mode 100644 index 0000000..d7c2cb8 --- /dev/null +++ b/src/packaging/MacOS/OpenAFS.Description.plist @@ -0,0 +1,14 @@ + + + + + IFPkgDescriptionDeleteWarning + + IFPkgDescriptionDescription + Mac OS X version of OpenAFS client and server. + IFPkgDescriptionTitle + OpenAFS + IFPkgDescriptionVersion + 1.2.10 + + diff --git a/src/packaging/MacOS/OpenAFS.Info.plist b/src/packaging/MacOS/OpenAFS.Info.plist new file mode 100644 index 0000000..c50b198 --- /dev/null +++ b/src/packaging/MacOS/OpenAFS.Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleGetInfoString + OpenAFS 1.2.10 + CFBundleIdentifier + org.openafs.OpenAFS.pkg + CFBundleName + OpenAFS + CFBundleShortVersionString + 1.2.10 + IFMajorVersion + 1 + IFMinorVersion + 2 + IFPkgFlagAllowBackRev + + IFPkgFlagAuthorizationAction + RootAuthorization + IFPkgFlagDefaultLocation + / + IFPkgFlagInstallFat + + IFPkgFlagIsRequired + + IFPkgFlagRelocatable + + IFPkgFlagRestartAction + RecommendedRestart + IFPkgFlagRootVolumeOnly + + IFPkgFlagUpdateInstalledLanguages + + IFPkgFlagUseUserMask + + IFPkgFormatVersion + 0.10000000149011612 + + diff --git a/src/packaging/MacOS/OpenAFS.post_install b/src/packaging/MacOS/OpenAFS.post_install index 82f2534..6582275 100644 --- a/src/packaging/MacOS/OpenAFS.post_install +++ b/src/packaging/MacOS/OpenAFS.post_install @@ -1,10 +1,24 @@ #!/bin/sh +# Portions Copyright (c) 2003 Apple Computer, Inc. All rights reserved. if [ -d /afs -a ! -h /afs ]; then rmdir /afs fi -mkdir -p /Network/afs -if [ ! -h /afs ]; then - ln -s /Network/afs /afs +majorvers=`uname -r | sed 's/\..*//'` +if [ $majorvers -ge 7 ]; then + # /Network is now readonly, so put AFS in /afs; make sure /afs is a directory + if [ -e /afs ]; then + if [ -h /afs -o ! -d /afs ]; then + rm -f /afs + mkdir /afs + fi + else + mkdir /afs + fi +else + mkdir -p /Network/afs + if [ ! -h /afs ]; then + ln -s /Network/afs /afs + fi fi cd /var/db/openafs/etc @@ -13,6 +27,11 @@ if [ ! -f cacheinfo ]; then cp cacheinfo.sample cacheinfo fi +if [ `grep /Network/afs cacheinfo` ]; then + cat cacheinfo |sed s#/Network/afs#/afs# > cacheinfo.new + mv cacheinfo.new cacheinfo +fi + # testing case -- upgrading from pre 1.2.7, but .last file exists. # merge the .save and .last.... if [ ! -f CellServDB -a -f CellServDB.save -a -f CellServDB.master.last ]; then @@ -49,3 +68,14 @@ if [ -z "$done" ]; then cp CellServDB.master CellServDB fi fi + +if [ $majorvers -ge 7 ]; then + # make config/settings.plist if it doesn't exist + if [ ! -e config/settings.plist -a -e config/settings.plist.orig ]; then + cp config/settings.plist.orig config/settings.plist + fi +elif [ -e config/afssettings ]; then + # turn off execution of afssettings + chmod a-x config/afssettings +fi + diff --git a/src/packaging/MacOS/afssettings.m b/src/packaging/MacOS/afssettings.m new file mode 100644 index 0000000..c1e647a --- /dev/null +++ b/src/packaging/MacOS/afssettings.m @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +#import +#import +#import +#import +#import +#import +#import + +enum Type { + TypeNode = 0, + TypeNum, + TypeStr +}; + +typedef struct _setting { + NSString *key; + int selector; + enum Type type; + struct _setting *children; +} Setting; + +Setting s_darwin_all[] = { + {@"RealModes", AFS_SC_DARWIN_ALL_REALMODES, TypeNum, NULL}, + {NULL, 0, 0, NULL} +}; +Setting s_darwin[] = { + {@"All", AFS_SC_DARWIN_ALL, TypeNode, s_darwin_all}, + {@"Darwin12", AFS_SC_DARWIN_12, TypeNode, NULL}, + {@"Darwin13", AFS_SC_DARWIN_13, TypeNode, NULL}, + {@"Darwin14", AFS_SC_DARWIN_14, TypeNode, NULL}, + {@"Darwin60", AFS_SC_DARWIN_60, TypeNode, NULL}, + {@"Darwin70", AFS_SC_DARWIN_70, TypeNode, NULL}, + {NULL, 0, 0, NULL} +}; +Setting s_first[] = { + {@"All", AFS_SC_ALL, TypeNode, NULL}, + {@"Darwin", AFS_SC_DARWIN, TypeNode, s_darwin}, + {NULL, 0, 0, NULL} +}; +Setting s_top = {NULL, -1, TypeNode, s_first}; + +int oid[CTL_MAXNAME] = {CTL_VFS}; +NSString *path = @"/var/db/openafs/etc/config/settings.plist"; + +char *oidString(int *oid, int len); +void init(void); +void walk(id obj, Setting *s, int level); + +void +init(void) +{ + int oidmax[] = {CTL_VFS, VFS_GENERIC, VFS_MAXTYPENUM}; + int oidvfs[] = {CTL_VFS, VFS_GENERIC, VFS_CONF, 0}; + int max; + struct vfsconf conf; + size_t len; + int i; + + len = sizeof(max); + if(sysctl(oidmax, 3, &max, &len, NULL, NULL) < 0) + err(1, "sysctl VFS_MAXTYPENUM"); + for(i = max; --i >= 0; ) { + oidvfs[3] = i; + len = sizeof(conf); + if(sysctl(oidvfs, 4, &conf, &len, NULL, NULL) < 0) + continue; + if(strcmp("afs", conf.vfc_name) == 0) { + s_top.selector = conf.vfc_typenum; + break; + } + } + if(s_top.selector < 0) + errx(1, "AFS is not loaded"); +} + +char * +oidString(int *oid, int len) +{ + static char buf[256]; + char *cp = buf; + + for(;;) { + sprintf(cp, "%d", *oid++); + if(--len <= 0) + break; + cp += strlen(cp); + *cp++ = '.'; + } + return buf; +} + +void +walk(id obj, Setting *s, int level) +{ + Setting *child; + id newobj; + int intval; + const char *cp; + int level1 = level + 1; + + oid[level] = s->selector; + switch(s->type) { + case TypeNode: + for(child = s->children; child->key; child++) { + if(child->type == TypeNode && !child->children) + continue; + newobj = [obj objectForKey: child->key]; + if(newobj) + walk(newobj, child, level1); + } + break; + case TypeNum: + intval = [obj intValue]; + if(sysctl(oid, level1, NULL, NULL, &intval, sizeof(intval)) < 0) + err(1, "sysctl %s => %d", oidString(oid, level1), intval); + break; + case TypeStr: + cp = [obj UTF8String]; + if(sysctl(oid, level1, NULL, NULL, (void *)cp, strlen(cp)) < 0) + err(1, "sysctl %s => %s", oidString(oid, level1), cp); + break; + } +} + +main() +{ + NSData *plistData; + id plist; + NSString *error; + NSPropertyListFormat format; + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + + init(); + plistData = [NSData dataWithContentsOfFile: path]; + if(plistData) { + plist = [NSPropertyListSerialization propertyListFromData: plistData + mutabilityOption: NSPropertyListImmutable + format: &format + errorDescription: &error + ]; + if(plist) + walk(plist, &s_top, 1); + else + errx(1, "%s: %s", [path UTF8String], [error UTF8String]); + } + + [pool release]; + return 0; +} diff --git a/src/packaging/MacOS/buildpkg.sh b/src/packaging/MacOS/buildpkg.sh index 183a7e5..efe482b 100644 --- a/src/packaging/MacOS/buildpkg.sh +++ b/src/packaging/MacOS/buildpkg.sh @@ -1,4 +1,5 @@ #!/bin/sh +# Portions Copyright (c) 2003 Apple Computer, Inc. All rights reserved. if [ -z "$1" ]; then echo Usage: buildpkg binary-dir @@ -6,15 +7,28 @@ if [ -z "$1" ]; then fi BINDEST=$1 RESSRC=`pwd` -if [ ! -f /usr/bin/package ]; then - echo "/usr/bin/package does not exist. Please run this script on a MacOS X system" - echo "with the BSD subsystem installed" - exit 1 -fi -if grep -q 'set resDir = ""' /usr/bin/package ; then - echo /usr/bin/package is buggy. - echo remove the line \''set resDir = ""'\' from /usr/bin/package and try again - exit 1 +majorvers=`uname -r | sed 's/\..*//'` +if [ $majorvers -ge 7 ]; then + SEP=: + package=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker + if [ ! -x $package ]; then + echo "PackageMaker does not exist. Please run this script on a MacOS X system" + echo "with the DeveloperTools package installed" + exit 1 + fi +else + SEP=. + package=/usr/bin/package + if [ ! -f $package ]; then + echo "$package does not exist. Please run this script on a MacOS X system" + echo "with the BSD subsystem installed" + exit 1 + fi + if grep -q 'set resDir = ""' $package ; then + echo $package is buggy. + echo remove the line \''set resDir = ""'\' from $package and try again + exit 1 + fi fi if [ -x /usr/bin/curl ]; then @@ -54,22 +68,21 @@ rm -rf pkgroot pkgres mkdir -p $PKGROOT $PKGRES mkdir $PKGROOT/Library -chown -R root.admin $PKGROOT +chown -R root${SEP}admin $PKGROOT chmod -R 775 $PKGROOT mkdir $PKGROOT/Library/OpenAFS $PKGROOT/Library/OpenAFS/Tools cd $BINDEST pax -rw * $PKGROOT/Library/OpenAFS/Tools cd $RESSRC -mkdir $PKGROOT/Library mkdir $PKGROOT/Library/StartupItems mkdir $PKGROOT/Library/StartupItems/OpenAFS cp $BINDEST/root.client/usr/vice/etc/afs.rc $PKGROOT/Library/StartupItems/OpenAFS/OpenAFS chmod a+x $PKGROOT/Library/StartupItems/OpenAFS/OpenAFS cp $BINDEST/root.client/usr/vice/etc/StartupParameters.plist $PKGROOT/Library/StartupItems/OpenAFS/StartupParameters.plist -chown -R root.admin $PKGROOT/Library +chown -R root${SEP}admin $PKGROOT/Library chmod -R o-w $PKGROOT/Library chmod -R g+w $PKGROOT/Library -chown -R root.wheel $PKGROOT/Library/OpenAFS/Tools +chown -R root${SEP}wheel $PKGROOT/Library/OpenAFS/Tools chmod -R og-w $PKGROOT/Library/OpenAFS/Tools mkdir $PKGROOT/private $PKGROOT/private/var $PKGROOT/private/var/db @@ -77,14 +90,22 @@ mkdir $PKGROOT/private/var/db/openafs $PKGROOT/private/var/db/openafs/cache mkdir $PKGROOT/private/var/db/openafs/etc $PKGROOT/private/var/db/openafs/etc/config cp $RESSRC/CellServDB $PKGROOT/private/var/db/openafs/etc/CellServDB.master echo andrew.cmu.edu > $PKGROOT/private/var/db/openafs/etc/ThisCell.sample -echo /Network/afs:/var/db/openafs/cache:30000 > $PKGROOT/private/var/db/openafs/etc/cacheinfo.sample +if [ $majorvers -ge 7 ]; then + echo /afs:/var/db/openafs/cache:30000 > $PKGROOT/private/var/db/openafs/etc/cacheinfo.sample + make AFSINCLUDE=$BINDEST/include + cp afssettings $PKGROOT/private/var/db/openafs/etc/config + cp settings.plist $PKGROOT/private/var/db/openafs/etc/config/settings.plist.orig + make clean +else + echo /Network/afs:/var/db/openafs/cache:30000 > $PKGROOT/private/var/db/openafs/etc/cacheinfo.sample +fi #echo '-stat 2000 -dcache 800 -daemons 3 -volumes 70 -rootvol root.afs.local' > $PKGROOT/private/var/db/openafs/etc/config/afsd.options.sample strip -X -S $PKGROOT/Library/OpenAFS/Tools/root.client/usr/vice/etc/afs.kext/Contents/MacOS/afs cp -RP $PKGROOT/Library/OpenAFS/Tools/root.client/usr/vice/etc/afs.kext $PKGROOT/private/var/db/openafs/etc -chown -R root.wheel $PKGROOT/private +chown -R root${SEP}wheel $PKGROOT/private chmod -R og-w $PKGROOT/private chmod og-rx $PKGROOT/private/var/db/openafs/cache @@ -102,26 +123,41 @@ done ln -s ../../Library/OpenAFS/Tools/root.client/usr/vice/etc/afsd $PKGROOT/usr/sbin/afsd -chown -R root.wheel $PKGROOT/usr +chown -R root${SEP}wheel $PKGROOT/usr chmod -R og-w $PKGROOT/usr -cp License.rtf ReadMe.rtf OpenAFS.post_install OpenAFS.pre_upgrade $PKGRES -cp OpenAFS.post_install $PKGRES/OpenAFS.post_upgrade -chmod a+x $PKGRES/OpenAFS.post_install $PKGRES/OpenAFS.post_upgrade $PKGRES/OpenAFS.pre_upgrade +if [ $majorvers -ge 7 ]; then + cp OpenAFS.post_install $PKGRES/postinstall + cp OpenAFS.pre_upgrade $PKGRES/preupgrade + cp OpenAFS.post_install $PKGRES/postupgrade + chmod a+x $PKGRES/postinstall $PKGRES/postupgrade $PKGRES/preupgrade +else + cp OpenAFS.post_install OpenAFS.pre_upgrade $PKGRES + cp OpenAFS.post_install $PKGRES/OpenAFS.post_upgrade + chmod a+x $PKGRES/OpenAFS.post_install $PKGRES/OpenAFS.post_upgrade $PKGRES/OpenAFS.pre_upgrade +fi +cp License.rtf ReadMe.rtf $PKGRES cp csrvdbmerge.pl $PKGRES chmod a+x $PKGRES/csrvdbmerge.pl cp CellServDB.list $PKGRES -chown -R root.wheel $PKGRES +chown -R root${SEP}wheel $PKGRES rm -rf OpenAFS.pkg -echo /usr/bin/package $PKGROOT OpenAFS.info -r $PKGRES -/usr/bin/package $PKGROOT OpenAFS.info -r $PKGRES -#old versions of package didn't handle this properly -if [ ! -r OpenAFS.pkg/Contents ]; then - mkdir OpenAFS.pkg/Contents OpenAFS.pkg/Contents/Resources - mv OpenAFS.pkg/OpenAFS.* OpenAFS.pkg/Contents/Resources - mv OpenAFS.pkg/*.rtf OpenAFS.pkg/Contents/Resources - mv OpenAFS.pkg/csrvdbmerge.pl OpenAFS.pkg/Contents/Resources - mv OpenAFS.pkg/CellServDB* OpenAFS.pkg/Contents/Resources +if [ $majorvers -ge 7 ]; then + echo $package -build -p $RESSRC/OpenAFS.pkg -f $PKGROOT -r $PKGRES \ + -i OpenAFS.Info.plist -d OpenAFS.Description.plist + $package -build -p $RESSRC/OpenAFS.pkg -f $PKGROOT -r $PKGRES \ + -i OpenAFS.Info.plist -d OpenAFS.Description.plist +else + echo $package $PKGROOT OpenAFS.info -r $PKGRES + $package $PKGROOT OpenAFS.info -r $PKGRES + #old versions of package didn't handle this properly + if [ ! -r OpenAFS.pkg/Contents ]; then + mkdir OpenAFS.pkg/Contents OpenAFS.pkg/Contents/Resources + mv OpenAFS.pkg/OpenAFS.* OpenAFS.pkg/Contents/Resources + mv OpenAFS.pkg/*.rtf OpenAFS.pkg/Contents/Resources + mv OpenAFS.pkg/csrvdbmerge.pl OpenAFS.pkg/Contents/Resources + mv OpenAFS.pkg/CellServDB* OpenAFS.pkg/Contents/Resources + fi fi rm -rf pkgroot pkgres diff --git a/src/packaging/MacOS/settings.plist b/src/packaging/MacOS/settings.plist new file mode 100644 index 0000000..36e8977 --- /dev/null +++ b/src/packaging/MacOS/settings.plist @@ -0,0 +1,14 @@ + + + + + Darwin + + All + + RealModes + + + + + diff --git a/src/ptserver/Makefile.in b/src/ptserver/Makefile.in index 761928c..13bfef2 100644 --- a/src/ptserver/Makefile.in +++ b/src/ptserver/Makefile.in @@ -138,7 +138,7 @@ readpwd.o: readpwd.c ${LINCLS} AFS_component_version_number.c testpt: testpt.o libprot.a ${TOP_LIBDIR}/libcmd.a $(LIBS) case "$(SYS_NAME)" in \ - ppc_darwin_12 ) \ + *_darwin_12 ) \ $(CC) ${CFLAGS} -o testpt testpt.o ${TOP_LIBDIR}/libcmd.a libprot.a $(LIBS) ;; \ * ) \ $(CC) ${CFLAGS} -o testpt testpt.o -lm ${TOP_LIBDIR}/libcmd.a libprot.a $(LIBS) ${XLIBS} ;; \ diff --git a/src/rxgen/rpc_scan.c b/src/rxgen/rpc_scan.c index ef89fd4..1137068 100644 --- a/src/rxgen/rpc_scan.c +++ b/src/rxgen/rpc_scan.c @@ -32,6 +32,8 @@ * rpc_scan.c, Scanner for the RPC protocol compiler * Copyright (C) 1987, Sun Microsystems, Inc. */ + +/* Portions Copyright (c) 2003 Apple Computer, Inc. */ #include #include @@ -198,6 +200,10 @@ get_token(token * tokp) if (commenting) { break; } else if (cppline(curline)) { +#if defined(AFS_DARWIN_ENV) + if (strncmp(curline, "#pragma", 7) == 0) + continue; +#endif /* defined(AFS_DARWIN_ENV) */ docppline(curline, &linenum, &infilename); } else if (directive(curline)) { printdirective(curline); diff --git a/src/rxkad/Makefile.in b/src/rxkad/Makefile.in index c3db64d..057b7a7 100644 --- a/src/rxkad/Makefile.in +++ b/src/rxkad/Makefile.in @@ -4,6 +4,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config diff --git a/src/shlibafsrpc/Makefile.in b/src/shlibafsrpc/Makefile.in index 28370dd..cbe5107 100644 --- a/src/shlibafsrpc/Makefile.in +++ b/src/shlibafsrpc/Makefile.in @@ -9,6 +9,8 @@ LIBAFSRPCMINOR=0 # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. # This is a pthread safe library containing rx, rxkad and des. @@ -342,7 +344,7 @@ syscall.o: ${SYS}/syscall.s /usr/ccs/lib/cpp ${SFLAGS} ${SYS}/syscall.s syscall.ss; \ as -o syscall.o syscall.ss; \ $(RM) syscall.ss;; \ - sgi_* | ppc_darwin* ) \ + sgi_* | *_darwin_* ) \ ${CC} ${CFLAGS} -c ${SYS}/syscall.s;; \ alpha_dux?? ) \ ${AS} -P ${CFLAGS} -D_NO_PROTO -DMACH -DOSF -nostdinc -traditional -DASSEMBLER ${SYS}/syscall.s; \ diff --git a/src/sys/Makefile.in b/src/sys/Makefile.in index f3da11a..28b48b4 100644 --- a/src/sys/Makefile.in +++ b/src/sys/Makefile.in @@ -4,6 +4,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config @@ -47,7 +49,7 @@ syscall.o: syscall.s /usr/ccs/lib/cpp ${SFLAGS} ${srcdir}/syscall.s syscall.ss; \ as -o syscall.o syscall.ss; \ $(RM) syscall.ss;; \ - sgi_* |ppc_darwin* ) \ + sgi_* |*_darwin* ) \ ${CC} ${CFLAGS} -c ${srcdir}/syscall.s;; \ alpha_osf1 | alpha_osf20 | alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \ ${AS} -P ${CFLAGS} -D_NO_PROTO -DMACH -DOSF -nostdinc -traditional -DASSEMBLER ${srcdir}/syscall.s; \ diff --git a/src/tviced/Makefile.in b/src/tviced/Makefile.in index f643cf7..4849a76 100644 --- a/src/tviced/Makefile.in +++ b/src/tviced/Makefile.in @@ -4,6 +4,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config @@ -35,7 +37,8 @@ UTILOBJS=assert.o uuid.o serverLog.o fileutil.o netutils.o dirpath.o volparse.o DIROBJS=buffer.o dir.o salvage.o VOLOBJS= vnode.o volume.o vutil.o partition.o fssync.o purge.o \ - clone.o devname.o common.o ihandle.o listinodes.o namei_ops.o + clone.o devname.o common.o ihandle.o listinodes.o namei_ops.o \ + ${EXTRA_VLIBOBJS} FSINTOBJS= afsaux.o afscbint.cs.o afsint.ss.o afsint.xdr.o @@ -145,6 +148,10 @@ nuke.o: ${VOL}/nuke.c devname.o: ${VOL}/devname.c ${CCRULE} +# only for darwin +fstab.o: ${VOL}/fstab.c + ${COMPILE} + common.o: ${VOL}/common.c ${CCRULE} diff --git a/src/util/flipbase64.c b/src/util/flipbase64.c index 6b55be8..a329410 100644 --- a/src/util/flipbase64.c +++ b/src/util/flipbase64.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ #include @@ -23,9 +25,53 @@ RCSID */ /* This table needs to be in lexical order to efficiently map back from * characters to the numerical value. + * + * In c_reverse, we use 99 to represent an illegal value, rather than -1 + * which would assume "char" is signed. */ +#ifdef AFS_DARWIN_ENV +static char c_xlate[80] = + "!\"#$%&()*+,-0123456789:;<=>?@[]^_`abcdefghijklmnopqrstuvwxyz{|}~"; +static char c_reverse[] = { + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 0, 1, 2, 3, 4, 5, 99, 6, 7, 8, 9, 10, 11, 99, 99, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 29, 99, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 +}; +#else /* AFS_DARWIN_ENV */ static char c_xlate[80] = "+=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +static char c_reverse[] = { + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 0, 99, 99, 99, 99, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 99, 99, 99, 1, 99, 99, + 99, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 99, 99, 99, 99, 99, + 99, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 +}; +#endif /* AFS_DARWIN_ENV */ /* int_to_base64 * Create a base 64 string representation of a number. @@ -60,7 +106,6 @@ int64_to_flipbase64(lb64_string_t s, u_int64_t a) } -/* Mapping: +=0, ==1, 0-9 = 2-11, A-Z = 12-37, a-z = 38-63 */ #ifdef AFS_64BIT_ENV afs_int64 flipbase64_to_int64(char *s) @@ -78,20 +123,13 @@ flipbase64_to_int64(char *s) #endif int shift; - for (shift = 0; *s; s++, shift += 6) { - if (*s == '+') - n = 0; - else if (*s == '=') - n = 1; - else if (*s <= '9') { - n = 2 + (int)(*s - '0'); - } else if (*s <= 'Z') { - n = 12 + (int)(*s - 'A'); - } else if (*s <= 'z') { - n = 38 + (int)(*s - 'a'); - } - n <<= shift; - result |= n; + for (shift = 0; *s; s++) { + n = c_reverse[*(unsigned char *)s]; + if (n >= 64) /* should never happen */ + continue; + n <<= shift; + result |= n ; + shift += 6; } return result; } diff --git a/src/util/softsig.c b/src/util/softsig.c index eadb2ff..9891dea 100644 --- a/src/util/softsig.c +++ b/src/util/softsig.c @@ -5,8 +5,13 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ +#include +#include + #define _POSIX_PTHREAD_SEMANTICS #include #include @@ -21,11 +26,19 @@ #include "pthread_nosigs.h" +/*------------------------------------------------------------------------ + * Under Darwin 6.x (including 7.0), sigwait() is broken, so we use + * sigsuspend() instead. We also don't block signals we don't know + * about, so they should kill us, rather than us returning zero status. + *------------------------------------------------------------------------*/ + static pthread_t softsig_tid; static struct { void (*handler) (int); int pending; +#if !defined(AFS_DARWIN60_ENV) int fatal; +#endif /* !defined(AFS_DARWIN60_ENV) */ int inited; } softsig_sigs[NSIG]; @@ -40,12 +53,17 @@ softsig_thread(void *arg) pthread_sigmask(SIG_BLOCK, &ss, &os); pthread_sigmask(SIG_SETMASK, &os, NULL); sigaddset(&ss, SIGUSR1); +#if defined(AFS_DARWIN60_ENV) + pthread_sigmask (SIG_BLOCK, &ss, NULL); + sigdelset (&os, SIGUSR1); +#else /* !defined(AFS_DARWIN60_ENV) */ for (i = 0; i < NSIG; i++) { if (!sigismember(&os, i) && i != SIGSTOP && i != SIGKILL) { sigaddset(&ss, i); softsig_sigs[i].fatal = 1; } } +#endif /* defined(AFS_DARWIN60_ENV) */ while (1) { void (*h) (int); @@ -56,6 +74,10 @@ softsig_thread(void *arg) for (i = 0; i < NSIG; i++) { if (softsig_sigs[i].handler && !softsig_sigs[i].inited) { sigaddset(&ss, i); +#if defined(AFS_DARWIN60_ENV) + pthread_sigmask (SIG_BLOCK, &ss, NULL); + sigdelset (&os, i); +#endif /* defined(AFS_DARWIN60_ENV) */ softsig_sigs[i].inited = 1; } if (softsig_sigs[i].pending) { @@ -65,17 +87,29 @@ softsig_thread(void *arg) } } if (i == NSIG) { +#if defined(AFS_DARWIN60_ENV) + sigsuspend (&os); +#else /* !defined(AFS_DARWIN60_ENV) */ sigwait(&ss, &sigw); if (sigw != SIGUSR1) { if (softsig_sigs[sigw].fatal) exit(0); softsig_sigs[sigw].pending = 1; } +#endif /* defined(AFS_DARWIN60_ENV) */ } else if (h) h(i); } } +#if defined(AFS_DARWIN60_ENV) +static void +softsig_usr1(int signo) +{ + signal (SIGUSR1, softsig_usr1); +} +#endif /* defined(AFS_DARWIN60_ENV) */ + void softsig_init() { @@ -85,6 +119,9 @@ softsig_init() rc = pthread_create(&softsig_tid, NULL, &softsig_thread, NULL); assert(0 == rc); AFS_SIGSET_RESTORE(); +#if defined(AFS_DARWIN60_ENV) + signal (SIGUSR1, softsig_usr1); +#endif /* defined(AFS_DARWIN60_ENV) */ } static void diff --git a/src/viced/Makefile.in b/src/viced/Makefile.in index 349e0c0..e37ac71 100644 --- a/src/viced/Makefile.in +++ b/src/viced/Makefile.in @@ -4,6 +4,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config @@ -92,6 +94,11 @@ ${DEST}/root.server/usr/afs/bin/fileserver: fileserver @case ${SYS_NAME} in \ alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun4x*|sunx86*) \ echo "Don't install fileserver for ${SYS_NAME}" ;; \ + *_darwin_[1-6][0-9]) \ + echo ${INSTALL} -ns $? $@ ; \ + ${INSTALL} -ns $? $@ ;; \ + *_darwin_*) \ + echo "Don't install fileserver for ${SYS_NAME}" ;; \ *) \ echo ${INSTALL} -ns $? $@ ; \ ${INSTALL} -ns $? $@ ;; \ @@ -110,6 +117,11 @@ ${DESTDIR}${afssrvlibexecdir}/fileserver: fileserver @case ${SYS_NAME} in \ alpha_dux4*|*linux*|rs_aix*|sgi_6*|sun4x*|sunx86*) \ echo "Don't install fileserver for ${SYS_NAME}" ;; \ + *_darwin_[1-6][0-9]) \ + echo ${INSTALL} -ns $? $@ ; \ + ${INSTALL} -ns $? $@ ;; \ + *_darwin_*) \ + echo "Don't install fileserver for ${SYS_NAME}" ;; \ *) \ echo ${INSTALL} -ns $? $@ ; \ ${INSTALL} -ns $? $@ ;; \ diff --git a/src/vol/Makefile.in b/src/vol/Makefile.in index 18ba917..76ed38b 100644 --- a/src/vol/Makefile.in +++ b/src/vol/Makefile.in @@ -4,6 +4,8 @@ # This software has been released under the terms of the IBM Public # License. For details, see the LICENSE file in the top-level source # directory or online at http://www.openafs.org/dl/license10.html +# +# Portions Copyright (c) 2003 Apple Computer, Inc. srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config @@ -21,7 +23,7 @@ PUBLICHEADERS=nfs.h vnode.h viceinode.h volume.h voldefs.h partition.h\ VLIBOBJS=vnode.o volume.o vutil.o partition.o fssync.o purge.o \ clone.o nuke.o devname.o listinodes.o common.o ihandle.o \ - namei_ops.o + namei_ops.o ${EXTRA_VLIBOBJS} OBJECTS=${VLIBOBJS} physio.o vol-salvage.o vol-info.o vol-dump.o diff --git a/src/vol/fstab.c b/src/vol/fstab.c new file mode 100644 index 0000000..46e5801 --- /dev/null +++ b/src/vol/fstab.c @@ -0,0 +1,179 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ +/* + * Copyright (c) 1980, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(AFS_DARWIN_ENV) +/*----------------------------------------------------------------------- + * This version of fstab.c is intended to be used on Darwin systems to + * replace getfsent() and family. It has been modified so that rather + * than read /etc/fstab, it calls getfsstat() to get the real list of + * mounted volumes. + *-----------------------------------------------------------------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define STDERR_FILENO 2 + +static struct fstab _fs_fstab; +static struct statfs *_fs_buf; +static struct statfs *_fs_ptr; +static int _fs_count; + +static error __P((int)); +static fstabscan __P((void)); + +static +fstabscan() +{ + if(_fs_count <= 0) + return(0); + _fs_fstab.fs_spec = _fs_ptr->f_mntfromname; + _fs_fstab.fs_file = _fs_ptr->f_mntonname; + _fs_fstab.fs_vfstype = _fs_ptr->f_fstypename; + _fs_fstab.fs_mntops = _fs_ptr->f_fstypename; // no mount options given + _fs_fstab.fs_type = (_fs_ptr->f_flags & MNT_RDONLY) ? FSTAB_RO : FSTAB_RW; + _fs_fstab.fs_freq = 0; + _fs_fstab.fs_passno = 0; + + _fs_ptr++; + _fs_count--; + return(1); +} + +struct fstab * +getfsent() +{ + if (!_fs_buf && !setfsent() || !fstabscan()) + return((struct fstab *)NULL); + return(&_fs_fstab); +} + +struct fstab * +getfsspec(name) + register const char *name; +{ + if (setfsent()) + while (fstabscan()) + if (!strcmp(_fs_fstab.fs_spec, name)) + return(&_fs_fstab); + return((struct fstab *)NULL); +} + +struct fstab * +getfsfile(name) + register const char *name; +{ + if (setfsent()) + while (fstabscan()) + if (!strcmp(_fs_fstab.fs_file, name)) + return(&_fs_fstab); + return((struct fstab *)NULL); +} + +setfsent() +{ + long bufsize; + + if (_fs_buf) { + free(_fs_buf); + _fs_buf = NULL; + } + if((_fs_count = getfsstat(NULL, 0, MNT_WAIT)) < 0) { + error(errno); + return(0); + } + bufsize = (long)_fs_count * sizeof(struct statfs); + if((_fs_buf = malloc(bufsize)) == NULL) { + error(errno); + return(0); + } + if(getfsstat(_fs_buf, bufsize, MNT_WAIT) < 0) { + error(errno); + return(0); + } + _fs_ptr = _fs_buf; + return(1); +} + +void +endfsent() +{ + if (_fs_buf) { + free(_fs_buf); + _fs_buf = NULL; + } + _fs_count = 0; +} + +static +error(err) + int err; +{ + char *p; + + (void)write(STDERR_FILENO, "fstab: ", 7); + (void)write(STDERR_FILENO, _PATH_FSTAB, sizeof(_PATH_FSTAB) - 1); + (void)write(STDERR_FILENO, ": ", 1); + p = strerror(err); + (void)write(STDERR_FILENO, p, strlen(p)); + (void)write(STDERR_FILENO, "\n", 1); +} +#endif /* defined(AFS_DARWIN_ENV) */ diff --git a/src/vol/partition.c b/src/vol/partition.c index e8032e4..5d6c26c 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -5,6 +5,8 @@ * This software has been released under the terms of the IBM Public * License. For details, see the LICENSE file in the top-level source * directory or online at http://www.openafs.org/dl/license10.html + * + * Portions Copyright (c) 2003 Apple Computer, Inc. */ /* @@ -1101,6 +1103,9 @@ VLockPartition_r(char *name) unsigned int *globalMask; int globalMaskIndex; #endif /* defined(AFS_HPUX_ENV) */ +#if defined(AFS_DARWIN_ENV) + char lockfile[MAXPATHLEN]; +#endif /* defined(AFS_DARWIN_ENV) */ #ifdef AFS_NAMEI_ENV #ifdef AFS_AIX42_ENV char LockFileName[MAXPATHLEN + 1]; @@ -1120,6 +1125,10 @@ VLockPartition_r(char *name) partitionName = dp->devName; #endif code = O_RDWR; +#elif defined(AFS_DARWIN_ENV) + strlcpy((partitionName = lockfile), dp->name, sizeof(lockfile)); + strlcat(lockfile, "/.lock.afs", sizeof(lockfile)); + code = O_RDONLY | O_CREAT; #else partitionName = dp->name; code = O_RDONLY;