[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080916165305.GL8702@ghostprotocols.net>
Date: Tue, 16 Sep 2008 13:53:05 -0300
From: Arnaldo Carvalho de Melo <acme@...hat.com>
To: Rémi Denis-Courmont
<remi.denis-courmont@...ia.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH 09/14] Phonet: allocate and initialize new sockets
Em Tue, Sep 16, 2008 at 06:08:09PM +0300, Rémi Denis-Courmont escreveu:
> Signed-off-by: Remi Denis-Courmont <remi.denis-courmont@...ia.com>
> ---
> include/net/phonet/phonet.h | 1 +
> net/phonet/af_phonet.c | 20 ++++++++++++++++++--
> 2 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
> index 8e7e42d..1131833 100644
> --- a/include/net/phonet/phonet.h
> +++ b/include/net/phonet/phonet.h
> @@ -81,6 +81,7 @@ void pn_skb_get_dst_sockaddr(struct sk_buff *skb, struct sockaddr_pn *sa)
>
> /* Protocols in Phonet protocol family. */
> struct phonet_protocol {
> + const struct proto_ops *ops;
> struct proto *prot;
> int sock_type;
> };
> diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
> index 317f30c..1628e7c 100644
> --- a/net/phonet/af_phonet.c
> +++ b/net/phonet/af_phonet.c
> @@ -41,6 +41,8 @@ static inline void phonet_proto_put(struct phonet_protocol *pp);
>
> static int pn_socket_create(struct net *net, struct socket *sock, int protocol)
> {
> + struct sock *sk;
> + struct pn_sock *pn;
> struct phonet_protocol *pnp;
> int err;
>
> @@ -71,8 +73,22 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol)
> goto out;
> }
>
> - /* TODO: create and init the struct sock */
> - err = -EPROTONOSUPPORT;
> + sk = sk_alloc(net, PF_PHONET, GFP_KERNEL, pnp->prot);
> + if (sk == NULL) {
> + err = -ENOMEM;
> + goto out;
> + }
> +
> + sock_init_data(sock, sk);
> + sock->state = SS_UNCONNECTED;
> + sock->ops = pnp->ops;
> + sk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
Scrap the comment I made in a previous patch, I guess
> + sk->sk_protocol = protocol;
> + pn = pn_sk(sk);
> + pn->sobject = 0;
> + pn->resource = 0;
> + sk->sk_prot->init(sk);
> + err = 0;
>
> out:
> phonet_proto_put(pnp);
> --
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists