xfs_vnodeops_bhv.c 7.8 KB

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