sunrpc: remove sv_kill_signal field from svc_serv struct
[safe/jmp/linux-2.6] / include / linux / sunrpc / svc.h
index 52db9c8..dc69068 100644 (file)
@@ -11,6 +11,7 @@
 #define SUNRPC_SVC_H
 
 #include <linux/in.h>
+#include <linux/in6.h>
 #include <linux/sunrpc/types.h>
 #include <linux/sunrpc/xdr.h>
 #include <linux/sunrpc/auth.h>
@@ -21,7 +22,7 @@
 /*
  * This is the RPC server thread function prototype
  */
-typedef void           (*svc_thread_fn)(struct svc_rqst *);
+typedef int            (*svc_thread_fn)(void *);
 
 /*
  *
@@ -79,7 +80,6 @@ struct svc_serv {
        struct module *         sv_module;      /* optional module to count when
                                                 * adding threads */
        svc_thread_fn           sv_function;    /* main function for threads */
-       int                     sv_kill_signal; /* signal to kill threads */
 };
 
 /*
@@ -191,7 +191,11 @@ static inline void svc_putu32(struct kvec *iov, __be32 val)
        iov->iov_len += sizeof(__be32);
 }
 
-       
+union svc_addr_u {
+    struct in_addr     addr;
+    struct in6_addr    addr6;
+};
+
 /*
  * The context of a single thread, including the request currently being
  * processed.
@@ -199,18 +203,20 @@ static inline void svc_putu32(struct kvec *iov, __be32 val)
 struct svc_rqst {
        struct list_head        rq_list;        /* idle list */
        struct list_head        rq_all;         /* all threads list */
-       struct svc_sock *       rq_sock;        /* socket */
-       struct sockaddr_in      rq_addr;        /* peer address */
-       int                     rq_addrlen;
+       struct svc_xprt *       rq_xprt;        /* transport ptr */
+       struct sockaddr_storage rq_addr;        /* peer address */
+       size_t                  rq_addrlen;
 
        struct svc_serv *       rq_server;      /* RPC service definition */
        struct svc_pool *       rq_pool;        /* thread pool */
        struct svc_procedure *  rq_procinfo;    /* procedure info */
        struct auth_ops *       rq_authop;      /* authentication flavour */
+       u32                     rq_flavor;      /* pseudoflavor */
        struct svc_cred         rq_cred;        /* auth info */
-       struct sk_buff *        rq_skbuff;      /* fast recv inet buffer */
+       void *                  rq_xprt_ctxt;   /* transport specific context ptr */
        struct svc_deferred_req*rq_deferred;    /* deferred request we are replaying */
 
+       size_t                  rq_xprt_hlen;   /* xprt header len */
        struct xdr_buf          rq_arg;
        struct xdr_buf          rq_res;
        struct page *           rq_pages[RPCSVC_MAXPAGES];
@@ -227,8 +233,8 @@ struct svc_rqst {
        unsigned short
                                rq_secure  : 1; /* secure port */
 
-
-       __be32                  rq_daddr;       /* dest addr of request - reply from here */
+       union svc_addr_u        rq_daddr;       /* dest addr of request
+                                                *  - reply from here */
 
        void *                  rq_argp;        /* decoded arguments */
        void *                  rq_resp;        /* xdr'd results */
@@ -243,12 +249,13 @@ struct svc_rqst {
                                                 */
        /* Catering to nfsd */
        struct auth_domain *    rq_client;      /* RPC peer info */
+       struct auth_domain *    rq_gssclient;   /* "gss/"-style peer info */
        struct svc_cacherep *   rq_cacherep;    /* cache info */
        struct knfsd_fh *       rq_reffh;       /* Referrence filehandle, used to
                                                 * determine what device number
                                                 * to report (real or virtual)
                                                 */
-       int                     rq_sendfile_ok; /* turned off in gss privacy
+       int                     rq_splice_ok;   /* turned off in gss privacy
                                                 * to prevent encrypting page
                                                 * cache pages */
        wait_queue_head_t       rq_wait;        /* synchronization */
@@ -256,6 +263,24 @@ struct svc_rqst {
 };
 
 /*
+ * Rigorous type checking on sockaddr type conversions
+ */
+static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst)
+{
+       return (struct sockaddr_in *) &rqst->rq_addr;
+}
+
+static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst)
+{
+       return (struct sockaddr_in6 *) &rqst->rq_addr;
+}
+
+static inline struct sockaddr *svc_addr(struct svc_rqst *rqst)
+{
+       return (struct sockaddr *) &rqst->rq_addr;
+}
+
+/*
  * Check buffer bounds after decoding arguments
  */
 static inline int
@@ -292,11 +317,12 @@ static inline void svc_free_res_pages(struct svc_rqst *rqstp)
 
 struct svc_deferred_req {
        u32                     prot;   /* protocol (UDP or TCP) */
-       struct svc_sock         *svsk;
+       struct svc_xprt         *xprt;
        struct sockaddr_storage addr;   /* where reply must go */
        size_t                  addrlen;
-       __be32                  daddr;  /* where reply must come from */
+       union svc_addr_u        daddr;  /* where reply must come from */
        struct cache_deferred_req handle;
+       size_t                  xprt_hlen;
        int                     argslen;
        __be32                  args[0];
 };
@@ -357,11 +383,12 @@ struct svc_procedure {
  */
 struct svc_serv *  svc_create(struct svc_program *, unsigned int,
                              void (*shutdown)(struct svc_serv*));
-int               svc_create_thread(svc_thread_fn, struct svc_serv *);
+struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
+                                       struct svc_pool *pool);
 void              svc_exit_thread(struct svc_rqst *);
 struct svc_serv *  svc_create_pooled(struct svc_program *, unsigned int,
-                       void (*shutdown)(struct svc_serv*),
-                       svc_thread_fn, int sig, struct module *);
+                       void (*shutdown)(struct svc_serv*), svc_thread_fn,
+                       struct module *);
 int               svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
 void              svc_destroy(struct svc_serv *);
 int               svc_process(struct svc_rqst *);
@@ -373,4 +400,20 @@ char *                svc_print_addr(struct svc_rqst *, char *, size_t);
 
 #define        RPC_MAX_ADDRBUFLEN      (63U)
 
+/*
+ * When we want to reduce the size of the reserved space in the response
+ * buffer, we need to take into account the size of any checksum data that
+ * may be at the end of the packet. This is difficult to determine exactly
+ * for all cases without actually generating the checksum, so we just use a
+ * static value.
+ */
+static inline void svc_reserve_auth(struct svc_rqst *rqstp, int space)
+{
+       int added_space = 0;
+
+       if (rqstp->rq_authop->flavour)
+               added_space = RPC_MAX_AUTH_SIZE;
+       svc_reserve(rqstp, space + added_space);
+}
+
 #endif /* SUNRPC_SVC_H */