RE: [ndctl PATCH] libndctl: fix 'type-pun' warnings with hpe1 commands

2016-10-13 Thread Boylston, Brian
Dan Williams wrote on 2016-10-13:
> On Wed, Oct 12, 2016 at 1:40 PM, Dan Williams  
> wrote:
>> Fix warnings of the form:
>> 
>> libndctl-hpe1.c: In function 'hpe1_smart_valid':
>> libndctl-hpe1.c:78:15: warning: dereferencing type-punned pointer will
>> break strict-aliasing rules [-Wstrict-aliasing]
>> CMD_HPE1(cmd)->gen.nd_family != NVDIMM_FAMILY_HPE1 ||
>> ^
>> libndctl-hpe1.c:79:15: warning: dereferencing type-punned pointer will
>> break strict-aliasing rules [-Wstrict-aliasing]
>> CMD_HPE1(cmd)->gen.nd_command != NDN_HPE1_CMD_SMART ||
>> ^
>> libndctl-hpe1.c: In function 'hpe1_cmd_smart_get_flags':
>> libndctl-hpe1.c:93:55: warning: dereferencing type-punned pointer will
>> break strict-aliasing rules [-Wstrict-aliasing]
>> libndctl-hpe1.c:93:55: warning: dereferencing type-punned pointer will
>> break strict-aliasing rules [-Wstrict-aliasing]
>> libndctl-hpe1.c: In function 'hpe1_cmd_smart_get_health':
>> libndctl-hpe1.c:121:56: warning: dereferencing type-punned pointer will
>> break strict-aliasing rules [-Wstrict-aliasing]
>> libndctl-hpe1.c:121:56: warning: dereferencing type-punned pointer will
>> break strict-aliasing rules [-Wstrict-aliasing]
>> ...for distributions that include "-Wstrict-aliasing" in CFLAGS.
>> 
>> Cc: Brian Boylston 
>> Signed-off-by: Dan Williams 
> 
> Brian, it occurs to me that I do not have unit test coverage for hpe1
> command functionality.  Can you confirm that this patch does not break
> anything?

Yes!  I actually tested this earlier today using the pending branch,
and it seems to work fine:

# ndctl --version
54.44.g4a4c09e
# ndctl list -D -i -H
[
  {
"dev":"nmem1",
"id":"802c-0f-1612-122f8182",
"state":"disabled",
"health":{
  "health_state":"fatal",
  "temperature_celsius":25.00,
  "spares_percentage":99,
  "alarm_temperature":false,
  "alarm_spares":false,
  "temperature_threshold":50.00,
  "spares_threshold":20,
  "life_used_percentage":29,
  "shutdown_state":"dirty"
}
  },
  {
"dev":"nmem3",
"id":"802c-0f-1612-122f81da",
"state":"disabled",
"health":{
  "health_state":"ok",
  "temperature_celsius":25.00,
  "spares_percentage":99,
  "alarm_temperature":false,
  "alarm_spares":false,
  "temperature_threshold":50.00,
  "spares_threshold":20,
  "life_used_percentage":29,
  "shutdown_state":"clean"
}
  },
...

nmem1 here has an injected error.

> 
> For extra credit, I wouldn't say no if you instrumented the kernel's
> nfit_test infrastructure to provide sample hpe1 data payload results.

Sure, when I get a chance, I'll take a look.


Thanks!
Brian

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [ndctl PATCH] libndctl: fix 'type-pun' warnings with hpe1 commands

2016-10-13 Thread Dan Williams
On Wed, Oct 12, 2016 at 1:40 PM, Dan Williams  wrote:
> Fix warnings of the form:
>
> libndctl-hpe1.c: In function 'hpe1_smart_valid':
> libndctl-hpe1.c:78:15: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
> CMD_HPE1(cmd)->gen.nd_family != NVDIMM_FAMILY_HPE1 ||
> ^
> libndctl-hpe1.c:79:15: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
> CMD_HPE1(cmd)->gen.nd_command != NDN_HPE1_CMD_SMART ||
> ^
> libndctl-hpe1.c: In function 'hpe1_cmd_smart_get_flags':
> libndctl-hpe1.c:93:55: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
> libndctl-hpe1.c:93:55: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
> libndctl-hpe1.c: In function 'hpe1_cmd_smart_get_health':
> libndctl-hpe1.c:121:56: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
> libndctl-hpe1.c:121:56: warning: dereferencing type-punned pointer will
> break strict-aliasing rules [-Wstrict-aliasing]
>
> ...for distributions that include "-Wstrict-aliasing" in CFLAGS.
>
> Cc: Brian Boylston 
> Signed-off-by: Dan Williams 

Brian, it occurs to me that I do not have unit test coverage for hpe1
command functionality.  Can you confirm that this patch does not break
anything?

For extra credit, I wouldn't say no if you instrumented the kernel's
nfit_test infrastructure to provide sample hpe1 data payload results.
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm