X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=include%2Flinux%2Fsunrpc%2Fsvc.h;h=6d6892fa1d4017085aaee586f7014bbe0abcc65b;hb=73df0dbaff8d0853387e140f52b6250c486b18a1;hp=965d6c20086ee2980ddee1f30e7d842df019a1df;hpb=752c58a471c108d64da1676b2925dfbd83eb177e;p=mv-sheeva.git diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 965d6c20086..6d6892fa1d4 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -11,6 +11,7 @@ #define SUNRPC_SVC_H #include +#include #include #include #include @@ -144,8 +145,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) { @@ -188,7 +192,13 @@ static inline void svc_putu32(struct kvec *iov, __be32 val) iov->iov_len += sizeof(__be32); } - +union svc_addr_u { + struct in_addr addr; +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) + struct in6_addr addr6; +#endif +}; + /* * The context of a single thread, including the request currently being * processed. @@ -197,8 +207,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 */ @@ -224,8 +234,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 */ @@ -252,6 +262,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,9 +312,10 @@ 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 */ - __be32 daddr; /* where reply must come from */ + struct svc_sock *svsk; + struct sockaddr_storage addr; /* where reply must go */ + size_t addrlen; + union svc_addr_u daddr; /* where reply must come from */ struct cache_deferred_req handle; int argslen; __be32 args[0]; @@ -365,5 +389,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 */