From 5e2f4cf200203b968666acb6979aaccf7d62bbf5 Mon Sep 17 00:00:00 2001 From: alfred Date: Sun, 13 Jan 2002 21:37:49 +0000 Subject: Include sys/_lock.h and sys/_mutex.h to reduce namespace pollution. Requested by: jhb --- sys/contrib/ipfilter/netinet/fil.c | 3 +++ sys/contrib/ipfilter/netinet/ip_auth.c | 3 +++ sys/contrib/ipfilter/netinet/ip_fil.c | 3 +++ sys/contrib/ipfilter/netinet/ip_frag.c | 3 +++ sys/contrib/ipfilter/netinet/ip_log.c | 3 +++ sys/contrib/ipfilter/netinet/ip_nat.c | 3 +++ sys/contrib/ipfilter/netinet/ip_proxy.c | 3 +++ sys/contrib/ipfilter/netinet/ip_state.c | 3 +++ sys/dev/aac/aac.c | 2 ++ sys/fs/fdescfs/fdesc_vfsops.c | 1 + sys/fs/fdescfs/fdesc_vnops.c | 1 + sys/fs/fifofs/fifo_vnops.c | 1 + sys/fs/portalfs/portal_vfsops.c | 1 + sys/kern/init_main.c | 2 +- sys/kern/vfs_cache.c | 1 + sys/kern/vfs_lookup.c | 1 + sys/sys/file.h | 41 +++++++++++---------------------- sys/sys/filedesc.h | 4 ++-- 18 files changed, 49 insertions(+), 30 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/fil.c b/sys/contrib/ipfilter/netinet/fil.c index bd7cd1f..a5abb95 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 26ed004..0cc29ac 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 5e5bfce..dbe1834 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 622d0cc..d0623c5 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 b3f1e56..9d2c9a3 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 363ab24..1f0c0f3 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 1fee6b7..6428516 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 585929f..5584f65 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 f456f3f..3a7c063 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 541358f..329eab9 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 eb6f0db..3326375 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 3597cbb..9fea7a2 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 bc71fa5..caf9b6d 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 e984aec..a36fbcd 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 d0b412d..cccb69d 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 66d27af..689190b 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 a97482d..d8dbf48 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; -{ - -#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_locked(fp) \ + do { \ + FILE_LOCK_ASSERT(fp, MA_OWNED); \ + (fp)->f_count++; \ + } while (0) + +#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 40c6bf0..4419c21 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 -- cgit v1.1