From: Breno Leitao Date: Mon, 11 Jul 2016 18:23:03 +0000 (-0400) Subject: There is one problem with these printf because they are architecture dependent. X-Git-Tag: v0.9~22^2~2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8a0eb54fd6fe5f3d115d7c9378fe6d5998c1668c;p=users%2Fsagi%2Fnvme-cli.git There is one problem with these printf because they are architecture dependent. This code fails to compile on a ppc64le architecture due to the following errors: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘__le64 {aka long unsigned int}’ This patch just uses PRIu64 to print 64 uint64_t types. --- diff --git a/fabrics.c b/fabrics.c index 869592c8..ec3179f1 100644 --- a/fabrics.c +++ b/fabrics.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #ifdef LIBUDEV_EXISTS #include #endif @@ -266,8 +268,8 @@ static void print_discovery_log(struct nvmf_disc_rsp_page_hdr *log, int numrec) { int i; - printf("Discovery Log Number of Records %d, Generation counter %lld\n", - numrec, log->genctr); + printf("Discovery Log Number of Records %d, Generation counter %"PRIu64"\n", + numrec, __le64_to_cpu(log->genctr)); for (i = 0; i < numrec; i++) { struct nvmf_disc_rsp_page_entry *e = &log->entries[i]; diff --git a/intel-nvme.c b/intel-nvme.c index 67c85b76..241b26cd 100644 --- a/intel-nvme.c +++ b/intel-nvme.c @@ -4,6 +4,8 @@ #include #include #include +#include +#include #include "linux/nvme_ioctl.h" @@ -127,14 +129,14 @@ static void show_temp_stats(struct intel_temp_stats *stats) { printf(" Intel Temperature Statistics\n"); printf("--------------------------------\n"); - printf("Current temperature : %llu\n", stats->curr); - printf("Last critical overtemp flag : %llu\n", stats->last_overtemp); - printf("Life critical overtemp flag : %llu\n", stats->life_overtemp); - printf("Highest temperature : %llu\n", stats->highest_temp); - printf("Lowest temperature : %llu\n", stats->lowest_temp); - printf("Max operating temperature : %llu\n", stats->max_operating_temp); - printf("Min operating temperature : %llu\n", stats->min_operating_temp); - printf("Estimated offset : %llu\n", stats->est_offset); + printf("Current temperature : %"PRIu64"\n", __le64_to_cpu(stats->curr)); + printf("Last critical overtemp flag : %"PRIu64"\n", __le64_to_cpu(stats->last_overtemp)); + printf("Life critical overtemp flag : %"PRIu64"\n", __le64_to_cpu(stats->life_overtemp)); + printf("Highest temperature : %"PRIu64"\n", __le64_to_cpu(stats->highest_temp)); + printf("Lowest temperature : %"PRIu64"\n", __le64_to_cpu(stats->lowest_temp)); + printf("Max operating temperature : %"PRIu64"\n", __le64_to_cpu(stats->max_operating_temp)); + printf("Min operating temperature : %"PRIu64"\n", __le64_to_cpu(stats->min_operating_temp)); + printf("Estimated offset : %"PRIu64"\n", __le64_to_cpu(stats->est_offset)); } static int get_temp_stats_log(int argc, char **argv, struct command *cmd, struct plugin *plugin)