* [PATCH 1/3] nvme-fabrics: rework nvmf_get_address() for variable options
@ 2016-07-29 0:00 James Smart
2016-07-29 8:53 ` Johannes Thumshirn
2016-08-01 11:19 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: James Smart @ 2016-07-29 0:00 UTC (permalink / raw)
To: linux-nvme, linux-scsi
Revise nvmf_get_address() string to account for not all options being
present.
Signed-off-by: James Smart <james.smart@broadcom.com>
---
drivers/nvme/host/fabrics.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index dc99676..2867b92 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -109,8 +109,16 @@ static void nvmf_host_put(struct nvmf_host *host)
*/
int nvmf_get_address(struct nvme_ctrl *ctrl, char *buf, int size)
{
- return snprintf(buf, size, "traddr=%s,trsvcid=%s\n",
- ctrl->opts->traddr, ctrl->opts->trsvcid);
+ int len = 0;
+
+ if (ctrl->opts->mask & NVMF_OPT_TRADDR)
+ len += snprintf(buf, size, "traddr=%s", ctrl->opts->traddr);
+ if (ctrl->opts->mask & NVMF_OPT_TRSVCID)
+ len += snprintf(buf + len, size - len, "%strsvcid=%s",
+ (len) ? "," : "", ctrl->opts->trsvcid);
+ len += snprintf(buf + len, size - len, "\n");
+
+ return len;
}
EXPORT_SYMBOL_GPL(nvmf_get_address);
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] nvme-fabrics: rework nvmf_get_address() for variable options
2016-07-29 0:00 [PATCH 1/3] nvme-fabrics: rework nvmf_get_address() for variable options James Smart
@ 2016-07-29 8:53 ` Johannes Thumshirn
2016-08-01 11:19 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2016-07-29 8:53 UTC (permalink / raw)
To: James Smart; +Cc: linux-nvme, linux-scsi
On Thu, Jul 28, 2016 at 05:00:25PM -0700, James Smart wrote:
>
> Revise nvmf_get_address() string to account for not all options being
> present.
>
> Signed-off-by: James Smart <james.smart@broadcom.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] nvme-fabrics: rework nvmf_get_address() for variable options
2016-07-29 0:00 [PATCH 1/3] nvme-fabrics: rework nvmf_get_address() for variable options James Smart
2016-07-29 8:53 ` Johannes Thumshirn
@ 2016-08-01 11:19 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2016-08-01 11:19 UTC (permalink / raw)
To: James Smart; +Cc: linux-nvme, linux-scsi
On Thu, Jul 28, 2016 at 05:00:25PM -0700, James Smart wrote:
>
> Revise nvmf_get_address() string to account for not all options being
> present.
>
> Signed-off-by: James Smart <james.smart@broadcom.com>
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-01 11:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-29 0:00 [PATCH 1/3] nvme-fabrics: rework nvmf_get_address() for variable options James Smart
2016-07-29 8:53 ` Johannes Thumshirn
2016-08-01 11:19 ` Christoph Hellwig
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).