summaryrefslogtreecommitdiffstats
path: root/include/sys/vnode.h
diff options
context:
space:
mode:
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-03-18 23:20:30 +0000
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-03-18 23:20:30 +0000
commite4f1d29f89b70a06197f86640c9544ffff07920b (patch)
tree7d01f33661083f922055a095422797965f7992f9 /include/sys/vnode.h
parent5d86345d3753fd6d873ba40480e1121eb7c28e21 (diff)
OK, some pretty substantial rework here. I've merged the spl-file
stuff which only inclused the getf()/releasef() in to the vnode area where it will only really be used. These calls allow a user to grab an open file struct given only the known open fd for a particular user context. ZFS makes use of these, but they're a bit tricky to test from within the kernel since you already need the file open and know the fd. So we basically spook the system calls to setup the environment we need for the splat test case and verify given just the know fd we can get the file, create the needed vnode, and then use the vnode interface as usual to read and write from it. While I was hacking away I also noticed a NULL termination issue in the second kobj test case so I fixed that too. In fact, I fixed a few other things as well but all for the best! git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@51 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
Diffstat (limited to 'include/sys/vnode.h')
-rw-r--r--include/sys/vnode.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/sys/vnode.h b/include/sys/vnode.h
index 74a09b9b6..1b9c3b671 100644
--- a/include/sys/vnode.h
+++ b/include/sys/vnode.h
@@ -12,6 +12,7 @@ extern "C" {
#include <linux/buffer_head.h>
#include <linux/dcache.h>
#include <linux/namei.h>
+#include <linux/file.h>
#include <linux/fs.h>
#include <sys/kmem.h>
#include <sys/mutex.h>
@@ -133,7 +134,7 @@ typedef struct vsecattr {
} vsecattr_t;
typedef struct vnode {
- struct file *v_fp;
+ struct file *v_file;
kmutex_t v_lock; /* protects vnode fields */
uint_t v_flag; /* vnode flags (see below) */
uint_t v_count; /* reference count */
@@ -144,6 +145,16 @@ typedef struct vnode {
dev_t v_rdev; /* device (VCHR, VBLK) */
} vnode_t;
+typedef struct vn_file {
+ int f_fd; /* linux fd for lookup */
+ struct file *f_file; /* linux file struct */
+ atomic_t f_ref; /* ref count */
+ kmutex_t f_lock; /* struct lock */
+ loff_t f_offset; /* offset */
+ vnode_t *f_vnode; /* vnode */
+ struct list_head f_list; /* list of referenced file_t's */
+} file_t;
+
extern vnode_t *vn_alloc(int flag);
void vn_free(vnode_t *vp);
extern int vn_open(const char *path, uio_seg_t seg, int flags, int mode,
@@ -158,6 +169,8 @@ extern int vn_remove(const char *path, uio_seg_t seg, int flags);
extern int vn_rename(const char *path1, const char *path2, int x1);
extern int vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4);
extern int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4);
+extern file_t *vn_getf(int fd);
+extern void vn_releasef(int fd);
int vn_init(void);
void vn_fini(void);
@@ -180,6 +193,8 @@ vn_putpage(vnode_t *vp, offset_t off, ssize_t size,
#define VOP_FSYNC vn_fsync
#define VOP_PUTPAGE vn_putpage
#define vn_is_readonly(vp) 0
+#define getf vn_getf
+#define releasef vn_releasef
extern void *rootdir;