From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org,
josef@toxicpanda.com, dsterba@suse.com
Subject: Re: [PATCH v9 1/3] btrfs: add btrfs_strmatch helper
Date: Tue, 27 Oct 2020 19:00:01 +0100 [thread overview]
Message-ID: <20201027180001.GE6756@twin.jikos.cz> (raw)
In-Reply-To: <d241d508-6c7e-1624-8f04-4c234bcd6c57@oracle.com>
On Tue, Oct 27, 2020 at 09:19:33PM +0800, Anand Jain wrote:
> >> + stripped = skip_spaces(given);
> >> +
> >> + /* strip trailing whitespace */
> >> + if ((strncmp(stripped, golden, len) == 0) &&
> >> + (strlen(skip_spaces(stripped + len)) == 0))
> >> + return 0;
> >
> > This a bit hard to read but ok, essentially we can do the string
> > comparison in a loop or use the library functions.
> >
>
> >> +
> >> + return -EINVAL;
> >
> > This does not make sense as it's an error code while the function is a
> > predicate, without error states.
> >
>
> A non zero value return will be some arbitrary number, is that OK?
> Or the return arg can be bool instead of int.
Bool is fine in this case.
next prev parent reply other threads:[~2020-10-27 18:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 7:43 [PATCH v9 0/3] readmirror feature (read_policy sysfs and in-memory only approach) Anand Jain
2020-10-22 7:43 ` [PATCH v9 1/3] btrfs: add btrfs_strmatch helper Anand Jain
2020-10-23 11:12 ` Christoph Hellwig
2020-10-27 13:25 ` Anand Jain
2020-10-26 17:52 ` David Sterba
2020-10-27 13:19 ` Anand Jain
2020-10-27 18:00 ` David Sterba [this message]
2020-10-22 7:43 ` [PATCH v9 2/3] btrfs: create read policy framework Anand Jain
2020-10-22 7:43 ` [PATCH v9 3/3] btrfs: create read policy sysfs attribute, pid Anand Jain
2020-10-26 17:57 ` David Sterba
2020-10-28 12:37 ` Anand Jain
2020-10-23 17:04 ` [PATCH v9 0/3] readmirror feature (read_policy sysfs and in-memory only approach) David Sterba
2020-10-27 1:52 ` Anand Jain
2020-10-27 18:02 ` David Sterba
2020-10-28 12:06 ` Anand Jain
2020-10-26 14:01 ` Josef Bacik
2020-10-28 4:25 ` [PATCH v10 " Anand Jain
2020-10-28 4:25 ` [PATCH v10 1/3] btrfs: add btrfs_strmatch helper Anand Jain
2020-10-28 4:25 ` [PATCH v10 2/3] btrfs: create read policy framework Anand Jain
2020-10-28 4:25 ` [PATCH v10 3/3] btrfs: create read policy sysfs attribute, pid Anand Jain
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=20201027180001.GE6756@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=anand.jain@oracle.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.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