[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1706211326110.12819@sstabellini-ThinkPad-X260>
Date: Wed, 21 Jun 2017 13:26:23 -0700 (PDT)
From: Stefano Stabellini <sstabellini@...nel.org>
To: Boris Ostrovsky <boris.ostrovsky@...cle.com>
cc: Stefano Stabellini <sstabellini@...nel.org>,
xen-devel@...ts.xen.org, linux-kernel@...r.kernel.org,
jgross@...e.com, Stefano Stabellini <stefano@...reto.com>
Subject: Re: [PATCH v4 08/18] xen/pvcalls: implement connect command
On Tue, 20 Jun 2017, Boris Ostrovsky wrote:
> >> +
> >> static int pvcalls_back_connect(struct xenbus_device *dev,
> >> struct xen_pvcalls_request *req)
> >> {
> >> + struct pvcalls_fedata *fedata;
> >> + int ret = -EINVAL;
> >> + struct socket *sock;
> >> + struct sock_mapping *map;
> >> + struct xen_pvcalls_response *rsp;
> >> +
> >> + fedata = dev_get_drvdata(&dev->dev);
> >> +
> >> + ret = sock_create(AF_INET, SOCK_STREAM, 0, &sock);
> >> + if (ret < 0)
> >> + goto out;
> >> + ret = inet_stream_connect(sock, (struct sockaddr *)&req->u.connect.addr,
> >> + req->u.connect.len, req->u.connect.flags);
> >> + if (ret < 0) {
> >> + sock_release(sock);
> >> + goto out;
> >> + }
> >> +
> >> + map = pvcalls_new_active_socket(fedata,
> >> + req->u.connect.id,
> >> + req->u.connect.ref,
> >> + req->u.connect.evtchn,
> >> + sock);
> >> + if (!map) {
> >> + sock_release(map->sock);
> >> + goto out;
> > Unnecessary goto.
>
> Oh, and also ret needs to be set since it will be cleared by
> inet_stream_connect().
Right, thanks!
> >
> >> + }
> >> +
> >> +out:
> >> + rsp = RING_GET_RESPONSE(&fedata->ring, fedata->ring.rsp_prod_pvt++);
> >> + rsp->req_id = req->req_id;
> >> + rsp->cmd = req->cmd;
> >> + rsp->u.connect.id = req->u.connect.id;
> >> + rsp->ret = ret;
> >> +
> >> + return ret;
> >
>
Powered by blists - more mailing lists