bind.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * linux/include/linux/lockd/bind.h
  3. *
  4. * This is the part of lockd visible to nfsd and the nfs client.
  5. *
  6. * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
  7. */
  8. #ifndef LINUX_LOCKD_BIND_H
  9. #define LINUX_LOCKD_BIND_H
  10. #include <linux/lockd/nlm.h>
  11. /* need xdr-encoded error codes too, so... */
  12. #include <linux/lockd/xdr.h>
  13. #ifdef CONFIG_LOCKD_V4
  14. #include <linux/lockd/xdr4.h>
  15. #endif
  16. /* Dummy declarations */
  17. struct svc_rqst;
  18. struct rpc_task;
  19. /*
  20. * This is the set of functions for lockd->nfsd communication
  21. */
  22. struct nlmsvc_binding {
  23. __be32 (*fopen)(struct svc_rqst *,
  24. struct nfs_fh *,
  25. struct file **);
  26. void (*fclose)(struct file *);
  27. };
  28. extern const struct nlmsvc_binding *nlmsvc_ops;
  29. /*
  30. * Similar to nfs_client_initdata, but without the NFS-specific
  31. * rpc_ops field.
  32. */
  33. struct nlmclnt_initdata {
  34. const char *hostname;
  35. const struct sockaddr *address;
  36. size_t addrlen;
  37. unsigned short protocol;
  38. u32 nfs_version;
  39. int noresvport;
  40. struct net *net;
  41. const struct nlmclnt_operations *nlmclnt_ops;
  42. };
  43. /*
  44. * Functions exported by the lockd module
  45. */
  46. extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
  47. extern void nlmclnt_done(struct nlm_host *host);
  48. /*
  49. * NLM client operations provide a means to modify RPC processing of NLM
  50. * requests. Callbacks receive a pointer to data passed into the call to
  51. * nlmclnt_proc().
  52. */
  53. struct nlmclnt_operations {
  54. /* Called on successful allocation of nlm_rqst, use for allocation or
  55. * reference counting. */
  56. void (*nlmclnt_alloc_call)(void *);
  57. /* Called in rpc_task_prepare for unlock. A return value of true
  58. * indicates the callback has put the task to sleep on a waitqueue
  59. * and NLM should not call rpc_call_start(). */
  60. bool (*nlmclnt_unlock_prepare)(struct rpc_task*, void *);
  61. /* Called when the nlm_rqst is freed, callbacks should clean up here */
  62. void (*nlmclnt_release_call)(void *);
  63. };
  64. extern int nlmclnt_proc(struct nlm_host *host, int cmd, struct file_lock *fl, void *data);
  65. extern int lockd_up(struct net *net);
  66. extern void lockd_down(struct net *net);
  67. #endif /* LINUX_LOCKD_BIND_H */