Patchwork [Open-FCoE,3/7] Fix integer formatting

login
register
mail settings
Submitter Hannes Reinecke
Date Dec. 6, 2013, 11:51 a.m.
Message ID <1386330717-15616-4-git-send-email-hare@suse.de>
Download mbox | patch
Permalink /patch/133/
State Accepted
Headers show

Comments

Hannes Reinecke - Dec. 6, 2013, 11:51 a.m.
Properly use inttypes when printing 64bit values.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 fcoeadm_display.c |  4 ++--
 fcoemon.c         |  2 +-
 fcping.c          | 11 ++++++-----
 3 files changed, 9 insertions(+), 8 deletions(-)

Patch

diff --git a/fcoeadm_display.c b/fcoeadm_display.c
index 287e370..9b96aa7 100644
--- a/fcoeadm_display.c
+++ b/fcoeadm_display.c
@@ -1417,8 +1417,8 @@  static void print_fcoe_fcf_device(void *ep, UNUSED void *arg)
 	if (!buf)
 		buf = temp;
 	printf("        Connection Mode:  %s\n", buf);
-	printf("        Fabric Name:      0x%016lx\n", fcf->fabric_name);
-	printf("        Switch Name       0x%016lx\n", fcf->switch_name);
+	printf("        Fabric Name:      0x%016" PRIx64 "\n", fcf->fabric_name);
+	printf("        Switch Name       0x%016" PRIx64 "\n", fcf->switch_name);
 	mac2str(fcf->mac, mac, MAX_STR_LEN);
 	printf("        MAC Address:      %s\n", mac);
 	printf("        FCF Priority:     %u\n", fcf->priority);
diff --git a/fcoemon.c b/fcoemon.c
index a5babfa..be4c74d 100644
--- a/fcoemon.c
+++ b/fcoemon.c
@@ -2637,7 +2637,7 @@  static void fcm_dcbd_get_oper(struct fcm_netif *ff, char *resp, char *cp)
 
 	if (ep) {
 		FCM_LOG_DEV(ff, "Invalid get oper response "
-			    "parse error byte %ld, resp %s", ep - cp, cp);
+			    "parse error byte %td, resp %s", ep - cp, cp);
 		fcm_dcbd_state_set(ff, FCD_ERROR);
 	} else {
 		if (val && fcoe_config.debug)
diff --git a/fcping.c b/fcping.c
index c6f74a6..399b778 100644
--- a/fcping.c
+++ b/fcping.c
@@ -25,6 +25,7 @@ 
 #include <stddef.h>
 #include <stdarg.h>
 #include <unistd.h>
+#include <inttypes.h>
 #include <errno.h>
 #include <string.h>
 #include <time.h>
@@ -810,17 +811,17 @@  static void fp_check_data_len(void)
 	printf("Maximum ECHO data allowed by the Fabric (0x%06x) : %d bytes.\n"
 	       "Maximum ECHO data allowed by the Source (0x%06x) : %d bytes.\n"
 	       "Maximum ECHO data allowed by the Target (0x%06x) : %d bytes.\n"
-	       "Maximum ECHO data requested from user input (-s) : %lu "
+	       "Maximum ECHO data requested from user input (-s) : %" PRIu32 " "
 	       "(default %d) bytes.\n",
 	       FC_WKA_FABRIC_CONTROLLER, flen, sid, slen, fp_did, dlen,
-	       fp_len - FP_LEN_ECHO, FP_LEN_DEF);
+	       (uint32_t)(fp_len - FP_LEN_ECHO), FP_LEN_DEF);
 
 	/* fp_len is the total payload, including 4 bytes for ECHO command */
 	fp_len = MIN(fp_len, plen + FP_LEN_ECHO);
-	printf("Actual FC ELS ECHO data size used : %lu bytes.\n"
+	printf("Actual FC ELS ECHO data size used : %" PRIu32 " bytes.\n"
 	       "Actual FC ELS ECHO payload size used : %d bytes "
-	       "(including %ld bytes ECHO command).\n",
-	       fp_len - FP_LEN_ECHO, fp_len, FP_LEN_ECHO);
+	       "(including %zu bytes ECHO command).\n",
+	       (uint32_t)(fp_len - FP_LEN_ECHO), fp_len, FP_LEN_ECHO);
 }
 
 /*