Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1670895

Re: [PATCH v4 08/18] xen/pvcalls: implement connect command

From Boris Ostrovsky <boris.ostrovsky@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 08/18] xen/pvcalls: implement connect command
Date 2017-06-20 17:50 +0200
Message-ID <tUtzJ-238-37@gated-at.bofh.it> (permalink)
References <tSIjv-6s6-3@gated-at.bofh.it> <tSItb-6vK-3@gated-at.bofh.it> <tSItb-6vK-11@gated-at.bofh.it> <tUtzI-238-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


>> +
>>  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().

-boris


>
>> +	}
>> +
>> +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;
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v4 08/18] xen/pvcalls: implement connect command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-06-20 17:50 +0200
  Re: [PATCH v4 08/18] xen/pvcalls: implement connect command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-06-20 17:50 +0200
    Re: [PATCH v4 08/18] xen/pvcalls: implement connect command Stefano Stabellini <sstabellini@kernel.org> - 2017-06-21 22:30 +0200
  Re: [PATCH v4 08/18] xen/pvcalls: implement connect command Stefano Stabellini <sstabellini@kernel.org> - 2017-06-21 22:30 +0200

csiph-web