Linux-NVDIMM Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>
Cc: "Zloch, Jacek" <jacek.zloch@intel.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH v2] ndctl: add an api for getting the ars_status overflow flag
Date: Wed, 6 Jun 2018 19:53:59 +0000	[thread overview]
Message-ID: <1528314837.5328.24.camel@intel.com> (raw)
In-Reply-To: <CAPcyv4iQs8wdSLbCWFisacBYX7TWYy5tLQDqChHwi6qD1hvF6g@mail.gmail.com>

On Wed, 2018-06-06 at 12:51 -0700, Dan Williams wrote:
> On Wed, Jun 6, 2018 at 11:26 AM, Vishal Verma <vishal.l.verma@intel.com>
> wrote:
> > The ARS status command defines a 'flags' field that wasn't being
> > exposed
> > via an API yet. Since there is only one flag defined in ACPI 6.2, add a
> > helper for retrieving it (overflow flag).
> > 
> > Reported-by: Jacek Zloch <jacek.zloch@intel.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> > ---
> >  ndctl/lib/ars.c        | 11 +++++++++++
> >  ndctl/lib/libndctl.sym |  1 +
> >  ndctl/libndctl.h       |  4 ++++
> >  3 files changed, 16 insertions(+)
> > 
> > v2: instead of exposing the binary representation of flags, provide a
> > helper for each flag. ACPI currently defines a single 'overflow' flag.
> > (Dan)
> > 
> > diff --git a/ndctl/lib/ars.c b/ndctl/lib/ars.c
> > index e04b51e..b765c88 100644
> > --- a/ndctl/lib/ars.c
> > +++ b/ndctl/lib/ars.c
> > @@ -269,6 +269,17 @@ NDCTL_EXPORT unsigned long long
> > ndctl_cmd_ars_get_record_len(
> >         return ars_stat->ars_status->records[rec_index].length;
> >  }
> > 
> > +NDCTL_EXPORT int ndctl_cmd_ars_stat_get_flag_overflow(
> > +               struct ndctl_cmd *ars_stat)
> > +{
> > +       struct ndctl_ctx *ctx =
> > ndctl_bus_get_ctx(cmd_to_bus(ars_stat));
> > +
> > +       if (!validate_ars_stat(ctx, ars_stat))
> > +               return -EINVAL;
> > +
> > +       return (ars_stat->ars_status->flags &
> > ND_ARS_STAT_FLAG_OVERFLOW);
> > +}
> 
> How about return bool since it's a flag?

I considered it, but int allows us to return an error for an invalid status
command. If we use a bool, should we just return 'false' for a bad command?
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2018-06-06 19:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06 18:26 [ndctl PATCH v2] ndctl: add an api for getting the ars_status overflow flag Vishal Verma
2018-06-06 19:51 ` Dan Williams
2018-06-06 19:53   ` Verma, Vishal L [this message]
2018-06-06 20:00     ` Dan Williams
2018-06-06 20:11       ` Verma, Vishal L

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=1528314837.5328.24.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=jacek.zloch@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /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