diff options
Diffstat (limited to 'fs/xfs/xfs_vnodeops_bhv.c')
-rw-r--r-- | fs/xfs/xfs_vnodeops_bhv.c | 438 |
1 files changed, 438 insertions, 0 deletions
diff --git a/fs/xfs/xfs_vnodeops_bhv.c b/fs/xfs/xfs_vnodeops_bhv.c new file mode 100644 index 000000000000..c61653aed054 --- /dev/null +++ b/fs/xfs/xfs_vnodeops_bhv.c | |||
@@ -0,0 +1,438 @@ | |||
1 | |||
2 | #include "xfs_linux.h" | ||
3 | #include "xfs_vnodeops.h" | ||
4 | |||
5 | #include "xfs_bmap_btree.h" | ||
6 | #include "xfs_inode.h" | ||
7 | |||
8 | STATIC int | ||
9 | xfs_bhv_open( | ||
10 | bhv_desc_t *bdp, | ||
11 | cred_t *credp) | ||
12 | { | ||
13 | return xfs_open(XFS_BHVTOI(bdp)); | ||
14 | } | ||
15 | |||
16 | STATIC int | ||
17 | xfs_bhv_getattr( | ||
18 | bhv_desc_t *bdp, | ||
19 | bhv_vattr_t *vap, | ||
20 | int flags, | ||
21 | cred_t *credp) | ||
22 | { | ||
23 | return xfs_getattr(XFS_BHVTOI(bdp), vap, flags); | ||
24 | } | ||
25 | |||
26 | int | ||
27 | xfs_bhv_setattr( | ||
28 | bhv_desc_t *bdp, | ||
29 | bhv_vattr_t *vap, | ||
30 | int flags, | ||
31 | cred_t *credp) | ||
32 | { | ||
33 | return xfs_setattr(XFS_BHVTOI(bdp), vap, flags, credp); | ||
34 | } | ||
35 | |||
36 | STATIC int | ||
37 | xfs_bhv_access( | ||
38 | bhv_desc_t *bdp, | ||
39 | int mode, | ||
40 | cred_t *credp) | ||
41 | { | ||
42 | return xfs_access(XFS_BHVTOI(bdp), mode, credp); | ||
43 | } | ||
44 | |||
45 | STATIC int | ||
46 | xfs_bhv_readlink( | ||
47 | bhv_desc_t *bdp, | ||
48 | char *link) | ||
49 | { | ||
50 | return xfs_readlink(XFS_BHVTOI(bdp), link); | ||
51 | } | ||
52 | |||
53 | STATIC int | ||
54 | xfs_bhv_fsync( | ||
55 | bhv_desc_t *bdp, | ||
56 | int flag, | ||
57 | cred_t *credp, | ||
58 | xfs_off_t start, | ||
59 | xfs_off_t stop) | ||
60 | { | ||
61 | return xfs_fsync(XFS_BHVTOI(bdp), flag, start, stop); | ||
62 | } | ||
63 | |||
64 | STATIC int | ||
65 | xfs_bhv_release( | ||
66 | bhv_desc_t *bdp) | ||
67 | { | ||
68 | return xfs_release(XFS_BHVTOI(bdp)); | ||
69 | } | ||
70 | |||
71 | STATIC int | ||
72 | xfs_bhv_inactive( | ||
73 | bhv_desc_t *bdp, | ||
74 | cred_t *credp) | ||
75 | { | ||
76 | return xfs_inactive(XFS_BHVTOI(bdp)); | ||
77 | } | ||
78 | |||
79 | STATIC int | ||
80 | xfs_bhv_lookup( | ||
81 | bhv_desc_t *dir_bdp, | ||
82 | bhv_vname_t *dentry, | ||
83 | bhv_vnode_t **vpp, | ||
84 | int flags, | ||
85 | bhv_vnode_t *rdir, | ||
86 | cred_t *credp) | ||
87 | { | ||
88 | return xfs_lookup(XFS_BHVTOI(dir_bdp), dentry, vpp); | ||
89 | } | ||
90 | |||
91 | STATIC int | ||
92 | xfs_bhv_create( | ||
93 | bhv_desc_t *dir_bdp, | ||
94 | bhv_vname_t *dentry, | ||
95 | bhv_vattr_t *vap, | ||
96 | bhv_vnode_t **vpp, | ||
97 | cred_t *credp) | ||
98 | { | ||
99 | return xfs_create(XFS_BHVTOI(dir_bdp), dentry, vap, vpp, credp); | ||
100 | } | ||
101 | |||
102 | STATIC int | ||
103 | xfs_bhv_remove( | ||
104 | bhv_desc_t *dir_bdp, | ||
105 | bhv_vname_t *dentry, | ||
106 | cred_t *credp) | ||
107 | { | ||
108 | return xfs_remove(XFS_BHVTOI(dir_bdp), dentry); | ||
109 | } | ||
110 | |||
111 | STATIC int | ||
112 | xfs_bhv_link( | ||
113 | bhv_desc_t *target_dir_bdp, | ||
114 | bhv_vnode_t *src_vp, | ||
115 | bhv_vname_t *dentry, | ||
116 | cred_t *credp) | ||
117 | { | ||
118 | return xfs_link(XFS_BHVTOI(target_dir_bdp), src_vp, dentry); | ||
119 | } | ||
120 | |||
121 | STATIC int | ||
122 | xfs_bhv_mkdir( | ||
123 | bhv_desc_t *dir_bdp, | ||
124 | bhv_vname_t *dentry, | ||
125 | bhv_vattr_t *vap, | ||
126 | bhv_vnode_t **vpp, | ||
127 | cred_t *credp) | ||
128 | { | ||
129 | return xfs_mkdir(XFS_BHVTOI(dir_bdp), dentry, vap, vpp, credp); | ||
130 | } | ||
131 | |||
132 | STATIC int | ||
133 | xfs_bhv_rmdir( | ||
134 | bhv_desc_t *dir_bdp, | ||
135 | bhv_vname_t *dentry, | ||
136 | cred_t *credp) | ||
137 | { | ||
138 | return xfs_rmdir(XFS_BHVTOI(dir_bdp), dentry); | ||
139 | } | ||
140 | |||
141 | STATIC int | ||
142 | xfs_bhv_readdir( | ||
143 | bhv_desc_t *dir_bdp, | ||
144 | void *dirent, | ||
145 | size_t bufsize, | ||
146 | xfs_off_t *offset, | ||
147 | filldir_t filldir) | ||
148 | { | ||
149 | return xfs_readdir(XFS_BHVTOI(dir_bdp), dirent, bufsize, offset, filldir); | ||
150 | } | ||
151 | |||
152 | STATIC int | ||
153 | xfs_bhv_symlink( | ||
154 | bhv_desc_t *dir_bdp, | ||
155 | bhv_vname_t *dentry, | ||
156 | bhv_vattr_t *vap, | ||
157 | char *target_path, | ||
158 | bhv_vnode_t **vpp, | ||
159 | cred_t *credp) | ||
160 | { | ||
161 | return xfs_symlink(XFS_BHVTOI(dir_bdp), dentry, vap, target_path, vpp, credp); | ||
162 | } | ||
163 | |||
164 | STATIC int | ||
165 | xfs_bhv_fid2( | ||
166 | bhv_desc_t *bdp, | ||
167 | fid_t *fidp) | ||
168 | { | ||
169 | return xfs_fid2(XFS_BHVTOI(bdp), fidp); | ||
170 | } | ||
171 | |||
172 | STATIC int | ||
173 | xfs_bhv_rwlock( | ||
174 | bhv_desc_t *bdp, | ||
175 | bhv_vrwlock_t locktype) | ||
176 | { | ||
177 | return xfs_rwlock(XFS_BHVTOI(bdp), locktype); | ||
178 | } | ||
179 | |||
180 | STATIC void | ||
181 | xfs_bhv_rwunlock( | ||
182 | bhv_desc_t *bdp, | ||
183 | bhv_vrwlock_t locktype) | ||
184 | { | ||
185 | xfs_rwunlock(XFS_BHVTOI(bdp), locktype); | ||
186 | } | ||
187 | |||
188 | STATIC int | ||
189 | xfs_bhv_inode_flush( | ||
190 | bhv_desc_t *bdp, | ||
191 | int flags) | ||
192 | { | ||
193 | return xfs_inode_flush(XFS_BHVTOI(bdp), flags); | ||
194 | } | ||
195 | |||
196 | STATIC int | ||
197 | xfs_bhv_reclaim( | ||
198 | bhv_desc_t *bdp) | ||
199 | { | ||
200 | return xfs_reclaim(XFS_BHVTOI(bdp)); | ||
201 | } | ||
202 | |||
203 | STATIC int | ||
204 | xfs_bhv_rename( | ||
205 | bhv_desc_t *src_dir_bdp, | ||
206 | bhv_vname_t *src_vname, | ||
207 | bhv_vnode_t *target_dir_vp, | ||
208 | bhv_vname_t *target_vname, | ||
209 | cred_t *credp) | ||
210 | { | ||
211 | return xfs_rename(XFS_BHVTOI(src_dir_bdp), src_vname, | ||
212 | target_dir_vp, target_vname); | ||
213 | } | ||
214 | |||
215 | STATIC int | ||
216 | xfs_bhv_attr_get( | ||
217 | bhv_desc_t *bdp, | ||
218 | const char *name, | ||
219 | char *value, | ||
220 | int *valuelenp, | ||
221 | int flags, | ||
222 | cred_t *cred) | ||
223 | { | ||
224 | return xfs_attr_get(XFS_BHVTOI(bdp), name, value, valuelenp, | ||
225 | flags, cred); | ||
226 | } | ||
227 | |||
228 | STATIC int | ||
229 | xfs_bhv_attr_set( | ||
230 | bhv_desc_t *bdp, | ||
231 | const char *name, | ||
232 | char *value, | ||
233 | int valuelen, | ||
234 | int flags, | ||
235 | cred_t *cred) | ||
236 | { | ||
237 | return xfs_attr_set(XFS_BHVTOI(bdp), name, value, valuelen, | ||
238 | flags); | ||
239 | } | ||
240 | |||
241 | STATIC int | ||
242 | xfs_bhv_attr_remove( | ||
243 | bhv_desc_t *bdp, | ||
244 | const char *name, | ||
245 | int flags, | ||
246 | cred_t *cred) | ||
247 | { | ||
248 | return xfs_attr_remove(XFS_BHVTOI(bdp), name, flags); | ||
249 | } | ||
250 | |||
251 | STATIC int | ||
252 | xfs_bhv_attr_list( | ||
253 | bhv_desc_t *bdp, | ||
254 | char *buffer, | ||
255 | int bufsize, | ||
256 | int flags, | ||
257 | struct attrlist_cursor_kern *cursor, | ||
258 | cred_t *cred) | ||
259 | { | ||
260 | return xfs_attr_list(XFS_BHVTOI(bdp), buffer, bufsize, flags, | ||
261 | cursor); | ||
262 | } | ||
263 | |||
264 | STATIC int | ||
265 | xfs_bhv_ioctl( | ||
266 | bhv_desc_t *bdp, | ||
267 | struct inode *inode, | ||
268 | struct file *filp, | ||
269 | int ioflags, | ||
270 | unsigned int cmd, | ||
271 | void __user *arg) | ||
272 | { | ||
273 | return xfs_ioctl(XFS_BHVTOI(bdp), filp, ioflags, cmd, arg); | ||
274 | } | ||
275 | |||
276 | STATIC ssize_t | ||
277 | xfs_bhv_read( | ||
278 | bhv_desc_t *bdp, | ||
279 | struct kiocb *iocb, | ||
280 | const struct iovec *iovp, | ||
281 | unsigned int segs, | ||
282 | loff_t *offset, | ||
283 | int ioflags, | ||
284 | cred_t *credp) | ||
285 | { | ||
286 | return xfs_read(XFS_BHVTOI(bdp), iocb, iovp, segs, | ||
287 | offset, ioflags); | ||
288 | } | ||
289 | |||
290 | STATIC ssize_t | ||
291 | xfs_bhv_sendfile( | ||
292 | bhv_desc_t *bdp, | ||
293 | struct file *filp, | ||
294 | loff_t *offset, | ||
295 | int ioflags, | ||
296 | size_t count, | ||
297 | read_actor_t actor, | ||
298 | void *target, | ||
299 | cred_t *credp) | ||
300 | { | ||
301 | return xfs_sendfile(XFS_BHVTOI(bdp), filp, offset, ioflags, | ||
302 | count, actor, target); | ||
303 | } | ||
304 | |||
305 | STATIC ssize_t | ||
306 | xfs_bhv_splice_read( | ||
307 | bhv_desc_t *bdp, | ||
308 | struct file *infilp, | ||
309 | loff_t *ppos, | ||
310 | struct pipe_inode_info *pipe, | ||
311 | size_t count, | ||
312 | int flags, | ||
313 | int ioflags, | ||
314 | cred_t *credp) | ||
315 | { | ||
316 | return xfs_splice_read(XFS_BHVTOI(bdp), infilp, ppos, pipe, | ||
317 | count, flags, ioflags); | ||
318 | } | ||
319 | |||
320 | STATIC ssize_t | ||
321 | xfs_bhv_splice_write( | ||
322 | bhv_desc_t *bdp, | ||
323 | struct pipe_inode_info *pipe, | ||
324 | struct file *outfilp, | ||
325 | loff_t *ppos, | ||
326 | size_t count, | ||
327 | int flags, | ||
328 | int ioflags, | ||
329 | cred_t *credp) | ||
330 | { | ||
331 | return xfs_splice_write(XFS_BHVTOI(bdp), pipe, outfilp, ppos, | ||
332 | count, flags, ioflags); | ||
333 | } | ||
334 | |||
335 | STATIC ssize_t | ||
336 | xfs_bhv_write( | ||
337 | bhv_desc_t *bdp, | ||
338 | struct kiocb *iocb, | ||
339 | const struct iovec *iovp, | ||
340 | unsigned int nsegs, | ||
341 | loff_t *offset, | ||
342 | int ioflags, | ||
343 | cred_t *credp) | ||
344 | { | ||
345 | return xfs_write(XFS_BHVTOI(bdp), iocb, iovp, nsegs, offset, | ||
346 | ioflags); | ||
347 | } | ||
348 | |||
349 | STATIC int | ||
350 | xfs_bhv_bmap(bhv_desc_t *bdp, | ||
351 | xfs_off_t offset, | ||
352 | ssize_t count, | ||
353 | int flags, | ||
354 | struct xfs_iomap *iomapp, | ||
355 | int *niomaps) | ||
356 | { | ||
357 | return xfs_bmap(XFS_BHVTOI(bdp), offset, count, flags, | ||
358 | iomapp, niomaps); | ||
359 | } | ||
360 | |||
361 | STATIC void | ||
362 | fs_tosspages( | ||
363 | bhv_desc_t *bdp, | ||
364 | xfs_off_t first, | ||
365 | xfs_off_t last, | ||
366 | int fiopt) | ||
367 | { | ||
368 | xfs_tosspages(XFS_BHVTOI(bdp), first, last, fiopt); | ||
369 | } | ||
370 | |||
371 | STATIC int | ||
372 | fs_flushinval_pages( | ||
373 | bhv_desc_t *bdp, | ||
374 | xfs_off_t first, | ||
375 | xfs_off_t last, | ||
376 | int fiopt) | ||
377 | { | ||
378 | return xfs_flushinval_pages(XFS_BHVTOI(bdp), first, last, | ||
379 | fiopt); | ||
380 | } | ||
381 | |||
382 | STATIC int | ||
383 | fs_flush_pages( | ||
384 | bhv_desc_t *bdp, | ||
385 | xfs_off_t first, | ||
386 | xfs_off_t last, | ||
387 | uint64_t flags, | ||
388 | int fiopt) | ||
389 | { | ||
390 | return xfs_flush_pages(XFS_BHVTOI(bdp), first, last, flags, | ||
391 | fiopt); | ||
392 | } | ||
393 | |||
394 | bhv_vnodeops_t xfs_vnodeops = { | ||
395 | BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS), | ||
396 | .vop_open = xfs_bhv_open, | ||
397 | .vop_read = xfs_bhv_read, | ||
398 | #ifdef HAVE_SENDFILE | ||
399 | .vop_sendfile = xfs_bhv_sendfile, | ||
400 | #endif | ||
401 | #ifdef HAVE_SPLICE | ||
402 | .vop_splice_read = xfs_bhv_splice_read, | ||
403 | .vop_splice_write = xfs_bhv_splice_write, | ||
404 | #endif | ||
405 | .vop_write = xfs_bhv_write, | ||
406 | .vop_ioctl = xfs_bhv_ioctl, | ||
407 | .vop_getattr = xfs_bhv_getattr, | ||
408 | .vop_setattr = xfs_bhv_setattr, | ||
409 | .vop_access = xfs_bhv_access, | ||
410 | .vop_lookup = xfs_bhv_lookup, | ||
411 | .vop_create = xfs_bhv_create, | ||
412 | .vop_remove = xfs_bhv_remove, | ||
413 | .vop_link = xfs_bhv_link, | ||
414 | .vop_rename = xfs_bhv_rename, | ||
415 | .vop_mkdir = xfs_bhv_mkdir, | ||
416 | .vop_rmdir = xfs_bhv_rmdir, | ||
417 | .vop_readdir = xfs_bhv_readdir, | ||
418 | .vop_symlink = xfs_bhv_symlink, | ||
419 | .vop_readlink = xfs_bhv_readlink, | ||
420 | .vop_fsync = xfs_bhv_fsync, | ||
421 | .vop_inactive = xfs_bhv_inactive, | ||
422 | .vop_fid2 = xfs_bhv_fid2, | ||
423 | .vop_rwlock = xfs_bhv_rwlock, | ||
424 | .vop_rwunlock = xfs_bhv_rwunlock, | ||
425 | .vop_bmap = xfs_bhv_bmap, | ||
426 | .vop_reclaim = xfs_bhv_reclaim, | ||
427 | .vop_attr_get = xfs_bhv_attr_get, | ||
428 | .vop_attr_set = xfs_bhv_attr_set, | ||
429 | .vop_attr_remove = xfs_bhv_attr_remove, | ||
430 | .vop_attr_list = xfs_bhv_attr_list, | ||
431 | .vop_link_removed = (vop_link_removed_t)fs_noval, | ||
432 | .vop_vnode_change = (vop_vnode_change_t)fs_noval, | ||
433 | .vop_tosspages = fs_tosspages, | ||
434 | .vop_flushinval_pages = fs_flushinval_pages, | ||
435 | .vop_flush_pages = fs_flush_pages, | ||
436 | .vop_release = xfs_bhv_release, | ||
437 | .vop_iflush = xfs_bhv_inode_flush, | ||
438 | }; | ||