From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 2/6] nvme: read the subsystem NQN from Identify Controller
Date: Fri, 16 Jun 2017 10:53:51 +0200 [thread overview]
Message-ID: <20170616085351.GA11261@lst.de> (raw)
In-Reply-To: <560367a8-34c8-7cda-c6b4-b5b59569590d@suse.de>
On Fri, Jun 16, 2017@10:42:34AM +0200, Johannes Thumshirn wrote:
> On 06/15/2017 06:34 PM, Christoph Hellwig wrote:
> > + /* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */
> > + snprintf(ctrl->subnqn, NVMF_NQN_SIZE,
> > + "nqn.2014.08.org.nvmexpress:%4x%4x",
> > + le16_to_cpu(id->vid), le16_to_cpu(id->ssvid));
> > + memcpy(ctrl->subnqn + 35, id->sn, sizeof(id->sn));
> > + memcpy(ctrl->subnqn + 55, id->mn, sizeof(id->mn));
> > + memset(ctrl->subnqn + 95, 0, sizeof(ctrl->subnqn) - 95);
>
> Is there a chance we can do this with a bit less magic values? We can
> calculate all of the offsets.
>
> Something like:
>
> off = snprintf(ctrl->subnqn, NVMF_NQN_SIZE,
> "nqn.2014.08.org.nvmexpress:%4x%4x",
> le16_to_cpu(id->vid), le16_to_cpu(id->ssvid));
> memcpy(ctrl->subnqn + off, id->sn, sizeof(id->sn));
> off += sizeof(id->sn);
> memcpy(ctrl->subnqn + off, id->mn, sizeof(id->mn));
> off += sizeof(id->mn);
> memset(ctrl->subnqn + off, 0, sizeof(ctrl->subnqn) - off);
Not really much more readable, but if there is a preference for this
version I can do it.
next prev parent reply other threads:[~2017-06-16 8:53 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-15 16:34 track subsystem relationships and shared namespaces Christoph Hellwig
2017-06-15 16:34 ` [PATCH 1/6] nvme: remove an misleading comment on strut nvme_ns Christoph Hellwig
2017-06-15 16:51 ` Sagi Grimberg
2017-06-16 8:29 ` Johannes Thumshirn
2017-06-15 16:34 ` [PATCH 2/6] nvme: read the subsystem NQN from Identify Controller Christoph Hellwig
2017-06-15 16:54 ` Sagi Grimberg
2017-06-16 8:42 ` Johannes Thumshirn
2017-06-16 8:53 ` Christoph Hellwig [this message]
2017-06-18 8:03 ` Sagi Grimberg
2017-06-15 16:34 ` [PATCH 3/6] nvme: simplify nvme_dev_attrs_are_visible Christoph Hellwig
2017-06-15 16:55 ` Sagi Grimberg
2017-06-16 8:44 ` Johannes Thumshirn
2017-06-15 16:35 ` [PATCH 4/6] nvme-fabrics: verify that a controller returns the correct NQN Christoph Hellwig
2017-06-15 16:55 ` Sagi Grimberg
2017-06-16 8:47 ` Johannes Thumshirn
2017-06-15 16:35 ` [PATCH 5/6] nvme: track subsystems Christoph Hellwig
2017-06-15 17:04 ` Sagi Grimberg
2017-06-16 6:21 ` Christoph Hellwig
2017-06-15 16:35 ` [PATCH 6/6] nvme: track shared namespaces in a siblings list Christoph Hellwig
2017-06-15 16:49 ` Sagi Grimberg
2017-06-16 6:20 ` Christoph Hellwig
2017-06-18 8:17 ` Sagi Grimberg
-- strict thread matches above, loose matches on Subject: below --
2017-06-19 9:57 track subsystem relationships and shared namespaces V2 Christoph Hellwig
2017-06-19 9:57 ` [PATCH 2/6] nvme: read the subsystem NQN from Identify Controller Christoph Hellwig
2017-06-19 11:44 ` Johannes Thumshirn
2017-06-19 16:50 ` Keith Busch
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=20170616085351.GA11261@lst.de \
--to=hch@lst.de \
/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