From: Dave Jiang <dave.jiang@intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH v5 3/4] ndctl: convert region actions to use util_filter_walk()
Date: Fri, 11 May 2018 12:52:31 -0700 [thread overview]
Message-ID: <d457381b-0f3e-ab5d-309d-4a18063b7fd5@intel.com> (raw)
In-Reply-To: <CAPcyv4g4oXgjPz=wiYpnOd725vPbyfAZT1LOmaxJ_A989bNUNw@mail.gmail.com>
On 05/09/2018 04:26 PM, Dan Williams wrote:
> On Wed, May 9, 2018 at 4:24 PM, Dave Jiang <dave.jiang@intel.com> wrote:
>>
>>
>> On 05/09/2018 04:23 PM, Dan Williams wrote:
>>> On Wed, May 9, 2018 at 4:17 PM, Verma, Vishal L
>>> <vishal.l.verma@intel.com> wrote:
>>>> On Fri, 2018-04-27 at 15:08 -0700, Dave Jiang wrote:
>>>>> util_filter_walk() does the looping through of busses and regions.
>>>>> Removing
>>>>> duplicate code in region ops and provide filter functions so we can
>>>>> utilize util_filter_walk() and share common code.
>>>>>
>>>>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>>>>> ---
>>>>> ndctl/region.c | 59 ++++++++++++++++++++++++++++++++++--------------
>>>>> --------
>>>>> util/filter.h | 6 ++++++
>>>>> 2 files changed, 42 insertions(+), 23 deletions(-)
>>>>>
>>>>> diff --git a/ndctl/region.c b/ndctl/region.c
>>>>> index 9fc90808..9fd07af6 100644
>>>>> --- a/ndctl/region.c
>>>>> +++ b/ndctl/region.c
>>>>> @@ -19,10 +19,7 @@
>>>>> #include <util/parse-options.h>
>>>>> #include <ndctl/libndctl.h>
>>>>>
>>>>> -static struct {
>>>>> - const char *bus;
>>>>> - const char *type;
>>>>> -} param;
>>>>> +struct util_filter_params param;
>>>>>
>>>>> static const struct option region_options[] = {
>>>>> OPT_STRING('b', "bus", ¶m.bus, "bus-id",
>>>>> @@ -92,33 +89,49 @@ static int region_action(struct ndctl_region *region,
>>>>> enum device_action mode)
>>>>> return 0;
>>>>> }
>>>>>
>>>>> +static bool filter_bus(struct ndctl_bus *bus, struct util_filter_ctx
>>>>> *ctx)
>>>>> +{
>>>>> + return true;
>>>>> +}
>>>>> +
>>>>
>>>> Instead of creating these trivial functions everywhere (also applies to
>>>> namespaces.c, dimm.c), should we just leave fctx.bus_filter NULL. And fix
>>>> util_filter_walk to check for fctx->ptr != NULL any time it calls one of
>>>> the functions..
>>>
>>> I think I'd prefer a common nop routine. That way individual are
>>> forced to decide to use the nop or implement something. Leaving it
>>> NULL may just be a programming mistake. I.e. it's harder to get wrong
>>> if it's required.
>>>
>>
>> I'll add a common nop routine.
>
> ...but wait why would it be a nop in this case. Region action commands
> take a --bus= option?
>
It just passes through by return true because it doesn't do anything to
do the bus? The util_bus_filter() call before it filters appropriate bus
right?
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
next prev parent reply other threads:[~2018-05-11 19:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-27 22:08 [PATCH v5 0/4] ndctl: convert actions to use util_filter_walk Dave Jiang
2018-04-27 22:08 ` [PATCH v5 1/4] ndctl: convert namespace actions to use util_filter_params Dave Jiang
2018-04-27 22:08 ` [PATCH v5 2/4] ndctl: convert namespace actions to use util_filter_walk() Dave Jiang
2018-05-09 22:47 ` Verma, Vishal L
2018-05-09 22:49 ` Dave Jiang
2018-04-27 22:08 ` [PATCH v5 3/4] ndctl: convert region " Dave Jiang
2018-05-09 23:17 ` Verma, Vishal L
2018-05-09 23:23 ` Dan Williams
2018-05-09 23:24 ` Dave Jiang
2018-05-09 23:26 ` Dan Williams
2018-05-09 23:41 ` Verma, Vishal L
2018-05-11 19:52 ` Dave Jiang [this message]
2018-05-11 20:17 ` Dan Williams
2018-04-27 22:08 ` [PATCH v5 4/4] ndctl: convert dimm " Dave Jiang
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=d457381b-0f3e-ab5d-309d-4a18063b7fd5@intel.com \
--to=dave.jiang@intel.com \
--cc=dan.j.williams@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;
as well as URLs for NNTP newsgroup(s).