summaryrefslogtreecommitdiffstats
path: root/sys/sys/file.h
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-01-13 21:37:49 +0000
committeralfred <alfred@FreeBSD.org>2002-01-13 21:37:49 +0000
commit5e2f4cf200203b968666acb6979aaccf7d62bbf5 (patch)
tree6c0138650247c4667d104eeda26a13d70947bdb2 /sys/sys/file.h
parent2624e483f082b443613da8ffb57521327188691e (diff)
downloadFreeBSD-src-5e2f4cf200203b968666acb6979aaccf7d62bbf5.zip
FreeBSD-src-5e2f4cf200203b968666acb6979aaccf7d62bbf5.tar.gz
Include sys/_lock.h and sys/_mutex.h to reduce namespace pollution.
Requested by: jhb
Diffstat (limited to 'sys/sys/file.h')
-rw-r--r--sys/sys/file.h41
1 files changed, 14 insertions, 27 deletions
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 <sys/types.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-#include <sys/sx.h>
+#include <sys/_lock.h>
+#include <sys/_mutex.h>
#include <sys/queue.h>
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));
OpenPOWER on IntegriCloud