All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	Trond Myklebust
	<Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>,
	"J. Bruce Fields"
	<bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [Patch net-next v2 5/8] sunrpc: use generic union inet_addr
Date: Tue, 6 Aug 2013 06:28:01 -0400	[thread overview]
Message-ID: <20130806062801.67714276@tlielax.poochiereds.net> (raw)
In-Reply-To: <1375672445.32485.8.camel@cr0>

On Mon, 05 Aug 2013 11:14:05 +0800
Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:

> On Fri, 2013-08-02 at 09:36 -0400, Jeff Layton wrote:
> > On Fri,  2 Aug 2013 15:14:31 +0800
> > Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > 
> > > From: Cong Wang <amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > > 
> > > sunrpc defines some helper functions for sockaddr, actually they
> > > can re-use the generic functions for union inet_addr too.
> > 
> > Only some of these patches in this series have made it to lists to
> > which I'm subscribed, so I may be missing some context here...
> > 
> > I'm not sure I really understand the value of "union inet_addr". Why
> > not just use the conventional method of passing around "struct sockaddr"
> > pointers, and then casting them to struct sockaddr_in/sockaddr_in6
> > depending on what the sa_family is set to?
> 
> Yes.
> 
> > 
> > With that you wouldn't need to leave the (now pointless) rpc_* wrappers
> > in place and could just call your new helpers directly.
> > 
> 
> J. Bruce asked the same question, see:
> http://marc.info/?l=linux-nfs&m=137475685903460&w=2
> 

Not exactly...

He asked why you were keeping the wrappers and you replied that it was
because you didn't want to change all of the callers of rpc_get_port.
That's a fair enough answer to his question.

My question is a bit more fundamental: Why are you using this new union
in your patches instead of simply passing around "struct sockaddr"
pointers? If you did that, then you could simply replace all of the
rpc_* wrappers with your generic ones, since you wouldn't need to do
the cast to this (seemingly unnecessary) union.

FWIW, I too am happy to see these routines moved to common code. I just
wonder whether it might make more sense to use the existing convention
instead of this new union.

-- 
Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Jeff Layton <jlayton@redhat.com>
To: Cong Wang <amwang@redhat.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Trond Myklebust <Trond.Myklebust@netapp.com>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	linux-nfs@vger.kernel.org
Subject: Re: [Patch net-next v2 5/8] sunrpc: use generic union inet_addr
Date: Tue, 6 Aug 2013 06:28:01 -0400	[thread overview]
Message-ID: <20130806062801.67714276@tlielax.poochiereds.net> (raw)
In-Reply-To: <1375672445.32485.8.camel@cr0>

On Mon, 05 Aug 2013 11:14:05 +0800
Cong Wang <amwang@redhat.com> wrote:

> On Fri, 2013-08-02 at 09:36 -0400, Jeff Layton wrote:
> > On Fri,  2 Aug 2013 15:14:31 +0800
> > Cong Wang <amwang@redhat.com> wrote:
> > 
> > > From: Cong Wang <amwang@redhat.com>
> > > 
> > > sunrpc defines some helper functions for sockaddr, actually they
> > > can re-use the generic functions for union inet_addr too.
> > 
> > Only some of these patches in this series have made it to lists to
> > which I'm subscribed, so I may be missing some context here...
> > 
> > I'm not sure I really understand the value of "union inet_addr". Why
> > not just use the conventional method of passing around "struct sockaddr"
> > pointers, and then casting them to struct sockaddr_in/sockaddr_in6
> > depending on what the sa_family is set to?
> 
> Yes.
> 
> > 
> > With that you wouldn't need to leave the (now pointless) rpc_* wrappers
> > in place and could just call your new helpers directly.
> > 
> 
> J. Bruce asked the same question, see:
> http://marc.info/?l=linux-nfs&m=137475685903460&w=2
> 

Not exactly...

He asked why you were keeping the wrappers and you replied that it was
because you didn't want to change all of the callers of rpc_get_port.
That's a fair enough answer to his question.

My question is a bit more fundamental: Why are you using this new union
in your patches instead of simply passing around "struct sockaddr"
pointers? If you did that, then you could simply replace all of the
rpc_* wrappers with your generic ones, since you wouldn't need to do
the cast to this (seemingly unnecessary) union.

FWIW, I too am happy to see these routines moved to common code. I just
wonder whether it might make more sense to use the existing convention
instead of this new union.

-- 
Jeff Layton <jlayton@redhat.com>

  reply	other threads:[~2013-08-06 10:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02  7:14 [Patch net-next v2 0/8] net: introduce generic type and helpers for IP address Cong Wang
2013-08-02  7:14 ` [Patch net-next v2 1/8] net: introduce generic union inet_addr Cong Wang
2013-08-02 21:50   ` David Miller
2013-08-05  3:09     ` Cong Wang
2013-08-02  7:14 ` [Patch net-next v2 2/8] net: introduce generic simple_inet_pton() Cong Wang
2013-08-02  7:14 ` [Patch net-next v2 3/8] inetpeer: use generic struct in_addr_gen Cong Wang
2013-08-02  7:14 ` [Patch net-next v2 4/8] bridge: " Cong Wang
     [not found] ` <1375427674-21735-1-git-send-email-amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-08-02  7:14   ` [Patch net-next v2 5/8] sunrpc: use generic union inet_addr Cong Wang
2013-08-02  7:14     ` Cong Wang
2013-08-02 13:36     ` Jeff Layton
     [not found]       ` <20130802093625.2c70a330-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-08-05  3:14         ` Cong Wang
2013-08-05  3:14           ` Cong Wang
2013-08-06 10:28           ` Jeff Layton [this message]
2013-08-06 10:28             ` Jeff Layton
     [not found]             ` <20130806062801.67714276-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-08-07 12:27               ` Cong Wang
2013-08-07 12:27                 ` Cong Wang
2013-08-07 13:21                 ` Jeff Layton
     [not found]                   ` <20130807092123.451e93db-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-08-08  1:37                     ` Cong Wang
2013-08-08  1:37                       ` Cong Wang
2013-08-07 13:30                 ` Jim Rees
2013-08-07 13:30                   ` Jim Rees
2013-08-02  7:14 ` [Patch net-next v2 6/8] fs: use generic union inet_addr and helper functions Cong Wang
2013-08-02  7:14   ` [Cluster-devel] " Cong Wang
2013-08-02 10:31   ` Christoph Hellwig
2013-08-02 10:31     ` Christoph Hellwig
     [not found]     ` <20130802103107.GA17244-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2013-08-05  3:16       ` Cong Wang
2013-08-05  3:16         ` Cong Wang
2013-08-05  3:16         ` Cong Wang
2013-08-02  7:14 ` [Patch net-next v2 7/8] sctp: use generic union inet_addr Cong Wang
2013-08-02  7:14 ` [Patch net-next v2 8/8] selinux: " Cong Wang
2013-08-02 14:34   ` Paul Moore
2013-08-02 21:51     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130806062801.67714276@tlielax.poochiereds.net \
    --to=jlayton-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
    --cc=amwang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.