callback.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * linux/fs/nfs/callback.h
  3. *
  4. * Copyright (C) 2004 Trond Myklebust
  5. *
  6. * NFSv4 callback definitions
  7. */
  8. #ifndef __LINUX_FS_NFS_CALLBACK_H
  9. #define __LINUX_FS_NFS_CALLBACK_H
  10. #define NFS4_CALLBACK 0x40000000
  11. #define NFS4_CALLBACK_XDRSIZE 2048
  12. #define NFS4_CALLBACK_BUFSIZE (1024 + NFS4_CALLBACK_XDRSIZE)
  13. enum nfs4_callback_procnum {
  14. CB_NULL = 0,
  15. CB_COMPOUND = 1,
  16. };
  17. enum nfs4_callback_opnum {
  18. OP_CB_GETATTR = 3,
  19. OP_CB_RECALL = 4,
  20. /* Callback operations new to NFSv4.1 */
  21. OP_CB_LAYOUTRECALL = 5,
  22. OP_CB_NOTIFY = 6,
  23. OP_CB_PUSH_DELEG = 7,
  24. OP_CB_RECALL_ANY = 8,
  25. OP_CB_RECALLABLE_OBJ_AVAIL = 9,
  26. OP_CB_RECALL_SLOT = 10,
  27. OP_CB_SEQUENCE = 11,
  28. OP_CB_WANTS_CANCELLED = 12,
  29. OP_CB_NOTIFY_LOCK = 13,
  30. OP_CB_NOTIFY_DEVICEID = 14,
  31. OP_CB_ILLEGAL = 10044,
  32. };
  33. struct cb_compound_hdr_arg {
  34. unsigned int taglen;
  35. const char *tag;
  36. unsigned int minorversion;
  37. unsigned nops;
  38. };
  39. struct cb_compound_hdr_res {
  40. __be32 *status;
  41. unsigned int taglen;
  42. const char *tag;
  43. __be32 *nops;
  44. };
  45. struct cb_getattrargs {
  46. struct sockaddr *addr;
  47. struct nfs_fh fh;
  48. uint32_t bitmap[2];
  49. };
  50. struct cb_getattrres {
  51. __be32 status;
  52. uint32_t bitmap[2];
  53. uint64_t size;
  54. uint64_t change_attr;
  55. struct timespec ctime;
  56. struct timespec mtime;
  57. };
  58. struct cb_recallargs {
  59. struct sockaddr *addr;
  60. struct nfs_fh fh;
  61. nfs4_stateid stateid;
  62. uint32_t truncate;
  63. };
  64. #if defined(CONFIG_NFS_V4_1)
  65. struct referring_call {
  66. uint32_t rc_sequenceid;
  67. uint32_t rc_slotid;
  68. };
  69. struct referring_call_list {
  70. struct nfs4_sessionid rcl_sessionid;
  71. uint32_t rcl_nrefcalls;
  72. struct referring_call *rcl_refcalls;
  73. };
  74. struct cb_sequenceargs {
  75. struct sockaddr *csa_addr;
  76. struct nfs4_sessionid csa_sessionid;
  77. uint32_t csa_sequenceid;
  78. uint32_t csa_slotid;
  79. uint32_t csa_highestslotid;
  80. uint32_t csa_cachethis;
  81. uint32_t csa_nrclists;
  82. struct referring_call_list *csa_rclists;
  83. };
  84. struct cb_sequenceres {
  85. __be32 csr_status;
  86. struct nfs4_sessionid csr_sessionid;
  87. uint32_t csr_sequenceid;
  88. uint32_t csr_slotid;
  89. uint32_t csr_highestslotid;
  90. uint32_t csr_target_highestslotid;
  91. };
  92. extern unsigned nfs4_callback_sequence(struct cb_sequenceargs *args,
  93. struct cb_sequenceres *res);
  94. #endif /* CONFIG_NFS_V4_1 */
  95. extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res);
  96. extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy);
  97. #ifdef CONFIG_NFS_V4
  98. extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt);
  99. extern void nfs_callback_down(int minorversion);
  100. #endif /* CONFIG_NFS_V4 */
  101. /*
  102. * nfs41: Callbacks are expected to not cause substantial latency,
  103. * so we limit their concurrency to 1 by setting up the maximum number
  104. * of slots for the backchannel.
  105. */
  106. #define NFS41_BC_MIN_CALLBACKS 1
  107. #define NFS41_BC_MAX_CALLBACKS 1
  108. extern unsigned int nfs_callback_set_tcpport;
  109. extern unsigned short nfs_callback_tcpport;
  110. extern unsigned short nfs_callback_tcpport6;
  111. #endif /* __LINUX_FS_NFS_CALLBACK_H */