- Implemented vnode interfaces and 6 test cases to the test suite.

- Re-implmented kobj support based on the vnode support.
- Add TESTS option to check.sh, and removed delay after module load.



git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@39 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
behlendo
2008-03-12 20:52:46 +00:00
parent 9490c14835
commit 4b17158506
13 changed files with 830 additions and 264 deletions
+3 -8
View File
@@ -5,21 +5,16 @@
extern "C" {
#endif
#include <linux/module.h>
#include <linux/uaccess.h>
#include <sys/types.h>
#include <sys/kmem.h>
#include <sys/vnode.h>
typedef struct _buf {
struct file *fp;
vnode_t *vp;
} _buf_t;
extern void *rootdir;
extern struct _buf *kobj_open_file(const char *name);
extern void kobj_close_file(struct _buf *file);
extern int kobj_read_file(struct _buf *file, char *buf,
unsigned size, unsigned off);
ssize_t size, offset_t off);
extern int kobj_get_filesize(struct _buf *file, uint64_t *size);
#ifdef __cplusplus
-16
View File
@@ -56,21 +56,6 @@ extern "C" {
#define NICE_TO_PRIO(nice) (MAX_RT_PRIO + (nice) + 20)
#define PRIO_TO_NICE(prio) ((prio) - MAX_RT_PRIO - 20)
#define kred NULL
#define FREAD 1
#define FWRITE 2
#define FCREAT O_CREAT
#define FTRUNC O_TRUNC
#define FOFFMAX O_LARGEFILE
#define FSYNC O_SYNC
#define FDSYNC O_DSYNC
#define FRSYNC O_RSYNC
#define FEXCL O_EXCL
#define FNODSYNC 0x10000 /* fsync pseudo flag */
#define FNOFOLLOW 0x20000 /* don't follow symlinks */
/* Missing macros
*/
#define PAGESIZE PAGE_SIZE
@@ -136,7 +121,6 @@ extern int highbit(unsigned long i);
#define zone_dataset_visible(x, y) (1)
#define INGLOBALZONE(z) (1)
/* XXX - Borrowed from zfs project libsolcompat/include/sys/sysmacros.h */
/* common macros */
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
+4 -1
View File
@@ -1,7 +1,10 @@
#ifndef _SPL_UIO_H
#define _SPL_UIO_H
typedef enum uio_rw { UIO_READ, UIO_WRITE } uio_rw_t;
typedef enum uio_rw {
UIO_READ = 0,
UIO_WRITE = 1,
} uio_rw_t;
#define UIO_SYSSPACE 1
+95 -60
View File
@@ -1,35 +1,94 @@
#ifndef _SPL_VNODE_H
#define _SPL_VNODE_H
#include <linux/module.h>
#include <linux/syscalls.h>
#include <linux/fcntl.h>
#include <linux/uaccess.h>
#include <linux/buffer_head.h>
#include <linux/dcache.h>
#include <linux/namei.h>
#include <linux/fs.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/uio.h>
#define XVA_MAPSIZE 3
#define XVA_MAGIC 0x78766174
#define FREAD 1
#define FWRITE 2
#define FCREAT O_CREAT
#define FTRUNC O_TRUNC
#define FOFFMAX O_LARGEFILE
#define FSYNC O_SYNC
#define FDSYNC O_DSYNC
#define FRSYNC O_RSYNC
#define FEXCL O_EXCL
#define FDIRECT O_DIRECT
#define FNODSYNC 0x10000 /* fsync pseudo flag */
#define FNOFOLLOW 0x20000 /* don't follow symlinks */
#define AT_TYPE 0x00001
#define AT_MODE 0x00002
#undef AT_UID /* Conflicts with linux/auxvec.h */
#define AT_UID 0x00004
#undef AT_GID /* Conflicts with linux/auxvec.h */
#define AT_GID 0x00008
#define AT_FSID 0x00010
#define AT_NODEID 0x00020
#define AT_NLINK 0x00040
#define AT_SIZE 0x00080
#define AT_ATIME 0x00100
#define AT_MTIME 0x00200
#define AT_CTIME 0x00400
#define AT_RDEV 0x00800
#define AT_BLKSIZE 0x01000
#define AT_NBLOCKS 0x02000
#define AT_SEQ 0x08000
#define AT_XVATTR 0x10000
#define CRCREAT 0
typedef enum vtype {
VNON = 0,
VREG = 1,
VDIR = 2,
VBLK = 3,
VCHR = 4,
VLNK = 5,
VFIFO = 6,
VDOOR = 7,
VPROC = 8,
VSOCK = 9,
VPORT = 10,
VBAD = 11
VNON = 0,
VREG = 1,
VDIR = 2,
VBLK = 3,
VCHR = 4,
VLNK = 5,
VFIFO = 6,
VDOOR = 7,
VPROC = 8,
VSOCK = 9,
VPORT = 10,
VBAD = 11
} vtype_t;
typedef struct vnode {
uint64_t v_size;
int v_fd;
mode_t v_mode;
char *v_path;
struct file *v_fp;
vtype_t v_type;
} vnode_t;
typedef struct vattr {
enum vtype va_type; /* vnode type */
u_short va_mode; /* acc mode */
short va_uid; /* owner uid */
short va_gid; /* owner gid */
long va_fsid; /* fs id */
long va_nodeid; /* node # */
short va_nlink; /* # links */
u_long va_size; /* file size */
long va_blocksize; /* block size */
struct timeval va_atime; /* last acc */
struct timeval va_mtime; /* last mod */
struct timeval va_ctime; /* last chg */
dev_t va_rdev; /* dev */
long va_blocks; /* space used */
} vattr_t;
#if 0
typedef struct xoptattr {
timestruc_t xoa_createtime; /* Create time of file */
uint8_t xoa_archive;
@@ -46,12 +105,6 @@ typedef struct xoptattr {
uint8_t xoa_av_modified;
} xoptattr_t;
typedef struct vattr {
uint_t va_mask; /* bit-mask of attributes */
u_offset_t va_size; /* file size in bytes */
} vattr_t;
typedef struct xvattr {
vattr_t xva_vattr; /* Embedded vattr structure */
uint32_t xva_magic; /* Magic Number */
@@ -70,46 +123,28 @@ typedef struct vsecattr {
void *vsa_dfaclentp; /* pointer to default ACL entries */
size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */
} vsecattr_t;
#endif
#define AT_TYPE 0x00001
#define AT_MODE 0x00002
// #define AT_UID 0x00004 /* Conflicts with linux/auxvec.h */
// #define AT_GID 0x00008 /* Conflicts with linux/auxvec.h */
#define AT_FSID 0x00010
#define AT_NODEID 0x00020
#define AT_NLINK 0x00040
#define AT_SIZE 0x00080
#define AT_ATIME 0x00100
#define AT_MTIME 0x00200
#define AT_CTIME 0x00400
#define AT_RDEV 0x00800
#define AT_BLKSIZE 0x01000
#define AT_NBLOCKS 0x02000
#define AT_SEQ 0x08000
#define AT_XVATTR 0x10000
extern int vn_open(const char *path, int seg, int flags, int mode,
vnode_t **vpp, int x1, void *x2);
extern int vn_openat(const char *path, int seg, int flags, int mode,
vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd);
extern int vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len,
offset_t off, int seg, int x1, rlim64_t x2,
void *x3, ssize_t *residp);
extern int vn_close(vnode_t *vp, int flags, int x1, int x2, int x3, int x4);
extern int vn_remove(const char *path, int x1, int x2);
extern int vn_rename(const char *path1, const char *path2, int x1);
extern int vn_getattr(vnode_t *vp, vattr_t *vap, int flags, int x3, void *x4);
extern int vn_fsync(vnode_t *vp, int flags, int x3, int x4);
#define CRCREAT 0
#define VOP_CLOSE vn_close
#define VN_RELE(vp)
#define VOP_GETATTR vn_getattr
#define VOP_FSYNC vn_fsync
#define VOP_PUTPAGE(vp, of, sz, fl, cr, ct)
#define vn_is_readonly(vp) 0
#define VOP_CLOSE(vp, f, c, o, cr, ct) 0
#define VOP_PUTPAGE(vp, of, sz, fl, cr, ct) 0
#define VOP_GETATTR(vp, vap, fl, cr, ct) ((vap)->va_size = (vp)->v_size, 0)
#define VOP_FSYNC(vp, f, cr, ct) sys_fsync((vp)->v_fd)
#define VN_RELE(vp) vn_close(vp)
extern int vn_open(char *path, int x1, int oflags, int mode, vnode_t **vpp,
int x2, int x3);
extern int vn_openat(char *path, int x1, int oflags, int mode, vnode_t **vpp,
int x2, int x3, vnode_t *vp, int fd);
extern int vn_rdwr(int uio, vnode_t *vp, void *addr, ssize_t len,
offset_t offset, int x1, int x2, rlim64_t x3, void *x4, ssize_t *residp);
extern void vn_close(vnode_t *vp);
#define vn_remove(path, x1, x2) remove(path)
#define vn_rename(from, to, seg) rename((from), (to))
#define vn_is_readonly(vp) B_FALSE
extern vnode_t *rootdir;
extern void *rootdir;
#endif /* SPL_VNODE_H */