Re: [RFC][PATCH] Btrfs-progs: Fix compiler warnings on PPC64.
From: Wade Cline <hidden>
Date: 2012-09-14 17:14:00
On 09/14/2012 06:59 AM, David Sterba wrote:
On Wed, Sep 12, 2012 at 04:21:56PM -0700, clinew@linux.vnet.ibm.com wrote:quoted
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.Defining __KERNEL__ in random places does not seem clean, I understand it in kerncompat.h which should transparently fix any compatibility issues, and the files like cmd-receive.c should include this instead of the explicit defines. david
I agree that defining __KERNEL__ does not seem clean, but the problem is that the various include files sort of "race" to include the type definition. For example, in cmds-scrub.c: #include <sys/ioctl.h> #include <sys/wait.h> #define __KERNEL__ #include <sys/stat.h> will generate compiler warnings while: #include <sys/ioctl.h> #define __KERNEL__ #include <sys/wait.h> #include <sys/stat.h> will not. By the time kerncompat.h is included, u64 is almost always defined to the non-compatible value. So either kerncompat.h needs to be defined as the -first- included header file, or __KERNEL__ needs to be defined. ...it would also be possible to do something like: #define __KERNEL__ #include <sys/wait.h> #undef __KERNEL__ but that seems a bit too hacky. I'm open to any other ideas, though. Thank you, Wade