From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH nvme-cli v1 1/2] nvme-cli: Add nvme hostnqn generation option
Date: Wed, 16 Nov 2016 18:11:12 +0100 [thread overview]
Message-ID: <20161116171112.GC5005@lst.de> (raw)
In-Reply-To: <1478602108-29571-2-git-send-email-sagi@grimberg.me>
On Tue, Nov 08, 2016@12:48:27PM +0200, Sagi Grimberg wrote:
> Add option to generate a NVMe qualified name of a given host
> (in the form of: nqn.2014-08.org.nvmexpress:NVMf:uuid:<some_uuid>).
> This hostnqn will be used for fabrics discovery and connect functions.
Keith - should we have any special prefixes for nvme-cli commands
that don't map to NVMe commands?
> +static int gen_hostnqn_cmd(int argc, char **argv, struct command *command, struct plugin *plugin)
> +{
> + char hostnqn[NVMF_NQN_SIZE];
> + uuid_t uuid;
> + char uuid_str[37]; /* e.g. 1b4e28ba-2fa1-11d2-883f-0016d3cca427 + \0 */
> +
> + uuid_generate_random(uuid);
> + uuid_unparse_lower(uuid, uuid_str);
> + sprintf(hostnqn, "nqn.2014-08.org.nvmexpress:NVMf:uuid:%s", uuid_str);
> + printf("%s\n", hostnqn);
Shouldn't the sprintf and printf get merged into one? No need for the
local variable here. That would also take care of the snprintf nitpick
from Jay ;-)
next prev parent reply other threads:[~2016-11-16 17:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-08 10:48 [PATCH nvme-cli v1 0/2] auto generate hostnqn file on installation Sagi Grimberg
2016-11-08 10:48 ` [PATCH nvme-cli v1 1/2] nvme-cli: Add nvme hostnqn generation option Sagi Grimberg
2016-11-08 17:36 ` J Freyensee
2016-11-16 17:11 ` Christoph Hellwig [this message]
2016-11-08 10:48 ` [PATCH nvme-cli v1 2/2] nvme.spec/debian: Auto generate host nqn as part of install Sagi Grimberg
2016-11-08 17:41 ` J Freyensee
2016-11-14 14:58 ` Gabriel Krisman Bertazi
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=20161116171112.GC5005@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;
as well as URLs for NNTP newsgroup(s).