DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tetsuya Mukawa <mukawa@igel.co.jp>
To: Huawei Xie <huawei.xie@intel.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] test whether file descriptor is valid before close it
Date: Mon, 09 Mar 2015 11:23:15 +0900	[thread overview]
Message-ID: <54FD0413.9070804@igel.co.jp> (raw)
In-Reply-To: <1425639943-27157-1-git-send-email-huawei.xie@intel.com>

On 2015/03/06 20:05, Huawei Xie wrote:
> This avoids closing -1 in our case.
>
> Signed-off-by: Huawei Xie <huawei.xie@intel.com>
> ---
>  lib/librte_vhost/virtio-net.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
> index 6917fcf..4672e67 100644
> --- a/lib/librte_vhost/virtio-net.c
> +++ b/lib/librte_vhost/virtio-net.c
> @@ -185,13 +185,13 @@ cleanup_device(struct virtio_net *dev)
>  	}
>  
>  	/* Close any event notifiers opened by device. */
> -	if (dev->virtqueue[VIRTIO_RXQ]->callfd)
> +	if ((int)dev->virtqueue[VIRTIO_RXQ]->callfd >= 0)
>  		close((int)dev->virtqueue[VIRTIO_RXQ]->callfd);
> -	if (dev->virtqueue[VIRTIO_RXQ]->kickfd)
> +	if ((int)dev->virtqueue[VIRTIO_RXQ]->kickfd >= 0)
>  		close((int)dev->virtqueue[VIRTIO_RXQ]->kickfd);
> -	if (dev->virtqueue[VIRTIO_TXQ]->callfd)
> +	if ((int)dev->virtqueue[VIRTIO_TXQ]->callfd >= 0)
>  		close((int)dev->virtqueue[VIRTIO_TXQ]->callfd);
> -	if (dev->virtqueue[VIRTIO_TXQ]->kickfd)
> +	if ((int)dev->virtqueue[VIRTIO_TXQ]->kickfd >= 0)
>  		close((int)dev->virtqueue[VIRTIO_TXQ]->kickfd);
>  }
>  
Acked-by: Tetsuya Mukawa <mukawa@igel.co.jp>

  parent reply	other threads:[~2015-03-09  2:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06 10:39 [dpdk-dev] [PATCH] lib/librte_vhost: exchange kickfd and callfd to avoid confusion Huawei Xie
2015-03-06 11:05 ` [dpdk-dev] [PATCH] test whether file descriptor is valid before close it Huawei Xie
2015-03-09  1:32   ` Ouyang, Changchun
2015-03-09  8:34     ` Thomas Monjalon
2015-03-09  2:23   ` Tetsuya Mukawa [this message]
2015-03-09  1:28 ` [dpdk-dev] [PATCH] lib/librte_vhost: exchange kickfd and callfd to avoid confusion Ouyang, Changchun
2015-03-09  8:33   ` Thomas Monjalon
2015-03-09  2:23 ` Tetsuya Mukawa

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=54FD0413.9070804@igel.co.jp \
    --to=mukawa@igel.co.jp \
    --cc=dev@dpdk.org \
    --cc=huawei.xie@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).