proc.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  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. #include "internal.h"
  47. #define NFSDBG_FACILITY NFSDBG_PROC
  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. struct rpc_message msg = {
  58. .rpc_proc = &nfs_procedures[NFSPROC_GETATTR],
  59. .rpc_argp = fhandle,
  60. .rpc_resp = fattr,
  61. };
  62. int status;
  63. dprintk("%s: call getattr\n", __FUNCTION__);
  64. nfs_fattr_init(fattr);
  65. status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0);
  66. dprintk("%s: reply getattr: %d\n", __FUNCTION__, status);
  67. if (status)
  68. return status;
  69. dprintk("%s: call statfs\n", __FUNCTION__);
  70. msg.rpc_proc = &nfs_procedures[NFSPROC_STATFS];
  71. msg.rpc_resp = &fsinfo;
  72. status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0);
  73. dprintk("%s: reply statfs: %d\n", __FUNCTION__, status);
  74. if (status)
  75. return status;
  76. info->rtmax = NFS_MAXDATA;
  77. info->rtpref = fsinfo.tsize;
  78. info->rtmult = fsinfo.bsize;
  79. info->wtmax = NFS_MAXDATA;
  80. info->wtpref = fsinfo.tsize;
  81. info->wtmult = fsinfo.bsize;
  82. info->dtpref = fsinfo.tsize;
  83. info->maxfilesize = 0x7FFFFFFF;
  84. info->lease_time = 0;
  85. return 0;
  86. }
  87. /*
  88. * One function for each procedure in the NFS protocol.
  89. */
  90. static int
  91. nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
  92. struct nfs_fattr *fattr)
  93. {
  94. struct rpc_message msg = {
  95. .rpc_proc = &nfs_procedures[NFSPROC_GETATTR],
  96. .rpc_argp = fhandle,
  97. .rpc_resp = fattr,
  98. };
  99. int status;
  100. dprintk("NFS call getattr\n");
  101. nfs_fattr_init(fattr);
  102. status = rpc_call_sync(server->client, &msg, 0);
  103. dprintk("NFS reply getattr: %d\n", status);
  104. return status;
  105. }
  106. static int
  107. nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
  108. struct iattr *sattr)
  109. {
  110. struct inode *inode = dentry->d_inode;
  111. struct nfs_sattrargs arg = {
  112. .fh = NFS_FH(inode),
  113. .sattr = sattr
  114. };
  115. struct rpc_message msg = {
  116. .rpc_proc = &nfs_procedures[NFSPROC_SETATTR],
  117. .rpc_argp = &arg,
  118. .rpc_resp = fattr,
  119. };
  120. int status;
  121. /* Mask out the non-modebit related stuff from attr->ia_mode */
  122. sattr->ia_mode &= S_IALLUGO;
  123. dprintk("NFS call setattr\n");
  124. nfs_fattr_init(fattr);
  125. status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
  126. if (status == 0)
  127. nfs_setattr_update_inode(inode, sattr);
  128. dprintk("NFS reply setattr: %d\n", status);
  129. return status;
  130. }
  131. static int
  132. nfs_proc_lookup(struct inode *dir, struct qstr *name,
  133. struct nfs_fh *fhandle, struct nfs_fattr *fattr)
  134. {
  135. struct nfs_diropargs arg = {
  136. .fh = NFS_FH(dir),
  137. .name = name->name,
  138. .len = name->len
  139. };
  140. struct nfs_diropok res = {
  141. .fh = fhandle,
  142. .fattr = fattr
  143. };
  144. struct rpc_message msg = {
  145. .rpc_proc = &nfs_procedures[NFSPROC_LOOKUP],
  146. .rpc_argp = &arg,
  147. .rpc_resp = &res,
  148. };
  149. int status;
  150. dprintk("NFS call lookup %s\n", name->name);
  151. nfs_fattr_init(fattr);
  152. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  153. dprintk("NFS reply lookup: %d\n", status);
  154. return status;
  155. }
  156. static int nfs_proc_readlink(struct inode *inode, struct page *page,
  157. unsigned int pgbase, unsigned int pglen)
  158. {
  159. struct nfs_readlinkargs args = {
  160. .fh = NFS_FH(inode),
  161. .pgbase = pgbase,
  162. .pglen = pglen,
  163. .pages = &page
  164. };
  165. struct rpc_message msg = {
  166. .rpc_proc = &nfs_procedures[NFSPROC_READLINK],
  167. .rpc_argp = &args,
  168. };
  169. int status;
  170. dprintk("NFS call readlink\n");
  171. status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
  172. dprintk("NFS reply readlink: %d\n", status);
  173. return status;
  174. }
  175. static int
  176. nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
  177. int flags, struct nameidata *nd)
  178. {
  179. struct nfs_fh fhandle;
  180. struct nfs_fattr fattr;
  181. struct nfs_createargs arg = {
  182. .fh = NFS_FH(dir),
  183. .name = dentry->d_name.name,
  184. .len = dentry->d_name.len,
  185. .sattr = sattr
  186. };
  187. struct nfs_diropok res = {
  188. .fh = &fhandle,
  189. .fattr = &fattr
  190. };
  191. struct rpc_message msg = {
  192. .rpc_proc = &nfs_procedures[NFSPROC_CREATE],
  193. .rpc_argp = &arg,
  194. .rpc_resp = &res,
  195. };
  196. int status;
  197. nfs_fattr_init(&fattr);
  198. dprintk("NFS call create %s\n", dentry->d_name.name);
  199. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  200. if (status == 0)
  201. status = nfs_instantiate(dentry, &fhandle, &fattr);
  202. dprintk("NFS reply create: %d\n", status);
  203. return status;
  204. }
  205. /*
  206. * In NFSv2, mknod is grafted onto the create call.
  207. */
  208. static int
  209. nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
  210. dev_t rdev)
  211. {
  212. struct nfs_fh fhandle;
  213. struct nfs_fattr fattr;
  214. struct nfs_createargs arg = {
  215. .fh = NFS_FH(dir),
  216. .name = dentry->d_name.name,
  217. .len = dentry->d_name.len,
  218. .sattr = sattr
  219. };
  220. struct nfs_diropok res = {
  221. .fh = &fhandle,
  222. .fattr = &fattr
  223. };
  224. struct rpc_message msg = {
  225. .rpc_proc = &nfs_procedures[NFSPROC_CREATE],
  226. .rpc_argp = &arg,
  227. .rpc_resp = &res,
  228. };
  229. int status, mode;
  230. dprintk("NFS call mknod %s\n", dentry->d_name.name);
  231. mode = sattr->ia_mode;
  232. if (S_ISFIFO(mode)) {
  233. sattr->ia_mode = (mode & ~S_IFMT) | S_IFCHR;
  234. sattr->ia_valid &= ~ATTR_SIZE;
  235. } else if (S_ISCHR(mode) || S_ISBLK(mode)) {
  236. sattr->ia_valid |= ATTR_SIZE;
  237. sattr->ia_size = new_encode_dev(rdev);/* get out your barf bag */
  238. }
  239. nfs_fattr_init(&fattr);
  240. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  241. nfs_mark_for_revalidate(dir);
  242. if (status == -EINVAL && S_ISFIFO(mode)) {
  243. sattr->ia_mode = mode;
  244. nfs_fattr_init(&fattr);
  245. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  246. }
  247. if (status == 0)
  248. status = nfs_instantiate(dentry, &fhandle, &fattr);
  249. dprintk("NFS reply mknod: %d\n", status);
  250. return status;
  251. }
  252. static int
  253. nfs_proc_remove(struct inode *dir, struct qstr *name)
  254. {
  255. struct nfs_diropargs arg = {
  256. .fh = NFS_FH(dir),
  257. .name = name->name,
  258. .len = name->len
  259. };
  260. struct rpc_message msg = {
  261. .rpc_proc = &nfs_procedures[NFSPROC_REMOVE],
  262. .rpc_argp = &arg,
  263. };
  264. int status;
  265. dprintk("NFS call remove %s\n", name->name);
  266. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  267. nfs_mark_for_revalidate(dir);
  268. dprintk("NFS reply remove: %d\n", status);
  269. return status;
  270. }
  271. static int
  272. nfs_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name)
  273. {
  274. struct nfs_diropargs *arg;
  275. arg = kmalloc(sizeof(*arg), GFP_KERNEL);
  276. if (!arg)
  277. return -ENOMEM;
  278. arg->fh = NFS_FH(dir->d_inode);
  279. arg->name = name->name;
  280. arg->len = name->len;
  281. msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE];
  282. msg->rpc_argp = arg;
  283. return 0;
  284. }
  285. static int
  286. nfs_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
  287. {
  288. struct rpc_message *msg = &task->tk_msg;
  289. if (msg->rpc_argp) {
  290. nfs_mark_for_revalidate(dir->d_inode);
  291. kfree(msg->rpc_argp);
  292. }
  293. return 0;
  294. }
  295. static int
  296. nfs_proc_rename(struct inode *old_dir, struct qstr *old_name,
  297. struct inode *new_dir, struct qstr *new_name)
  298. {
  299. struct nfs_renameargs arg = {
  300. .fromfh = NFS_FH(old_dir),
  301. .fromname = old_name->name,
  302. .fromlen = old_name->len,
  303. .tofh = NFS_FH(new_dir),
  304. .toname = new_name->name,
  305. .tolen = new_name->len
  306. };
  307. struct rpc_message msg = {
  308. .rpc_proc = &nfs_procedures[NFSPROC_RENAME],
  309. .rpc_argp = &arg,
  310. };
  311. int status;
  312. dprintk("NFS call rename %s -> %s\n", old_name->name, new_name->name);
  313. status = rpc_call_sync(NFS_CLIENT(old_dir), &msg, 0);
  314. nfs_mark_for_revalidate(old_dir);
  315. nfs_mark_for_revalidate(new_dir);
  316. dprintk("NFS reply rename: %d\n", status);
  317. return status;
  318. }
  319. static int
  320. nfs_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
  321. {
  322. struct nfs_linkargs arg = {
  323. .fromfh = NFS_FH(inode),
  324. .tofh = NFS_FH(dir),
  325. .toname = name->name,
  326. .tolen = name->len
  327. };
  328. struct rpc_message msg = {
  329. .rpc_proc = &nfs_procedures[NFSPROC_LINK],
  330. .rpc_argp = &arg,
  331. };
  332. int status;
  333. dprintk("NFS call link %s\n", name->name);
  334. status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
  335. nfs_mark_for_revalidate(inode);
  336. nfs_mark_for_revalidate(dir);
  337. dprintk("NFS reply link: %d\n", status);
  338. return status;
  339. }
  340. static int
  341. nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page,
  342. unsigned int len, struct iattr *sattr)
  343. {
  344. struct nfs_fh fhandle;
  345. struct nfs_fattr fattr;
  346. struct nfs_symlinkargs arg = {
  347. .fromfh = NFS_FH(dir),
  348. .fromname = dentry->d_name.name,
  349. .fromlen = dentry->d_name.len,
  350. .pages = &page,
  351. .pathlen = len,
  352. .sattr = sattr
  353. };
  354. struct rpc_message msg = {
  355. .rpc_proc = &nfs_procedures[NFSPROC_SYMLINK],
  356. .rpc_argp = &arg,
  357. };
  358. int status;
  359. if (len > NFS2_MAXPATHLEN)
  360. return -ENAMETOOLONG;
  361. dprintk("NFS call symlink %s\n", dentry->d_name.name);
  362. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  363. nfs_mark_for_revalidate(dir);
  364. /*
  365. * V2 SYMLINK requests don't return any attributes. Setting the
  366. * filehandle size to zero indicates to nfs_instantiate that it
  367. * should fill in the data with a LOOKUP call on the wire.
  368. */
  369. if (status == 0) {
  370. nfs_fattr_init(&fattr);
  371. fhandle.size = 0;
  372. status = nfs_instantiate(dentry, &fhandle, &fattr);
  373. }
  374. dprintk("NFS reply symlink: %d\n", status);
  375. return status;
  376. }
  377. static int
  378. nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
  379. {
  380. struct nfs_fh fhandle;
  381. struct nfs_fattr fattr;
  382. struct nfs_createargs arg = {
  383. .fh = NFS_FH(dir),
  384. .name = dentry->d_name.name,
  385. .len = dentry->d_name.len,
  386. .sattr = sattr
  387. };
  388. struct nfs_diropok res = {
  389. .fh = &fhandle,
  390. .fattr = &fattr
  391. };
  392. struct rpc_message msg = {
  393. .rpc_proc = &nfs_procedures[NFSPROC_MKDIR],
  394. .rpc_argp = &arg,
  395. .rpc_resp = &res,
  396. };
  397. int status;
  398. dprintk("NFS call mkdir %s\n", dentry->d_name.name);
  399. nfs_fattr_init(&fattr);
  400. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  401. nfs_mark_for_revalidate(dir);
  402. if (status == 0)
  403. status = nfs_instantiate(dentry, &fhandle, &fattr);
  404. dprintk("NFS reply mkdir: %d\n", status);
  405. return status;
  406. }
  407. static int
  408. nfs_proc_rmdir(struct inode *dir, struct qstr *name)
  409. {
  410. struct nfs_diropargs arg = {
  411. .fh = NFS_FH(dir),
  412. .name = name->name,
  413. .len = name->len
  414. };
  415. struct rpc_message msg = {
  416. .rpc_proc = &nfs_procedures[NFSPROC_RMDIR],
  417. .rpc_argp = &arg,
  418. };
  419. int status;
  420. dprintk("NFS call rmdir %s\n", name->name);
  421. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  422. nfs_mark_for_revalidate(dir);
  423. dprintk("NFS reply rmdir: %d\n", status);
  424. return status;
  425. }
  426. /*
  427. * The READDIR implementation is somewhat hackish - we pass a temporary
  428. * buffer to the encode function, which installs it in the receive
  429. * the receive iovec. The decode function just parses the reply to make
  430. * sure it is syntactically correct; the entries itself are decoded
  431. * from nfs_readdir by calling the decode_entry function directly.
  432. */
  433. static int
  434. nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
  435. u64 cookie, struct page *page, unsigned int count, int plus)
  436. {
  437. struct inode *dir = dentry->d_inode;
  438. struct nfs_readdirargs arg = {
  439. .fh = NFS_FH(dir),
  440. .cookie = cookie,
  441. .count = count,
  442. .pages = &page,
  443. };
  444. struct rpc_message msg = {
  445. .rpc_proc = &nfs_procedures[NFSPROC_READDIR],
  446. .rpc_argp = &arg,
  447. .rpc_cred = cred,
  448. };
  449. int status;
  450. dprintk("NFS call readdir %d\n", (unsigned int)cookie);
  451. status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
  452. dprintk("NFS reply readdir: %d\n", status);
  453. return status;
  454. }
  455. static int
  456. nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
  457. struct nfs_fsstat *stat)
  458. {
  459. struct nfs2_fsstat fsinfo;
  460. struct rpc_message msg = {
  461. .rpc_proc = &nfs_procedures[NFSPROC_STATFS],
  462. .rpc_argp = fhandle,
  463. .rpc_resp = &fsinfo,
  464. };
  465. int status;
  466. dprintk("NFS call statfs\n");
  467. nfs_fattr_init(stat->fattr);
  468. status = rpc_call_sync(server->client, &msg, 0);
  469. dprintk("NFS reply statfs: %d\n", status);
  470. if (status)
  471. goto out;
  472. stat->tbytes = (u64)fsinfo.blocks * fsinfo.bsize;
  473. stat->fbytes = (u64)fsinfo.bfree * fsinfo.bsize;
  474. stat->abytes = (u64)fsinfo.bavail * fsinfo.bsize;
  475. stat->tfiles = 0;
  476. stat->ffiles = 0;
  477. stat->afiles = 0;
  478. out:
  479. return status;
  480. }
  481. static int
  482. nfs_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
  483. struct nfs_fsinfo *info)
  484. {
  485. struct nfs2_fsstat fsinfo;
  486. struct rpc_message msg = {
  487. .rpc_proc = &nfs_procedures[NFSPROC_STATFS],
  488. .rpc_argp = fhandle,
  489. .rpc_resp = &fsinfo,
  490. };
  491. int status;
  492. dprintk("NFS call fsinfo\n");
  493. nfs_fattr_init(info->fattr);
  494. status = rpc_call_sync(server->client, &msg, 0);
  495. dprintk("NFS reply fsinfo: %d\n", status);
  496. if (status)
  497. goto out;
  498. info->rtmax = NFS_MAXDATA;
  499. info->rtpref = fsinfo.tsize;
  500. info->rtmult = fsinfo.bsize;
  501. info->wtmax = NFS_MAXDATA;
  502. info->wtpref = fsinfo.tsize;
  503. info->wtmult = fsinfo.bsize;
  504. info->dtpref = fsinfo.tsize;
  505. info->maxfilesize = 0x7FFFFFFF;
  506. info->lease_time = 0;
  507. out:
  508. return status;
  509. }
  510. static int
  511. nfs_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
  512. struct nfs_pathconf *info)
  513. {
  514. info->max_link = 0;
  515. info->max_namelen = NFS2_MAXNAMLEN;
  516. return 0;
  517. }
  518. static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data)
  519. {
  520. if (task->tk_status >= 0) {
  521. nfs_refresh_inode(data->inode, data->res.fattr);
  522. /* Emulate the eof flag, which isn't normally needed in NFSv2
  523. * as it is guaranteed to always return the file attributes
  524. */
  525. if (data->args.offset + data->args.count >= data->res.fattr->size)
  526. data->res.eof = 1;
  527. }
  528. return 0;
  529. }
  530. static void nfs_proc_read_setup(struct nfs_read_data *data)
  531. {
  532. struct rpc_message msg = {
  533. .rpc_proc = &nfs_procedures[NFSPROC_READ],
  534. .rpc_argp = &data->args,
  535. .rpc_resp = &data->res,
  536. .rpc_cred = data->cred,
  537. };
  538. rpc_call_setup(&data->task, &msg, 0);
  539. }
  540. static int nfs_write_done(struct rpc_task *task, struct nfs_write_data *data)
  541. {
  542. if (task->tk_status >= 0)
  543. nfs_post_op_update_inode(data->inode, data->res.fattr);
  544. return 0;
  545. }
  546. static void nfs_proc_write_setup(struct nfs_write_data *data, int how)
  547. {
  548. struct rpc_message msg = {
  549. .rpc_proc = &nfs_procedures[NFSPROC_WRITE],
  550. .rpc_argp = &data->args,
  551. .rpc_resp = &data->res,
  552. .rpc_cred = data->cred,
  553. };
  554. /* Note: NFSv2 ignores @stable and always uses NFS_FILE_SYNC */
  555. data->args.stable = NFS_FILE_SYNC;
  556. /* Finalize the task. */
  557. rpc_call_setup(&data->task, &msg, 0);
  558. }
  559. static void
  560. nfs_proc_commit_setup(struct nfs_write_data *data, int how)
  561. {
  562. BUG();
  563. }
  564. static int
  565. nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
  566. {
  567. return nlmclnt_proc(filp->f_path.dentry->d_inode, cmd, fl);
  568. }
  569. const struct nfs_rpc_ops nfs_v2_clientops = {
  570. .version = 2, /* protocol version */
  571. .dentry_ops = &nfs_dentry_operations,
  572. .dir_inode_ops = &nfs_dir_inode_operations,
  573. .file_inode_ops = &nfs_file_inode_operations,
  574. .getroot = nfs_proc_get_root,
  575. .getattr = nfs_proc_getattr,
  576. .setattr = nfs_proc_setattr,
  577. .lookup = nfs_proc_lookup,
  578. .access = NULL, /* access */
  579. .readlink = nfs_proc_readlink,
  580. .create = nfs_proc_create,
  581. .remove = nfs_proc_remove,
  582. .unlink_setup = nfs_proc_unlink_setup,
  583. .unlink_done = nfs_proc_unlink_done,
  584. .rename = nfs_proc_rename,
  585. .link = nfs_proc_link,
  586. .symlink = nfs_proc_symlink,
  587. .mkdir = nfs_proc_mkdir,
  588. .rmdir = nfs_proc_rmdir,
  589. .readdir = nfs_proc_readdir,
  590. .mknod = nfs_proc_mknod,
  591. .statfs = nfs_proc_statfs,
  592. .fsinfo = nfs_proc_fsinfo,
  593. .pathconf = nfs_proc_pathconf,
  594. .decode_dirent = nfs_decode_dirent,
  595. .read_setup = nfs_proc_read_setup,
  596. .read_done = nfs_read_done,
  597. .write_setup = nfs_proc_write_setup,
  598. .write_done = nfs_write_done,
  599. .commit_setup = nfs_proc_commit_setup,
  600. .file_open = nfs_open,
  601. .file_release = nfs_release,
  602. .lock = nfs_proc_lock,
  603. };