types: replace remaining uses of __u{16,32,64}
cover types: replace remaining uses of __u{16,32,64}
1: byteorder: replace __u16
2: byteorder: replace __u32
3: Flask: replace uses of __u32
4: x86: modernize swab64()
5: types: replace remaining uses of __u32
6: byteorder: replace __u64
7: types: replace remaining use of __u64
Jan
PATCH 1/7 byteorder: replace __u16
In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway.
In swab.h the casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab16()'s local variable is renamed, and __arch__swab16()'s is dropped as being redundant with ___swab16()'s.
With that no uses of the type remain, so it moves to linux-compat.h.
---
I'm unconvinced of the need of the separate ___constant_swab16(). I'm also unconvinced of the need for said constants (that even had casts on them).
xen/include/xen/byteorder/big_endian.h +12 -12
@@ -16,25 +16,25 @@#define __constant_cpu_to_le32 (x) ((__force __le32)___constant_swab32((x)))#define __constant_le32_to_cpu (x) ___constant_swab32((__force __u32)(__le32)(x))#define __constant_cpu_to_le16 (x) ((__force __le16)___constant_swab16((x))) -#define __constant_le16_to_cpu (x) ___constant_swab16((__force __u16)(__le16)(x)) +#define __constant_le16_to_cpu (x) ___constant_swab16((__force uint16_t)(__le16)(x))#define __constant_cpu_to_be64 (x) ((__force __be64)(__u64)(x))#define __constant_be64_to_cpu (x) ((__force __u64)(__be64)(x))#define __constant_cpu_to_be32 (x) ((__force __be32)(__u32)(x))#define __constant_be32_to_cpu (x) ((__force __u32)(__be32)(x)) -#define __constant_cpu_to_be16 (x) ((__force __be16)(__u16)(x)) -#define __constant_be16_to_cpu (x) ((__force __u16)(__be16)(x)) +#define __constant_cpu_to_be16 (x) ((__force __be16)(uint16_t)(x)) +#define __constant_be16_to_cpu (x) ((__force uint16_t)(__be16)(x))#define __cpu_to_le64 (x) ((__force __le64)__swab64((x)))#define __le64_to_cpu (x) __swab64((__force __u64)(__le64)(x))#define __cpu_to_le32 (x) ((__force __le32)__swab32((x)))#define __le32_to_cpu (x) __swab32((__force __u32)(__le32)(x))#define __cpu_to_le16 (x) ((__force __le16)__swab16((x))) -#define __le16_to_cpu (x) __swab16((__force __u16)(__le16)(x)) +#define __le16_to_cpu (x) __swab16((__force uint16_t)(__le16)(x))#define __cpu_to_be64 (x) ((__force __be64)(__u64)(x))#define __be64_to_cpu (x) ((__force __u64)(__be64)(x))#define __cpu_to_be32 (x) ((__force __be32)(__u32)(x))#define __be32_to_cpu (x) ((__force __u32)(__be32)(x)) -#define __cpu_to_be16 (x) ((__force __be16)(__u16)(x)) -#define __be16_to_cpu (x) ((__force __u16)(__be16)(x)) +#define __cpu_to_be16 (x) ((__force __be16)(uint16_t)(x)) +#define __be16_to_cpu (x) ((__force uint16_t)(__be16)(x))static inline __le64 __cpu_to_le64p (const __u64 *p) {
@@ -52,13 +52,13 @@ static inline __u32 __le32_to_cpup(const {return __swab32p ((__u32 *)p); } -static inline __le16 __cpu_to_le16p (const __u16 *p) +static inline __le16 __cpu_to_le16p (const uint16_t *p) {return (__force __le16 )__swab16p (p); } -static inline __u16 __le16_to_cpup (const __le16 *p) +static inline uint16_t __le16_to_cpup (const __le16 *p) { -return __swab16p ((__u16 *)p); +return __swab16p ((const uint16_t *)p); }static inline __be64 __cpu_to_be64p (const __u64 *p) {
@@ -76,13 +76,13 @@ static inline __u32 __be32_to_cpup(const {return (__force __u32)*p; } -static inline __be16 __cpu_to_be16p (const __u16 *p) +static inline __be16 __cpu_to_be16p (const uint16_t *p) {return (__force __be16)*p; } -static inline __u16 __be16_to_cpup (const __be16 *p) +static inline uint16_t __be16_to_cpup (const __be16 *p) { -return (__force __u16)*p; +return (__force uint16_t )*p; }#define __cpu_to_le64s (x) __swab64s((x))#define __le64_to_cpus (x) __swab64s((x))
xen/include/xen/byteorder/little_endian.h +12 -12
@@ -15,26 +15,26 @@#define __constant_le64_to_cpu (x) ((__force __u64)(__le64)(x))#define __constant_cpu_to_le32 (x) ((__force __le32)(__u32)(x))#define __constant_le32_to_cpu (x) ((__force __u32)(__le32)(x)) -#define __constant_cpu_to_le16 (x) ((__force __le16)(__u16)(x)) -#define __constant_le16_to_cpu (x) ((__force __u16)(__le16)(x)) +#define __constant_cpu_to_le16 (x) ((__force __le16)(uint16_t)(x)) +#define __constant_le16_to_cpu (x) ((__force uint16_t)(__le16)(x))#define __constant_cpu_to_be64 (x) ((__force __be64)___constant_swab64((x)))#define __constant_be64_to_cpu (x) ___constant_swab64((__force __u64)(__be64)(x))#define __constant_cpu_to_be32 (x) ((__force __be32)___constant_swab32((x)))#define __constant_be32_to_cpu (x) ___constant_swab32((__force __u32)(__be32)(x))#define __constant_cpu_to_be16 (x) ((__force __be16)___constant_swab16((x))) -#define __constant_be16_to_cpu (x) ___constant_swab16((__force __u16)(__be16)(x)) +#define __constant_be16_to_cpu (x) ___constant_swab16((__force uint16_t)(__be16)(x))#define __cpu_to_le64 (x) ((__force __le64)(__u64)(x))#define __le64_to_cpu (x) ((__force __u64)(__le64)(x))#define __cpu_to_le32 (x) ((__force __le32)(__u32)(x))#define __le32_to_cpu (x) ((__force __u32)(__le32)(x)) -#define __cpu_to_le16 (x) ((__force __le16)(__u16)(x)) -#define __le16_to_cpu (x) ((__force __u16)(__le16)(x)) +#define __cpu_to_le16 (x) ((__force __le16)(uint16_t)(x)) +#define __le16_to_cpu (x) ((__force uint16_t)(__le16)(x))#define __cpu_to_be64 (x) ((__force __be64)__swab64((x)))#define __be64_to_cpu (x) __swab64((__force __u64)(__be64)(x))#define __cpu_to_be32 (x) ((__force __be32)__swab32((x)))#define __be32_to_cpu (x) __swab32((__force __u32)(__be32)(x))#define __cpu_to_be16 (x) ((__force __be16)__swab16((x))) -#define __be16_to_cpu (x) __swab16((__force __u16)(__be16)(x)) +#define __be16_to_cpu (x) __swab16((__force uint16_t)(__be16)(x))static inline __le64 __cpu_to_le64p (const __u64 *p) {
@@ -52,13 +52,13 @@ static inline __u32 __le32_to_cpup(const {return (__force __u32)*p; } -static inline __le16 __cpu_to_le16p (const __u16 *p) +static inline __le16 __cpu_to_le16p (const uint16_t *p) {return (__force __le16)*p; } -static inline __u16 __le16_to_cpup (const __le16 *p) +static inline uint16_t __le16_to_cpup (const __le16 *p) { -return (__force __u16)*p; +return (__force uint16_t )*p; }static inline __be64 __cpu_to_be64p (const __u64 *p) {
@@ -76,13 +76,13 @@ static inline __u32 __be32_to_cpup(const {return __swab32p ((__u32 *)p); } -static inline __be16 __cpu_to_be16p (const __u16 *p) +static inline __be16 __cpu_to_be16p (const uint16_t *p) {return (__force __be16 )__swab16p (p); } -static inline __u16 __be16_to_cpup (const __be16 *p) +static inline uint16_t __be16_to_cpup (const __be16 *p) { -return __swab16p ((__u16 *)p); +return __swab16p ((const uint16_t *)p); }#define __cpu_to_le64s (x) do {} while (0)#define __le64_to_cpus (x) do {} while (0)
xen/include/xen/byteorder/swab.h +15 -14
@@ -10,15 +10,16 @@* to clean up support for bizarre-endian architectures. */ -/* casts are necessary for constants, because we never know how for sure -* how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. +/* +* Casts are necessary for constants, because we never know for sure how +* U/UL/ULL map to __u32, __u64. At least not in a portable way. */ #define ___swab16 (x) \ ({ \ - __u16 __x = (x); \ - ((__u16)( \ - (((__u16)(__x) & (__u16)0x00ffU) << 8) | \ - (((__u16)(__x) & (__u16)0xff00U) >> 8) )); \ + uint16_t x_ = (x); \ + (uint16_t)( \ + (((uint16_t)(x_) & 0x00ffU) << 8) | \ + (((uint16_t)(x_) & 0xff00U) >> 8)); \ })#define ___swab32 (x) \
@@ -46,9 +47,9 @@ })#define ___constant_swab16 (x) \ - ((__u16)( \ - (((__u16)(x) & (__u16)0x00ffU) << 8) | \ - (((__u16)(x) & (__u16)0xff00U) >> 8) )) + ((uint16_t)( \ + (((uint16_t)(x) & 0x00ffU) << 8) | \ + (((uint16_t)(x) & 0xff00U) >> 8)))#define ___constant_swab32 (x) \ ((__u32)( \ (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
@@ -70,7 +71,7 @@* provide defaults when no architecture-specific optimization is detected */ #ifndef __arch__swab16 -# define __arch__swab16 (x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); }) +# define __arch__swab16 (x) ___swab16(x)#endif #ifndef __arch__swab32# define __arch__swab32 (x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); })
@@ -105,7 +106,7 @@*/ #if defined(__GNUC__) && defined(__OPTIMIZE__)# define __swab16 (x) \ -(__builtin_constant_p((__u16)(x)) ? \ +(__builtin_constant_p((uint16_t)(x)) ? \ ___swab16((x)) : \ __fswab16((x)))# define __swab32 (x) \
@@ -123,15 +124,15 @@#endif /* OPTIMIZE */ -static inline attr_const __u16 __fswab16(__u16 x) +static inline attr_const uint16_t __fswab16(uint16_t x) {return __arch__swab16 (x); } -static inline __u16 __swab16p (const __u16 *x) +static inline uint16_t __swab16p (const uint16_t *x) {return __arch__swab16p (x); } -static inline void __swab16s (__u16 *addr) +static inline void __swab16s (uint16_t *addr) {__arch__swab16s (addr); }
xen/include/xen/linux-compat.h +1 -0
@@ -14,6 +14,7 @@typedef int8_t s8 ,__s8 ;typedef uint8_t __u8 ;typedef int16_t s16 ,__s16 ; +typedef uint16_t __u16 ;typedef int32_t s32 ,__s32 ;typedef int64_t s64 ,__s64 ;
xen/include/xen/types.h +3 -3
@@ -6,7 +6,7 @@/* Linux inherited types which are being phased out */ typedef uint8_t u8 ; -typedef uint16_t u16 ,__u16 ; +typedef uint16_t u16 ;typedef uint32_t u32 ,__u32 ;typedef uint64_t u64 ,__u64 ;
@@ -51,8 +51,8 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;#define LONG_MIN (-LONG_MAX - 1)#define ULONG_MAX (~0UL) -typedef __u16 __le16 ; -typedef __u16 __be16 ; +typedef uint16_t __le16 ; +typedef uint16_t __be16 ;typedef __u32 __le32 ;typedef __u32 __be32 ;typedef __u64 __le64 ;
Re: [PATCH 1/7] byteorder: replace __u16
Quoted 12 lines · Jan Beulich
In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway.
In
swab.hthe casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab16()'s local variable is renamed, and __arch__swab16()'s is dropped as being redundant with ___swab16()'s.
Quoted 7 lines
With that no uses of the type remain, so it moves to
linux-compat.h.Signed-off-by Jan Beulich <[email protected]>---
I'm unconvinced of the need of the separate___constant_swab16(). I'm also unconvinced of the need for said constants (that even had casts on them).
There is a still-good series deleting the whole of byteorder/ and replacing it with a few-hundred line single header.
It is the second thing stalled on a governance change (prohibited reasons to object to a change) which clearly no-one gives a damn about fixing. In fact double spite because it denied a good engineer his first changes in Xen.
I don't particularly feel like trying to polish byteorder. I'm inclined to rebase+repost Lin's patches, at which point the majority of this series simply disappears.
~Andrew
Re: [PATCH 1/7] byteorder: replace __u16
Quoted 30 lines · Andrew Cooper
Quoted 12 lines · Jan Beulich
In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway.
In
swab.hthe casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab16()'s local variable is renamed, and __arch__swab16()'s is dropped as being redundant with ___swab16()'s.Quoted 7 lines
With that no uses of the type remain, so it moves to
linux-compat.h.Signed-off-by Jan Beulich <[email protected]>---
I'm unconvinced of the need of the separate___constant_swab16(). I'm also unconvinced of the need for said constants (that even had casts on them).There is a still-good series deleting the whole of byteorder/ and replacing it with a few-hundred line single header.
It is the second thing stalled on a governance change (prohibited reasons to object to a change) which clearly no-one gives a damn about fixing. In fact double spite because it denied a good engineer his first changes in Xen.
Quoted 3 lines
I don't particularly feel like trying to polish byteorder. I'm inclined to rebase+repost Lin's patches, at which point the majority of this series simply disappears.
I wouldn't mind you doing so, as long as that other series then progresses. What I don't want to get into is the other series being stuck rendering this one stuck, too. Then it would imo be better to take this one first, rebase the other on top, and work towards it becoming unstuck (whatever that takes; I have no recollection of what the issue was back at the time, all I recall is that, yes, there was such work at some point).
Jan
Re: [PATCH 1/7] byteorder: replace __u16
Quoted 36 lines · Jan Beulich
Quoted 30 lines · Andrew Cooper
Quoted 12 lines · Jan Beulich
In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway.
In
swab.hthe casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab16()'s local variable is renamed, and __arch__swab16()'s is dropped as being redundant with ___swab16()'s.Quoted 7 lines
With that no uses of the type remain, so it moves to
linux-compat.h.Signed-off-by Jan Beulich <[email protected]>---
I'm unconvinced of the need of the separate___constant_swab16(). I'm also unconvinced of the need for said constants (that even had casts on them).There is a still-good series deleting the whole of byteorder/ and replacing it with a few-hundred line single header.
It is the second thing stalled on a governance change (prohibited reasons to object to a change) which clearly no-one gives a damn about fixing. In fact double spite because it denied a good engineer his first changes in Xen.
Quoted 3 lines
I don't particularly feel like trying to polish byteorder. I'm inclined to rebase+repost Lin's patches, at which point the majority of this series simply disappears.
Quoted 9 lines
I wouldn't mind you doing so, as long as that other series then progresses. What I don't want to get into is the other series being stuck rendering this one stuck, too. Then it would imo be better to take this one first, rebase the other on top, and work towards it becoming unstuck (whatever that takes; I have no recollection of what the issue was back at the time, all I recall is that, yes, there was such work at some point).
Jan
I usually don't like stopping a series waiting for another series too.
In these mostly automated large changes instead of a manual rebase I extract patches with "git format-patch", do the same automated replace with sed/perl (like "s/\<u32\>/uint32_t/" and so on) and apply with "git am".
My 2 cents.
Frediano
Re: [PATCH 1/7] byteorder: replace __u16
In reply to Jan BeulichQuoted 35 lines · Jan Beulich
Quoted 30 lines · Andrew Cooper
Quoted 12 lines · Jan Beulich
In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway.
In
swab.hthe casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab16()'s local variable is renamed, and __arch__swab16()'s is dropped as being redundant with ___swab16()'s.Quoted 7 lines
With that no uses of the type remain, so it moves to
linux-compat.h.Signed-off-by Jan Beulich <[email protected]>---
I'm unconvinced of the need of the separate___constant_swab16(). I'm also unconvinced of the need for said constants (that even had casts on them).There is a still-good series deleting the whole of byteorder/ and replacing it with a few-hundred line single header.
It is the second thing stalled on a governance change (prohibited reasons to object to a change) which clearly no-one gives a damn about fixing. In fact double spite because it denied a good engineer his first changes in Xen.
Quoted 3 lines
I don't particularly feel like trying to polish byteorder. I'm inclined to rebase+repost Lin's patches, at which point the majority of this series simply disappears.
Quoted 6 lines
I wouldn't mind you doing so, as long as that other series then progresses. What I don't want to get into is the other series being stuck rendering this one stuck, too. Then it would imo be better to take this one first, rebase the other on top, and work towards it becoming unstuck (whatever that takes; I have no recollection of what the issue was back at the time, all I recall is that, yes, there was such work at some point).
Just to have a clear picture: Was your reply an objection, with you indeed meaning me to hold back this tidying work? If so, can you please indicate when, at least roughly, you mean to re-post what you think wants re-posting? If not, can you please indicate so, for me to commit stuff that's otherwise ready to go in (and which that other work should be easy to re-base over)?
Jan
Re: [PATCH 1/7] byteorder: replace __u16
Quoted 43 lines · Jan Beulich
Quoted 35 lines · Jan Beulich
Quoted 30 lines · Andrew Cooper
Quoted 12 lines · Jan Beulich
In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway.
In
swab.hthe casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab16()'s local variable is renamed, and __arch__swab16()'s is dropped as being redundant with ___swab16()'s.Quoted 7 lines
With that no uses of the type remain, so it moves to
linux-compat.h.Signed-off-by Jan Beulich <[email protected]>---
I'm unconvinced of the need of the separate___constant_swab16(). I'm also unconvinced of the need for said constants (that even had casts on them).There is a still-good series deleting the whole of byteorder/ and replacing it with a few-hundred line single header.
It is the second thing stalled on a governance change (prohibited reasons to object to a change) which clearly no-one gives a damn about fixing. In fact double spite because it denied a good engineer his first changes in Xen.
Quoted 3 lines
I don't particularly feel like trying to polish byteorder. I'm inclined to rebase+repost Lin's patches, at which point the majority of this series simply disappears.
Quoted 6 lines
I wouldn't mind you doing so, as long as that other series then progresses. What I don't want to get into is the other series being stuck rendering this one stuck, too. Then it would imo be better to take this one first, rebase the other on top, and work towards it becoming unstuck (whatever that takes; I have no recollection of what the issue was back at the time, all I recall is that, yes, there was such work at some point).
Quoted 5 lines
Just to have a clear picture: Was your reply an objection, with you indeed meaning me to hold back this tidying work? If so, can you please indicate when, at least roughly, you mean to re-post what you think wants re-posting? If not, can you please indicate so, for me to commit stuff that's otherwise ready to go in (and which that other work should be easy to re-base over)?
Just to mention here - short of an answer I'm going to commit this with the R-b from Frediano that I've got.
Jan
Andrew Cooper
NAKRe: [PATCH 1/7] byteorder: replace __u16
Quoted 41 lines · Jan Beulich
Quoted 40 lines · Jan Beulich
Quoted 39 lines · Jan Beulich
Quoted 29 lines · Andrew Cooper
Quoted 12 lines · Jan Beulich
In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway.
In
swab.hthe casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab16()'s local variable is renamed, and __arch__swab16()'s is dropped as being redundant with ___swab16()'s.Quoted 7 lines
With that no uses of the type remain, so it moves to
linux-compat.h.Signed-off-by Jan Beulich <[email protected]>---
I'm unconvinced of the need of the separate___constant_swab16(). I'm also unconvinced of the need for said constants (that even had casts on them).There is a still-good series deleting the whole of byteorder/ and replacing it with a few-hundred line single header.
It is the second thing stalled on a governance change (prohibited reasons to object to a change) which clearly no-one gives a damn about fixing. In fact double spite because it denied a good engineer his first changes in Xen.
Quoted 3 lines
I don't particularly feel like trying to polish byteorder. I'm inclined to rebase+repost Lin's patches, at which point the majority of this series simply disappears.
I wouldn't mind you doing so, as long as that other series then progresses. What I don't want to get into is the other series being stuck rendering this one stuck, too. Then it would imo be better to take this one first, rebase the other on top, and work towards it becoming unstuck (whatever that takes; I have no recollection of what the issue was back at the time, all I recall is that, yes, there was such work at some point).
Quoted 7 lines
Quoted 5 lines
Just to have a clear picture: Was your reply an objection, with you indeed meaning me to hold back this tidying work? If so, can you please indicate when, at least roughly, you mean to re-post what you think wants re-posting? If not, can you please indicate so, for me to commit stuff that's otherwise ready to go in (and which that other work should be easy to re-base over)?
Just to mention here - short of an answer I'm going to commit this with the R-b from Frediano that I've got.
nack.
The reason there's even anything to do here is, in part, because you were obstructive to Lin's series.
It wasn't only you, but the maintainers (plural) behaviour on that series was so outrageous that it started the effort to governance to prohibit certain classes of feedback, to make Xen a less toxic place to contribute to.
I will get to it when I get to it. You can use the time to reflect on how you could have been more helpful in the past, and avoided this whole issue.
~Andrew
Re: [PATCH 1/7] byteorder: replace __u16
Quoted 47 lines · Andrew Cooper
Quoted 46 lines · Jan Beulich
Quoted 45 lines · Jan Beulich
Quoted 33 lines · Jan Beulich
Quoted 29 lines · Andrew Cooper
Quoted 12 lines · Jan Beulich
In {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway.
In
swab.hthe casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab16()'s local variable is renamed, and __arch__swab16()'s is dropped as being redundant with ___swab16()'s.Quoted 7 lines
With that no uses of the type remain, so it moves to
linux-compat.h.Signed-off-by Jan Beulich <[email protected]>---
I'm unconvinced of the need of the separate___constant_swab16(). I'm also unconvinced of the need for said constants (that even had casts on them).There is a still-good series deleting the whole of byteorder/ and replacing it with a few-hundred line single header.
It is the second thing stalled on a governance change (prohibited reasons to object to a change) which clearly no-one gives a damn about fixing. In fact double spite because it denied a good engineer his first changes in Xen.
Quoted 3 lines
I don't particularly feel like trying to polish byteorder. I'm inclined to rebase+repost Lin's patches, at which point the majority of this series simply disappears.
Quoted 6 lines
I wouldn't mind you doing so, as long as that other series then progresses. What I don't want to get into is the other series being stuck rendering this one stuck, too. Then it would imo be better to take this one first, rebase the other on top, and work towards it becoming unstuck (whatever that takes; I have no recollection of what the issue was back at the time, all I recall is that, yes, there was such work at some point).
Just to have a clear picture: Was your reply an objection, with you indeed meaning me to hold back this tidying work? If so, can you please indicate when, at least roughly, you mean to re-post what you think wants re-posting? If not, can you please indicate so, for me to commit stuff that's otherwise ready to go in (and which that other work should be easy to re-base over)?
Quoted 4 lines
Quoted 2 lines
Just to mention here - short of an answer I'm going to commit this with the R-b from Frediano that I've got.
nack.
Too late.
Quoted 11 lines
The reason there's even anything to do here is, in part, because you were obstructive to Lin's series.
It wasn't only you, but the maintainers (plural) behaviour on that series was so outrageous that it started the effort to governance to prohibit certain classes of feedback, to make Xen a less toxic place to contribute to.
I will get to it when I get to it. You can use the time to reflect on how you could have been more helpful in the past, and avoided this whole issue.
Do you really think that with this kind of reply you do any better than what you complain about in my (supposed) earlier behavior? I can't help the impression that you simply can't live with views differing from your own in certain cases. If you have specific, reasonably objective comments on that past communication (which I no longer have to hand), I may certainly try to do better in the future. Blanket statements like those above simply aren't actionable (and wording-wise close to a conduct violation imo).
Jan
PATCH 2/7 byteorder: replace __u32
In reply to Jan BeulichIn {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway.
In swab.h the casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab32()'s local variable is renamed, and __arch__swab32()'s is dropped as being redundant with ___swab32()'s.
The masking operation is also dropped from __fswab64().
---
I'm unconvinced of the need of the separate ___constant_swab32(). I'm also unconvinced of the need for some of said constants (that even had casts on them).
xen/include/xen/byteorder/big_endian.h +12 -12
@@ -14,25 +14,25 @@#define __constant_cpu_to_le64 (x) ((__force __le64)___constant_swab64((x)))#define __constant_le64_to_cpu (x) ___constant_swab64((__force __u64)(__le64)(x))#define __constant_cpu_to_le32 (x) ((__force __le32)___constant_swab32((x))) -#define __constant_le32_to_cpu (x) ___constant_swab32((__force __u32)(__le32)(x)) +#define __constant_le32_to_cpu (x) ___constant_swab32((__force uint32_t)(__le32)(x))#define __constant_cpu_to_le16 (x) ((__force __le16)___constant_swab16((x)))#define __constant_le16_to_cpu (x) ___constant_swab16((__force uint16_t)(__le16)(x))#define __constant_cpu_to_be64 (x) ((__force __be64)(__u64)(x))#define __constant_be64_to_cpu (x) ((__force __u64)(__be64)(x)) -#define __constant_cpu_to_be32 (x) ((__force __be32)(__u32)(x)) -#define __constant_be32_to_cpu (x) ((__force __u32)(__be32)(x)) +#define __constant_cpu_to_be32 (x) ((__force __be32)(uint32_t)(x)) +#define __constant_be32_to_cpu (x) ((__force uint32_t)(__be32)(x))#define __constant_cpu_to_be16 (x) ((__force __be16)(uint16_t)(x))#define __constant_be16_to_cpu (x) ((__force uint16_t)(__be16)(x))#define __cpu_to_le64 (x) ((__force __le64)__swab64((x)))#define __le64_to_cpu (x) __swab64((__force __u64)(__le64)(x))#define __cpu_to_le32 (x) ((__force __le32)__swab32((x))) -#define __le32_to_cpu (x) __swab32((__force __u32)(__le32)(x)) +#define __le32_to_cpu (x) __swab32((__force uint32_t)(__le32)(x))#define __cpu_to_le16 (x) ((__force __le16)__swab16((x)))#define __le16_to_cpu (x) __swab16((__force uint16_t)(__le16)(x))#define __cpu_to_be64 (x) ((__force __be64)(__u64)(x))#define __be64_to_cpu (x) ((__force __u64)(__be64)(x)) -#define __cpu_to_be32 (x) ((__force __be32)(__u32)(x)) -#define __be32_to_cpu (x) ((__force __u32)(__be32)(x)) +#define __cpu_to_be32 (x) ((__force __be32)(uint32_t)(x)) +#define __be32_to_cpu (x) ((__force uint32_t)(__be32)(x))#define __cpu_to_be16 (x) ((__force __be16)(uint16_t)(x))#define __be16_to_cpu (x) ((__force uint16_t)(__be16)(x))
@@ -44,13 +44,13 @@ static inline __u64 __le64_to_cpup(const {return __swab64p ((__u64 *)p); } -static inline __le32 __cpu_to_le32p (const __u32 *p) +static inline __le32 __cpu_to_le32p (const uint32_t *p) {return (__force __le32 )__swab32p (p); } -static inline __u32 __le32_to_cpup (const __le32 *p) +static inline uint32_t __le32_to_cpup (const __le32 *p) { -return __swab32p ((__u32 *)p); +return __swab32p ((const uint32_t *)p); }static inline __le16 __cpu_to_le16p (const uint16_t *p) {
@@ -68,13 +68,13 @@ static inline __u64 __be64_to_cpup(const {return (__force __u64)*p; } -static inline __be32 __cpu_to_be32p (const __u32 *p) +static inline __be32 __cpu_to_be32p (const uint32_t *p) {return (__force __be32)*p; } -static inline __u32 __be32_to_cpup (const __be32 *p) +static inline uint32_t __be32_to_cpup (const __be32 *p) { -return (__force __u32)*p; +return (__force uint32_t )*p; }static inline __be16 __cpu_to_be16p (const uint16_t *p) {
xen/include/xen/byteorder/little_endian.h +12 -12
@@ -13,26 +13,26 @@#define __constant_cpu_to_le64 (x) ((__force __le64)(__u64)(x))#define __constant_le64_to_cpu (x) ((__force __u64)(__le64)(x)) -#define __constant_cpu_to_le32 (x) ((__force __le32)(__u32)(x)) -#define __constant_le32_to_cpu (x) ((__force __u32)(__le32)(x)) +#define __constant_cpu_to_le32 (x) ((__force __le32)(uint32_t)(x)) +#define __constant_le32_to_cpu (x) ((__force uint32_t)(__le32)(x))#define __constant_cpu_to_le16 (x) ((__force __le16)(uint16_t)(x))#define __constant_le16_to_cpu (x) ((__force uint16_t)(__le16)(x))#define __constant_cpu_to_be64 (x) ((__force __be64)___constant_swab64((x)))#define __constant_be64_to_cpu (x) ___constant_swab64((__force __u64)(__be64)(x))#define __constant_cpu_to_be32 (x) ((__force __be32)___constant_swab32((x))) -#define __constant_be32_to_cpu (x) ___constant_swab32((__force __u32)(__be32)(x)) +#define __constant_be32_to_cpu (x) ___constant_swab32((__force uint32_t)(__be32)(x))#define __constant_cpu_to_be16 (x) ((__force __be16)___constant_swab16((x)))#define __constant_be16_to_cpu (x) ___constant_swab16((__force uint16_t)(__be16)(x))#define __cpu_to_le64 (x) ((__force __le64)(__u64)(x))#define __le64_to_cpu (x) ((__force __u64)(__le64)(x)) -#define __cpu_to_le32 (x) ((__force __le32)(__u32)(x)) -#define __le32_to_cpu (x) ((__force __u32)(__le32)(x)) +#define __cpu_to_le32 (x) ((__force __le32)(uint32_t)(x)) +#define __le32_to_cpu (x) ((__force uint32_t)(__le32)(x))#define __cpu_to_le16 (x) ((__force __le16)(uint16_t)(x))#define __le16_to_cpu (x) ((__force uint16_t)(__le16)(x))#define __cpu_to_be64 (x) ((__force __be64)__swab64((x)))#define __be64_to_cpu (x) __swab64((__force __u64)(__be64)(x))#define __cpu_to_be32 (x) ((__force __be32)__swab32((x))) -#define __be32_to_cpu (x) __swab32((__force __u32)(__be32)(x)) +#define __be32_to_cpu (x) __swab32((__force uint32_t)(__be32)(x))#define __cpu_to_be16 (x) ((__force __be16)__swab16((x)))#define __be16_to_cpu (x) __swab16((__force uint16_t)(__be16)(x))
@@ -44,13 +44,13 @@ static inline __u64 __le64_to_cpup(const {return (__force __u64)*p; } -static inline __le32 __cpu_to_le32p (const __u32 *p) +static inline __le32 __cpu_to_le32p (const uint32_t *p) {return (__force __le32)*p; } -static inline __u32 __le32_to_cpup (const __le32 *p) +static inline uint32_t __le32_to_cpup (const __le32 *p) { -return (__force __u32)*p; +return (__force uint32_t )*p; }static inline __le16 __cpu_to_le16p (const uint16_t *p) {
@@ -68,13 +68,13 @@ static inline __u64 __be64_to_cpup(const {return __swab64p ((__u64 *)p); } -static inline __be32 __cpu_to_be32p (const __u32 *p) +static inline __be32 __cpu_to_be32p (const uint32_t *p) {return (__force __be32 )__swab32p (p); } -static inline __u32 __be32_to_cpup (const __be32 *p) +static inline uint32_t __be32_to_cpup (const __be32 *p) { -return __swab32p ((__u32 *)p); +return __swab32p ((const uint32_t *)p); }static inline __be16 __cpu_to_be16p (const uint16_t *p) {
xen/include/xen/byteorder/swab.h +18 -19
@@ -12,7 +12,7 @@/* * Casts are necessary for constants, because we never know for sure how -* U/UL/ULL map to __u32, __u64. At least not in a portable way. +* UL/ULL map to __u64. At least not in a portable way. */ #define ___swab16 (x) \ ({ \
@@ -24,12 +24,12 @@#define ___swab32 (x) \ ({ \ - __u32 __x = (x); \ - ((__u32)( \ - (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | \ - (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | \ - (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | \ - (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); \ + uint32_t x_ = (x); \ + (uint32_t)( \ + (((uint32_t)(x_) & 0x000000ffU) << 24) | \ + (((uint32_t)(x_) & 0x0000ff00U) << 8) | \ + (((uint32_t)(x_) & 0x00ff0000U) >> 8) | \ + (((uint32_t)(x_) & 0xff000000U) >> 24)); \ })#define ___swab64 (x) \
@@ -51,11 +51,11 @@ (((uint16_t)(x) & 0x00ffU) << 8) | \ (((uint16_t)(x) & 0xff00U) >> 8)))#define ___constant_swab32 (x) \ - ((__u32)( \ - (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ - (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ - (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ - (((__u32)(x) & (__u32)0xff000000UL) >> 24) )) + ((uint32_t)( \ + (((uint32_t)(x) & 0x000000ffU) << 24) | \ + (((uint32_t)(x) & 0x0000ff00U) << 8) | \ + (((uint32_t)(x) & 0x00ff0000U) >> 8) | \ + (((uint32_t)(x) & 0xff000000U) >> 24)))#define ___constant_swab64 (x) \ ((__u64)( \ (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
@@ -74,7 +74,7 @@# define __arch__swab16 (x) ___swab16(x)#endif #ifndef __arch__swab32 -# define __arch__swab32 (x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); }) +# define __arch__swab32 (x) ___swab32(x)#endif #ifndef __arch__swab64# define __arch__swab64 (x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); })
@@ -110,7 +110,7 @@ ___swab16((x)) : \ __fswab16((x)))# define __swab32 (x) \ -(__builtin_constant_p((__u32)(x)) ? \ +(__builtin_constant_p((uint32_t)(x)) ? \ ___swab32((x)) : \ __fswab32((x)))# define __swab64 (x) \
@@ -137,15 +137,15 @@ static inline void __swab16s(uint16_t *a__arch__swab16s (addr); } -static inline attr_const __u32 __fswab32(__u32 x) +static inline attr_const uint32_t __fswab32(uint32_t x) {return __arch__swab32 (x); } -static inline __u32 __swab32p (const __u32 *x) +static inline uint32_t __swab32p (const uint32_t *x) {return __arch__swab32p (x); } -static inline void __swab32s (__u32 *addr) +static inline void __swab32s (uint32_t *addr) {__arch__swab32s (addr); }
@@ -154,8 +154,7 @@ static inline void __swab32s(__u32 *addr static inline attr_const __u64 __fswab64(__u64 x) {# ifdef __SWAB_64_THRU_32__ -__u32 h = x >>32 ; -__u32 l = x & ((1ULL <<32 )-1 ); +uint32_t h = x >>32 , l = x;return (((__u64 )__swab32 (l)) <<32 ) | ((__u64)(__swab32 (h)));# else return __arch__swab64 (x);
PATCH 3/7 Flask: replace uses of __u32
In reply to Jan Beulich... by uint32_t.
---
Uses of bool_val look suspicious; I looked at them because by its name I would have hoped I can switch it to bool instead.
xen/xsm/flask/ss/conditional.h +2 -2
@@ -29,8 +29,8 @@ struct cond_expr {#define COND_EQ 6/* bool == bool */ #define COND_NEQ 7/* bool != bool */ #define COND_LAST COND_NEQ -__u32 expr_type; -__u32 bool_val; +uint32_t expr_type; +uint32_t bool_val;struct cond_expr *next; };
xen/xsm/flask/ss/policydb.h +1 -1
@@ -131,7 +131,7 @@ struct range_trans {/* Boolean data type */ struct cond_bool_datum { -__u32 value;/* internal type value */ +uint32_t value;/* internal type value */ int state; };
Re: [PATCH 3/7] Flask: replace uses of __u32
Quoted 23 lines · Jan Beulich
... by
uint32_t.Signed-off-by Jan Beulich <[email protected]>---
Uses ofbool_vallook suspicious; I looked at them because by its name I would have hoped I can switch it to bool instead.xen/xsm/flask/ss/conditional.h +2
-2@@ -29,8 +29,8 @@ struct cond_expr {#define COND_EQ 6/* bool == bool */ #define COND_NEQ 7/* bool != bool */ #define COND_LAST COND_NEQ -__u32 expr_type; -__u32 bool_val; +uint32_t expr_type; +uint32_t bool_val;struct cond_expr *next; };
xen/xsm/flask/ss/policydb.h struct range_trans { · line 137
Quoted 8 lines
xen/xsm/flask/ss/policydb.h +1
-1@@ -131,7 +131,7 @@ struct range_trans {/* Boolean data type */ struct cond_bool_datum { -__u32 value;/* internal type value */ +uint32_t value;/* internal type value */ int state; };
PATCH 4/7 x86: modernize swab64()
In reply to Jan BeulichFor quite a while we didn't need to be concerned of 32-bit code generation anymore: Simply use the 64-bit form of BSWAP here.
xen/arch/x86/include/asm/byteorder.h +3 -10
@@ -10,17 +10,10 @@ static inline attr_const __u32 ___arch__return x; } -static inline attr_const __u64 ___arch__swab64(__u64 val) +static inline attr_const uint64_t ___arch__swab64(uint64_t x) { -union { -struct {__u32 a,b; } s; -__u64 u; - } v; - v.u = val; - asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" - :"=r" (v.s.a),"=r" (v.s.b) - :"0" (v.s.a),"1" (v.s.b)); -return v.u; + asm ("bswap %0" :"+r" (x) ); +return x; }/* Do not define swab16. Gcc is smart enough to recognize "C" version and
PATCH 5/7 types: replace remaining uses of __u32
In reply to Jan Beulich... and move the type itself to linux-compat.h.
While doing so drop casts (instead of modiyfing them) from x86'es wrmsrl().
xen/arch/x86/include/asm/byteorder.h +1 -1
@@ -4,7 +4,7 @@#include <xen/types.h> #include <xen/compiler.h> -static inline attr_const __u32 ___arch__swab32(__u32 x) +static inline attr_const uint32_t ___arch__swab32(uint32_t x) { asm("bswap %0" :"=r" (x) :"0" (x));return x;
xen/arch/x86/include/asm/msr.h +2 -3
@@ -33,9 +33,8 @@static inline void wrmsrl (unsigned int msr,__u64 val) { -__u32 lo, hi; - lo = (__u32 )val; - hi = (__u32)(val >>32 ); +uint32_t lo = val, hi = val >>32 ; +wrmsr (msr, lo, hi); }
xen/include/xen/bitops.h +2 -2
@@ -413,7 +413,7 @@ static inline int get_count_order(unsign* @word: value to rotate * @shift: bits to roll */ -static inline __u32 rol32 (__u32 word,unsigned int shift) +static inline uint32_t rol32 (uint32_t word,unsigned int shift) {return (word << shift) | (word >> (32 - shift)); }
@@ -424,7 +424,7 @@ static inline __u32 rol32(__u32 word, un* @word: value to rotate * @shift: bits to roll */ -static inline __u32 ror32 (__u32 word,unsigned int shift) +static inline uint32_t ror32 (uint32_t word,unsigned int shift) {return (word >> shift) | (word << (32 - shift)); }
xen/include/xen/linux-compat.h +1 -0
@@ -16,6 +16,7 @@ typedef uint8_t __u8;typedef int16_t s16 ,__s16 ;typedef uint16_t __u16 ;typedef int32_t s32 ,__s32 ; +typedef uint32_t __u32 ;typedef int64_t s64 ,__s64 ;typedef paddr_t phys_addr_t ;
xen/include/xen/types.h +3 -3
@@ -7,7 +7,7 @@/* Linux inherited types which are being phased out */ typedef uint8_t u8 ;typedef uint16_t u16 ; -typedef uint32_t u32 ,__u32 ; +typedef uint32_t u32 ;typedef uint64_t u64 ,__u64 ;#include <asm/types.h>
@@ -53,8 +53,8 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;typedef uint16_t __le16 ;typedef uint16_t __be16 ; -typedef __u32 __le32 ; -typedef __u32 __be32 ; +typedef uint32_t __le32 ; +typedef uint32_t __be32 ;typedef __u64 __le64 ;typedef __u64 __be64 ;
PATCH 6/7 byteorder: replace __u64
In reply to Jan BeulichIn {big,little}_endian.h the changes are entirely mechanical, except for dealing with casting away of const from pointers-to-const on lines touched anyway.
In swab.h the casting of constants is done away with as well - I simply don't see what the respective comment is concerned about in our environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on architecture, sizeof(long long) >= 8). The comment is certainly relevant in more general cases. Excess parentheses are dropped as well, ___swab64()'s local variable is renamed, and __arch__swab64()'s is dropped as being redundant with ___swab64()'s.
Excessive casts compared to ___{,constant_}swab{16,32}() are also dropped. Much like excessive ones in __fswab64().
---
I'm unconvinced of the need of the separate ___constant_swab64(). I'm also unconvinced of the need for some of said constants (that even had casts on them).
xen/include/xen/byteorder/big_endian.h +12 -12
@@ -12,37 +12,37 @@#include <xen/byteorder/swab.h> #define __constant_cpu_to_le64 (x) ((__force __le64)___constant_swab64((x))) -#define __constant_le64_to_cpu (x) ___constant_swab64((__force __u64)(__le64)(x)) +#define __constant_le64_to_cpu (x) ___constant_swab64((__force uint64_t)(__le64)(x))#define __constant_cpu_to_le32 (x) ((__force __le32)___constant_swab32((x)))#define __constant_le32_to_cpu (x) ___constant_swab32((__force uint32_t)(__le32)(x))#define __constant_cpu_to_le16 (x) ((__force __le16)___constant_swab16((x)))#define __constant_le16_to_cpu (x) ___constant_swab16((__force uint16_t)(__le16)(x)) -#define __constant_cpu_to_be64 (x) ((__force __be64)(__u64)(x)) -#define __constant_be64_to_cpu (x) ((__force __u64)(__be64)(x)) +#define __constant_cpu_to_be64 (x) ((__force __be64)(uint64_t)(x)) +#define __constant_be64_to_cpu (x) ((__force uint64_t)(__be64)(x))#define __constant_cpu_to_be32 (x) ((__force __be32)(uint32_t)(x))#define __constant_be32_to_cpu (x) ((__force uint32_t)(__be32)(x))#define __constant_cpu_to_be16 (x) ((__force __be16)(uint16_t)(x))#define __constant_be16_to_cpu (x) ((__force uint16_t)(__be16)(x))#define __cpu_to_le64 (x) ((__force __le64)__swab64((x))) -#define __le64_to_cpu (x) __swab64((__force __u64)(__le64)(x)) +#define __le64_to_cpu (x) __swab64((__force uint64_t)(__le64)(x))#define __cpu_to_le32 (x) ((__force __le32)__swab32((x)))#define __le32_to_cpu (x) __swab32((__force uint32_t)(__le32)(x))#define __cpu_to_le16 (x) ((__force __le16)__swab16((x)))#define __le16_to_cpu (x) __swab16((__force uint16_t)(__le16)(x)) -#define __cpu_to_be64 (x) ((__force __be64)(__u64)(x)) -#define __be64_to_cpu (x) ((__force __u64)(__be64)(x)) +#define __cpu_to_be64 (x) ((__force __be64)(uint64_t)(x)) +#define __be64_to_cpu (x) ((__force uint64_t)(__be64)(x))#define __cpu_to_be32 (x) ((__force __be32)(uint32_t)(x))#define __be32_to_cpu (x) ((__force uint32_t)(__be32)(x))#define __cpu_to_be16 (x) ((__force __be16)(uint16_t)(x))#define __be16_to_cpu (x) ((__force uint16_t)(__be16)(x)) -static inline __le64 __cpu_to_le64p (const __u64 *p) +static inline __le64 __cpu_to_le64p (const uint64_t *p) {return (__force __le64 )__swab64p (p); } -static inline __u64 __le64_to_cpup (const __le64 *p) +static inline uint64_t __le64_to_cpup (const __le64 *p) { -return __swab64p ((__u64 *)p); +return __swab64p ((const uint64_t *)p); }static inline __le32 __cpu_to_le32p (const uint32_t *p) {
@@ -60,13 +60,13 @@ static inline uint16_t __le16_to_cpup(co {return __swab16p ((const uint16_t *)p); } -static inline __be64 __cpu_to_be64p (const __u64 *p) +static inline __be64 __cpu_to_be64p (const uint64_t *p) {return (__force __be64)*p; } -static inline __u64 __be64_to_cpup (const __be64 *p) +static inline uint64_t __be64_to_cpup (const __be64 *p) { -return (__force __u64)*p; +return (__force uint64_t )*p; }static inline __be32 __cpu_to_be32p (const uint32_t *p) {
xen/include/xen/byteorder/little_endian.h +12 -12
@@ -11,38 +11,38 @@#include <xen/types.h> #include <xen/byteorder/swab.h> -#define __constant_cpu_to_le64 (x) ((__force __le64)(__u64)(x)) -#define __constant_le64_to_cpu (x) ((__force __u64)(__le64)(x)) +#define __constant_cpu_to_le64 (x) ((__force __le64)(uint64_t)(x)) +#define __constant_le64_to_cpu (x) ((__force uint64_t)(__le64)(x))#define __constant_cpu_to_le32 (x) ((__force __le32)(uint32_t)(x))#define __constant_le32_to_cpu (x) ((__force uint32_t)(__le32)(x))#define __constant_cpu_to_le16 (x) ((__force __le16)(uint16_t)(x))#define __constant_le16_to_cpu (x) ((__force uint16_t)(__le16)(x))#define __constant_cpu_to_be64 (x) ((__force __be64)___constant_swab64((x))) -#define __constant_be64_to_cpu (x) ___constant_swab64((__force __u64)(__be64)(x)) +#define __constant_be64_to_cpu (x) ___constant_swab64((__force uint64_t)(__be64)(x))#define __constant_cpu_to_be32 (x) ((__force __be32)___constant_swab32((x)))#define __constant_be32_to_cpu (x) ___constant_swab32((__force uint32_t)(__be32)(x))#define __constant_cpu_to_be16 (x) ((__force __be16)___constant_swab16((x)))#define __constant_be16_to_cpu (x) ___constant_swab16((__force uint16_t)(__be16)(x)) -#define __cpu_to_le64 (x) ((__force __le64)(__u64)(x)) -#define __le64_to_cpu (x) ((__force __u64)(__le64)(x)) +#define __cpu_to_le64 (x) ((__force __le64)(uint64_t)(x)) +#define __le64_to_cpu (x) ((__force uint64_t)(__le64)(x))#define __cpu_to_le32 (x) ((__force __le32)(uint32_t)(x))#define __le32_to_cpu (x) ((__force uint32_t)(__le32)(x))#define __cpu_to_le16 (x) ((__force __le16)(uint16_t)(x))#define __le16_to_cpu (x) ((__force uint16_t)(__le16)(x))#define __cpu_to_be64 (x) ((__force __be64)__swab64((x))) -#define __be64_to_cpu (x) __swab64((__force __u64)(__be64)(x)) +#define __be64_to_cpu (x) __swab64((__force uint64_t)(__be64)(x))#define __cpu_to_be32 (x) ((__force __be32)__swab32((x)))#define __be32_to_cpu (x) __swab32((__force uint32_t)(__be32)(x))#define __cpu_to_be16 (x) ((__force __be16)__swab16((x)))#define __be16_to_cpu (x) __swab16((__force uint16_t)(__be16)(x)) -static inline __le64 __cpu_to_le64p (const __u64 *p) +static inline __le64 __cpu_to_le64p (const uint64_t *p) {return (__force __le64)*p; } -static inline __u64 __le64_to_cpup (const __le64 *p) +static inline uint64_t __le64_to_cpup (const __le64 *p) { -return (__force __u64)*p; +return (__force uint64_t )*p; }static inline __le32 __cpu_to_le32p (const uint32_t *p) {
@@ -60,13 +60,13 @@ static inline uint16_t __le16_to_cpup(co {return (__force uint16_t )*p; } -static inline __be64 __cpu_to_be64p (const __u64 *p) +static inline __be64 __cpu_to_be64p (const uint64_t *p) {return (__force __be64 )__swab64p (p); } -static inline __u64 __be64_to_cpup (const __be64 *p) +static inline uint64_t __be64_to_cpup (const __be64 *p) { -return __swab64p ((__u64 *)p); +return __swab64p ((const uint64_t *)p); }static inline __be32 __cpu_to_be32p (const uint32_t *p) {
xen/include/xen/byteorder/swab.h +25 -29
100 lines not on this page · raw message
PATCH 7/7 types: replace remaining use of __u64
In reply to Jan Beulich... and move the type itself to linux-compat.h.
xen/arch/x86/include/asm/msr.h +1 -1
@@ -31,7 +31,7 @@ : /* no outputs */ \ : "c" (msr), "a" (val1), "d" (val2)) -static inline void wrmsrl (unsigned int msr,__u64 val) +static inline void wrmsrl (unsigned int msr,uint64_t val) {uint32_t lo = val, hi = val >>32 ;
xen/include/xen/linux-compat.h +1 -0
@@ -18,6 +18,7 @@ typedef uint16_t __u16;typedef int32_t s32 ,__s32 ;typedef uint32_t __u32 ;typedef int64_t s64 ,__s64 ; +typedef uint64_t __u64 ;typedef paddr_t phys_addr_t ;
xen/include/xen/types.h +3 -3
@@ -8,7 +8,7 @@typedef uint8_t u8 ;typedef uint16_t u16 ;typedef uint32_t u32 ; -typedef uint64_t u64 ,__u64 ; +typedef uint64_t u64 ;#include <asm/types.h>
@@ -55,8 +55,8 @@ typedef uint16_t __le16;typedef uint16_t __be16 ;typedef uint32_t __le32 ;typedef uint32_t __be32 ; -typedef __u64 __le64 ; -typedef __u64 __be64 ; +typedef uint64_t __le64 ; +typedef uint64_t __be64 ; typedef unsigned int __attribute__((__mode__(__pointer__))) uintptr_t;
Quoted 11 lines · Jan Beulich
1: byteorder: replace
__u16
2: byteorder: replace__u32
3: Flask: replace uses of__u32
4: x86: modernizeswab64()
5: types: replace remaining uses of__u32
6: byteorder: replace__u64
7: types: replace remaining use of__u64Jan
For the series
Frediano