[dm-devel] [PATCH V2 1/5] multipathd: adopt static char* arr in daemon_status

Zhiqiang Liu liuzhiqiang26 at huawei.com
Sat Aug 22 04:31:40 UTC 2020


On 2020/8/21 21:42, Martin Wilck wrote:
> On Fri, 2020-08-21 at 18:58 +0800, Zhiqiang Liu wrote:
>> We adopt static char* array (demon_status_msg) in daemon_status func,
>> so it looks more simpler and easier to expand.
>>
>> V1->V2:
>> - use "int" as the type of "status" (suggested by Martin)
>>
>> Signed-off-by: Zhiqiang Liu <liuzhiqiang26 at huawei.com>
>> Signed-off-by: lixiaokeng <lixiaokeng at huawei.com>
>> ---
>>  multipathd/main.c | 30 +++++++++++++++---------------
>>  multipathd/main.h |  3 ++-
>>  2 files changed, 17 insertions(+), 16 deletions(-)
>>
>> diff --git a/multipathd/main.c b/multipathd/main.c
>> index 9ec65856..62cf4ff4 100644
>> --- a/multipathd/main.c
>> +++ b/multipathd/main.c
>> diff --git a/multipathd/main.h b/multipathd/main.h
>> index 5dff17e5..6a5592c0 100644
>> --- a/multipathd/main.h
>> +++ b/multipathd/main.h
>> @@ -4,12 +4,13 @@
>>  #define MAPGCINT 5
>>
>>  enum daemon_status {
>> -	DAEMON_INIT,
>> +	DAEMON_INIT = 0,
>>  	DAEMON_START,
>>  	DAEMON_CONFIGURE,
>>  	DAEMON_IDLE,
>>  	DAEMON_RUNNING,
>>  	DAEMON_SHUTDOWN,
>> +	DAEMON_STATUS_SIZE,
>>  };
> 
> This breaks compilation:
> 
> main.c: In function ‘sd_notify_status’:
> main.c:184:2: error: enumeration value ‘DAEMON_STATUS_SIZE’ not handled
> in switch [-Werror=switch]
>   switch (state) {
>   ^~~~~~
> 
> Please avoid introducing DAEMON_STATUS_SIZE.
> 
> This would be fixed by your patch 2 because it removes the switch
> statement, but no patch in a series should break compilation, to 
> allow future bisections.
> 
> I have to withdraw my "Reviewed-by: for the time being, sorry.

> Martin

Thanks for your reply.
I think we should keep DAEMON_STATUS_SIZE for boundary check.
For solving the problem, we can add default case in switch(state)
in sd_notify_status func.

I will send the v3 patch series.

Regards
Zhiqiang Liu
> 
> 
>>
>>  struct prout_param_descriptor;
> 
> 
> 
> .
> 





More information about the dm-devel mailing list