[PATCH] knfsd: SUNRPC: Provide room in svc_rqst for larger addresses
[powerpc.git] / include / linux / sunrpc / svc.h
index 9c9a8ad..96c1b6a 100644 (file)
@@ -144,8 +144,11 @@ extern u32 svc_max_payload(const struct svc_rqst *rqstp);
  *
  * Each request/reply pair can have at most one "payload", plus two pages,
  * one for the request, and one for the reply.
+ * We using ->sendfile to return read data, we might need one extra page
+ * if the request is not page-aligned.  So add another '1'.
  */
-#define RPCSVC_MAXPAGES                ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2)
+#define RPCSVC_MAXPAGES                ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE \
+                               + 2 + 1)
 
 static inline u32 svc_getnl(struct kvec *iov)
 {
@@ -197,8 +200,8 @@ 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 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 */
@@ -252,6 +255,19 @@ struct svc_rqst {
        struct task_struct      *rq_task;       /* service thread */
 };
 
+/*
+ * 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 *svc_addr(struct svc_rqst *rqst)
+{
+       return (struct sockaddr *) &rqst->rq_addr;
+}
+
 /*
  * Check buffer bounds after decoding arguments
  */
@@ -289,8 +305,9 @@ static inline void svc_free_res_pages(struct svc_rqst *rqstp)
 
 struct svc_deferred_req {
        u32                     prot;   /* protocol (UDP or TCP) */
-       struct sockaddr_in      addr;
-       struct svc_sock         *svsk;  /* where reply must go */
+       struct svc_sock         *svsk;
+       struct sockaddr_storage addr;   /* where reply must go */
+       size_t                  addrlen;
        __be32                  daddr;  /* where reply must come from */
        struct cache_deferred_req handle;
        int                     argslen;
@@ -335,7 +352,7 @@ struct svc_version {
 /*
  * RPC procedure info
  */
-typedef int    (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp);
+typedef __be32 (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp);
 struct svc_procedure {
        svc_procfunc            pc_func;        /* process the request */
        kxdrproc_t              pc_decode;      /* XDR decode args */
@@ -365,5 +382,8 @@ int            svc_register(struct svc_serv *, int, unsigned short);
 void              svc_wake_up(struct svc_serv *);
 void              svc_reserve(struct svc_rqst *rqstp, int space);
 struct svc_pool *  svc_pool_for_cpu(struct svc_serv *serv, int cpu);
+char *            svc_print_addr(struct svc_rqst *, char *, size_t);
+
+#define        RPC_MAX_ADDRBUFLEN      (63U)
 
 #endif /* SUNRPC_SVC_H */