btrfs-progs: fix 64-bit mips and powerpc types
PATCH 1/1 btrfs-progs: fix 64-bit mips and powerpc types
The kernel uses unsigned long specifically for ppc64 and mips64. This fixes that.
Removed asm/types.h include as it will get included properly later.
Fixes -Wformat warnings.
--- cmds/receive-dump.c | 1 - kerncompat.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)
cmds/receive-dump.c +0 -1
@@ -31,7 +31,6 @@#include <stdlib.h> #include <time.h> #include <ctype.h> -#include <asm/types.h> #include <uuid/uuid.h> #include "common/utils.h" #include "cmds/commands.h"
kerncompat.h +4 -0
@@ -19,6 +19,10 @@#ifndef __KERNCOMPAT_H__#define __KERNCOMPAT_H__ +#ifndef __SANE_USERSPACE_TYPES__ +#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ +#endif +#include <stdio.h> #include <stdlib.h> #include <errno.h>
Signature · 1 line
2.34.1
Quoted 2 lines · Rosen Penev
The kernel uses unsigned long specifically for ppc64 and mips64. This fixes that.
What do you mean? Uses unsigned long for what?
Quoted 27 lines
Removed
asm/types.hinclude as it will get included properly later.Fixes -Wformat warnings.
Signed-off-by Rosen Penev <[email protected]>--- cmds/receive-dump.c | 1 - kerncompat.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)cmds/receive-dump.c +0
-1@@ -31,7 +31,6 @@#include <stdlib.h> #include <time.h> #include <ctype.h> -#include <asm/types.h> #include <uuid/uuid.h> #include "common/utils.h" #include "cmds/commands.h" kerncompat.h +0
-0
kerncompat.h line 24
Quoted 6 lines
kerncompat.h +3
-0@@ -19,6 +19,10 @@#ifndef __KERNCOMPAT_H__#define __KERNCOMPAT_H__ +#ifndef __SANE_USERSPACE_TYPES__ +#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ +#endif
Is there a cleaner way instead of defining magic macros?
Quoted 6 lines
kerncompat.h +1
-0+#include <stdio.h> #include <stdlib.h> #include <errno.h> Signature · 1 line
2.34.1
Quoted 6 lines · David Sterba
Quoted 2 lines · Rosen Penev
The kernel uses unsigned long specifically for ppc64 and mips64. This fixes that.
What do you mean? Uses unsigned long for what?
kernel's u64 is normally unsigned long long, but not for ppc64 and mips64.
Quoted 31 lines
Quoted 31 lines
Removed
asm/types.hinclude as it will get included properly later.Fixes -Wformat warnings.
Signed-off-by Rosen Penev <[email protected]>--- cmds/receive-dump.c | 1 - kerncompat.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)cmds/receive-dump.c +0
-1@@ -31,7 +31,6 @@#include <stdlib.h> #include <time.h> #include <ctype.h> -#include <asm/types.h> #include <uuid/uuid.h> #include "common/utils.h" #include "cmds/commands.h" kerncompat.h +0
-0@@ -19,6 +19,10 @@#ifndef __KERNCOMPAT_H__#define __KERNCOMPAT_H__
Quoted 5 lines
kerncompat.h line 24
Quoted 3 lines
kerncompat.h +3
-0+#ifndef __SANE_USERSPACE_TYPES__ +#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ +#endif Is there a cleaner way instead of defining magic macros?
no. https://github.com/torvalds/linux/blob/master/arch/powerpc/include/uapi/asm/types.h#L18
Quoted 7 lines
Quoted 7 lines
kerncompat.h +1
-1+#include <stdio.h> #include <stdlib.h> #include <errno.h> --2.34.1
Quoted 39 lines · Rosen Penev
Quoted 6 lines · David Sterba
Quoted 2 lines · Rosen Penev
The kernel uses unsigned long specifically for ppc64 and mips64. This fixes that.
What do you mean? Uses unsigned long for what?
kernel's u64 is normally unsigned long long, but not for ppc64 and mips64.
Quoted 31 lines
Quoted 31 lines
Removed
asm/types.hinclude as it will get included properly later.Fixes -Wformat warnings.
Signed-off-by Rosen Penev <[email protected]>--- cmds/receive-dump.c | 1 - kerncompat.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)cmds/receive-dump.c +0
-1@@ -31,7 +31,6 @@#include <stdlib.h> #include <time.h> #include <ctype.h> -#include <asm/types.h> #include <uuid/uuid.h> #include "common/utils.h" #include "cmds/commands.h" kerncompat.h +0
-0@@ -19,6 +19,10 @@#ifndef __KERNCOMPAT_H__#define __KERNCOMPAT_H__
Quoted 6 lines
Quoted 5 lines
kerncompat.h line 24
Quoted 3 lines
kerncompat.h +3
-0+#ifndef __SANE_USERSPACE_TYPES__ +#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ +#endif Is there a cleaner way instead of defining magic macros?
no. https://github.com/torvalds/linux/blob/master/arch/powerpc/include/uapi/asm/types.h#L18
Really?
I have the same issue in btrfs-fuse, but it can be easily solved without using the magic macro.
See this issue:
https://github.com/adam900710/btrfs-fuse/issues/2
including <linux/types.h> seems to solve it for btrfs-fuse.
Thanks,
Qu
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
kerncompat.h +1
-1+#include <stdio.h> #include <stdlib.h> #include <errno.h> --2.34.1
Quoted 51 lines · Qu Wenruo
Quoted 39 lines · Rosen Penev
Quoted 6 lines · David Sterba
Quoted 2 lines · Rosen Penev
The kernel uses unsigned long specifically for ppc64 and mips64. This fixes that.
What do you mean? Uses unsigned long for what?
kernel's u64 is normally unsigned long long, but not for ppc64 and mips64.
Quoted 31 lines
Quoted 31 lines
Removed
asm/types.hinclude as it will get included properly later.Fixes -Wformat warnings.
Signed-off-by Rosen Penev <[email protected]>--- cmds/receive-dump.c | 1 - kerncompat.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)cmds/receive-dump.c +0
-1@@ -31,7 +31,6 @@#include <stdlib.h> #include <time.h> #include <ctype.h> -#include <asm/types.h> #include <uuid/uuid.h> #include "common/utils.h" #include "cmds/commands.h" kerncompat.h +0
-0@@ -19,6 +19,10 @@#ifndef __KERNCOMPAT_H__#define __KERNCOMPAT_H__Quoted 6 lines
Quoted 5 lines
kerncompat.h line 24
Quoted 3 lines
kerncompat.h +3
-0+#ifndef __SANE_USERSPACE_TYPES__ +#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ +#endif Is there a cleaner way instead of defining magic macros?
no. https://github.com/torvalds/linux/blob/master/arch/powerpc/include/uapi/asm/types.h#L18
Really?
Quoted 8 lines
I have the same issue in btrfs-fuse, but it can be easily solved without using the magic macro.
See this issue:
https://github.com/adam900710/btrfs-fuse/issues/2
including <
linux/types.h> seems to solve it for btrfs-fuse.
Ok, so it's just the asm/types.h, once it's deleted it should all work with linux/types.h (included via kerncompat.h).
Rosen, could you please verify that this is sufficient (without the extra macro)?
Quoted 56 lines · David Sterba
Quoted 54 lines · Qu Wenruo
Quoted 39 lines · Rosen Penev
Quoted 6 lines · David Sterba
Quoted 2 lines · Rosen Penev
The kernel uses unsigned long specifically for ppc64 and mips64. This fixes that.
What do you mean? Uses unsigned long for what?
kernel's u64 is normally unsigned long long, but not for ppc64 and mips64.
Quoted 31 lines
Quoted 31 lines
Removed
asm/types.hinclude as it will get included properly later.Fixes -Wformat warnings.
Signed-off-by Rosen Penev <[email protected]>--- cmds/receive-dump.c | 1 - kerncompat.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)cmds/receive-dump.c +0
-1@@ -31,7 +31,6 @@#include <stdlib.h> #include <time.h> #include <ctype.h> -#include <asm/types.h> #include <uuid/uuid.h> #include "common/utils.h" #include "cmds/commands.h" kerncompat.h +0
-0@@ -19,6 +19,10 @@#ifndef __KERNCOMPAT_H__#define __KERNCOMPAT_H__Quoted 6 lines
Quoted 5 lines
kerncompat.h line 24
Quoted 3 lines
kerncompat.h +3
-0+#ifndef __SANE_USERSPACE_TYPES__ +#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ +#endif Is there a cleaner way instead of defining magic macros?
no. https://github.com/torvalds/linux/blob/master/arch/powerpc/include/uapi/asm/types.h#L18
Really?
I have the same issue in btrfs-fuse, but it can be easily solved without using the magic macro.
Quoted 8 lines
Quoted 5 lines
See this issue:
https://github.com/adam900710/btrfs-fuse/issues/2
including <
linux/types.h> seems to solve it for btrfs-fuse.Ok, so it's just the
asm/types.h, once it's deleted it should all work withlinux/types.h(included viakerncompat.h).
Qu is referring to a different issue. I am referring to bad printf formats.
Quoted 3 lines
Rosen, could you please verify that this is sufficient (without the extra macro)?
It is not.
Also note that this is specific to ppc64 and mips64. and alpha (whatever that is).
a git grep of the linux tree for that macro shows that it's used in tools/
Quoted 59 lines · Rosen Penev
Quoted 58 lines · David Sterba
Quoted 56 lines · Qu Wenruo
Quoted 39 lines · Rosen Penev
Quoted 6 lines · David Sterba
Quoted 2 lines · Rosen Penev
The kernel uses unsigned long specifically for ppc64 and mips64. This fixes that.
What do you mean? Uses unsigned long for what?
kernel's u64 is normally unsigned long long, but not for ppc64 and mips64.
Quoted 31 lines
Quoted 31 lines
Removed
asm/types.hinclude as it will get included properly later.Fixes -Wformat warnings.
Signed-off-by Rosen Penev <[email protected]>--- cmds/receive-dump.c | 1 - kerncompat.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)cmds/receive-dump.c +0
-1@@ -31,7 +31,6 @@#include <stdlib.h> #include <time.h> #include <ctype.h> -#include <asm/types.h> #include <uuid/uuid.h> #include "common/utils.h" #include "cmds/commands.h" kerncompat.h +0
-0@@ -19,6 +19,10 @@#ifndef __KERNCOMPAT_H__#define __KERNCOMPAT_H__Quoted 6 lines
Quoted 5 lines
kerncompat.h line 24
Quoted 3 lines
kerncompat.h +3
-0+#ifndef __SANE_USERSPACE_TYPES__ +#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ +#endif Is there a cleaner way instead of defining magic macros?
no. https://github.com/torvalds/linux/blob/master/arch/powerpc/include/uapi/asm/types.h#L18
Really?
I have the same issue in btrfs-fuse, but it can be easily solved without using the magic macro.
See this issue:
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
https://github.com/adam900710/btrfs-fuse/issues/2
including <
linux/types.h> seems to solve it for btrfs-fuse.Ok, so it's just the
asm/types.h, once it's deleted it should all work withlinux/types.h(included viakerncompat.h).Qu is referring to a different issue. I am referring to bad printf formats.
Weird, as the report includes format '%llu' warning for printf formats.
Quoted 9 lines
Quoted 3 lines
Rosen, could you please verify that this is sufficient (without the extra macro)?
It is not.
Also note that this is specific to ppc64 and mips64. and alpha (whatever that is).
a git grep of the linux tree for that macro shows that it's used in
tools/
OK, after checking the latest build log from Fedora36 ppc64le, it indeed still shows the warning:
Although from what I see, that magic is more common set for packaging, not directly into the source code:
Where chromium choose to add that magic only for mips64
Or this:
https://github.com/LLNL/lustre/blob/2.12.7-llnl/lustre.spec.in#L343
Which is only defined during packaging, not in the source code.
We can put this into our Makefile, and only for affected archtectures then.
Thanks,
Qu
Quoted 83 lines · Qu Wenruo
Quoted 59 lines · Rosen Penev
Quoted 58 lines · David Sterba
Quoted 56 lines · Qu Wenruo
Quoted 39 lines · Rosen Penev
Quoted 6 lines · David Sterba
Quoted 2 lines · Rosen Penev
The kernel uses unsigned long specifically for ppc64 and mips64. This fixes that.
What do you mean? Uses unsigned long for what?
kernel's u64 is normally unsigned long long, but not for ppc64 and mips64.
Quoted 31 lines
Quoted 31 lines
Removed
asm/types.hinclude as it will get included properly later.Fixes -Wformat warnings.
Signed-off-by Rosen Penev <[email protected]>--- cmds/receive-dump.c | 1 - kerncompat.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)cmds/receive-dump.c +0
-1@@ -31,7 +31,6 @@#include <stdlib.h> #include <time.h> #include <ctype.h> -#include <asm/types.h> #include <uuid/uuid.h> #include "common/utils.h" #include "cmds/commands.h" kerncompat.h +0
-0@@ -19,6 +19,10 @@#ifndef __KERNCOMPAT_H__#define __KERNCOMPAT_H__Quoted 6 lines
Quoted 5 lines
kerncompat.h line 24
Quoted 3 lines
kerncompat.h +3
-0+#ifndef __SANE_USERSPACE_TYPES__ +#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ +#endif Is there a cleaner way instead of defining magic macros?
no. https://github.com/torvalds/linux/blob/master/arch/powerpc/include/uapi/asm/types.h#L18
Really?
I have the same issue in btrfs-fuse, but it can be easily solved without using the magic macro.
See this issue:
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
https://github.com/adam900710/btrfs-fuse/issues/2
including <
linux/types.h> seems to solve it for btrfs-fuse.Ok, so it's just the
asm/types.h, once it's deleted it should all work withlinux/types.h(included viakerncompat.h).Qu is referring to a different issue. I am referring to bad printf formats.
Weird, as the report includes format '%llu' warning for printf formats.
Quoted 9 lines
Quoted 3 lines
Rosen, could you please verify that this is sufficient (without the extra macro)?
It is not.
Also note that this is specific to ppc64 and mips64. and alpha (whatever that is).
a git grep of the linux tree for that macro shows that it's used in
tools/
Quoted 8 lines
OK, after checking the latest build log from Fedora36 ppc64le, it indeed still shows the warning:
Although from what I see, that magic is more common set for packaging, not directly into the source code:
OTOH tools/perf and some tests define this macro.
Quoted 16 lines
Where chromium choose to add that magic only for mips64
Or this:
https://github.com/LLNL/lustre/blob/2.12.7-llnl/lustre.spec.in#L343
Which is only defined during packaging, not in the source code.
We can put this into our
Makefile, and only for affected archtectures then.Thanks,
Qu
Quoted 87 lines · Rosen Penev
Quoted 86 lines · Qu Wenruo
Quoted 59 lines · Rosen Penev
Quoted 58 lines · David Sterba
Quoted 56 lines · Qu Wenruo
Quoted 39 lines · Rosen Penev
Quoted 6 lines · David Sterba
Quoted 2 lines · Rosen Penev
The kernel uses unsigned long specifically for ppc64 and mips64. This fixes that.
What do you mean? Uses unsigned long for what?
kernel's u64 is normally unsigned long long, but not for ppc64 and mips64.
Quoted 31 lines
Quoted 31 lines
Removed
asm/types.hinclude as it will get included properly later.Fixes -Wformat warnings.
Signed-off-by Rosen Penev <[email protected]>--- cmds/receive-dump.c | 1 - kerncompat.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)cmds/receive-dump.c +0
-1@@ -31,7 +31,6 @@#include <stdlib.h> #include <time.h> #include <ctype.h> -#include <asm/types.h> #include <uuid/uuid.h> #include "common/utils.h" #include "cmds/commands.h" kerncompat.h +0
-0@@ -19,6 +19,10 @@#ifndef __KERNCOMPAT_H__#define __KERNCOMPAT_H__Quoted 6 lines
Quoted 5 lines
kerncompat.h line 24
Quoted 3 lines
kerncompat.h +3
-0+#ifndef __SANE_USERSPACE_TYPES__ +#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ +#endif Is there a cleaner way instead of defining magic macros?
no. https://github.com/torvalds/linux/blob/master/arch/powerpc/include/uapi/asm/types.h#L18
Really?
I have the same issue in btrfs-fuse, but it can be easily solved without using the magic macro.
See this issue:
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
https://github.com/adam900710/btrfs-fuse/issues/2
including <
linux/types.h> seems to solve it for btrfs-fuse.Ok, so it's just the
asm/types.h, once it's deleted it should all work withlinux/types.h(included viakerncompat.h).Qu is referring to a different issue. I am referring to bad printf formats.
Weird, as the report includes format '%llu' warning for printf formats.
Quoted 9 lines
Quoted 3 lines
Rosen, could you please verify that this is sufficient (without the extra macro)?
It is not.
Also note that this is specific to ppc64 and mips64. and alpha (whatever that is).
a git grep of the linux tree for that macro shows that it's used in
tools/OK, after checking the latest build log from Fedora36 ppc64le, it indeed still shows the warning:
Quoted 6 lines
Quoted 5 lines
Although from what I see, that magic is more common set for packaging, not directly into the source code:
OTOH
tools/perfand some tests define this macro.
That's a trade-off between easier to package and easier to read.
Although as mentioned, it seems more common to define it at packaging time.
Personally I'm fine with both way, but a little more towards defined in Makefile.
(Also my time to update btrfs-fuse to handle the build warning)
Thanks,
Qu
Quoted 16 lines
Quoted 16 lines
Where chromium choose to add that magic only for mips64
Or this:
https://github.com/LLNL/lustre/blob/2.12.7-llnl/lustre.spec.in#L343
Which is only defined during packaging, not in the source code.
We can put this into our
Makefile, and only for affected archtectures then.Thanks,
Qu
Quoted 22 lines · Rosen Penev
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
Quoted 5 lines
kerncompat.h line 24
Quoted 3 lines
kerncompat.h +3
-0+#ifndef __SANE_USERSPACE_TYPES__ +#define __SANE_USERSPACE_TYPES__/* For PPC64, to get LL64 types */ +#endif Is there a cleaner way instead of defining magic macros?
no. https://github.com/torvalds/linux/blob/master/arch/powerpc/include/uapi/asm/types.h#L18
Really?
I have the same issue in btrfs-fuse, but it can be easily solved without using the magic macro.
Quoted 8 lines
Quoted 5 lines
See this issue:
https://github.com/adam900710/btrfs-fuse/issues/2
including <
linux/types.h> seems to solve it for btrfs-fuse.Ok, so it's just the
asm/types.h, once it's deleted it should all work withlinux/types.h(included viakerncompat.h).Qu is referring to a different issue. I am referring to bad printf formats.
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
Rosen, could you please verify that this is sufficient (without the extra macro)?
It is not.
Also note that this is specific to ppc64 and mips64. and alpha (whatever that is).
a git grep of the linux tree for that macro shows that it's used in
tools/
Ok, let's use the magic macro.