1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
From 920c515478b441eaca31e33a18b95ceaa49ace19 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Mon, 5 Nov 2018 11:06:41 -0800
Subject: [PATCH] btrfs-progs: kernel-lib: bitops: Fix big endian compilation
Replaced bswap with _ variants bswap_32 etc. While it's a glibc
extension, all of the popular libc implementations (glibc, uClibc, musl,
BIONIC) seem to support it.
Added static inline to two functions to match little endian variants. This
fixes a linking error experienced when compiling on gcc 7.3.0 with LTO,
possibly a bug that was fixed later.
Upstream-Status: Backport [https://gitlab.com/kdave/btrfs-progs/commit/ed570e2df335063280c9d3affd8bb89919a1ac0d.patch]
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
kernel-lib/bitops.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel-lib/bitops.h b/kernel-lib/bitops.h
index b1fd6f53..2c51a265 100644
--- a/kernel-lib/bitops.h
+++ b/kernel-lib/bitops.h
@@ -178,9 +178,9 @@ static inline unsigned long find_next_zero_bit(const unsigned long *addr,
static inline unsigned long ext2_swab(const unsigned long y)
{
#if BITS_PER_LONG == 64
- return (unsigned long) bswap64((u64) y);
+ return (unsigned long) bswap_64((u64) y);
#elif BITS_PER_LONG == 32
- return (unsigned long) bswap32((u32) y);
+ return (unsigned long) bswap_32((u32) y);
#else
#error BITS_PER_LONG not defined
#endif
@@ -218,14 +218,14 @@ static inline unsigned long _find_next_bit_le(const unsigned long *addr1,
return min(start + __ffs(ext2_swab(tmp)), nbits);
}
-unsigned long find_next_zero_bit_le(const void *addr, unsigned long size,
+static inline unsigned long find_next_zero_bit_le(const void *addr, unsigned long size,
unsigned long offset)
{
return _find_next_bit_le(addr, NULL, size, offset, ~0UL);
}
-unsigned long find_next_bit_le(const void *addr, unsigned long size,
+static inline unsigned long find_next_bit_le(const void *addr, unsigned long size,
unsigned long offset)
{
return _find_next_bit_le(addr, NULL, size, offset, 0UL);
|