All of lore.kernel.org
 help / color / mirror / Atom feed
From: clinew@linux.vnet.ibm.com
To: linux-btrfs@vger.kernel.org
Cc: cmm@linux.vnet.ibm.com, Wade Cline <clinew@linux.vnet.ibm.com>
Subject: [RFC][PATCH] Btrfs-progs: Fix compiler warnings on PPC64.
Date: Wed, 12 Sep 2012 16:21:56 -0700	[thread overview]
Message-ID: <1347492116-16317-1-git-send-email-clinew@linux.vnet.ibm.com> (raw)

From: Wade Cline <clinew@linux.vnet.ibm.com>

The kernel uses unsigned long long for u64, but PPC64 uses unsigned
long by default. This results in print warnings such as:

print-tree.c:333: warning: format ‘%llu’ expects type ‘long long
unsigned int’, but argument 4 has type ‘u64’

Defining __KERNEL__ before the file <asm/types.h>, or any file that
includes this file, will let PPC64 know to use unsigned long long
for u64 instead. This patch adds the defines and fixes the print
warnings on PPC64.

Signed-off-by: Wade Cline <clinew@linux.vnet.ibm.com>
---
 cmds-receive.c |    1 +
 cmds-scrub.c   |    2 ++
 convert.c      |    1 +
 kerncompat.h   |    6 ++++++
 mkfs.c         |    1 +
 5 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/cmds-receive.c b/cmds-receive.c
index a8be6fa..6cb51fe 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -20,6 +20,7 @@
 #define _POSIX_C_SOURCE 200809
 #define _XOPEN_SOURCE 700
 #define _BSD_SOURCE
+#define __KERNEL__
 
 #include <unistd.h>
 #include <stdint.h>
diff --git a/cmds-scrub.c b/cmds-scrub.c
index 24be20f..7f6aa68 100644
--- a/cmds-scrub.c
+++ b/cmds-scrub.c
@@ -16,6 +16,8 @@
  * Boston, MA 021110-1307, USA.
  */
 
+#define __KERNEL__
+
 #include <sys/ioctl.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
diff --git a/convert.c b/convert.c
index fa7bf8c..74ffceb 100644
--- a/convert.c
+++ b/convert.c
@@ -18,6 +18,7 @@
 
 #define _XOPEN_SOURCE 600
 #define _GNU_SOURCE 1
+#define __KERNEL__
 #ifndef __CHECKER__
 #include <sys/ioctl.h>
 #include <sys/mount.h>
diff --git a/kerncompat.h b/kerncompat.h
index 46236cd..2e571b8 100644
--- a/kerncompat.h
+++ b/kerncompat.h
@@ -57,11 +57,17 @@
 #endif
 
 #ifndef __CHECKER__
+/*
+ * PPC64 uses unsigned long for u64 while the kernel uses unsigned long long;
+ * Specifying this will let PPC64 know to use unsigned long long instead.
+ */
+#define __KERNEL__
 #include <asm/types.h>
 typedef __u32 u32;
 typedef __u64 u64;
 typedef __u16 u16;
 typedef __u8 u8;
+#undef __KERNEL__
 #else
 typedef unsigned int u32;
 typedef unsigned int __u32;
diff --git a/mkfs.c b/mkfs.c
index dff5eb8..1c88804 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -18,6 +18,7 @@
 
 #define _XOPEN_SOURCE 500
 #define _GNU_SOURCE
+#define __KERNEL__
 
 #ifndef __CHECKER__
 #include <sys/ioctl.h>
-- 
1.7.1


             reply	other threads:[~2012-09-12 23:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 23:21 clinew [this message]
2012-09-14 13:59 ` [RFC][PATCH] Btrfs-progs: Fix compiler warnings on PPC64 David Sterba
2012-09-14 17:13   ` Wade Cline
2012-09-20 14:15     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347492116-16317-1-git-send-email-clinew@linux.vnet.ibm.com \
    --to=clinew@linux.vnet.ibm.com \
    --cc=cmm@linux.vnet.ibm.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.