PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/include/linux/sunrpc/clnt.h

https://gitlab.com/pine64-android/linux-3.10
C Header | 172 lines | 136 code | 19 blank | 17 comment | 0 complexity | 81915498e070be18d66220cd1002ae0e MD5 | raw file
  1. /*
  2. * linux/include/linux/sunrpc/clnt.h
  3. *
  4. * Declarations for the high-level RPC client interface
  5. *
  6. * Copyright (C) 1995, 1996, Olaf Kirch <okir@monad.swb.de>
  7. */
  8. #ifndef _LINUX_SUNRPC_CLNT_H
  9. #define _LINUX_SUNRPC_CLNT_H
  10. #include <linux/types.h>
  11. #include <linux/socket.h>
  12. #include <linux/in.h>
  13. #include <linux/in6.h>
  14. #include <linux/sunrpc/msg_prot.h>
  15. #include <linux/sunrpc/sched.h>
  16. #include <linux/sunrpc/xprt.h>
  17. #include <linux/sunrpc/auth.h>
  18. #include <linux/sunrpc/stats.h>
  19. #include <linux/sunrpc/xdr.h>
  20. #include <linux/sunrpc/timer.h>
  21. #include <asm/signal.h>
  22. #include <linux/path.h>
  23. #include <net/ipv6.h>
  24. struct rpc_inode;
  25. /*
  26. * The high-level client handle
  27. */
  28. struct rpc_clnt {
  29. atomic_t cl_count; /* Number of references */
  30. struct list_head cl_clients; /* Global list of clients */
  31. struct list_head cl_tasks; /* List of tasks */
  32. spinlock_t cl_lock; /* spinlock */
  33. struct rpc_xprt __rcu * cl_xprt; /* transport */
  34. struct rpc_procinfo * cl_procinfo; /* procedure info */
  35. u32 cl_prog, /* RPC program number */
  36. cl_vers, /* RPC version number */
  37. cl_maxproc; /* max procedure number */
  38. const char * cl_protname; /* protocol name */
  39. struct rpc_auth * cl_auth; /* authenticator */
  40. struct rpc_stat * cl_stats; /* per-program statistics */
  41. struct rpc_iostats * cl_metrics; /* per-client statistics */
  42. unsigned int cl_softrtry : 1,/* soft timeouts */
  43. cl_discrtry : 1,/* disconnect before retry */
  44. cl_autobind : 1,/* use getport() */
  45. cl_chatty : 1;/* be verbose */
  46. struct rpc_rtt * cl_rtt; /* RTO estimator data */
  47. const struct rpc_timeout *cl_timeout; /* Timeout strategy */
  48. int cl_nodelen; /* nodename length */
  49. char cl_nodename[UNX_MAXNODENAME];
  50. struct dentry * cl_dentry;
  51. struct rpc_clnt * cl_parent; /* Points to parent of clones */
  52. struct rpc_rtt cl_rtt_default;
  53. struct rpc_timeout cl_timeout_default;
  54. const struct rpc_program *cl_program;
  55. char *cl_principal; /* target to authenticate to */
  56. };
  57. /*
  58. * General RPC program info
  59. */
  60. #define RPC_MAXVERSION 4
  61. struct rpc_program {
  62. const char * name; /* protocol name */
  63. u32 number; /* program number */
  64. unsigned int nrvers; /* number of versions */
  65. const struct rpc_version ** version; /* version array */
  66. struct rpc_stat * stats; /* statistics */
  67. const char * pipe_dir_name; /* path to rpc_pipefs dir */
  68. };
  69. struct rpc_version {
  70. u32 number; /* version number */
  71. unsigned int nrprocs; /* number of procs */
  72. struct rpc_procinfo * procs; /* procedure array */
  73. };
  74. /*
  75. * Procedure information
  76. */
  77. struct rpc_procinfo {
  78. u32 p_proc; /* RPC procedure number */
  79. kxdreproc_t p_encode; /* XDR encode function */
  80. kxdrdproc_t p_decode; /* XDR decode function */
  81. unsigned int p_arglen; /* argument hdr length (u32) */
  82. unsigned int p_replen; /* reply hdr length (u32) */
  83. unsigned int p_count; /* call count */
  84. unsigned int p_timer; /* Which RTT timer to use */
  85. u32 p_statidx; /* Which procedure to account */
  86. const char * p_name; /* name of procedure */
  87. };
  88. #ifdef __KERNEL__
  89. struct rpc_create_args {
  90. struct net *net;
  91. int protocol;
  92. struct sockaddr *address;
  93. size_t addrsize;
  94. struct sockaddr *saddress;
  95. const struct rpc_timeout *timeout;
  96. const char *servername;
  97. const struct rpc_program *program;
  98. u32 prognumber; /* overrides program->number */
  99. u32 version;
  100. rpc_authflavor_t authflavor;
  101. unsigned long flags;
  102. char *client_name;
  103. struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
  104. };
  105. /* Values for "flags" field */
  106. #define RPC_CLNT_CREATE_HARDRTRY (1UL << 0)
  107. #define RPC_CLNT_CREATE_AUTOBIND (1UL << 2)
  108. #define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3)
  109. #define RPC_CLNT_CREATE_NOPING (1UL << 4)
  110. #define RPC_CLNT_CREATE_DISCRTRY (1UL << 5)
  111. #define RPC_CLNT_CREATE_QUIET (1UL << 6)
  112. #define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7)
  113. #define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8)
  114. struct rpc_clnt *rpc_create(struct rpc_create_args *args);
  115. struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
  116. const struct rpc_program *, u32);
  117. void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
  118. struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
  119. struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *,
  120. rpc_authflavor_t);
  121. void rpc_shutdown_client(struct rpc_clnt *);
  122. void rpc_release_client(struct rpc_clnt *);
  123. void rpc_task_release_client(struct rpc_task *);
  124. int rpcb_create_local(struct net *);
  125. void rpcb_put_local(struct net *);
  126. int rpcb_register(struct net *, u32, u32, int, unsigned short);
  127. int rpcb_v4_register(struct net *net, const u32 program,
  128. const u32 version,
  129. const struct sockaddr *address,
  130. const char *netid);
  131. void rpcb_getport_async(struct rpc_task *);
  132. void rpc_call_start(struct rpc_task *);
  133. int rpc_call_async(struct rpc_clnt *clnt,
  134. const struct rpc_message *msg, int flags,
  135. const struct rpc_call_ops *tk_ops,
  136. void *calldata);
  137. int rpc_call_sync(struct rpc_clnt *clnt,
  138. const struct rpc_message *msg, int flags);
  139. struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
  140. int flags);
  141. int rpc_restart_call_prepare(struct rpc_task *);
  142. int rpc_restart_call(struct rpc_task *);
  143. void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
  144. int rpc_protocol(struct rpc_clnt *);
  145. struct net * rpc_net_ns(struct rpc_clnt *);
  146. size_t rpc_max_payload(struct rpc_clnt *);
  147. unsigned long rpc_get_timeout(struct rpc_clnt *clnt);
  148. void rpc_force_rebind(struct rpc_clnt *);
  149. size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
  150. const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
  151. int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t);
  152. #endif /* __KERNEL__ */
  153. #endif /* _LINUX_SUNRPC_CLNT_H */