From: NeilBrown <neilb@suse.com>
To: Jes Sorensen <jes.sorensen@gmail.com>, Shaohua Li <shli@kernel.org>
Cc: linux-raid@vger.kernel.org
Subject: Re: GET_ARRAY_INFO assumptions?
Date: Fri, 21 Apr 2017 07:49:31 +1000 [thread overview]
Message-ID: <87k26esqac.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <59ca76c6-1f1f-4d9c-4eb9-d468131e0d55@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]
On Thu, Apr 20 2017, Jes Sorensen wrote:
>
> I think I got it right this time and pushed it into git. It made things
> a lot prettier too IMHO :)
>
> In the process I also changed the behavior of
> sysfs_read(GET_ARRAY_STATE) as I really didn't like how it was copying
> in the string rather than parsing it.
>
> I am traveling at the moment and don't yet have my new raid test box
> setup back at the office, so my testing is limited. If I broke something
> badly, feel free to throw rotten tomatoes at me.
>
> Cheers,
> Jes
Looks good to me, except...
/*
* Beware map_name() uses strcmp() so active-idle must come before
* active, to be detected correctly.
*/
???
If map_name() used strncmp() you might need to be careful, but not with
strcmp.
Also:
int map_name(mapping_t *map, char *name)
{
while (map->name) {
if (strcmp(map->name, name)==0)
return map->num;
map++;
}
return map->num;
}
Both returns do the same thing... so there should (could) just be one.
is:
while (map->name && strcmp(map->name, name) != 0)
map++;
return map->num;
too terse??
I do like that you could use map_name to parse the array_state file.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-04-20 21:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-13 17:50 GET_ARRAY_INFO assumptions? Jes Sorensen
2017-04-13 20:37 ` Shaohua Li
2017-04-13 21:06 ` Jes Sorensen
2017-04-14 15:48 ` Jes Sorensen
2017-04-17 23:48 ` NeilBrown
2017-04-18 16:28 ` Jes Sorensen
2017-04-20 16:05 ` Jes Sorensen
2017-04-20 21:49 ` NeilBrown [this message]
2017-04-21 16:13 ` Jes Sorensen
2017-04-21 14:06 ` Tomasz Majchrzak
2017-04-21 16:08 ` Jes Sorensen
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=87k26esqac.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=jes.sorensen@gmail.com \
--cc=linux-raid@vger.kernel.org \
--cc=shli@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;
as well as URLs for NNTP newsgroup(s).