From patchwork Thu Sep 20 21:26:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: clinew@linux.vnet.ibm.com X-Patchwork-Id: 1487911 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 72FB8DF2D2 for ; Thu, 20 Sep 2012 21:27:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752651Ab2ITV1E (ORCPT ); Thu, 20 Sep 2012 17:27:04 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:51682 "EHLO e7.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752086Ab2ITV1C (ORCPT ); Thu, 20 Sep 2012 17:27:02 -0400 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 20 Sep 2012 17:27:01 -0400 Received: from d01relay05.pok.ibm.com (9.56.227.237) by e7.ny.us.ibm.com (192.168.1.107) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 20 Sep 2012 17:26:59 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8KLQwTV108252 for ; Thu, 20 Sep 2012 17:26:58 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8KLQwAQ019671 for ; Thu, 20 Sep 2012 17:26:58 -0400 Received: from oc0545723817.ibm.com ([9.47.25.119]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8KLQucc019566; Thu, 20 Sep 2012 17:26:57 -0400 From: clinew@linux.vnet.ibm.com To: linux-btrfs@vger.kernel.org Cc: cmm@linux.vnet.ibm.com, Wade Cline Subject: [PATCH] Btrfs-progs: Fix compiler warnings on PPC64 Date: Thu, 20 Sep 2012 14:26:28 -0700 Message-Id: <1348176388-3524-1-git-send-email-clinew@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.12.rc3.2.gbd120e3 x-cbid: 12092021-5806-0000-0000-000019D1FE02 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Wade Cline The kernel uses unsigned long long for u64, but PPC64 uses unsigned long by default. This results in compilation warnings such as: print-tree.c:333: warning: format '%llu' expects type 'long long unsigned int', but argument 4 has type 'u64' To fix this, the macro __KERNEL__ needs to be defined before including the file . This can be done by defining the macro in "kerncompat.h" and making it the first included file in the relevant header files; this fixes the compiler warnings on PPC64. Signed-off-by: Wade Cline --- cmds-receive.c | 2 ++ cmds-scrub.c | 2 ++ cmds-send.c | 2 ++ convert.c | 5 ++++- kerncompat.h | 12 ++++++++++++ mkfs.c | 3 ++- restore.c | 5 ++++- 7 files changed, 28 insertions(+), 3 deletions(-) diff --git a/cmds-receive.c b/cmds-receive.c index a8be6fa..a21c037 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -21,6 +21,8 @@ #define _XOPEN_SOURCE 700 #define _BSD_SOURCE +#include "kerncompat.h" + #include #include #include diff --git a/cmds-scrub.c b/cmds-scrub.c index 24be20f..e29db27 100644 --- a/cmds-scrub.c +++ b/cmds-scrub.c @@ -16,6 +16,8 @@ * Boston, MA 021110-1307, USA. */ +#include "kerncompat.h" + #include #include #include diff --git a/cmds-send.c b/cmds-send.c index 41ea523..9da2af4 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -18,6 +18,8 @@ #define _GNU_SOURCE +#include "kerncompat.h" + #include #include #include diff --git a/convert.c b/convert.c index fa7bf8c..1de2a44 100644 --- a/convert.c +++ b/convert.c @@ -18,6 +18,9 @@ #define _XOPEN_SOURCE 600 #define _GNU_SOURCE 1 + +#include "kerncompat.h" + #ifndef __CHECKER__ #include #include @@ -31,7 +34,7 @@ #include #include #include -#include "kerncompat.h" + #include "ctree.h" #include "disk-io.h" #include "volumes.h" diff --git a/kerncompat.h b/kerncompat.h index 46236cd..d60f722 100644 --- a/kerncompat.h +++ b/kerncompat.h @@ -18,6 +18,7 @@ #ifndef __KERNCOMPAT #define __KERNCOMPAT + #include #include #include @@ -57,11 +58,22 @@ #endif #ifndef __CHECKER__ +/* + * Since we're using primitive definitions from kernel-space, we need to + * define __KERNEL__ so that system header files know which definitions + * to use. + */ +#define __KERNEL__ #include typedef __u32 u32; typedef __u64 u64; typedef __u16 u16; typedef __u8 u8; +/* + * Continuing to define __KERNEL__ breaks others parts of the code, so + * we can just undefine it now that we have the correct headers... + */ +#undef __KERNEL__ #else typedef unsigned int u32; typedef unsigned int __u32; diff --git a/mkfs.c b/mkfs.c index dff5eb8..c3d5cf7 100644 --- a/mkfs.c +++ b/mkfs.c @@ -19,6 +19,8 @@ #define _XOPEN_SOURCE 500 #define _GNU_SOURCE +#include "kerncompat.h" + #ifndef __CHECKER__ #include #include @@ -37,7 +39,6 @@ #include #include #include -#include "kerncompat.h" #include "ctree.h" #include "disk-io.h" #include "volumes.h" diff --git a/restore.c b/restore.c index d1ac542..248c473 100644 --- a/restore.c +++ b/restore.c @@ -18,6 +18,9 @@ #define _XOPEN_SOURCE 500 #define _GNU_SOURCE 1 + +#include "kerncompat.h" + #include #include #include @@ -25,7 +28,7 @@ #include #include #include -#include "kerncompat.h" + #include "ctree.h" #include "disk-io.h" #include "print-tree.h"