From e222b08c4049dae95475eda2d5c54bd43dd45e2e Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Wed, 25 Sep 2013 16:57:41 -0400 Subject: [PATCH 1/1] Fix build for FreeBSD 10.0 Move a rmlock.h inclusion up a bit so that the vm headers can get the rmlock assertion (and other) macros they need. The filedesc structure has been expanded on FreeBSD to support a stronger capabilities system; getting to the actual file descriptor requires another structure access. limits.h and stdarg.h need sys/ and machine/ prefixes for inclusion in the kernel on FreeBSD. Fixing this lets us get rid of some unnecessary -I arguemnts in the kernel module build, which seem to have not been functioning as expected, anyway. Catch up to VM layer changes. This builds, but crashes at runtime due to some ABI incompatibilities that appear in the rx event layer; those will be fixed in a separate patch. Change-Id: Icc253b1e938a58a7ab8d1b789c82b9b940d263fd Reviewed-on: http://gerrit.openafs.org/10339 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk Reviewed-by: Jeffrey Altman --- src/afs/FBSD/osi_vm.c | 2 +- src/afs/FBSD/osi_vnodeops.c | 10 +++++++--- src/afs/afs_pioctl.c | 4 ++++ src/afs/afs_warn.c | 2 ++ src/afs/sysincludes.h | 2 +- src/libafs/MakefileProto.FBSD.in | 2 +- src/rx/rx_kcommon.h | 6 +++++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/afs/FBSD/osi_vm.c b/src/afs/FBSD/osi_vm.c index 8de7f10..d5d56f7 100644 --- a/src/afs/FBSD/osi_vm.c +++ b/src/afs/FBSD/osi_vm.c @@ -29,7 +29,7 @@ #include "afs/afs_stats.h" /* statistics */ #include #include -#include +#include #if __FreeBSD_version >= 1000030 #include #endif diff --git a/src/afs/FBSD/osi_vnodeops.c b/src/afs/FBSD/osi_vnodeops.c index 9365090..9797249 100644 --- a/src/afs/FBSD/osi_vnodeops.c +++ b/src/afs/FBSD/osi_vnodeops.c @@ -54,12 +54,12 @@ #include #include #include -#include -#include -#include #if __FreeBSD_version >= 1000030 #include #endif +#include +#include +#include #include extern int afs_pbuf_freecnt; @@ -904,6 +904,9 @@ afs_vop_getpages(struct vop_getpages_args *ap) } if (i != ap->a_reqpage) { +#if __FreeBSD_version >= 1000042 + vm_page_readahead_finish(m); +#else /* * Whether or not to leave the page activated is up in * the air, but we should put the page on a page queue @@ -937,6 +940,7 @@ afs_vop_getpages(struct vop_getpages_args *ap) vm_page_free(m); ma_vm_page_unlock(m); } +#endif /* __FreeBSD_version 1000042 */ } } ma_vm_page_unlock_queues(); diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index cde09d7..7f0329a 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -820,6 +820,10 @@ afs_xioctl(afs_proc_t *p, const struct ioctl_args *uap, register_t *retval) #if defined(AFS_NBSD50_ENV) if ((fd = fd_getfile(SCARG(uap, fd))) == NULL) return (EBADF); +#elif defined(AFS_FBSD100_ENV) + if ((uap->fd >= fdp->fd_nfiles) + || ((fd = fdp->fd_ofiles[uap->fd].fde_file) == NULL)) + return EBADF; #else if ((uap->fd >= fdp->fd_nfiles) || ((fd = fdp->fd_ofiles[uap->fd]) == NULL)) diff --git a/src/afs/afs_warn.c b/src/afs/afs_warn.c index 834a848..92cb5f7 100644 --- a/src/afs/afs_warn.c +++ b/src/afs/afs_warn.c @@ -25,6 +25,8 @@ # include # if defined(AFS_SUN5_ENV) # include +# elif defined(AFS_FBSD_ENV) +# include # else # include # endif diff --git a/src/afs/sysincludes.h b/src/afs/sysincludes.h index 34501b5..3e3a172 100644 --- a/src/afs/sysincludes.h +++ b/src/afs/sysincludes.h @@ -279,7 +279,7 @@ typedef unsigned short etap_event_t; # include "h/protosw.h" # if defined(AFS_FBSD_ENV) -# include "limits.h" +# include "sys/limits.h" # endif # ifdef AFS_HPUX_ENV diff --git a/src/libafs/MakefileProto.FBSD.in b/src/libafs/MakefileProto.FBSD.in index a3f2bff..22fd09f 100644 --- a/src/libafs/MakefileProto.FBSD.in +++ b/src/libafs/MakefileProto.FBSD.in @@ -94,7 +94,7 @@ OBJS= ${AFSAOBJS} ${AFSNONFSOBJS} LIBAFSNONFS= libafs.ko DEFINES= -DAFSDEBUG -DKERNEL -DAFS -DVICE -DNFS -DUFS -DINET -DQUOTA -DGETMOUNT -CFLAGS+= $(DEFINES) ${COMMON_INCLUDE} -I@/sys -Imachine +CFLAGS+= $(DEFINES) ${COMMON_INCLUDE} INST_LIBAFS = ${DESTDIR}${afskerneldir}/${LIBAFS} INST_LIBAFSNONFS = ${DESTDIR}${afskerneldir}/${LIBAFSNONFS} diff --git a/src/rx/rx_kcommon.h b/src/rx/rx_kcommon.h index 9133045..9b04123 100644 --- a/src/rx/rx_kcommon.h +++ b/src/rx/rx_kcommon.h @@ -141,7 +141,11 @@ typedef unsigned short etap_event_t; #include "h/errno.h" #if !(defined(AFS_SUN5_ENV) && defined(KERNEL)) /* if sys/systm.h includes varargs.h some versions of solaris have conflicts */ -#include "stdarg.h" +# if defined(AFS_FBSD_ENV) +# include "machine/stdarg.h" +# else +# include "stdarg.h" +# endif #endif #ifdef KERNEL #include "afs/sysincludes.h" -- 1.7.1