Patchwork [1/6] Phonet: transport protocol auto-loading

login
register
mail settings
Submitter Rémi Denis-Courmont
Date Oct. 1, 2008, 10:13 a.m.
Message ID <1222855985-22859-1-git-send-email-remi.denis-courmont@nokia.com>
Download mbox | patch
Permalink /patch/2223/
State Superseded
Delegated to: David Miller
Headers show

Comments

Rémi Denis-Courmont - Oct. 1, 2008, 10:13 a.m.
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
---
 net/phonet/af_phonet.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
Arnaldo Carvalho de Melo - Oct. 1, 2008, 12:45 p.m.
Em Wed, Oct 01, 2008 at 01:13:00PM +0300, Remi Denis-Courmont escreveu:
> Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
> ---
>  net/phonet/af_phonet.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
> index 1d8df6b..06627d3 100644
> --- a/net/phonet/af_phonet.c
> +++ b/net/phonet/af_phonet.c
> @@ -64,6 +64,11 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol)
>  	}
>  
>  	pnp = phonet_proto_get(protocol);
> +#ifdef CONFIG_KMOD
> +	if (pnp == NULL
> +	 && request_module("net-pf-%d-proto-%d", PF_PHONET, protocol) == 0)

&& at the end of previous line, please.

I wonder if we shouldn't have:

net_pf_request_module(PF_PHONET, protocol)

[acme@doppio linux-2.6]$ grep "net-pf-%d-proto-%d" net/*/*.c
net/ipv4/af_inet.c: request_module("net-pf-%d-proto-%d-type-%d",
net/ipv4/af_inet.c: request_module("net-pf-%d-proto-%d",
net/ipv4/inet_diag.c: request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
net/ipv6/af_inet6.c: request_module("net-pf-%d-proto-%d-type-%d",
net/ipv6/af_inet6.c: request_module("net-pf-%d-proto-%d",
net/netlink/af_netlink.c: request_module("net-pf-%d-proto-%d", PF_NETLINK, protocol);
[acme@doppio linux-2.6]$

Nah, perhaps not...


> +		pnp = phonet_proto_get(protocol);
> +#endif
>  	if (pnp == NULL)
>  		return -EPROTONOSUPPORT;
>  	if (sock->type != pnp->sock_type) {
> -- 
> 1.5.4.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marcel Holtmann - Oct. 1, 2008, 3:01 p.m.
Hi,

> > Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
> > ---
> >  net/phonet/af_phonet.c |    5 +++++
> >  1 files changed, 5 insertions(+), 0 deletions(-)
> > 
> > diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
> > index 1d8df6b..06627d3 100644
> > --- a/net/phonet/af_phonet.c
> > +++ b/net/phonet/af_phonet.c
> > @@ -64,6 +64,11 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol)
> >  	}
> >  
> >  	pnp = phonet_proto_get(protocol);
> > +#ifdef CONFIG_KMOD
> > +	if (pnp == NULL
> > +	 && request_module("net-pf-%d-proto-%d", PF_PHONET, protocol) == 0)
> 
> && at the end of previous line, please.
> 
> I wonder if we shouldn't have:
> 
> net_pf_request_module(PF_PHONET, protocol)
> 
> [acme@doppio linux-2.6]$ grep "net-pf-%d-proto-%d" net/*/*.c
> net/ipv4/af_inet.c: request_module("net-pf-%d-proto-%d-type-%d",
> net/ipv4/af_inet.c: request_module("net-pf-%d-proto-%d",
> net/ipv4/inet_diag.c: request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
> net/ipv6/af_inet6.c: request_module("net-pf-%d-proto-%d-type-%d",
> net/ipv6/af_inet6.c: request_module("net-pf-%d-proto-%d",
> net/netlink/af_netlink.c: request_module("net-pf-%d-proto-%d", PF_NETLINK, protocol);
> [acme@doppio linux-2.6]$
> 
> Nah, perhaps not...

maybe it is not such a bad idea. Every protocol seems to have its own
code in it. I am using this:

#if defined(CONFIG_KMOD)
        if (!bt_proto[proto]) {
                request_module("bt-proto-%d", proto);
        }
#endif

Regards

Marcel


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rémi Denis-Courmont - Oct. 3, 2008, 1:49 p.m.
On Wednesday 01 October 2008 15:45:43 ext Arnaldo Carvalho de Melo, you wrote:
> I wonder if we shouldn't have:
>
> net_pf_request_module(PF_PHONET, protocol)
>
> [acme@doppio linux-2.6]$ grep "net-pf-%d-proto-%d" net/*/*.c
> net/ipv4/af_inet.c: request_module("net-pf-%d-proto-%d-type-%d",
> net/ipv4/af_inet.c: request_module("net-pf-%d-proto-%d",
> net/ipv4/inet_diag.c: request_module("net-pf-%d-proto-%d-type-%d",
> PF_NETLINK, net/ipv6/af_inet6.c:
> request_module("net-pf-%d-proto-%d-type-%d",
> net/ipv6/af_inet6.c: request_module("net-pf-%d-proto-%d",
> net/netlink/af_netlink.c: request_module("net-pf-%d-proto-%d", PF_NETLINK,
> protocol);
> [acme@doppio linux-2.6]$ 
>
> Nah, perhaps not...

Looking at it, I could not find a "vrequest_module", which seems to preclude a 
functional implementation?? Not sure if a macro makes much sense here.

Patch

diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
index 1d8df6b..06627d3 100644
--- a/net/phonet/af_phonet.c
+++ b/net/phonet/af_phonet.c
@@ -64,6 +64,11 @@  static int pn_socket_create(struct net *net, struct socket *sock, int protocol)
 	}
 
 	pnp = phonet_proto_get(protocol);
+#ifdef CONFIG_KMOD
+	if (pnp == NULL
+	 && request_module("net-pf-%d-proto-%d", PF_PHONET, protocol) == 0)
+		pnp = phonet_proto_get(protocol);
+#endif
 	if (pnp == NULL)
 		return -EPROTONOSUPPORT;
 	if (sock->type != pnp->sock_type) {