proc.c 16 KB

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