]>
Commit | Line | Data |
---|---|---|
0b3cf046 | 1 | #ifndef _SPL_VNODE_H |
2 | #define _SPL_VNODE_H | |
3 | ||
5d86345d | 4 | #ifdef __cplusplus |
5 | extern "C" { | |
6 | #endif | |
7 | ||
4b171585 | 8 | #include <linux/module.h> |
6adf99e7 | 9 | #include <linux/syscalls.h> |
4b171585 | 10 | #include <linux/fcntl.h> |
11 | #include <linux/uaccess.h> | |
12 | #include <linux/buffer_head.h> | |
13 | #include <linux/dcache.h> | |
14 | #include <linux/namei.h> | |
15 | #include <linux/fs.h> | |
af828292 | 16 | #include <sys/kmem.h> |
17 | #include <sys/mutex.h> | |
4b171585 | 18 | #include <sys/types.h> |
19 | #include <sys/time.h> | |
20 | #include <sys/uio.h> | |
6adf99e7 | 21 | |
0b3cf046 | 22 | #define XVA_MAPSIZE 3 |
23 | #define XVA_MAGIC 0x78766174 | |
24 | ||
36e6f861 | 25 | #define O_DSYNC 040000000 |
26 | ||
4b171585 | 27 | #define FREAD 1 |
28 | #define FWRITE 2 | |
29 | #define FCREAT O_CREAT | |
30 | #define FTRUNC O_TRUNC | |
31 | #define FOFFMAX O_LARGEFILE | |
32 | #define FSYNC O_SYNC | |
33 | #define FDSYNC O_DSYNC | |
34 | #define FRSYNC O_RSYNC | |
35 | #define FEXCL O_EXCL | |
36 | #define FDIRECT O_DIRECT | |
5d86345d | 37 | #define FAPPEND O_APPEND |
4b171585 | 38 | |
39 | #define FNODSYNC 0x10000 /* fsync pseudo flag */ | |
40 | #define FNOFOLLOW 0x20000 /* don't follow symlinks */ | |
41 | ||
42 | #define AT_TYPE 0x00001 | |
43 | #define AT_MODE 0x00002 | |
44 | #undef AT_UID /* Conflicts with linux/auxvec.h */ | |
45 | #define AT_UID 0x00004 | |
46 | #undef AT_GID /* Conflicts with linux/auxvec.h */ | |
47 | #define AT_GID 0x00008 | |
48 | #define AT_FSID 0x00010 | |
49 | #define AT_NODEID 0x00020 | |
50 | #define AT_NLINK 0x00040 | |
51 | #define AT_SIZE 0x00080 | |
52 | #define AT_ATIME 0x00100 | |
53 | #define AT_MTIME 0x00200 | |
54 | #define AT_CTIME 0x00400 | |
55 | #define AT_RDEV 0x00800 | |
56 | #define AT_BLKSIZE 0x01000 | |
57 | #define AT_NBLOCKS 0x02000 | |
58 | #define AT_SEQ 0x08000 | |
59 | #define AT_XVATTR 0x10000 | |
60 | ||
2f5d55aa | 61 | #define CRCREAT 0x01 |
62 | #define RMFILE 0x02 | |
4b171585 | 63 | |
36e6f861 | 64 | #define B_INVAL 0x01 |
65 | #define B_TRUNC 0x02 | |
66 | ||
6adf99e7 | 67 | typedef enum vtype { |
4b171585 | 68 | VNON = 0, |
69 | VREG = 1, | |
70 | VDIR = 2, | |
71 | VBLK = 3, | |
72 | VCHR = 4, | |
73 | VLNK = 5, | |
74 | VFIFO = 6, | |
75 | VDOOR = 7, | |
76 | VPROC = 8, | |
77 | VSOCK = 9, | |
78 | VPORT = 10, | |
79 | VBAD = 11 | |
6adf99e7 | 80 | } vtype_t; |
81 | ||
4b171585 | 82 | typedef struct vattr { |
83 | enum vtype va_type; /* vnode type */ | |
36e6f861 | 84 | u_int va_mask; /* attribute bit-mask */ |
4b171585 | 85 | u_short va_mode; /* acc mode */ |
86 | short va_uid; /* owner uid */ | |
87 | short va_gid; /* owner gid */ | |
88 | long va_fsid; /* fs id */ | |
89 | long va_nodeid; /* node # */ | |
90 | short va_nlink; /* # links */ | |
91 | u_long va_size; /* file size */ | |
92 | long va_blocksize; /* block size */ | |
93 | struct timeval va_atime; /* last acc */ | |
94 | struct timeval va_mtime; /* last mod */ | |
95 | struct timeval va_ctime; /* last chg */ | |
96 | dev_t va_rdev; /* dev */ | |
97 | long va_blocks; /* space used */ | |
98 | } vattr_t; | |
0b3cf046 | 99 | |
100 | typedef struct xoptattr { | |
101 | timestruc_t xoa_createtime; /* Create time of file */ | |
102 | uint8_t xoa_archive; | |
103 | uint8_t xoa_system; | |
104 | uint8_t xoa_readonly; | |
105 | uint8_t xoa_hidden; | |
106 | uint8_t xoa_nounlink; | |
107 | uint8_t xoa_immutable; | |
108 | uint8_t xoa_appendonly; | |
109 | uint8_t xoa_nodump; | |
110 | uint8_t xoa_settable; | |
111 | uint8_t xoa_opaque; | |
112 | uint8_t xoa_av_quarantined; | |
113 | uint8_t xoa_av_modified; | |
114 | } xoptattr_t; | |
115 | ||
0b3cf046 | 116 | typedef struct xvattr { |
117 | vattr_t xva_vattr; /* Embedded vattr structure */ | |
118 | uint32_t xva_magic; /* Magic Number */ | |
119 | uint32_t xva_mapsize; /* Size of attr bitmap (32-bit words) */ | |
120 | uint32_t *xva_rtnattrmapp; /* Ptr to xva_rtnattrmap[] */ | |
121 | uint32_t xva_reqattrmap[XVA_MAPSIZE]; /* Requested attrs */ | |
122 | uint32_t xva_rtnattrmap[XVA_MAPSIZE]; /* Returned attrs */ | |
123 | xoptattr_t xva_xoptattrs; /* Optional attributes */ | |
124 | } xvattr_t; | |
125 | ||
126 | typedef struct vsecattr { | |
127 | uint_t vsa_mask; /* See below */ | |
128 | int vsa_aclcnt; /* ACL entry count */ | |
129 | void *vsa_aclentp; /* pointer to ACL entries */ | |
130 | int vsa_dfaclcnt; /* default ACL entry count */ | |
131 | void *vsa_dfaclentp; /* pointer to default ACL entries */ | |
132 | size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */ | |
133 | } vsecattr_t; | |
4b171585 | 134 | |
af828292 | 135 | typedef struct vnode { |
136 | struct file *v_fp; | |
137 | kmutex_t v_lock; /* protects vnode fields */ | |
138 | uint_t v_flag; /* vnode flags (see below) */ | |
139 | uint_t v_count; /* reference count */ | |
140 | void *v_data; /* private data for fs */ | |
141 | struct vfs *v_vfsp; /* ptr to containing VFS */ | |
142 | struct stdata *v_stream; /* associated stream */ | |
143 | enum vtype v_type; /* vnode type */ | |
144 | dev_t v_rdev; /* device (VCHR, VBLK) */ | |
145 | } vnode_t; | |
146 | ||
147 | extern vnode_t *vn_alloc(int flag); | |
148 | void vn_free(vnode_t *vp); | |
73e540a0 | 149 | extern int vn_open(const char *path, uio_seg_t seg, int flags, int mode, |
4b171585 | 150 | vnode_t **vpp, int x1, void *x2); |
73e540a0 | 151 | extern int vn_openat(const char *path, uio_seg_t seg, int flags, int mode, |
4b171585 | 152 | vnode_t **vpp, int x1, void *x2, vnode_t *vp, int fd); |
153 | extern int vn_rdwr(uio_rw_t uio, vnode_t *vp, void *addr, ssize_t len, | |
73e540a0 | 154 | offset_t off, uio_seg_t seg, int x1, rlim64_t x2, |
4b171585 | 155 | void *x3, ssize_t *residp); |
2f5d55aa | 156 | extern int vn_close(vnode_t *vp, int flags, int x1, int x2, void *x3, void *x4); |
73e540a0 | 157 | extern int vn_remove(const char *path, uio_seg_t seg, int flags); |
4b171585 | 158 | extern int vn_rename(const char *path1, const char *path2, int x1); |
36e6f861 | 159 | extern int vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4); |
2f5d55aa | 160 | extern int vn_fsync(vnode_t *vp, int flags, void *x3, void *x4); |
4b171585 | 161 | |
af828292 | 162 | int vn_init(void); |
163 | void vn_fini(void); | |
164 | ||
36e6f861 | 165 | static __inline__ int |
166 | vn_rele(vnode_t *vp) | |
167 | { | |
168 | return 0; | |
169 | } /* vn_rele() */ | |
170 | ||
171 | static __inline__ int | |
172 | vn_putpage(vnode_t *vp, offset_t off, ssize_t size, | |
173 | int flags, void *x1, void *x2) { | |
174 | return 0; | |
175 | } /* vn_putpage() */ | |
176 | ||
4b171585 | 177 | #define VOP_CLOSE vn_close |
36e6f861 | 178 | #define VN_RELE vn_rele |
4b171585 | 179 | #define VOP_GETATTR vn_getattr |
180 | #define VOP_FSYNC vn_fsync | |
36e6f861 | 181 | #define VOP_PUTPAGE vn_putpage |
4b171585 | 182 | #define vn_is_readonly(vp) 0 |
183 | ||
184 | extern void *rootdir; | |
0b3cf046 | 185 | |
5d86345d | 186 | #ifdef __cplusplus |
187 | } | |
188 | #endif | |
189 | ||
0b3cf046 | 190 | #endif /* SPL_VNODE_H */ |