From: "Chengjike (ISSP)" <chengjike.cheng@huawei.com>
To: <kbusch@kernel.org>, <linux-nvme@lists.infradead.org>
Cc: <sunao.sun@huawei.com>, <jiangtao62@huawei.com>
Subject: Re: [PATCH nvme-cli] huawei: filter out the partition disks
Date: Mon, 18 Oct 2021 11:49:26 +0800 [thread overview]
Message-ID: <ce1f1493-201d-41b0-c370-cc43dbe74223@huawei.com> (raw)
In-Reply-To: <20211014091130.2083-1-chengjike.cheng@huawei.com>
ping
在 2021/10/14 17:11, chengjike 写道:
> When using "nvme huawei list" command, if the current disk has partitions,
> disk partitions will be displayed. This is not expected!
> So filter out the disk partitions through disk name.
>
> Signed-off-by: chengjike <chengjike.cheng@huawei.com>
> ---
> plugins/huawei/huawei-nvme.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/plugins/huawei/huawei-nvme.c b/plugins/huawei/huawei-nvme.c
> index 679578f..96de335 100644
> --- a/plugins/huawei/huawei-nvme.c
> +++ b/plugins/huawei/huawei-nvme.c
> @@ -296,6 +296,8 @@ static int huawei_list(int argc, char **argv, struct command *command,
> unsigned int i, n, fd, ret;
> unsigned int huawei_num = 0;
> int fmt;
> + int ctrl, ns, part;
> +
> const char *desc = "Retrieve basic information for the given huawei device";
> struct config {
> char *output_format;
> @@ -326,6 +328,8 @@ static int huawei_list(int argc, char **argv, struct command *command,
> }
>
> for (i = 0; i < n; i++) {
> + if (sscanf(devices[i]->d_name, "nvme%dn%dp%d", &ctrl, &ns, &part) == 3)
> + continue;
> snprintf(path, sizeof(path), "/dev/%s", devices[i]->d_name);
> fd = open(path, O_RDONLY);
> ret = huawei_get_nvme_info(fd, &list_items[huawei_num], path);
next prev parent reply other threads:[~2021-10-18 3:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-14 9:11 [PATCH nvme-cli] huawei: filter out the partition disks chengjike
2021-10-18 3:49 ` Chengjike (ISSP) [this message]
2021-10-18 5:30 ` Chaitanya Kulkarni
2021-10-18 7:06 ` Chengjike (ISSP)
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=ce1f1493-201d-41b0-c370-cc43dbe74223@huawei.com \
--to=chengjike.cheng@huawei.com \
--cc=jiangtao62@huawei.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sunao.sun@huawei.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