Re: [RFC][PATCH] Btrfs-progs: Fix compiler warnings on PPC64.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/14/2012 06:59 AM, David Sterba wrote:
On Wed, Sep 12, 2012 at 04:21:56PM -0700, clinew@xxxxxxxxxxxxxxxxxx wrote:
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

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux