xdr.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * linux/include/linux/lockd/xdr.h
  3. *
  4. * XDR types for the NLM protocol
  5. *
  6. * Copyright (C) 1996 Olaf Kirch <okir@monad.swb.de>
  7. */
  8. #ifndef LOCKD_XDR_H
  9. #define LOCKD_XDR_H
  10. #include <linux/fs.h>
  11. #include <linux/nfs.h>
  12. #include <linux/sunrpc/xdr.h>
  13. #define SM_MAXSTRLEN 1024
  14. #define SM_PRIV_SIZE 16
  15. struct nsm_private {
  16. unsigned char data[SM_PRIV_SIZE];
  17. };
  18. struct svc_rqst;
  19. #define NLM_MAXCOOKIELEN 32
  20. #define NLM_MAXSTRLEN 1024
  21. #define nlm_granted cpu_to_be32(NLM_LCK_GRANTED)
  22. #define nlm_lck_denied cpu_to_be32(NLM_LCK_DENIED)
  23. #define nlm_lck_denied_nolocks cpu_to_be32(NLM_LCK_DENIED_NOLOCKS)
  24. #define nlm_lck_blocked cpu_to_be32(NLM_LCK_BLOCKED)
  25. #define nlm_lck_denied_grace_period cpu_to_be32(NLM_LCK_DENIED_GRACE_PERIOD)
  26. #define nlm_drop_reply cpu_to_be32(30000)
  27. /* Lock info passed via NLM */
  28. struct nlm_lock {
  29. char * caller;
  30. unsigned int len; /* length of "caller" */
  31. struct nfs_fh fh;
  32. struct xdr_netobj oh;
  33. u32 svid;
  34. struct file_lock fl;
  35. };
  36. /*
  37. * NLM cookies. Technically they can be 1K, but Linux only uses 8 bytes.
  38. * FreeBSD uses 16, Apple Mac OS X 10.3 uses 20. Therefore we set it to
  39. * 32 bytes.
  40. */
  41. struct nlm_cookie
  42. {
  43. unsigned char data[NLM_MAXCOOKIELEN];
  44. unsigned int len;
  45. };
  46. /*
  47. * Generic lockd arguments for all but sm_notify
  48. */
  49. struct nlm_args {
  50. struct nlm_cookie cookie;
  51. struct nlm_lock lock;
  52. u32 block;
  53. u32 reclaim;
  54. u32 state;
  55. u32 monitor;
  56. u32 fsm_access;
  57. u32 fsm_mode;
  58. };
  59. typedef struct nlm_args nlm_args;
  60. /*
  61. * Generic lockd result
  62. */
  63. struct nlm_res {
  64. struct nlm_cookie cookie;
  65. __be32 status;
  66. struct nlm_lock lock;
  67. };
  68. /*
  69. * statd callback when client has rebooted
  70. */
  71. struct nlm_reboot {
  72. char *mon;
  73. unsigned int len;
  74. u32 state;
  75. struct nsm_private priv;
  76. };
  77. /*
  78. * Contents of statd callback when monitored host rebooted
  79. */
  80. #define NLMSVC_XDRSIZE sizeof(struct nlm_args)
  81. int nlmsvc_decode_testargs(struct svc_rqst *, __be32 *, struct nlm_args *);
  82. int nlmsvc_encode_testres(struct svc_rqst *, __be32 *, struct nlm_res *);
  83. int nlmsvc_decode_lockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
  84. int nlmsvc_decode_cancargs(struct svc_rqst *, __be32 *, struct nlm_args *);
  85. int nlmsvc_decode_unlockargs(struct svc_rqst *, __be32 *, struct nlm_args *);
  86. int nlmsvc_encode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
  87. int nlmsvc_decode_res(struct svc_rqst *, __be32 *, struct nlm_res *);
  88. int nlmsvc_encode_void(struct svc_rqst *, __be32 *, void *);
  89. int nlmsvc_decode_void(struct svc_rqst *, __be32 *, void *);
  90. int nlmsvc_decode_shareargs(struct svc_rqst *, __be32 *, struct nlm_args *);
  91. int nlmsvc_encode_shareres(struct svc_rqst *, __be32 *, struct nlm_res *);
  92. int nlmsvc_decode_notify(struct svc_rqst *, __be32 *, struct nlm_args *);
  93. int nlmsvc_decode_reboot(struct svc_rqst *, __be32 *, struct nlm_reboot *);
  94. /*
  95. int nlmclt_encode_testargs(struct rpc_rqst *, u32 *, struct nlm_args *);
  96. int nlmclt_encode_lockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
  97. int nlmclt_encode_cancargs(struct rpc_rqst *, u32 *, struct nlm_args *);
  98. int nlmclt_encode_unlockargs(struct rpc_rqst *, u32 *, struct nlm_args *);
  99. */
  100. #endif /* LOCKD_XDR_H */