diff --git a/sys/contrib/ipfilter/netinet/fil.c b/sys/contrib/ipfilter/netinet/fil.c index bd7cd1ff818e..a5abb9545bb9 100644 --- a/sys/contrib/ipfilter/netinet/fil.c +++ b/sys/contrib/ipfilter/netinet/fil.c @@ -7,6 +7,9 @@ #include #include #include +#if (__FreeBSD_version >= 500028) +#include +#endif #include #if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) && \ defined(_KERNEL) diff --git a/sys/contrib/ipfilter/netinet/ip_auth.c b/sys/contrib/ipfilter/netinet/ip_auth.c index 26ed0049cccf..0cc29acd76bd 100644 --- a/sys/contrib/ipfilter/netinet/ip_auth.c +++ b/sys/contrib/ipfilter/netinet/ip_auth.c @@ -7,6 +7,9 @@ #include #include #include +#if (__FreeBSD_version >= 500028) +#include +#endif #include #if !defined(_KERNEL) && !defined(KERNEL) # include diff --git a/sys/contrib/ipfilter/netinet/ip_fil.c b/sys/contrib/ipfilter/netinet/ip_fil.c index 5e5bfce2c96a..dbe1834ee657 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.c +++ b/sys/contrib/ipfilter/netinet/ip_fil.c @@ -34,6 +34,9 @@ #endif #include #include +#if (__FreeBSD_version >= 500028) +#include +#endif #include #if __FreeBSD_version >= 220000 && defined(_KERNEL) # include diff --git a/sys/contrib/ipfilter/netinet/ip_frag.c b/sys/contrib/ipfilter/netinet/ip_frag.c index 622d0cc5816d..d0623c5b39cf 100644 --- a/sys/contrib/ipfilter/netinet/ip_frag.c +++ b/sys/contrib/ipfilter/netinet/ip_frag.c @@ -11,6 +11,9 @@ #include #include #include +#if (__FreeBSD_version >= 500028) +#include +#endif #include #if !defined(_KERNEL) && !defined(KERNEL) # include diff --git a/sys/contrib/ipfilter/netinet/ip_log.c b/sys/contrib/ipfilter/netinet/ip_log.c index b3f1e5606242..9d2c9a327115 100644 --- a/sys/contrib/ipfilter/netinet/ip_log.c +++ b/sys/contrib/ipfilter/netinet/ip_log.c @@ -47,6 +47,9 @@ # endif # include # include +# if (__FreeBSD_version >= 500028) +# include +# endif # include # if __FreeBSD_version >= 220000 && defined(_KERNEL) # include diff --git a/sys/contrib/ipfilter/netinet/ip_nat.c b/sys/contrib/ipfilter/netinet/ip_nat.c index 363ab24cb01b..1f0c0f349dab 100644 --- a/sys/contrib/ipfilter/netinet/ip_nat.c +++ b/sys/contrib/ipfilter/netinet/ip_nat.c @@ -14,6 +14,9 @@ #include #include #include +#if (__FreeBSD_version >= 500028) +#include +#endif #include #if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) && \ defined(_KERNEL) diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c index 1fee6b720c4e..6428516a003c 100644 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ b/sys/contrib/ipfilter/netinet/ip_proxy.c @@ -12,6 +12,9 @@ #include #include #include +#if (__FreeBSD_version >= 500028) +#include +#endif #include #if !defined(__FreeBSD_version) # include diff --git a/sys/contrib/ipfilter/netinet/ip_state.c b/sys/contrib/ipfilter/netinet/ip_state.c index 585929fd21d1..5584f658a6d3 100644 --- a/sys/contrib/ipfilter/netinet/ip_state.c +++ b/sys/contrib/ipfilter/netinet/ip_state.c @@ -7,6 +7,9 @@ #include #include #include +#if (__FreeBSD_version >= 500028) +#include +#endif #include #if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) && \ defined(_KERNEL) diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index f456f3f39ae1..3a7c063f0ed5 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include #include #if __FreeBSD_version >= 500005 diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index 541358f3c3fe..329eab96bd75 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index eb6f0dbe1abf..3326375e445c 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -49,6 +49,7 @@ #include #include /* boottime */ #include +#include #include #include /* Must come after sys/malloc.h */ #include diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 3597cbb15fab..9fea7a24eef1 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include /* XXXKSE */ diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index bc71fa5b16d1..caf9b6d07420 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include /* Must come after sys/malloc.h */ #include diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index e984aec1be93..a36fbcdf0c8b 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -45,9 +45,9 @@ #include "opt_init_path.h" #include +#include #include #include -#include #include #include #include diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index d0b412d5e171..cccb69da6d12 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 66d27afd5ae5..689190b03e10 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/sys/file.h b/sys/sys/file.h index a97482d83227..d8dbf48c81a5 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -44,9 +44,8 @@ #ifdef _KERNEL #include -#include -#include -#include +#include +#include #include struct stat; @@ -122,8 +121,6 @@ extern int maxfilesperproc; /* per process limit on number of open files */ extern int nfiles; /* (fl) actual number of open files */ extern struct sx filelist_lock; /* sx to protect filelist and nfiles */ -static __inline struct file * fhold __P((struct file *fp)); -static __inline struct file * fhold_locked __P((struct file *fp)); int fget __P((struct thread *td, int fd, struct file **fpp)); int fget_read __P((struct thread *td, int fd, struct file **fpp)); int fget_write __P((struct thread *td, int fd, struct file **fpp)); @@ -143,28 +140,18 @@ int fgetvp_write __P((struct thread *td, int fd, struct vnode **vpp)); int fgetsock __P((struct thread *td, int fd, struct socket **spp, u_int *fflagp)); void fputsock __P((struct socket *sp)); -static __inline struct file * -fhold_locked(fp) - struct file *fp; -{ +#define fhold_locked(fp) \ + do { \ + FILE_LOCK_ASSERT(fp, MA_OWNED); \ + (fp)->f_count++; \ + } while (0) -#ifdef INVARIANTS - FILE_LOCK_ASSERT(fp, MA_OWNED); -#endif - fp->f_count++; - return (fp); -} - -static __inline struct file * -fhold(fp) - struct file *fp; -{ - - FILE_LOCK(fp); - fhold_locked(fp); - FILE_UNLOCK(fp); - return (fp); -} +#define fhold(fp) \ + do { \ + FILE_LOCK(fp); \ + fhold_locked(fp); \ + FILE_UNLOCK(fp); \ + } while (0) static __inline int fo_read __P((struct file *fp, struct uio *uio, struct ucred *cred, int flags, struct thread *td)); diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 40c6bf071174..4419c21dd0ec 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -37,8 +37,8 @@ #ifndef _SYS_FILEDESC_H_ #define _SYS_FILEDESC_H_ -#include -#include +#include +#include #include #include