From patchwork Wed Sep 12 23:21:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: clinew@linux.vnet.ibm.com X-Patchwork-Id: 1447121 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 26249DF238 for ; Wed, 12 Sep 2012 23:22:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751421Ab2ILXWK (ORCPT ); Wed, 12 Sep 2012 19:22:10 -0400 Received: from e3.ny.us.ibm.com ([32.97.182.143]:56028 "EHLO e3.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751137Ab2ILXWI (ORCPT ); Wed, 12 Sep 2012 19:22:08 -0400 Received: from /spool/local by e3.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Sep 2012 19:22:04 -0400 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e3.ny.us.ibm.com (192.168.1.103) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 12 Sep 2012 19:22:03 -0400 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 8AC4B38C8039 for ; Wed, 12 Sep 2012 19:22:02 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8CNM2ke144954 for ; Wed, 12 Sep 2012 19:22:02 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8CNM1R4011598 for ; Wed, 12 Sep 2012 20:22:02 -0300 Received: from oc0545723817.ibm.com.beaverton.ibm.com ([9.47.25.196]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8CNM0Ck011480; Wed, 12 Sep 2012 20:22:00 -0300 From: clinew@linux.vnet.ibm.com To: linux-btrfs@vger.kernel.org Cc: cmm@linux.vnet.ibm.com, Wade Cline Subject: [RFC][PATCH] Btrfs-progs: Fix compiler warnings on PPC64. Date: Wed, 12 Sep 2012 16:21:56 -0700 Message-Id: <1347492116-16317-1-git-send-email-clinew@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.12.rc3.2.gbd120e3 MIME-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12091223-8974-0000-0000-00000DA2FBB6 X-IBM-ISS-SpamDetectors: X-IBM-ISS-DetailInfo: BY=3.00000294; HX=3.00000196; KW=3.00000007; PH=3.00000001; SC=3.00000007; SDB=6.00173614; UDB=6.00039324; UTC=2012-09-12 23:22:03 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 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 , 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 --- 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 #include 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 #include #include 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 #include 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 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