Subject: Re: [Patch net-next 4/7] sunrpc: use generic union inet_addr

From: Cong Wang <[email-masked]>
Date: Thu, 25 Jul 2013 20:34:43 +0800

On Tue, 2013-07-23 at 12:40 -0400, J. Bruce Fields wrote:
> On Mon, Jul 22, 2013 at 03:05:10PM +0800, Cong Wang wrote: 
> >  static inline unsigned short rpc_get_port(const struct sockaddr *sap)
> >  {
> > -	switch (sap->sa_family) {
> > -	case AF_INET:
> > -		return ntohs(((struct sockaddr_in *)sap)->sin_port);
> > -	case AF_INET6:
> > -		return ntohs(((struct sockaddr_in6 *)sap)->sin6_port);
> > -	}
> > -	return 0;
> > +	return inet_addr_get_port((const union inet_addr *)sap);
> >  }
> 
> Is there any reason to keep the rpc_get_port wrapper at all after this?
> Or if its still useful to have the convenience of not having to do the
> cast, maybe the wrapper should move to common code to?  (Is there some
> reason only the rpc code needs this?)
> 

Yeah, the only reason why I keep it is that I don't want to touch all
the callers of rpc_get_port(). I agree that we can make it a generic
function.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email-masked]
More majordomo info at  http://vger.kernel.org/majordomo-info.html