aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svc.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-03-18 20:46:06 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2009-03-28 15:54:12 -0400
commit4b62e58cccff9c5e7ffc7023f7ec24c75fbd549b (patch)
tree34965810fe2a9aff001dd193a3cb925c2c3e1abd /net/sunrpc/svc.c
parent156e62094a74cf43f02f56ef96b6cda567501357 (diff)
SUNRPC: Pass a family argument to svc_register()
The sv_family field is going away. Instead of using sv_family, have the svc_register() function take a protocol family argument. Since this argument represents a protocol family, and not an address family, this argument takes an int, as this is what is passed to sock_create_kern(). Also make sure svc_register's helpers are checking for PF_FOO instead of AF_FOO. The value of [AP]F_FOO are equivalent; this is simply a symbolic change to reflect the semantics of the value stored in that variable. sock_create_kern() should return EPFNOSUPPORT if the passed-in protocol family isn't supported, but it uses EAFNOSUPPORT for this case. We will stick with that tradition here, as svc_register() is called by the RPC server in the same path as sock_create_kern(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/svc.c')
-rw-r--r--net/sunrpc/svc.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index c51fed4d1af1..41bc36ea2224 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -800,17 +800,17 @@ static int __svc_rpcb_register6(const u32 program, const u32 version,
800 * if any error occurs. 800 * if any error occurs.
801 */ 801 */
802static int __svc_register(const u32 program, const u32 version, 802static int __svc_register(const u32 program, const u32 version,
803 const sa_family_t family, 803 const int family,
804 const unsigned short protocol, 804 const unsigned short protocol,
805 const unsigned short port) 805 const unsigned short port)
806{ 806{
807 int error; 807 int error;
808 808
809 switch (family) { 809 switch (family) {
810 case AF_INET: 810 case PF_INET:
811 return __svc_rpcb_register4(program, version, 811 return __svc_rpcb_register4(program, version,
812 protocol, port); 812 protocol, port);
813 case AF_INET6: 813 case PF_INET6:
814 error = __svc_rpcb_register6(program, version, 814 error = __svc_rpcb_register6(program, version,
815 protocol, port); 815 protocol, port);
816 if (error < 0) 816 if (error < 0)
@@ -840,11 +840,11 @@ static int __svc_register(const u32 program, const u32 version,
840 * if any error occurs. 840 * if any error occurs.
841 */ 841 */
842static int __svc_register(const u32 program, const u32 version, 842static int __svc_register(const u32 program, const u32 version,
843 sa_family_t family, 843 const int family,
844 const unsigned short protocol, 844 const unsigned short protocol,
845 const unsigned short port) 845 const unsigned short port)
846{ 846{
847 if (family != AF_INET) 847 if (family != PF_INET)
848 return -EAFNOSUPPORT; 848 return -EAFNOSUPPORT;
849 849
850 return rpcb_register(program, version, protocol, port); 850 return rpcb_register(program, version, protocol, port);
@@ -855,13 +855,14 @@ static int __svc_register(const u32 program, const u32 version,
855/** 855/**
856 * svc_register - register an RPC service with the local portmapper 856 * svc_register - register an RPC service with the local portmapper
857 * @serv: svc_serv struct for the service to register 857 * @serv: svc_serv struct for the service to register
858 * @family: protocol family of service's listener socket
858 * @proto: transport protocol number to advertise 859 * @proto: transport protocol number to advertise
859 * @port: port to advertise 860 * @port: port to advertise
860 * 861 *
861 * Service is registered for any address in serv's address family 862 * Service is registered for any address in the passed-in protocol family
862 */ 863 */
863int svc_register(const struct svc_serv *serv, const unsigned short proto, 864int svc_register(const struct svc_serv *serv, const int family,
864 const unsigned short port) 865 const unsigned short proto, const unsigned short port)
865{ 866{
866 struct svc_program *progp; 867 struct svc_program *progp;
867 unsigned int i; 868 unsigned int i;
@@ -879,7 +880,7 @@ int svc_register(const struct svc_serv *serv, const unsigned short proto,
879 i, 880 i,
880 proto == IPPROTO_UDP? "udp" : "tcp", 881 proto == IPPROTO_UDP? "udp" : "tcp",
881 port, 882 port,
882 serv->sv_family, 883 family,
883 progp->pg_vers[i]->vs_hidden? 884 progp->pg_vers[i]->vs_hidden?
884 " (but not telling portmap)" : ""); 885 " (but not telling portmap)" : "");
885 886
@@ -887,7 +888,7 @@ int svc_register(const struct svc_serv *serv, const unsigned short proto,
887 continue; 888 continue;
888 889
889 error = __svc_register(progp->pg_prog, i, 890 error = __svc_register(progp->pg_prog, i,
890 serv->sv_family, proto, port); 891 family, proto, port);
891 if (error < 0) 892 if (error < 0)
892 break; 893 break;
893 } 894 }