proc.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. /*
  2. * linux/fs/nfs/proc.c
  3. *
  4. * Copyright (C) 1992, 1993, 1994 Rick Sladkey
  5. *
  6. * OS-independent nfs remote procedure call functions
  7. *
  8. * Tuned by Alan Cox <A.Cox@swansea.ac.uk> for >3K buffers
  9. * so at last we can have decent(ish) throughput off a
  10. * Sun server.
  11. *
  12. * Coding optimized and cleaned up by Florian La Roche.
  13. * Note: Error returns are optimized for NFS_OK, which isn't translated via
  14. * nfs_stat_to_errno(), but happens to be already the right return code.
  15. *
  16. * Also, the code currently doesn't check the size of the packet, when
  17. * it decodes the packet.
  18. *
  19. * Feel free to fix it and mail me the diffs if it worries you.
  20. *
  21. * Completely rewritten to support the new RPC call interface;
  22. * rewrote and moved the entire XDR stuff to xdr.c
  23. * --Olaf Kirch June 1996
  24. *
  25. * The code below initializes all auto variables explicitly, otherwise
  26. * it will fail to work as a module (gcc generates a memset call for an
  27. * incomplete struct).
  28. */
  29. #include <linux/types.h>
  30. #include <linux/param.h>
  31. #include <linux/slab.h>
  32. #include <linux/time.h>
  33. #include <linux/mm.h>
  34. #include <linux/utsname.h>
  35. #include <linux/errno.h>
  36. #include <linux/string.h>
  37. #include <linux/in.h>
  38. #include <linux/pagemap.h>
  39. #include <linux/sunrpc/clnt.h>
  40. #include <linux/nfs.h>
  41. #include <linux/nfs2.h>
  42. #include <linux/nfs_fs.h>
  43. #include <linux/nfs_page.h>
  44. #include <linux/lockd/bind.h>
  45. #include <linux/smp_lock.h>
  46. #define NFSDBG_FACILITY NFSDBG_PROC
  47. extern struct rpc_procinfo nfs_procedures[];
  48. /*
  49. * Bare-bones access to getattr: this is for nfs_read_super.
  50. */
  51. static int
  52. nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
  53. struct nfs_fsinfo *info)
  54. {
  55. struct nfs_fattr *fattr = info->fattr;
  56. struct nfs2_fsstat fsinfo;
  57. int status;
  58. dprintk("%s: call getattr\n", __FUNCTION__);
  59. fattr->valid = 0;
  60. status = rpc_call(server->client_sys, NFSPROC_GETATTR, fhandle, fattr, 0);
  61. dprintk("%s: reply getattr: %d\n", __FUNCTION__, status);
  62. if (status)
  63. return status;
  64. dprintk("%s: call statfs\n", __FUNCTION__);
  65. status = rpc_call(server->client_sys, NFSPROC_STATFS, fhandle, &fsinfo, 0);
  66. dprintk("%s: reply statfs: %d\n", __FUNCTION__, status);
  67. if (status)
  68. return status;
  69. info->rtmax = NFS_MAXDATA;
  70. info->rtpref = fsinfo.tsize;
  71. info->rtmult = fsinfo.bsize;
  72. info->wtmax = NFS_MAXDATA;
  73. info->wtpref = fsinfo.tsize;
  74. info->wtmult = fsinfo.bsize;
  75. info->dtpref = fsinfo.tsize;
  76. info->maxfilesize = 0x7FFFFFFF;
  77. info->lease_time = 0;
  78. return 0;
  79. }
  80. /*
  81. * One function for each procedure in the NFS protocol.
  82. */
  83. static int
  84. nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
  85. struct nfs_fattr *fattr)
  86. {
  87. int status;
  88. dprintk("NFS call getattr\n");
  89. fattr->valid = 0;
  90. status = rpc_call(server->client, NFSPROC_GETATTR,
  91. fhandle, fattr, 0);
  92. dprintk("NFS reply getattr: %d\n", status);
  93. return status;
  94. }
  95. static int
  96. nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
  97. struct iattr *sattr)
  98. {
  99. struct inode *inode = dentry->d_inode;
  100. struct nfs_sattrargs arg = {
  101. .fh = NFS_FH(inode),
  102. .sattr = sattr
  103. };
  104. int status;
  105. dprintk("NFS call setattr\n");
  106. fattr->valid = 0;
  107. status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0);
  108. if (status == 0)
  109. nfs_setattr_update_inode(inode, sattr);
  110. dprintk("NFS reply setattr: %d\n", status);
  111. return status;
  112. }
  113. static int
  114. nfs_proc_lookup(struct inode *dir, struct qstr *name,
  115. struct nfs_fh *fhandle, struct nfs_fattr *fattr)
  116. {
  117. struct nfs_diropargs arg = {
  118. .fh = NFS_FH(dir),
  119. .name = name->name,
  120. .len = name->len
  121. };
  122. struct nfs_diropok res = {
  123. .fh = fhandle,
  124. .fattr = fattr
  125. };
  126. int status;
  127. dprintk("NFS call lookup %s\n", name->name);
  128. fattr->valid = 0;
  129. status = rpc_call(NFS_CLIENT(dir), NFSPROC_LOOKUP, &arg, &res, 0);
  130. dprintk("NFS reply lookup: %d\n", status);
  131. return status;
  132. }
  133. static int nfs_proc_readlink(struct inode *inode, struct page *page,
  134. unsigned int pgbase, unsigned int pglen)
  135. {
  136. struct nfs_readlinkargs args = {
  137. .fh = NFS_FH(inode),
  138. .pgbase = pgbase,
  139. .pglen = pglen,
  140. .pages = &page
  141. };
  142. int status;
  143. dprintk("NFS call readlink\n");
  144. status = rpc_call(NFS_CLIENT(inode), NFSPROC_READLINK, &args, NULL, 0);
  145. dprintk("NFS reply readlink: %d\n", status);
  146. return status;
  147. }
  148. static int nfs_proc_read(struct nfs_read_data *rdata)
  149. {
  150. int flags = rdata->flags;
  151. struct inode * inode = rdata->inode;
  152. struct nfs_fattr * fattr = rdata->res.fattr;
  153. struct rpc_message msg = {
  154. .rpc_proc = &nfs_procedures[NFSPROC_READ],
  155. .rpc_argp = &rdata->args,
  156. .rpc_resp = &rdata->res,
  157. .rpc_cred = rdata->cred,
  158. };
  159. int status;
  160. dprintk("NFS call read %d @ %Ld\n", rdata->args.count,
  161. (long long) rdata->args.offset);
  162. fattr->valid = 0;
  163. status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
  164. if (status >= 0) {
  165. nfs_refresh_inode(inode, fattr);
  166. /* Emulate the eof flag, which isn't normally needed in NFSv2
  167. * as it is guaranteed to always return the file attributes
  168. */
  169. if (rdata->args.offset + rdata->args.count >= fattr->size)
  170. rdata->res.eof = 1;
  171. }
  172. dprintk("NFS reply read: %d\n", status);
  173. return status;
  174. }
  175. static int nfs_proc_write(struct nfs_write_data *wdata)
  176. {
  177. int flags = wdata->flags;
  178. struct inode * inode = wdata->inode;
  179. struct nfs_fattr * fattr = wdata->res.fattr;
  180. struct rpc_message msg = {
  181. .rpc_proc = &nfs_procedures[NFSPROC_WRITE],
  182. .rpc_argp = &wdata->args,
  183. .rpc_resp = &wdata->res,
  184. .rpc_cred = wdata->cred,
  185. };
  186. int status;
  187. dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
  188. (long long) wdata->args.offset);
  189. fattr->valid = 0;
  190. status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
  191. if (status >= 0) {
  192. nfs_refresh_inode(inode, fattr);
  193. wdata->res.count = wdata->args.count;
  194. wdata->verf.committed = NFS_FILE_SYNC;
  195. }
  196. dprintk("NFS reply write: %d\n", status);
  197. return status < 0? status : wdata->res.count;
  198. }
  199. static int
  200. nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
  201. int flags)
  202. {
  203. struct nfs_fh fhandle;
  204. struct nfs_fattr fattr;
  205. struct nfs_createargs arg = {
  206. .fh = NFS_FH(dir),
  207. .name = dentry->d_name.name,
  208. .len = dentry->d_name.len,
  209. .sattr = sattr
  210. };
  211. struct nfs_diropok res = {
  212. .fh = &fhandle,
  213. .fattr = &fattr
  214. };
  215. int status;
  216. fattr.valid = 0;
  217. dprintk("NFS call create %s\n", dentry->d_name.name);
  218. status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
  219. if (status == 0)
  220. status = nfs_instantiate(dentry, &fhandle, &fattr);
  221. dprintk("NFS reply create: %d\n", status);
  222. return status;
  223. }
  224. /*
  225. * In NFSv2, mknod is grafted onto the create call.
  226. */
  227. static int
  228. nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
  229. dev_t rdev)
  230. {
  231. struct nfs_fh fhandle;
  232. struct nfs_fattr fattr;
  233. struct nfs_createargs arg = {
  234. .fh = NFS_FH(dir),
  235. .name = dentry->d_name.name,
  236. .len = dentry->d_name.len,
  237. .sattr = sattr
  238. };
  239. struct nfs_diropok res = {
  240. .fh = &fhandle,
  241. .fattr = &fattr
  242. };
  243. int status, mode;
  244. dprintk("NFS call mknod %s\n", dentry->d_name.name);
  245. mode = sattr->ia_mode;
  246. if (S_ISFIFO(mode)) {
  247. sattr->ia_mode = (mode & ~S_IFMT) | S_IFCHR;
  248. sattr->ia_valid &= ~ATTR_SIZE;
  249. } else if (S_ISCHR(mode) || S_ISBLK(mode)) {
  250. sattr->ia_valid |= ATTR_SIZE;
  251. sattr->ia_size = new_encode_dev(rdev);/* get out your barf bag */
  252. }
  253. fattr.valid = 0;
  254. status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
  255. if (status == -EINVAL && S_ISFIFO(mode)) {
  256. sattr->ia_mode = mode;
  257. fattr.valid = 0;
  258. status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0);
  259. }
  260. if (status == 0)
  261. status = nfs_instantiate(dentry, &fhandle, &fattr);
  262. dprintk("NFS reply mknod: %d\n", status);
  263. return status;
  264. }
  265. static int
  266. nfs_proc_remove(struct inode *dir, struct qstr *name)
  267. {
  268. struct nfs_diropargs arg = {
  269. .fh = NFS_FH(dir),
  270. .name = name->name,
  271. .len = name->len
  272. };
  273. struct rpc_message msg = {
  274. .rpc_proc = &nfs_procedures[NFSPROC_REMOVE],
  275. .rpc_argp = &arg,
  276. .rpc_resp = NULL,
  277. .rpc_cred = NULL
  278. };
  279. int status;
  280. dprintk("NFS call remove %s\n", name->name);
  281. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  282. dprintk("NFS reply remove: %d\n", status);
  283. return status;
  284. }
  285. static int
  286. nfs_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name)
  287. {
  288. struct nfs_diropargs *arg;
  289. arg = (struct nfs_diropargs *)kmalloc(sizeof(*arg), GFP_KERNEL);
  290. if (!arg)
  291. return -ENOMEM;
  292. arg->fh = NFS_FH(dir->d_inode);
  293. arg->name = name->name;
  294. arg->len = name->len;
  295. msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE];
  296. msg->rpc_argp = arg;
  297. return 0;
  298. }
  299. static int
  300. nfs_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
  301. {
  302. struct rpc_message *msg = &task->tk_msg;
  303. if (msg->rpc_argp)
  304. kfree(msg->rpc_argp);
  305. return 0;
  306. }
  307. static int
  308. nfs_proc_rename(struct inode *old_dir, struct qstr *old_name,
  309. struct inode *new_dir, struct qstr *new_name)
  310. {
  311. struct nfs_renameargs arg = {
  312. .fromfh = NFS_FH(old_dir),
  313. .fromname = old_name->name,
  314. .fromlen = old_name->len,
  315. .tofh = NFS_FH(new_dir),
  316. .toname = new_name->name,
  317. .tolen = new_name->len
  318. };
  319. int status;
  320. dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name);
  321. status = rpc_call(NFS_CLIENT(old_dir), NFSPROC_RENAME, &arg, NULL, 0);
  322. dprintk("NFS reply rename: %d\n", status);
  323. return status;
  324. }
  325. static int
  326. nfs_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
  327. {
  328. struct nfs_linkargs arg = {
  329. .fromfh = NFS_FH(inode),
  330. .tofh = NFS_FH(dir),
  331. .toname = name->name,
  332. .tolen = name->len
  333. };
  334. int status;
  335. dprintk("NFS call link %s\n", name->name);
  336. status = rpc_call(NFS_CLIENT(inode), NFSPROC_LINK, &arg, NULL, 0);
  337. dprintk("NFS reply link: %d\n", status);
  338. return status;
  339. }
  340. static int
  341. nfs_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
  342. struct iattr *sattr, struct nfs_fh *fhandle,
  343. struct nfs_fattr *fattr)
  344. {
  345. struct nfs_symlinkargs arg = {
  346. .fromfh = NFS_FH(dir),
  347. .fromname = name->name,
  348. .fromlen = name->len,
  349. .topath = path->name,
  350. .tolen = path->len,
  351. .sattr = sattr
  352. };
  353. int status;
  354. if (path->len > NFS2_MAXPATHLEN)
  355. return -ENAMETOOLONG;
  356. dprintk("NFS call symlink %s -> %s\n", name->name, path->name);
  357. fattr->valid = 0;
  358. fhandle->size = 0;
  359. status = rpc_call(NFS_CLIENT(dir), NFSPROC_SYMLINK, &arg, NULL, 0);
  360. dprintk("NFS reply symlink: %d\n", status);
  361. return status;
  362. }
  363. static int
  364. nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
  365. {
  366. struct nfs_fh fhandle;
  367. struct nfs_fattr fattr;
  368. struct nfs_createargs arg = {
  369. .fh = NFS_FH(dir),
  370. .name = dentry->d_name.name,
  371. .len = dentry->d_name.len,
  372. .sattr = sattr
  373. };
  374. struct nfs_diropok res = {
  375. .fh = &fhandle,
  376. .fattr = &fattr
  377. };
  378. int status;
  379. dprintk("NFS call mkdir %s\n", dentry->d_name.name);
  380. fattr.valid = 0;
  381. status = rpc_call(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res, 0);
  382. if (status == 0)
  383. status = nfs_instantiate(dentry, &fhandle, &fattr);
  384. dprintk("NFS reply mkdir: %d\n", status);
  385. return status;
  386. }
  387. static int
  388. nfs_proc_rmdir(struct inode *dir, struct qstr *name)
  389. {
  390. struct nfs_diropargs arg = {
  391. .fh = NFS_FH(dir),
  392. .name = name->name,
  393. .len = name->len
  394. };
  395. int status;
  396. dprintk("NFS call rmdir %s\n", name->name);
  397. status = rpc_call(NFS_CLIENT(dir), NFSPROC_RMDIR, &arg, NULL, 0);
  398. dprintk("NFS reply rmdir: %d\n", status);
  399. return status;
  400. }
  401. /*
  402. * The READDIR implementation is somewhat hackish - we pass a temporary
  403. * buffer to the encode function, which installs it in the receive
  404. * the receive iovec. The decode function just parses the reply to make
  405. * sure it is syntactically correct; the entries itself are decoded
  406. * from nfs_readdir by calling the decode_entry function directly.
  407. */
  408. static int
  409. nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
  410. u64 cookie, struct page *page, unsigned int count, int plus)
  411. {
  412. struct inode *dir = dentry->d_inode;
  413. struct nfs_readdirargs arg = {
  414. .fh = NFS_FH(dir),
  415. .cookie = cookie,
  416. .count = count,
  417. .pages = &page
  418. };
  419. struct rpc_message msg = {
  420. .rpc_proc = &nfs_procedures[NFSPROC_READDIR],
  421. .rpc_argp = &arg,
  422. .rpc_resp = NULL,
  423. .rpc_cred = cred
  424. };
  425. int status;
  426. lock_kernel();
  427. dprintk("NFS call readdir %d\n", (unsigned int)cookie);
  428. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  429. dprintk("NFS reply readdir: %d\n", status);
  430. unlock_kernel();
  431. return status;
  432. }
  433. static int
  434. nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
  435. struct nfs_fsstat *stat)
  436. {
  437. struct nfs2_fsstat fsinfo;
  438. int status;
  439. dprintk("NFS call statfs\n");
  440. stat->fattr->valid = 0;
  441. status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0);
  442. dprintk("NFS reply statfs: %d\n", status);
  443. if (status)
  444. goto out;
  445. stat->tbytes = (u64)fsinfo.blocks * fsinfo.bsize;
  446. stat->fbytes = (u64)fsinfo.bfree * fsinfo.bsize;
  447. stat->abytes = (u64)fsinfo.bavail * fsinfo.bsize;
  448. stat->tfiles = 0;
  449. stat->ffiles = 0;
  450. stat->afiles = 0;
  451. out:
  452. return status;
  453. }
  454. static int
  455. nfs_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
  456. struct nfs_fsinfo *info)
  457. {
  458. struct nfs2_fsstat fsinfo;
  459. int status;
  460. dprintk("NFS call fsinfo\n");
  461. info->fattr->valid = 0;
  462. status = rpc_call(server->client, NFSPROC_STATFS, fhandle, &fsinfo, 0);
  463. dprintk("NFS reply fsinfo: %d\n", status);
  464. if (status)
  465. goto out;
  466. info->rtmax = NFS_MAXDATA;
  467. info->rtpref = fsinfo.tsize;
  468. info->rtmult = fsinfo.bsize;
  469. info->wtmax = NFS_MAXDATA;
  470. info->wtpref = fsinfo.tsize;
  471. info->wtmult = fsinfo.bsize;
  472. info->dtpref = fsinfo.tsize;
  473. info->maxfilesize = 0x7FFFFFFF;
  474. info->lease_time = 0;
  475. out:
  476. return status;
  477. }
  478. static int
  479. nfs_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
  480. struct nfs_pathconf *info)
  481. {
  482. info->max_link = 0;
  483. info->max_namelen = NFS2_MAXNAMLEN;
  484. return 0;
  485. }
  486. extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int);
  487. static void
  488. nfs_read_done(struct rpc_task *task)
  489. {
  490. struct nfs_read_data *data = (struct nfs_read_data *) task->tk_calldata;
  491. if (task->tk_status >= 0) {
  492. nfs_refresh_inode(data->inode, data->res.fattr);
  493. /* Emulate the eof flag, which isn't normally needed in NFSv2
  494. * as it is guaranteed to always return the file attributes
  495. */
  496. if (data->args.offset + data->args.count >= data->res.fattr->size)
  497. data->res.eof = 1;
  498. }
  499. nfs_readpage_result(task);
  500. }
  501. static void
  502. nfs_proc_read_setup(struct nfs_read_data *data)
  503. {
  504. struct rpc_task *task = &data->task;
  505. struct inode *inode = data->inode;
  506. int flags;
  507. struct rpc_message msg = {
  508. .rpc_proc = &nfs_procedures[NFSPROC_READ],
  509. .rpc_argp = &data->args,
  510. .rpc_resp = &data->res,
  511. .rpc_cred = data->cred,
  512. };
  513. /* N.B. Do we need to test? Never called for swapfile inode */
  514. flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0);
  515. /* Finalize the task. */
  516. rpc_init_task(task, NFS_CLIENT(inode), nfs_read_done, flags);
  517. rpc_call_setup(task, &msg, 0);
  518. }
  519. static void
  520. nfs_write_done(struct rpc_task *task)
  521. {
  522. struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata;
  523. if (task->tk_status >= 0)
  524. nfs_refresh_inode(data->inode, data->res.fattr);
  525. nfs_writeback_done(task);
  526. }
  527. static void
  528. nfs_proc_write_setup(struct nfs_write_data *data, int how)
  529. {
  530. struct rpc_task *task = &data->task;
  531. struct inode *inode = data->inode;
  532. int flags;
  533. struct rpc_message msg = {
  534. .rpc_proc = &nfs_procedures[NFSPROC_WRITE],
  535. .rpc_argp = &data->args,
  536. .rpc_resp = &data->res,
  537. .rpc_cred = data->cred,
  538. };
  539. /* Note: NFSv2 ignores @stable and always uses NFS_FILE_SYNC */
  540. data->args.stable = NFS_FILE_SYNC;
  541. /* Set the initial flags for the task. */
  542. flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
  543. /* Finalize the task. */
  544. rpc_init_task(task, NFS_CLIENT(inode), nfs_write_done, flags);
  545. rpc_call_setup(task, &msg, 0);
  546. }
  547. static void
  548. nfs_proc_commit_setup(struct nfs_write_data *data, int how)
  549. {
  550. BUG();
  551. }
  552. static int
  553. nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
  554. {
  555. return nlmclnt_proc(filp->f_dentry->d_inode, cmd, fl);
  556. }
  557. struct nfs_rpc_ops nfs_v2_clientops = {
  558. .version = 2, /* protocol version */
  559. .dentry_ops = &nfs_dentry_operations,
  560. .dir_inode_ops = &nfs_dir_inode_operations,
  561. .file_inode_ops = &nfs_file_inode_operations,
  562. .getroot = nfs_proc_get_root,
  563. .getattr = nfs_proc_getattr,
  564. .setattr = nfs_proc_setattr,
  565. .lookup = nfs_proc_lookup,
  566. .access = NULL, /* access */
  567. .readlink = nfs_proc_readlink,
  568. .read = nfs_proc_read,
  569. .write = nfs_proc_write,
  570. .commit = NULL, /* commit */
  571. .create = nfs_proc_create,
  572. .remove = nfs_proc_remove,
  573. .unlink_setup = nfs_proc_unlink_setup,
  574. .unlink_done = nfs_proc_unlink_done,
  575. .rename = nfs_proc_rename,
  576. .link = nfs_proc_link,
  577. .symlink = nfs_proc_symlink,
  578. .mkdir = nfs_proc_mkdir,
  579. .rmdir = nfs_proc_rmdir,
  580. .readdir = nfs_proc_readdir,
  581. .mknod = nfs_proc_mknod,
  582. .statfs = nfs_proc_statfs,
  583. .fsinfo = nfs_proc_fsinfo,
  584. .pathconf = nfs_proc_pathconf,
  585. .decode_dirent = nfs_decode_dirent,
  586. .read_setup = nfs_proc_read_setup,
  587. .write_setup = nfs_proc_write_setup,
  588. .commit_setup = nfs_proc_commit_setup,
  589. .file_open = nfs_open,
  590. .file_release = nfs_release,
  591. .lock = nfs_proc_lock,
  592. };