linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: "Li, Redhairer" <redhairer.li@intel.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH] daxctl: Change region input type from INTEGER to STRING.
Date: Tue, 3 Dec 2019 18:42:42 -0800	[thread overview]
Message-ID: <CAPcyv4jTS+JcmH=Oe3Js0dw+Ovu+P6yBKHDZp8xxUT6Rbhpaqw@mail.gmail.com> (raw)
In-Reply-To: <2369E669066F8E42A79A3DF0E43B9E643AC9EB31@pgsmsx114.gar.corp.intel.com>

Nice! You got mail working!

On Tue, Dec 3, 2019 at 6:33 PM Li, Redhairer <redhairer.li@intel.com> wrote:
>
> Allow daxctl to accept both <region-id>, and region name as region parameter.
> For example:
>
>     daxctl list -r region5
>     daxctl list -r 5
>
> Link: https://github.com/pmem/ndctl/issues/109
> Signed-off-by: Redhairer Li <redhairer.li@intel.com>
> ---
>  daxctl/device.c | 11 ++++-------
>  daxctl/list.c   | 14 ++++++--------
>  util/filter.c   | 16 ++++++++++++++++
>  util/filter.h   |  2 ++
>  4 files changed, 28 insertions(+), 15 deletions(-)
>
> diff --git a/daxctl/device.c b/daxctl/device.c
> index 72e506e..d9db2f9 100644
> --- a/daxctl/device.c
> +++ b/daxctl/device.c
> @@ -19,15 +19,13 @@
>  static struct {
>         const char *dev;
>         const char *mode;
> -       int region_id;
> +       const char *region;
>         bool no_online;
>         bool no_movable;
>         bool force;
>         bool human;
>         bool verbose;
> -} param = {
> -       .region_id = -1,
> -};
> +} param;
>
>  enum dev_mode {
>         DAXCTL_DEV_MODE_UNKNOWN,
> @@ -51,7 +49,7 @@ enum device_action {
>  };
>
>  #define BASE_OPTIONS() \
> -OPT_INTEGER('r', "region", &param.region_id, "restrict to the given region"), \
> +OPT_STRING('r', "region", &param.region, "region-id", "filter by region"), \
>  OPT_BOOLEAN('u', "human", &param.human, "use human friendly number formats"), \
>  OPT_BOOLEAN('v', "verbose", &param.verbose, "emit more debug messages")
>
> @@ -484,8 +482,7 @@ static int do_xaction_device(const char *device, enum device_action action,
>         *processed = 0;
>
>         daxctl_region_foreach(ctx, region) {
> -               if (param.region_id >= 0 && param.region_id
> -                               != daxctl_region_get_id(region))
> +               if (!util_daxctl_region_filter(region, device))
>                         continue;

There's a bug here, can you spot it?

This causes:

     make TESTS=daxctl-devices.sh check

...to fail.
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

  reply	other threads:[~2019-12-04  2:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04  2:33 [PATCH] daxctl: Change region input type from INTEGER to STRING Li, Redhairer
2019-12-04  2:42 ` Dan Williams [this message]
2019-12-25 10:33   ` Li, Redhairer
2019-12-25 21:18     ` Dan Williams
2019-12-26  1:48       ` Li, Redhairer
2019-12-26  2:22         ` Li, Redhairer
2019-12-26  4:01           ` Li, Redhairer
2019-12-26 17:54             ` Dan Williams
2019-12-29  7:54               ` Li, Redhairer
2019-12-30  6:02                 ` Dan Williams
2020-01-01 13:36                   ` Li, Redhairer
2019-12-26 17:48           ` Dan Williams
2019-12-28  3:08             ` Li, Redhairer

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='CAPcyv4jTS+JcmH=Oe3Js0dw+Ovu+P6yBKHDZp8xxUT6Rbhpaqw@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=redhairer.li@intel.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).