diff mbox

[v2,1/4] ndctl: update dimm flag names

Message ID 20150909230126.4976.59652.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Superseded
Headers show

Commit Message

Dan Williams Sept. 9, 2015, 11:01 p.m. UTC
It is important for the flag names to be explicit about their polarity
as feedback to a firmware implementer to get the polarity correct.
Update to keep in sync with the kernel rename.

Cc: Robert Elliott <elliott@hp.com>
Cc: Linda Knippers <linda.knippers@hp.com>
Cc: Toshi Kani <toshi.kani@hp.com>
[toshi: fix up flag prints in check_dimms() as well]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 lib/libndctl.c      |   10 +++++-----
 lib/test-libndctl.c |   24 ++++++++++++------------
 2 files changed, 17 insertions(+), 17 deletions(-)

Comments

Kani, Toshi Sept. 10, 2015, 12:19 a.m. UTC | #1
On Wed, 2015-09-09 at 19:01 -0400, Dan Williams wrote:
> It is important for the flag names to be explicit about their polarity
> as feedback to a firmware implementer to get the polarity correct.
> Update to keep in sync with the kernel rename.
> 
> Cc: Robert Elliott <elliott@hp.com>
> Cc: Linda Knippers <linda.knippers@hp.com>
> Cc: Toshi Kani <toshi.kani@hp.com>
> [toshi: fix up flag prints in check_dimms() as well]
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  lib/libndctl.c      |   10 +++++-----
>  lib/test-libndctl.c |   24 ++++++++++++------------
>  2 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/lib/libndctl.c b/lib/libndctl.c
> index d08cf0812f50..d85453a3ac63 100644
> --- a/lib/libndctl.c
> +++ b/lib/libndctl.c
> @@ -839,15 +839,15 @@ static void parse_nfit_mem_flags(struct ndctl_dimm *dimm, char *flags)
>  	start = flags;
>  	while ((end = strchr(start, ' '))) {
>  		*end = '\0';
> -		if (strcmp(start, "arm") == 0)
> +		if (strcmp(start, "not_armed") == 0)
>  			dimm->f_arm = 1;
> -		else if (strcmp(start, "save") == 0)
> +		else if (strcmp(start, "save_fail") == 0)
>  			dimm->f_save = 1;
> -		else if (strcmp(start, "flush") == 0)
> +		else if (strcmp(start, "flush_fail") == 0)
>  			dimm->f_flush = 1;
> -		else if (strcmp(start, "smart") == 0)
> +		else if (strcmp(start, "smart_event") == 0)
>  			dimm->f_smart = 1;
> -		else if (strcmp(start, "restore") == 0)
> +		else if (strcmp(start, "restore_fail") == 0)
>  			dimm->f_restore = 1;
>  		start = end + 1;
>  	}
> diff --git a/lib/test-libndctl.c b/lib/test-libndctl.c
> index c2e7bc7b4ff4..d70fb3734d1f 100644
> --- a/lib/test-libndctl.c
> +++ b/lib/test-libndctl.c
> @@ -1471,8 +1471,8 @@ static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n,
>  		if (ndctl_dimm_has_errors(dimm) != !!dimms[i].flags) {
>  			fprintf(stderr, "bus: %s dimm%d %s expected%s errors\n",
>  					ndctl_bus_get_provider(bus), i,
> -					dimms[i].flags ? "" : " no",
> -					ndctl_dimm_get_devname(dimm));
> +					ndctl_dimm_get_devname(dimm),
> +					dimms[i].flags ? "" : " no");
>  			return -ENXIO;
>  		}
>  
> @@ -1482,16 +1482,16 @@ static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n,
>  				|| ndctl_dimm_smart_pending(dimm) != dimms[i].f_smart
>  				|| ndctl_dimm_failed_flush(dimm) != dimms[i].f_flush) {
>  			fprintf(stderr, "expected: %s%s%s%s%sgot: %s%s%s%s%s\n",
> -					dimms[i].f_save ? "save " : "",
> -					dimms[i].f_arm ? "arm " : "",
> -					dimms[i].f_restore ? "restore " : "",
> -					dimms[i].f_smart ? "smart " : "",
> -					dimms[i].f_flush ? "flush " : "",
> -					ndctl_dimm_failed_save(dimm) ? "save " : "",
> -					ndctl_dimm_failed_arm(dimm) ? "arm " : "",
> -					ndctl_dimm_failed_restore(dimm) ? "restore " : "",
> -					ndctl_dimm_smart_pending(dimm) ? "smart " : "",
> -					ndctl_dimm_failed_flush(dimm) ? "flush " : "");
> +					dimms[i].f_save ? "save_fail " : "",
> +					dimms[i].f_arm ? "arm_fail " : "",

s/arm_fail/not_armed

> +					dimms[i].f_restore ? "restore_fail " : "",
> +					dimms[i].f_smart ? "smart_event " : "",
> +					dimms[i].f_flush ? "flush_fail " : "",
> +					ndctl_dimm_failed_save(dimm) ? "save_fail " : "",
> +					ndctl_dimm_failed_arm(dimm) ? "arm_fail " : "",

Ditto.

With the update:

Reviewed-by: Toshi Kani <toshi.kani@hpe.com>

Thanks!
-Toshi
Dan Williams Sept. 10, 2015, 12:23 a.m. UTC | #2
On Wed, Sep 9, 2015 at 5:19 PM, Toshi Kani <toshi.kani@hpe.com> wrote:
> On Wed, 2015-09-09 at 19:01 -0400, Dan Williams wrote:
>> It is important for the flag names to be explicit about their polarity
>> as feedback to a firmware implementer to get the polarity correct.
>> Update to keep in sync with the kernel rename.
>>
>> Cc: Robert Elliott <elliott@hp.com>
>> Cc: Linda Knippers <linda.knippers@hp.com>
>> Cc: Toshi Kani <toshi.kani@hp.com>
>> [toshi: fix up flag prints in check_dimms() as well]
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> ---
>>  lib/libndctl.c      |   10 +++++-----
>>  lib/test-libndctl.c |   24 ++++++++++++------------
>>  2 files changed, 17 insertions(+), 17 deletions(-)
>>
>> diff --git a/lib/libndctl.c b/lib/libndctl.c
>> index d08cf0812f50..d85453a3ac63 100644
>> --- a/lib/libndctl.c
>> +++ b/lib/libndctl.c
>> @@ -839,15 +839,15 @@ static void parse_nfit_mem_flags(struct ndctl_dimm *dimm, char *flags)
>>       start = flags;
>>       while ((end = strchr(start, ' '))) {
>>               *end = '\0';
>> -             if (strcmp(start, "arm") == 0)
>> +             if (strcmp(start, "not_armed") == 0)
>>                       dimm->f_arm = 1;
>> -             else if (strcmp(start, "save") == 0)
>> +             else if (strcmp(start, "save_fail") == 0)
>>                       dimm->f_save = 1;
>> -             else if (strcmp(start, "flush") == 0)
>> +             else if (strcmp(start, "flush_fail") == 0)
>>                       dimm->f_flush = 1;
>> -             else if (strcmp(start, "smart") == 0)
>> +             else if (strcmp(start, "smart_event") == 0)
>>                       dimm->f_smart = 1;
>> -             else if (strcmp(start, "restore") == 0)
>> +             else if (strcmp(start, "restore_fail") == 0)
>>                       dimm->f_restore = 1;
>>               start = end + 1;
>>       }
>> diff --git a/lib/test-libndctl.c b/lib/test-libndctl.c
>> index c2e7bc7b4ff4..d70fb3734d1f 100644
>> --- a/lib/test-libndctl.c
>> +++ b/lib/test-libndctl.c
>> @@ -1471,8 +1471,8 @@ static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n,
>>               if (ndctl_dimm_has_errors(dimm) != !!dimms[i].flags) {
>>                       fprintf(stderr, "bus: %s dimm%d %s expected%s errors\n",
>>                                       ndctl_bus_get_provider(bus), i,
>> -                                     dimms[i].flags ? "" : " no",
>> -                                     ndctl_dimm_get_devname(dimm));
>> +                                     ndctl_dimm_get_devname(dimm),
>> +                                     dimms[i].flags ? "" : " no");
>>                       return -ENXIO;
>>               }
>>
>> @@ -1482,16 +1482,16 @@ static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n,
>>                               || ndctl_dimm_smart_pending(dimm) != dimms[i].f_smart
>>                               || ndctl_dimm_failed_flush(dimm) != dimms[i].f_flush) {
>>                       fprintf(stderr, "expected: %s%s%s%s%sgot: %s%s%s%s%s\n",
>> -                                     dimms[i].f_save ? "save " : "",
>> -                                     dimms[i].f_arm ? "arm " : "",
>> -                                     dimms[i].f_restore ? "restore " : "",
>> -                                     dimms[i].f_smart ? "smart " : "",
>> -                                     dimms[i].f_flush ? "flush " : "",
>> -                                     ndctl_dimm_failed_save(dimm) ? "save " : "",
>> -                                     ndctl_dimm_failed_arm(dimm) ? "arm " : "",
>> -                                     ndctl_dimm_failed_restore(dimm) ? "restore " : "",
>> -                                     ndctl_dimm_smart_pending(dimm) ? "smart " : "",
>> -                                     ndctl_dimm_failed_flush(dimm) ? "flush " : "");
>> +                                     dimms[i].f_save ? "save_fail " : "",
>> +                                     dimms[i].f_arm ? "arm_fail " : "",
>
> s/arm_fail/not_armed
>
>> +                                     dimms[i].f_restore ? "restore_fail " : "",
>> +                                     dimms[i].f_smart ? "smart_event " : "",
>> +                                     dimms[i].f_flush ? "flush_fail " : "",
>> +                                     ndctl_dimm_failed_save(dimm) ? "save_fail " : "",
>> +                                     ndctl_dimm_failed_arm(dimm) ? "arm_fail " : "",
>
> Ditto.
>
> With the update:
>
> Reviewed-by: Toshi Kani <toshi.kani@hpe.com>
>

Done, thanks.
diff mbox

Patch

diff --git a/lib/libndctl.c b/lib/libndctl.c
index d08cf0812f50..d85453a3ac63 100644
--- a/lib/libndctl.c
+++ b/lib/libndctl.c
@@ -839,15 +839,15 @@  static void parse_nfit_mem_flags(struct ndctl_dimm *dimm, char *flags)
 	start = flags;
 	while ((end = strchr(start, ' '))) {
 		*end = '\0';
-		if (strcmp(start, "arm") == 0)
+		if (strcmp(start, "not_armed") == 0)
 			dimm->f_arm = 1;
-		else if (strcmp(start, "save") == 0)
+		else if (strcmp(start, "save_fail") == 0)
 			dimm->f_save = 1;
-		else if (strcmp(start, "flush") == 0)
+		else if (strcmp(start, "flush_fail") == 0)
 			dimm->f_flush = 1;
-		else if (strcmp(start, "smart") == 0)
+		else if (strcmp(start, "smart_event") == 0)
 			dimm->f_smart = 1;
-		else if (strcmp(start, "restore") == 0)
+		else if (strcmp(start, "restore_fail") == 0)
 			dimm->f_restore = 1;
 		start = end + 1;
 	}
diff --git a/lib/test-libndctl.c b/lib/test-libndctl.c
index c2e7bc7b4ff4..d70fb3734d1f 100644
--- a/lib/test-libndctl.c
+++ b/lib/test-libndctl.c
@@ -1471,8 +1471,8 @@  static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n,
 		if (ndctl_dimm_has_errors(dimm) != !!dimms[i].flags) {
 			fprintf(stderr, "bus: %s dimm%d %s expected%s errors\n",
 					ndctl_bus_get_provider(bus), i,
-					dimms[i].flags ? "" : " no",
-					ndctl_dimm_get_devname(dimm));
+					ndctl_dimm_get_devname(dimm),
+					dimms[i].flags ? "" : " no");
 			return -ENXIO;
 		}
 
