linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH v2 2/4] nvme: add helper to compare options to controller
Date: Fri, 20 Oct 2017 16:17:07 -0700	[thread overview]
Message-ID: <20171020231709.3183-3-jsmart2021@gmail.com> (raw)
In-Reply-To: <20171020231709.3183-1-jsmart2021@gmail.com>

Adds a helper function that compares the host and subsytem
specified in a connect options list vs a controller.

Signed-off-by: James Smart <james.smart at broadcom.com>
---
 drivers/nvme/host/fabrics.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
index a7590cc59ba2..42232e731f19 100644
--- a/drivers/nvme/host/fabrics.h
+++ b/drivers/nvme/host/fabrics.h
@@ -133,6 +133,18 @@ struct nvmf_transport_ops {
 					struct nvmf_ctrl_options *opts);
 };
 
+static inline bool
+nvmf_ctlr_matches_baseopts(struct nvme_ctrl *ctrl,
+			struct nvmf_ctrl_options *opts)
+{
+	if (strcmp(opts->subsysnqn, ctrl->opts->subsysnqn) ||
+	    strcmp(opts->host->nqn, ctrl->opts->host->nqn) ||
+	    memcmp(&opts->host->id, &ctrl->opts->host->id, sizeof(uuid_t)))
+		return false;
+
+	return true;
+}
+
 int nvmf_reg_read32(struct nvme_ctrl *ctrl, u32 off, u32 *val);
 int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val);
 int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val);
-- 
2.13.1

  parent reply	other threads:[~2017-10-20 23:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 23:17 [PATCH v2 0/4] Add duplicate_connect option for ctlr connect requests James Smart
2017-10-20 23:17 ` [PATCH v2 1/4] nvme: add duplicate_connect option James Smart
2017-10-23  8:21   ` Johannes Thumshirn
2017-10-20 23:17 ` James Smart [this message]
2017-10-23  8:31   ` [PATCH v2 2/4] nvme: add helper to compare options to controller Johannes Thumshirn
2017-10-20 23:17 ` [PATCH v2 3/4] nvme_fc: add support for duplicate_connect option James Smart
2017-10-23  9:27   ` Johannes Thumshirn
2017-10-23  9:28   ` Johannes Thumshirn
2017-10-20 23:17 ` [PATCH v2 4/4] nvme-rdma: " James Smart
2017-10-23  9:30   ` Johannes Thumshirn

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=20171020231709.3183-3-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.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).