virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Asias He <asias@redhat.com>
To: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
	virtualization@lists.linux-foundation.org,
	target-devel@vger.kernel.org,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH V4 1/2] tcm_vhost: Introduce tcm_vhost_check_feature()
Date: Fri, 22 Mar 2013 13:39:04 +0800	[thread overview]
Message-ID: <1363930745-7520-2-git-send-email-asias@redhat.com> (raw)
In-Reply-To: <1363930745-7520-1-git-send-email-asias@redhat.com>

This helper is useful to check if a feature is supported.

Signed-off-by: Asias He <asias@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 drivers/vhost/tcm_vhost.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
index 0524267..d81e3a9 100644
--- a/drivers/vhost/tcm_vhost.c
+++ b/drivers/vhost/tcm_vhost.c
@@ -90,6 +90,18 @@ static int iov_num_pages(struct iovec *iov)
 	       ((unsigned long)iov->iov_base & PAGE_MASK)) >> PAGE_SHIFT;
 }
 
+static bool tcm_vhost_check_feature(struct vhost_scsi *vs, int feature)
+{
+	bool ret = false;
+
+	mutex_lock(&vs->dev.mutex);
+	if (vhost_has_feature(&vs->dev, feature))
+		ret = true;
+	mutex_unlock(&vs->dev.mutex);
+
+	return ret;
+}
+
 static bool tcm_vhost_check_endpoint(struct vhost_virtqueue *vq)
 {
 	bool ret = false;
-- 
1.8.1.4

  reply	other threads:[~2013-03-22  5:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22  5:39 [PATCH V4 0/2] tcm_vhost hotplug Asias He
2013-03-22  5:39 ` Asias He [this message]
2013-03-22  5:39 ` [PATCH V4 2/2] tcm_vhost: Add hotplug/hotunplug support Asias He
2013-03-24 15:20   ` Michael S. Tsirkin
     [not found]   ` <20130324152009.GB8657@redhat.com>
2013-03-25  7:48     ` Asias He
     [not found]     ` <20130325074806.GB20435@hj.localdomain>
2013-03-25 11:10       ` Michael S. Tsirkin
2013-03-26  2:56         ` Asias He
2013-03-26 20:46           ` Michael S. Tsirkin
2013-03-27  3:23             ` Asias He
2013-03-24 15:20 ` [PATCH V4 0/2] tcm_vhost hotplug Michael S. Tsirkin
2013-03-25  8:20   ` Asias He
2013-04-08 21:31 ` Nicholas A. Bellinger
2013-04-08 20:41   ` Michael S. Tsirkin
2013-04-09  0:57   ` Asias He
2013-04-08 21:36 ` Nicholas A. Bellinger

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=1363930745-7520-2-git-send-email-asias@redhat.com \
    --to=asias@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=target-devel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /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).