Initial pass at a file API getf/releasef hooks

git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@50 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
behlendo
2008-03-18 04:56:43 +00:00
parent 1ec74a114c
commit 5d86345d37
14 changed files with 317 additions and 23 deletions
+30
View File
@@ -1,4 +1,34 @@
#ifndef _SPL_FILE_H
#define _SPL_FILE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <linux/module.h>
#include <linux/file.h>
#include <sys/kmem.h>
#include <sys/mutex.h>
#include <sys/vnode.h>
typedef struct spl_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 file_t *getf(int fd);
extern void releasef(int fd);
int file_init(void);
void file_fini(void);
#ifdef __cplusplus
}
#endif
#endif /* SPL_FILE_H */
+3
View File
@@ -204,6 +204,9 @@ extern __kmem_cache_destroy(kmem_cache_t *cache);
void
extern __kmem_reap(void);
int kmem_init(void);
void kmem_fini(void);
#define kmem_cache_create(name,size,align,ctor,dtor,rclm,priv,vmp,flags) \
__kmem_cache_create(name,size,align,ctor,dtor,rclm,priv,vmp,flags)
#define kmem_cache_destroy(cache) __kmem_cache_destroy(cache)
+2
View File
@@ -31,5 +31,7 @@ typedef longlong_t diskaddr_t;
typedef ushort_t o_mode_t;
typedef uint_t major_t;
typedef uint_t minor_t;
typedef uint_t ldi_ident_t;
typedef dev_t dev_info_t;
#endif /* _SPL_TYPES_H */
+9
View File
@@ -1,6 +1,10 @@
#ifndef _SPL_VNODE_H
#define _SPL_VNODE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <linux/module.h>
#include <linux/syscalls.h>
#include <linux/fcntl.h>
@@ -30,6 +34,7 @@
#define FRSYNC O_RSYNC
#define FEXCL O_EXCL
#define FDIRECT O_DIRECT
#define FAPPEND O_APPEND
#define FNODSYNC 0x10000 /* fsync pseudo flag */
#define FNOFOLLOW 0x20000 /* don't follow symlinks */
@@ -178,4 +183,8 @@ vn_putpage(vnode_t *vp, offset_t off, ssize_t size,
extern void *rootdir;
#ifdef __cplusplus
}
#endif
#endif /* SPL_VNODE_H */