I was unsure exactly how to fix this. It seems that the 'x' formatter for
printf will not accept a u64. 'u' will print it, but then it won't be in
hex format. I tried printing it as a __64 thinking that somehow the typedef
from __64 to 64 might be confusing the compiler, but that did not seem to
help. Since inittype.h is already imported I decided to simply cast the
variables before printing them.

To resolve the last warning I ensured we were not passing a pointer to the
u64 and I allowed scanf to read the value in as an unsigned long long int.

fcnsq.c: In function 'gpn_id':
fcnsq.c:230:2: error: format '%llx' expects argument of type 'long long 
unsigned int', but argument 3 has type 'u64' [-Werror=format]
fcnsq.c: In function 'gnn_id':
fcnsq.c:251:2: error: format '%llx' expects argument of type 'long long 
unsigned int', but argument 3 has type 'u64' [-Werror=format]
fcnsq.c: In function 'main':
fcnsq.c:405:4: error: format '%llx' expects argument of type 'long long 
unsigned int *', but argument 3 has type 'u64 *' [-Werror=format]
cc1: all warnings being treated as errors
make[1]: *** [fcnsq.o] Error 1
make[1]: Leaving directory ...
dh_auto_build: make -j1 returned exit code 2
make: *** [build-arch] Error 2

Signed-off-by: Robert Love <[email protected]>
---
 fcnsq.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fcnsq.c b/fcnsq.c
index 7b45a32..08687eb 100644
--- a/fcnsq.c
+++ b/fcnsq.c
@@ -33,6 +33,7 @@
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <linux/types.h>
+#include <inttypes.h>
 typedef __u8 u8;
 typedef __u16 u16;
 typedef __u32 u32;
@@ -228,7 +229,7 @@ static int gpn_id(int bsg, u32 fcid)
        rjt = gn_id(bsg, fcid, FC_NS_GPN_ID, &wwpn);
        if (rjt)
                goto fail;
-       print_result("Port Name", "%16.16llx\n", wwpn);
+       print_result("Port Name", "%16.16" PRIx64 "\n", (u_int64_t)wwpn);
        return 0;
 fail:
        if (rjt == (u16) ~0)
@@ -249,7 +250,7 @@ static int gnn_id(int bsg, u32 fcid)
        rjt = gn_id(bsg, fcid, FC_NS_GNN_ID, &wwnn);
        if (rjt)
                goto fail;
-       print_result("Node Name", "%16.16llx\n", wwnn);
+       print_result("Node Name", "%16.16" PRIx64 "\n", (u_int64_t)wwnn);
        return 0;
 fail:
        if (rjt == (u16) ~0)
@@ -405,7 +406,7 @@ int main(int argc, char *argv[])
                        if (cmd)
                                help(-1);
                        cmd = c;
-                       sscanf(optarg, "%llx", &wwnn);
+                       sscanf(optarg, "%" PRIx64, (u_int64_t *)&wwnn);
                        break;
                }
        }

_______________________________________________
fcoe-devel mailing list
[email protected]
http://lists.open-fcoe.org/mailman/listinfo/fcoe-devel

Reply via email to