Re: [PATCH 07/10] super-intel: refactor the code for enum

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

 



On 14/09/2022 17:03, Coly Li wrote:
> 
> 
>> 2022年8月18日 22:56,Mateusz Kusiak <mateusz.kusiak@xxxxxxxxx> 写道:
>>
>> It prepares super-intel for change context->update to enum.
>>
>> Signed-off-by: Mateusz Kusiak <mateusz.kusiak@xxxxxxxxx>
>> ---
>> super-intel.c | 38 +++++++++++++++++++++++++-------------
>> 1 file changed, 25 insertions(+), 13 deletions(-)
>>
>> diff --git a/super-intel.c b/super-intel.c
>> index 672f946e..3de3873e 100644
>> --- a/super-intel.c
>> +++ b/super-intel.c
>> @@ -3930,7 +3930,8 @@ static int update_super_imsm(struct supertype *st, struct mdinfo *info,
>>
>> 	mpb = super->anchor;
>>
>> -	if (strcmp(update, "uuid") == 0) {
>> +	switch (map_name(update_options, update)) {
>> +	case UOPT_UUID:
>> 		/* We take this to mean that the family_num should be updated.
>> 		 * However that is much smaller than the uuid so we cannot really
>> 		 * allow an explicit uuid to be given.  And it is hard to reliably
>> @@ -3954,10 +3955,14 @@ static int update_super_imsm(struct supertype *st, struct mdinfo *info,
>> 		}
>> 		if (rv == 0)
>> 			mpb->orig_family_num = info->uuid[0];
>> -	} else if (strcmp(update, "assemble") == 0)
>> +		break;
>> +	case UOPT_SPEC_ASSEMBLE:
>> 		rv = 0;
>> -	else
>> +		break;
>> +	default:
>> 		rv = -1;
>> +		break;
>> +	}
>>
>> 	/* successful update? recompute checksum */
>> 	if (rv == 0)
>> @@ -7888,18 +7893,25 @@ static int kill_subarray_imsm(struct supertype *st, char *subarray_id)
>>
>> 	return 0;
>> }
>> -
>> -static int get_rwh_policy_from_update(char *update)
>> +/**
>> + * get_rwh_policy_from_update() - Get the rwh policy for update option.
>> + * @update: Update option.
>> + */
> 
> 
> The above comment format is not the existed code comments style.
> 
> For example for getinfo_super_disks_imsm() in same file,
> 
>  3862 /* allocates memory and fills disk in mdinfo structure
>  3863  * for each disk in array */
>  3864 struct mdinfo *getinfo_super_disks_imsm(struct supertype *st)
> 
I believe it matches kernel style descriptions, like in
imsm_get_free_size(). I can add "Return" part if you want me to.

I just noticed that empty line is missing before the function
description, I'll fix this in v2.
> 
> [snipped]
> 
> The rested part is fine to me.
> 
> Thanks.
> 
> Coly Li



[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