@@ -1482,16 +1482,16 @@  static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n,
 				|| ndctl_dimm_smart_pending(dimm) != dimms[i].f_smart
 				|| ndctl_dimm_failed_flush(dimm) != dimms[i].f_flush) {
 			fprintf(stderr, "expected: %s%s%s%s%sgot: %s%s%s%s%s\n",
-					dimms[i].f_save ? "save " : "",
-					dimms[i].f_arm ? "arm " : "",
-					dimms[i].f_restore ? "restore " : "",
-					dimms[i].f_smart ? "smart " : "",
-					dimms[i].f_flush ? "flush " : "",
-					ndctl_dimm_failed_save(dimm) ? "save " : "",
-					ndctl_dimm_failed_arm(dimm) ? "arm " : "",
-					ndctl_dimm_failed_restore(dimm) ? "restore " : "",
-					ndctl_dimm_smart_pending(dimm) ? "smart " : "",
-					ndctl_dimm_failed_flush(dimm) ? "flush " : "");
+					dimms[i].f_save ? "save_fail " : "",
+					dimms[i].f_arm ? "arm_fail " : "",
+					dimms[i].f_restore ? "restore_fail " : "",
+					dimms[i].f_smart ? "smart_event " : "",
+					dimms[i].f_flush ? "flush_fail " : "",
+					ndctl_dimm_failed_save(dimm) ? "save_fail " : "",
+					ndctl_dimm_failed_arm(dimm) ? "arm_fail " : "",
+					ndctl_dimm_failed_restore(dimm) ? "restore_fail " : "",
+					ndctl_dimm_smart_pending(dimm) ? "smart_event " : "",
+					ndctl_dimm_failed_flush(dimm) ? "flush_fail " : "");
 			return -ENXIO;
 		}