diff options
author | Peter Wemm <peter@FreeBSD.org> | 1999-11-08 03:25:23 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 1999-11-08 03:25:23 +0000 |
commit | a2eec8ee15eeabb3c1d32dd9fe4571b1369246dd (patch) | |
tree | 3b51a77c5a36f6dc90bb28ffddadadb82ae8c6e7 /sys/sys/file.h | |
parent | db8cd7ce1fbf3a6212e7ab181d2212b6ec7bf692 (diff) | |
download | src-a2eec8ee15eeabb3c1d32dd9fe4571b1369246dd.tar.gz src-a2eec8ee15eeabb3c1d32dd9fe4571b1369246dd.zip |
Create a fileops fo_stat() entry point. This will enable collection
of a bunch of duplicated code that breaks (read: panic) when a new
file type is added and some switch/case entries are missed.
Notes
Notes:
svn path=/head/; revision=52981
Diffstat (limited to 'sys/sys/file.h')
-rw-r--r-- | sys/sys/file.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/sys/file.h b/sys/sys/file.h index 47557d406617..014a2931b673 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -45,6 +45,7 @@ #ifdef KERNEL #include <sys/queue.h> +struct stat; struct proc; struct uio; @@ -75,6 +76,8 @@ struct file { caddr_t data, struct proc *p)); int (*fo_poll) __P((struct file *fp, int events, struct ucred *cred, struct proc *p)); + int (*fo_stat) __P((struct file *fp, struct stat *sb, + struct proc *p)); int (*fo_close) __P((struct file *fp, struct proc *p)); } *f_ops; int f_seqcount; /* @@ -119,6 +122,8 @@ static __inline int fo_ioctl __P((struct file *fp, u_long com, caddr_t data, struct proc *p)); static __inline int fo_poll __P((struct file *fp, int events, struct ucred *cred, struct proc *p)); +static __inline int fo_stat __P((struct file *fp, struct stat *sb, + struct proc *p)); static __inline int fo_close __P((struct file *fp, struct proc *p)); static __inline int @@ -184,6 +189,20 @@ fo_poll(fp, events, cred, p) } static __inline int +fo_stat(fp, sb, p) + struct file *fp; + struct stat *sb; + struct proc *p; +{ + int error; + + fhold(fp); + error = (*fp->f_ops->fo_stat)(fp, sb, p); + fdrop(fp, p); + return (error); +} + +static __inline int fo_close(fp, p) struct file *fp; struct proc *p; |