From: Asias He Subject: [PATCH V2 3/6] tcm_vhost: Introduce tcm_vhost_check_endpoint() Date: Fri, 8 Mar 2013 10:21:44 +0800 Message-ID: <1362709307-12554-4-git-send-email-asias@redhat.com> References: <1362709307-12554-1-git-send-email-asias@redhat.com> Cc: Paolo Bonzini , Stefan Hajnoczi , "Michael S. Tsirkin" , Rusty Russell , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, target-devel@vger.kernel.org, Asias He To: Nicholas Bellinger Return-path: Received: from mx1.redhat.com ([209.132.183.28]:61719 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933069Ab3CHCWU (ORCPT ); Thu, 7 Mar 2013 21:22:20 -0500 In-Reply-To: <1362709307-12554-1-git-send-email-asias@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This helper is useful to check if vs->vs_endpoint is setup by vhost_scsi_set_endpoint() Signed-off-by: Asias He --- 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 39654f4..b71e946 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c @@ -103,6 +103,18 @@ static bool tcm_vhost_check_feature(struct vhost_scsi *vs, int feature) return ret; } +static bool tcm_vhost_check_endpoint(struct vhost_scsi *vs) +{ + bool ret = false; + + mutex_lock(&vs->dev.mutex); + if (vs->vs_endpoint) + ret = true; + mutex_unlock(&vs->dev.mutex); + + return ret; +} + static int tcm_vhost_check_true(struct se_portal_group *se_tpg) { return 1; -- 1.8.1.4