All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: NVDIMM-ML <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH 2/5] make interface to check device/nfit/dsm_mask flags
Date: Wed, 30 Aug 2017 20:25:33 -0700	[thread overview]
Message-ID: <CAPcyv4iW=xaF5oT07fMo24J-kZ0zcA4L7N-NJ7p6n7WDz8yzgQ@mail.gmail.com> (raw)
In-Reply-To: <20170831102503.DA33.E1E9C6FF@jp.fujitsu.com>

On Wed, Aug 30, 2017 at 6:25 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>
> To check what feature can be called via ND_CMD_CALL, ndctl need to read
> device/nfit/dsm_mask. This patch make an interface to check it in libndctl.c
>
>
> Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
>
> ---
>  ndctl/lib/libndctl.c   | 13 +++++++++++++
>  ndctl/lib/libndctl.sym |  1 +
>  ndctl/libndctl.h.in    |  1 +
>  3 files changed, 15 insertions(+)
>
> diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
> index c2e0efb..803056d 100644
> --- a/ndctl/lib/libndctl.c
> +++ b/ndctl/lib/libndctl.c
> @@ -102,6 +102,7 @@ struct ndctl_bus {
>         size_t buf_len;
>         char *wait_probe_path;
>         unsigned long dsm_mask;
> +       unsigned long passthru_dsm_mask;
>  };
>
>  /**
> @@ -846,6 +847,12 @@ static void *add_bus(void *parent, int id, const char *ctl_base)
>                 bus->revision = strtoul(buf, NULL, 0);
>         }
>
> +       sprintf(path, "%s/device/nfit/dsm_mask", ctl_base);
> +       if (sysfs_read_attr(ctx, path, buf) < 0)
> +               bus->passthru_dsm_mask = 0;
> +       else
> +               bus->passthru_dsm_mask = strtoul(buf, NULL, 16);

Let's keep the base 0 and 16 like the other calls to strtoul in this file.

> +
>         sprintf(path, "%s/device/provider", ctl_base);
>         if (sysfs_read_attr(ctx, path, buf) < 0)
>                 goto err_read;
> @@ -1101,6 +1108,12 @@ NDCTL_EXPORT int ndctl_bus_is_cmd_supported(struct ndctl_bus *bus,
>         return !!(bus->dsm_mask & (1ULL << cmd));
>  }
>
> +NDCTL_EXPORT int ndctl_bus_is_passthru_cmd_supported(struct ndctl_bus *bus,
> +               int cmd)

I realize that I said to call this "passthru" before, but thinking
about it further these commands are truly nfit specific. The command
numbers that ndctl_bus_is_cmd_supported() reports could theoretically
be emulated by the kernel for other bus types, but these are truly
nfit specific. For example, another bus type could theoretically reuse
the same command numbers for other operations and
ndctl_bus_is_passthru_cmd_supported() would not be able to tell the
difference.

Let's add a new source file called ndctl/lib/nfit.c for these nfit
specifc commands and add a:

    ndctl_bus_is_nfit_cmd_supported()

...that can operate on nfit command numbers directly. We can later
decide to wrap that in a generic front-end if some future nvdimm bus
arrives with similar functionality.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-08-31  3:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31  1:21 [ndctl PATCH v3 0/5] show broken dimm info with translate SPA feature Yasunori Goto
2017-08-31  1:23 ` [ndctl PATCH 1/5] Introduce libndctl-nfit.h Yasunori Goto
2017-08-31  2:56   ` Dan Williams
2017-08-31  1:25 ` [ndctl PATCH 2/5] make interface to check device/nfit/dsm_mask flags Yasunori Goto
2017-08-31  3:25   ` Dan Williams [this message]
2017-08-31  1:26 ` [ndctl PATCH 3/5] allow ND_CMD_CALL for bus Yasunori Goto
2017-08-31  1:29 ` [ndctl PATCH 4/5] Make interfaces to use Translate SPA Yasunori Goto
2017-08-31  4:32   ` Dan Williams
2017-08-31  1:30 ` [ndctl PATCH 5/5] show bad dimm's name by ndctl list command Yasunori Goto

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='CAPcyv4iW=xaF5oT07fMo24J-kZ0zcA4L7N-NJ7p6n7WDz8yzgQ@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=y-goto@jp.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.