bind.h 2.2 KB

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