From d451a366fba93bdbfcd1dd40adf2335ed2d7adf7 Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Thu, 9 Mar 2006 15:27:17 +0000 Subject: [PATCH] openbsd39-20060309 Changes for OpenBSD 3.8 and 3.9. Based on ports by ober@linbsd.org and todd@fries.net. Untested. --- acinclude.m4 | 15 +++++++-- src/afs/OBSD/osi_file.c | 4 +++ src/afs/OBSD/osi_machdep.h | 10 ++++-- src/afs/OBSD/osi_vnodeops.c | 4 +-- src/config/afs_sysnames.h | 1 + src/config/param.i386_obsd39.h | 69 ++++++++++++++++++++++++++++++++++++++++++ src/des/stats.h | 6 ++++ 7 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 src/config/param.i386_obsd39.h diff --git a/acinclude.m4 b/acinclude.m4 index 830145f..c9b8417 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -246,6 +246,12 @@ else vm=${v#*.} AFS_SYSNAME="i386_obsd${vM}${vm}" ;; + sparc64-*-openbsd?.?) + v=${host#*openbsd} + vM=${v%.*} + vm=${v#*.} + AFS_SYSNAME="sparc64_obsd${vM}${vm}" + ;; i?86-*-freebsd?.*) v=${host#*freebsd} vM=${v%.*} @@ -875,8 +881,13 @@ else fi PTHREAD_LIBS=error -AC_CHECK_LIB(pthread, pthread_attr_init, - PTHREAD_LIBS="-lpthread") +if test "x$MKAFS_OSTYPE" = OBSD; then + PTHREAD_LIBS="-pthread" +fi +if test "x$PTHREAD_LIBS" = xerror; then + AC_CHECK_LIB(pthread, pthread_attr_init, + PTHREAD_LIBS="-lpthread") +fi if test "x$PTHREAD_LIBS" = xerror; then AC_CHECK_LIB(pthreads, pthread_attr_init, PTHREAD_LIBS="-lpthreads") diff --git a/src/afs/OBSD/osi_file.c b/src/afs/OBSD/osi_file.c index fd0aaa0..db1f3e7 100644 --- a/src/afs/OBSD/osi_file.c +++ b/src/afs/OBSD/osi_file.c @@ -48,7 +48,11 @@ osi_UFSOpen(afs_int32 ainode) } VOP_UNLOCK(vp, 0, curproc); afile->vnode = vp; +#ifdef AFS_OBSD39_ENV + afile->size = VTOI(vp)->i_ffs1_size; +#else afile->size = VTOI(vp)->i_ffs_size; +#endif afile->offset = 0; afile->proc = NULL; afile->inum = ainode; /* for hint validity checking */ diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index a449b6c..f7e486b 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -104,6 +104,12 @@ extern int afs_vget(); #define gop_lookupname(fnamep, segflg, followlink, compvpp) \ afs_nbsd_lookupname((fnamep), (segflg), (followlink), (compvpp)) +#ifdef AFS_OBSD39_ENV +#define afs_osi_lockmgr(l, f, i, p) lockmgr((l), (f), (i)) +#else +#define afs_osi_lockmgr(l, f, i, p) lockmgr((l), (f), (i), (p)) +#endif + #ifdef KERNEL #ifdef AFS_GLOBAL_SUNLOCK @@ -112,7 +118,7 @@ extern struct lock afs_global_lock; #define AFS_GLOCK() \ do { \ osi_Assert(curproc); \ - lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curproc); \ + afs_osi_lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, curproc); \ osi_Assert(afs_global_owner == NULL); \ afs_global_owner = curproc; \ } while (0) @@ -121,7 +127,7 @@ extern struct lock afs_global_lock; osi_Assert(curproc); \ osi_Assert(afs_global_owner == curproc); \ afs_global_owner = NULL; \ - lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \ + afs_osi_lockmgr(&afs_global_lock, LK_RELEASE, 0, curproc); \ } while(0) #define ISAFS_GLOCK() (afs_global_owner == curproc && curproc) #else diff --git a/src/afs/OBSD/osi_vnodeops.c b/src/afs/OBSD/osi_vnodeops.c index 426d4f4..880fe45 100644 --- a/src/afs/OBSD/osi_vnodeops.c +++ b/src/afs/OBSD/osi_vnodeops.c @@ -933,7 +933,7 @@ afs_nbsd_lock(void *v) if (!vc) panic("afs_nbsd_lock: null vcache"); - return lockmgr(&vc->rwlock, ap->a_flags | LK_CANRECURSE, &vp->v_interlock, + return afs_osi_lockmgr(&vc->rwlock, ap->a_flags | LK_CANRECURSE, &vp->v_interlock, ap->a_p); } @@ -950,7 +950,7 @@ afs_nbsd_unlock(void *v) if (!vc) panic("afs_nbsd_unlock: null vcache"); - return lockmgr(&vc->rwlock, ap->a_flags | LK_RELEASE, &vp->v_interlock, + return afs_osi_lockmgr(&vc->rwlock, ap->a_flags | LK_RELEASE, &vp->v_interlock, ap->a_p); } diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index afb6f15..60addf9 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -221,6 +221,7 @@ #define SYS_NAME_ID_i386_obsd36 2605 #define SYS_NAME_ID_i386_obsd37 2606 #define SYS_NAME_ID_i386_obsd38 2607 +#define SYS_NAME_ID_i386_obsd39 2608 #define SYS_NAME_ID_amd64_linux2 2700 #define SYS_NAME_ID_amd64_linux22 2701 diff --git a/src/config/param.i386_obsd39.h b/src/config/param.i386_obsd39.h new file mode 100644 index 0000000..b4f40c0 --- /dev/null +++ b/src/config/param.i386_obsd39.h @@ -0,0 +1,69 @@ +/* + * Jim Rees, University of Michigan CITI + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#ifndef IGNORE_STDS_H +#include +#endif + +#define SYS_NAME "i386_obsd39" +#define SYS_NAME_ID SYS_NAME_ID_i386_obsd39 + +#define AFS_XBSD_ENV 1 /* {Free,Open,Net}BSD */ +#define AFS_X86_XBSD_ENV 1 + +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 +#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ +#define AFS_OBSD_ENV 1 +#define AFS_OBSD34_ENV 1 +#define AFS_OBSD35_ENV 1 +#define AFS_OBSD36_ENV 1 +#define AFS_OBSD37_ENV 1 +#define AFS_OBSD38_ENV 1 +#define AFS_OBSD39_ENV 1 +#define AFS_NONFSTRANS 1 +#define AFS_VM_RDWR_ENV 1 +#define AFS_VFS_ENV 1 +#define AFS_VFSINCL_ENV 1 + +#define FTRUNC O_TRUNC + +#define AFS_SYSCALL 208 +#define AFS_MOUNT_AFS "afs" + +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */ + +#define AFSLITTLE_ENDIAN 1 + +#ifndef IGNORE_STDS_H +#include +#endif + +/* Extra kernel definitions (from kdefs file) */ +#ifdef _KERNEL +#ifdef MULTIPROCESSOR +#define AFS_GLOBAL_SUNLOCK 1 +#endif +#define AFS_SHORTGID 0 /* are group id's short? */ + +#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) +enum vcexcl { NONEXCL, EXCL }; + +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif + +#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */ +#endif /* _KERNEL */ + +#endif /* AFS_PARAM_H */ diff --git a/src/des/stats.h b/src/des/stats.h index 67fa9cf..3fd1fb6 100644 --- a/src/des/stats.h +++ b/src/des/stats.h @@ -106,6 +106,7 @@ extern int rxkad_stats_agg(rxkad_stats_t *); } \ rxkad_stats->stats_elem--; \ END +#ifndef AFS_OBSD38_ENV #define ADD_RXKAD_STATS(stats_elem, inc_value) \ BEGIN \ rxkad_stats_t * rxkad_stats; \ @@ -124,6 +125,11 @@ extern int rxkad_stats_agg(rxkad_stats_t *); } \ rxkad_stats->stats_elem -= dec_value; \ END +#else /* AFS_OBSD38_ENV */ +/* segfaults but we don't know why */ +#define ADD_RXKAD_STATS(stats_elem, inc_value) +#define SUB_RXKAD_STATS(stats_elem, dec_value) +#endif /* AFS_OBSD38_ENV */ #else /* AFS_PTHREAD_ENV */ #define INC_RXKAD_STATS(stats_elem) rxkad_stats.stats_elem++ #define DEC_RXKAD_STATS(stats_elem) rxkad_stats.stats_elem-- -- 1.9.4