Re: GET_ARRAY_INFO assumptions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux