summaryrefslogtreecommitdiffstats
path: root/sys/sys/file.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-09-22 16:20:47 +0000
committerjhb <jhb@FreeBSD.org>2014-09-22 16:20:47 +0000
commit8f082668d04c6a91668059ff9bdebcfa153839f0 (patch)
tree1934338f5bf1e12f3ce97b74e9e403dcf5a32bc8 /sys/sys/file.h
parent2a681a5c921fd16ac653be127abedd8baa3ab4a9 (diff)
downloadFreeBSD-src-8f082668d04c6a91668059ff9bdebcfa153839f0.zip
FreeBSD-src-8f082668d04c6a91668059ff9bdebcfa153839f0.tar.gz
Add a new fo_fill_kinfo fileops method to add type-specific information to
struct kinfo_file. - Move the various fill_*_info() methods out of kern_descrip.c and into the various file type implementations. - Rework the support for kinfo_ofile to generate a suitable kinfo_file object for each file and then convert that to a kinfo_ofile structure rather than keeping a second, different set of code that directly manipulates type-specific file information. - Remove the shm_path() and ksem_info() layering violations. Differential Revision: https://reviews.freebsd.org/D775 Reviewed by: kib, glebius (earlier version)
Diffstat (limited to 'sys/sys/file.h')
-rw-r--r--sys/sys/file.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/sys/file.h b/sys/sys/file.h
index 92f125f..e593d43 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -43,6 +43,7 @@
#include <sys/_lock.h>
#include <sys/_mutex.h>
+struct filedesc;
struct stat;
struct thread;
struct uio;
@@ -70,6 +71,7 @@ struct socket;
struct file;
struct filecaps;
+struct kinfo_file;
struct ucred;
#define FOF_OFFSET 0x01 /* Use the offset in uio argument */
@@ -114,6 +116,8 @@ typedef int fo_sendfile_t(struct file *fp, int sockfd, struct uio *hdr_uio,
struct sendfile_sync *sfs, struct thread *td);
typedef int fo_seek_t(struct file *fp, off_t offset, int whence,
struct thread *td);
+typedef int fo_fill_kinfo_t(struct file *fp, struct kinfo_file *kif,
+ struct filedesc *fdp);
typedef int fo_flags_t;
struct fileops {
@@ -129,6 +133,7 @@ struct fileops {
fo_chown_t *fo_chown;
fo_sendfile_t *fo_sendfile;
fo_seek_t *fo_seek;
+ fo_fill_kinfo_t *fo_fill_kinfo;
fo_flags_t fo_flags; /* DFLAG_* below */
};
@@ -242,6 +247,8 @@ fo_sendfile_t invfo_sendfile;
fo_sendfile_t vn_sendfile;
fo_seek_t vn_seek;
+fo_fill_kinfo_t vn_fill_kinfo;
+int vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif);
void finit(struct file *, u_int, short, void *, struct fileops *);
int fgetvp(struct thread *td, int fd, cap_rights_t *rightsp,
@@ -378,6 +385,13 @@ fo_seek(struct file *fp, off_t offset, int whence, struct thread *td)
return ((*fp->f_ops->fo_seek)(fp, offset, whence, td));
}
+static __inline int
+fo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
+{
+
+ return ((*fp->f_ops->fo_fill_kinfo)(fp, kif, fdp));
+}
+
#endif /* _KERNEL */
#endif /* !SYS_FILE_H */
OpenPOWER on IntegriCloud