proc.c 17 KB

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