fixed width type adjustments
v2 cover fixed width type adjustments
Patch 1 significantly reduced from Andrew's introduction of xen/stdint.h.
1: move Linux-inherited fixed width type decls to common header 2: __u8 is history
Jan
PATCH v2 1/2 common: move Linux-inherited fixed width type decls to common header
Have these in one place, for all architectures to use. Also use the C99 types as the "original" ones, and derive the Linux compatible ones (which we're trying to phase out). For __s<N>, seeing that no uses exist anymore, move them to a new Linux compatibility header (as an act of precaution - as said, we don't have any uses of these types right now).
In some Flask sources inclusion of asm/byteorder.h needs moving later.
No functional change intended.
---
v2: This is the residual (extended to PPC) of an earlier larger patch
which was partly replaced by introducing xen/stdint.h.
xen/arch/arm/include/asm/types.h +4 -14
@@ -1,18 +1,7 @@#ifndef __ARM_TYPES_H__#define __ARM_TYPES_H__ -typedef signed char s8 ; -typedef unsigned char u8 ; - -typedef signed short s16 ; -typedef unsigned short u16 ; - -typedef signed int s32 ; -typedef unsigned int u32 ; -#if defined(CONFIG_ARM_32 ) -typedef signed long long s64 ; -typedef unsigned long long u64 ;typedef u32 vaddr_t ;#define PRIvaddr PRIx32#if defined(CONFIG_PHYS_ADDR_T_32 )
@@ -34,9 +23,9 @@ typedef u64 paddr_t;#endif typedef u32 register_t ;#define PRIregister "08x" -#elif defined (CONFIG_ARM_64) -typedef signed long s64 ; -typedef unsigned long u64 ; + +#elif defined(CONFIG_ARM_64) +typedef u64 vaddr_t ;#define PRIvaddr PRIx64typedef u64 paddr_t ;
@@ -44,6 +33,7 @@ typedef u64 paddr_t;#define PRIpaddr "016lx"typedef u64 register_t ;#define PRIregister "016lx" +#endif #endif /* __ARM_TYPES_H__ */
xen/arch/ppc/include/asm/types.h +0 -11
@@ -3,17 +3,6 @@#ifndef _ASM_PPC_TYPES_H#define _ASM_PPC_TYPES_H -typedef signed char s8 ; -typedef unsigned char u8 ; - -typedef signed short s16 ; -typedef unsigned short u16 ; - -typedef signed int s32 ; -typedef unsigned int u32 ; - -typedef signed long s64 ; -typedef unsigned long u64 ;typedef unsigned long paddr_t ;#define INVALID_PADDR (~0UL)#define PRIpaddr "016lx"
xen/arch/riscv/include/asm/types.h +0 -13
@@ -3,19 +3,8 @@#ifndef __RISCV_TYPES_H__#define __RISCV_TYPES_H__ -typedef signed char s8 ; -typedef unsigned char u8 ; - -typedef signed short s16 ; -typedef unsigned short u16 ; - -typedef signed int s32 ; -typedef unsigned int u32 ; -#if defined(CONFIG_RISCV_32 ) -typedef signed long long s64 ; -typedef unsigned long long u64 ;typedef u32 vaddr_t ;#define PRIvaddr PRIx32typedef u64 paddr_t ;
@@ -26,8 +15,6 @@ typedef u32 register_t;#elif defined (CONFIG_RISCV_64 ) -typedef signed long s64 ; -typedef unsigned long u64 ;typedef u64 vaddr_t ;#define PRIvaddr PRIx64typedef u64 paddr_t ;
xen/arch/x86/include/asm/types.h +0 -11
@@ -1,17 +1,6 @@#ifndef __X86_TYPES_H__#define __X86_TYPES_H__ -typedef signed char s8 ; -typedef unsigned char u8 ; - -typedef signed short s16 ; -typedef unsigned short u16 ; - -typedef signed int s32 ; -typedef unsigned int u32 ; - -typedef signed long s64 ; -typedef unsigned long u64 ;typedef unsigned long paddr_t ;#define INVALID_PADDR (~0UL)#define PRIpaddr "016lx"
xen/include/xen/linux-compat.h new file +19 -0
@@ -0,0 +1,19 @@ +/****************************************************************************** +* linux-compat.h +* +* Container for types and other definitions use in Linux (and hence in files +* we "steal" from there), but which shouldn't be used (anymore) in normal Xen +* files. +*/ + +#ifndef __XEN_LINUX_COMPAT_H__ +#define __XEN_LINUX_COMPAT_H__ + +#include <xen/types.h> + +typedef int8_t __s8 ; +typedef int16_t __s16 ; +typedef int32_t __s32 ; +typedef int64_t __s64 ; + +#endif /* __XEN_LINUX_COMPAT_H__ */
xen/include/xen/types.h +10 -9
@@ -4,6 +4,16 @@#include <xen/stdbool.h> #include <xen/stdint.h> +/* Linux inherited types which are being phased out */ +typedef int8_t s8 ; +typedef uint8_t u8 ,__u8 ; +typedef int16_t s16 ; +typedef uint16_t u16 ,__u16 ; +typedef int32_t s32 ; +typedef uint32_t u32 ,__u32 ; +typedef int64_t s64 ; +typedef uint64_t u64 ,__u64 ; +#include <asm/types.h> typedef __SIZE_TYPE__ size_t ;
@@ -40,15 +50,6 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;#define LONG_MIN (-LONG_MAX - 1)#define ULONG_MAX (~0UL) -typedef uint8_t __u8 ; -typedef int8_t __s8 ; -typedef uint16_t __u16 ; -typedef int16_t __s16 ; -typedef uint32_t __u32 ; -typedef int32_t __s32 ; -typedef uint64_t __u64 ; -typedef int64_t __s64 ; -typedef __u16 __le16 ;typedef __u16 __be16 ;typedef __u32 __le32 ;
xen/xsm/flask/ss/conditional.c +2 -1
@@ -9,7 +9,6 @@/* Ported to Xen 3.0, George Coker, <[email protected]> */ -#include <asm/byteorder.h> #include <xen/lib.h> #include <xen/types.h> #include <xen/errno.h>
@@ -17,6 +16,8 @@#include <xen/spinlock.h> #include <xen/xmalloc.h> +#include <asm/byteorder.h> +#include "security.h" #include "conditional.h"
xen/xsm/flask/ss/ebitmap.c +3 -1
@@ -10,12 +10,14 @@/* Ported to Xen 3.0, George Coker, <[email protected]> */ -#include <asm/byteorder.h> #include <xen/lib.h> #include <xen/xmalloc.h> #include <xen/errno.h> #include <xen/spinlock.h> #include <xen/bitmap.h> + +#include <asm/byteorder.h> +#include "ebitmap.h" #include "policydb.h"
xen/xsm/flask/ss/policydb.c +3 -1
@@ -22,12 +22,14 @@/* Ported to Xen 3.0, George Coker, <[email protected]> */ -#include <asm/byteorder.h> #include <xen/lib.h> #include <xen/types.h> #include <xen/xmalloc.h> #include <xen/string.h> #include <xen/errno.h> + +#include <asm/byteorder.h> +#include <conditional.h> #include "security.h"
Re: [PATCH v2 1/2] common: move Linux-inherited fixed width type decls to common header
Quoted 7 lines · Jan Beulich
Have these in one place, for all architectures to use. Also use the C99 types as the "original" ones, and derive the Linux compatible ones (which we're trying to phase out). For __s<N>, seeing that no uses exist anymore, move them to a new Linux compatibility header (as an act of precaution - as said, we don't have any uses of these types right now).
In some Flask sources inclusion of
asm/byteorder.hneeds moving later.
I just did a test build against staging for x86 with all asm/byteorder.h includes removed from FLASK and it built successfully. If there are no object to a small non-functional change patch, I can clean up include ordering as well and submit it to xen-devel.
v/r,
dps
Re: [PATCH v2 1/2] common: move Linux-inherited fixed width type decls to common header
Quoted 7 lines · Daniel P. Smith
Quoted 6 lines · Jan Beulich
Have these in one place, for all architectures to use. Also use the C99 types as the "original" ones, and derive the Linux compatible ones (which we're trying to phase out). For __s<N>, seeing that no uses exist anymore, move them to a new Linux compatibility header (as an act of precaution - as said, we don't have any uses of these types right now).
Quoted 6 lines
Quoted 1 line
In some Flask sources inclusion of
asm/byteorder.hneeds moving later.I just did a test build against staging for x86 with all
asm/byteorder.hincludes removed from FLASK and it built successfully. If there are no object to a small non-functional change patch, I can clean up include ordering as well and submit it to xen-devel.
Of course, please go ahead. Simplifies the patch here.
Jan
Re: [PATCH v2 1/2] common: move Linux-inherited fixed width type decls to common header
In reply to Jan BeulichQuoted 11 lines · Jan Beulich
Have these in one place, for all architectures to use. Also use the C99 types as the "original" ones, and derive the Linux compatible ones (which we're trying to phase out). For __s<N>, seeing that no uses exist anymore, move them to a new Linux compatibility header (as an act of precaution - as said, we don't have any uses of these types right now).
In some Flask sources inclusion of
asm/byteorder.hneeds moving later.No functional change intended.
Signed-off-by Jan Beulich <[email protected]>
Re: [PATCH v2 1/2] common: move Linux-inherited fixed width type decls to common header
In reply to Jan BeulichHi Jan,
Quoted 11 lines · Jan Beulich
Have these in one place, for all architectures to use. Also use the C99 types as the "original" ones, and derive the Linux compatible ones (which we're trying to phase out). For __s<N>, seeing that no uses exist anymore, move them to a new Linux compatibility header (as an act of precaution - as said, we don't have any uses of these types right now).
In some Flask sources inclusion of
asm/byteorder.hneeds moving later.No functional change intended.
Signed-off-by Jan Beulich <[email protected]>
With one remark:
Quoted 26 lines
---
v2: This is the residual (extended to PPC) of an earlier larger patch
which was partly replaced by introducingxen/stdint.h.xen/arch/arm/include/asm/types.h +0
-11@@ -1,18 +1,7 @@#ifndef __ARM_TYPES_H__#define __ARM_TYPES_H__ -typedef signed char s8 ; -typedef unsigned char u8 ; - -typedef signed short s16 ; -typedef unsigned short u16 ; - -typedef signed int s32 ; -typedef unsigned int u32 ; -#if defined(CONFIG_ARM_32 ) -typedef signed long long s64 ; -typedef unsigned long long u64 ;typedef u32 vaddr_t ;#define PRIvaddr PRIx32#if defined(CONFIG_PHYS_ADDR_T_32 )
xen/arch/arm/include/asm/types.h typedef u64 paddr_t; · line 23
Quoted 1 line
xen/arch/arm/include/asm/types.h +0
-0@@ -34,9 +23,9 @@ typedef u64 paddr_t;#endif
I find odd that you don't add a newline before/after #endif here but...
Quoted 12 lines
xen/arch/arm/include/asm/types.h +3
-3typedef u32 register_t ;#define PRIregister "08x" -#elif defined (CONFIG_ARM_64 ) -typedef signed long s64 ; -typedef unsigned long u64 ; + +#elif defined(CONFIG_ARM_64 ) +typedef u64 vaddr_t ;#define PRIvaddr PRIx64typedef u64 paddr_t ;
xen/arch/arm/include/asm/types.h typedef u64 paddr_t; · line 36
Quoted 4 lines
xen/arch/arm/include/asm/types.h +1
-0@@ -44,6 +33,7 @@ typedef u64 paddr_t;#define PRIpaddr "016lx"typedef u64 register_t ;#define PRIregister "016lx" +
.. you add one here. But this change looks a bit unrelated and IMHO of out context.
xen/arch/arm/include/asm/types.h typedef u64 paddr_t;
Quoted 4 lines
xen/arch/arm/include/asm/types.h +0
-1#endif #endif /* __ARM_TYPES_H__ */ --- a/xen/arch/ppc/include/asm/types.h
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v2 1/2] common: move Linux-inherited fixed width type decls to common header
Quoted 9 lines · Julien Grall
Quoted 8 lines · Jan Beulich
Have these in one place, for all architectures to use. Also use the C99 types as the "original" ones, and derive the Linux compatible ones (which we're trying to phase out). For __s<N>, seeing that no uses exist anymore, move them to a new Linux compatibility header (as an act of precaution - as said, we don't have any uses of these types right now).
In some Flask sources inclusion of
asm/byteorder.hneeds moving later.
Quoted 7 lines
Quoted 3 lines
No functional change intended.
Signed-off-by Jan Beulich <[email protected]>With one remark:
Acked-by Julien Grall <[email protected]>
Thanks.
Quoted 37 lines
Quoted 22 lines
xen/arch/arm/include/asm/types.h +0
-11@@ -1,18 +1,7 @@#ifndef __ARM_TYPES_H__#define __ARM_TYPES_H__ -typedef signed char s8 ; -typedef unsigned char u8 ; - -typedef signed short s16 ; -typedef unsigned short u16 ; - -typedef signed int s32 ; -typedef unsigned int u32 ; -#if defined(CONFIG_ARM_32 ) -typedef signed long long s64 ; -typedef unsigned long long u64 ;typedef u32 vaddr_t ;#define PRIvaddr PRIx32#if defined(CONFIG_PHYS_ADDR_T_32 )xen/arch/arm/include/asm/types.h typedef u64 paddr_t; · line 23
Quoted 1 line
xen/arch/arm/include/asm/types.h +0
-0@@ -34,9 +23,9 @@ typedef u64 paddr_t;#endif I find odd that you don't add a newline before/after #endif here but...
Quoted 11 lines
xen/arch/arm/include/asm/types.h +3
-3typedef u32 register_t ;#define PRIregister "08x" -#elif defined (CONFIG_ARM_64 ) -typedef signed long s64 ; -typedef unsigned long u64 ; + +#elif defined(CONFIG_ARM_64 ) +typedef u64 vaddr_t ;#define PRIvaddr PRIx64typedef u64 paddr_t ;
Quoted 12 lines
xen/arch/arm/include/asm/types.h typedef u64 paddr_t; · line 36
Quoted 5 lines
xen/arch/arm/include/asm/types.h +1
-0@@ -44,6 +33,7 @@ typedef u64 paddr_t;#define PRIpaddr "016lx"typedef u64 register_t ;#define PRIregister "016lx" +.. you add one here. But this change looks a bit unrelated and IMHO of out context.
Quoted 3 lines
xen/arch/arm/include/asm/types.h +0
-0#endif #endif /* __ARM_TYPES_H__ */
Hmm, I think I was mistaking the blank line after
#if defined(CONFIG_PHYS_ADDR_T_32)
as the matching one. Which way would you prefer me to resolve the
inconsistency: Add the missing blank line, or drop again the three ones I'm presently adding?
Jan
Re: [PATCH v2 1/2] common: move Linux-inherited fixed width type decls to common header
Quoted 70 lines · Jan Beulich
Quoted 9 lines · Julien Grall
Quoted 8 lines · Jan Beulich
Have these in one place, for all architectures to use. Also use the C99 types as the "original" ones, and derive the Linux compatible ones (which we're trying to phase out). For __s<N>, seeing that no uses exist anymore, move them to a new Linux compatibility header (as an act of precaution - as said, we don't have any uses of these types right now).
In some Flask sources inclusion of
asm/byteorder.hneeds moving later.Quoted 7 lines
Quoted 3 lines
No functional change intended.
Signed-off-by Jan Beulich <[email protected]>With one remark:
Acked-by Julien Grall <[email protected]>Thanks.
Quoted 37 lines
Quoted 22 lines
xen/arch/arm/include/asm/types.h +0
-11@@ -1,18 +1,7 @@#ifndef __ARM_TYPES_H__#define __ARM_TYPES_H__ -typedef signed char s8 ; -typedef unsigned char u8 ; - -typedef signed short s16 ; -typedef unsigned short u16 ; - -typedef signed int s32 ; -typedef unsigned int u32 ; -#if defined(CONFIG_ARM_32 ) -typedef signed long long s64 ; -typedef unsigned long long u64 ;typedef u32 vaddr_t ;#define PRIvaddr PRIx32#if defined(CONFIG_PHYS_ADDR_T_32 )xen/arch/arm/include/asm/types.h typedef u64 paddr_t; · line 23
Quoted 1 line
xen/arch/arm/include/asm/types.h +0
-0@@ -34,9 +23,9 @@ typedef u64 paddr_t;#endif I find odd that you don't add a newline before/after #endif here but...
Quoted 11 lines
xen/arch/arm/include/asm/types.h +3
-3typedef u32 register_t ;#define PRIregister "08x" -#elif defined (CONFIG_ARM_64 ) -typedef signed long s64 ; -typedef unsigned long u64 ; + +#elif defined(CONFIG_ARM_64 ) +typedef u64 vaddr_t ;#define PRIvaddr PRIx64typedef u64 paddr_t ;Quoted 12 lines
xen/arch/arm/include/asm/types.h typedef u64 paddr_t; · line 36
Quoted 5 lines
xen/arch/arm/include/asm/types.h +1
-0@@ -44,6 +33,7 @@ typedef u64 paddr_t;#define PRIpaddr "016lx"typedef u64 register_t ;#define PRIregister "016lx" +.. you add one here. But this change looks a bit unrelated and IMHO of out context.
Quoted 3 lines
xen/arch/arm/include/asm/types.h +0
-0#endif #endif /* __ARM_TYPES_H__ */
Quoted 7 lines
Hmm, I think I was mistaking the blank line after
#if
defined(CONFIG_PHYS_ADDR_T_32)as the matching one. Which way would you prefer me to resolve the
inconsistency: Add the missing blank line, or drop again the three ones I'm presently adding?
I would be ok with adding the missing blank line.
Cheers,
Signature · 1 line
Julien Grall
PATCH v2 2/2 common: __u8 is history
In reply to Jan BeulichWith the last uses gone, move the type to linux-compat.h.
No functional change intended.
---
The primary use of __u{16,32,64} is in the byte-order headers. Iirc there is a series re-working part of that, so I guess before touching the logic there that other series would better land first.
xen/include/xen/linux-compat.h +1 -0
@@ -12,6 +12,7 @@#include <xen/types.h> typedef int8_t __s8 ; +typedef uint8_t __u8 ;typedef int16_t __s16 ;typedef int32_t __s32 ;typedef int64_t __s64 ;
xen/include/xen/types.h +1 -1
@@ -6,7 +6,7 @@/* Linux inherited types which are being phased out */ typedef int8_t s8 ; -typedef uint8_t u8 ,__u8 ; +typedef uint8_t u8 ;typedef int16_t s16 ;typedef uint16_t u16 ,__u16 ;typedef int32_t s32 ;