Whamcloud - gitweb
LU-12513 utils: change cy_valueint to 64 bits 23/35423/4
authorJames Simmons <jsimmons@infradead.org>
Sat, 6 Jul 2019 22:51:40 +0000 (18:51 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 17 Jul 2019 06:21:52 +0000 (06:21 +0000)
While testing the lustre YAML implementation with netlink I found
that it didn't support 64 bit integer values. Change cy_valueint
to a long long.

Test-Parameter: trivial

Change-Id: I1746a4907a83e7c5733a0681a66e7f4a54a4c392
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/35423
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
lnet/include/cyaml.h
lnet/utils/lnetconfig/cyaml.c

index 1537dbd..c624f62 100644 (file)
@@ -27,6 +27,7 @@
 #ifndef CYAML_H
 #define CYAML_H
 
+#include <inttypes.h>
 #include <stdbool.h>
 
 enum cYAML_object_type {
@@ -51,7 +52,7 @@ struct cYAML {
        /* The item's string, if type==CYAML_TYPE_STRING */
        char *cy_valuestring;
        /* The item's number, if type==CYAML_TYPE_NUMBER */
-       int cy_valueint;
+       int64_t cy_valueint;
        /* The item's number, if type==CYAML_TYPE_NUMBER */
        double cy_valuedouble;
        /* The item's name string, if this item is the child of,
index 71b3f49..ae5205f 100644 (file)
@@ -801,7 +801,7 @@ static inline void print_simple(FILE *f, struct cYAML *node,
        if (cpi->array_first_elem)
                fprintf(f, "%*s- ", INDENT * level, "");
 
-       fprintf(f, "%*s""%s: %d\n", (cpi->array_first_elem) ? 0 :
+       fprintf(f, "%*s""%s: %" PRId64 "\n", (cpi->array_first_elem) ? 0 :
                INDENT * level + ind, "", node->cy_string,
                node->cy_valueint);
 }
@@ -852,7 +852,7 @@ static void print_number(FILE *f, struct cYAML *node,
 
        if ((fabs(((double)node->cy_valueint) - d) <= DBL_EPSILON) &&
            (d <= INT_MAX) && (d >= INT_MIN))
-               fprintf(f, "%*s""%s: %d\n", (cpi->array_first_elem) ? 0 :
+               fprintf(f, "%*s""%s: %" PRId64 "\n", (cpi->array_first_elem) ? 0 :
                        INDENT * level + ind, "",
                        node->cy_string, node->cy_valueint);
        else {