Skip to contentSkip to conversation

include/linux/coda.h: remove useless '#else'

PATCH Applied Chen Gang 4 participants 12 messages Jul 30, 2013 – Aug 5, 2013

Subsystems (2)
lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 include/linux/coda.h: remove useless '#else'

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h +0 -1
index cff544f..d30209b 100644
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 
Signature · 1 line
1.7.7.6
Applied
#1 lore raw
Quoted 12 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h +0 -0
index cff544f..d30209b 100644

include/linux/coda.h Mellon the rights to redistribute these changes without encumbrance. · line 65

Quoted 7 lines
include/linux/coda.h +0 -1
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 

Applied.

Signature · 2 lines
Jiri Kosina
SUSE Labs
author
#2 lore raw
Quoted 15 lines · Jiri Kosina
Quoted 13 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h +0 -0
index cff544f..d30209b 100644
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
Quoted 9 lines

include/linux/coda.h Mellon the rights to redistribute these changes without encumbrance. · line 65

Quoted 6 lines
include/linux/coda.h +0 -1
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 

Applied.

Thanks.

Signature · 1 line
Chen Gang
#3 lore raw
In reply to Chen Gang
Quoted 12 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h +0 -0
index cff544f..d30209b 100644

include/linux/coda.h Mellon the rights to redistribute these changes without encumbrance. · line 65

Quoted 7 lines
include/linux/coda.h +0 -1
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 

Why have the #if at all?

author
#4 lore raw
Quoted 14 lines · Joe Perches
Quoted 13 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h +0 -0
index cff544f..d30209b 100644
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
Quoted 11 lines

include/linux/coda.h Mellon the rights to redistribute these changes without encumbrance. · line 65

Quoted 6 lines
include/linux/coda.h +0 -1
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 

Why have the #if at all?

Hmm... some old version compilers do not define __linux__ automatically (e.g. or32-linux-gcc 4.5.1-or32-1.0rc1, which is the latest cross compiler for openrisc, though).

If not define __linux__, the compiler will report error (u_quad_t is not defined).

When we remove "#if defined(__linux__)" from "include/linux/coda.h", the compiler will not report error, and 'cdev_t' will be defined as 'dev_t', not 'u_quad_t' (I guess, it is an implicit bug).

In "uapi/include/*", only "coda.h" has "#if defined(__linux__)", maybe they want multiple OS can share the same "coda.h" file (at least, we can not say it is a bad idea).

Neither suitable to define __linux__ in "include/linux/coda.h".

All together, I think:

the direct cause:
"uapi/include/coda.h" wants to share itself for multiple OS (so they need check __linux__).
(in "uapi/include/*", only coda.h need check __linux__)

the root cause:
the compiler for linux should define __linux__ automatically, the latest version of gcc has done, but some of the old version is not. most of cross compilers have merged their code into gcc main tree, but still left some (e.g. openrisc).
(at least, I can not build openrisc from gcc main tree correctly, but most of others can)
some of latest cross compilers still use old version of gcc, (still not define __linux__ automatically).

The related code in "uapi/linux/coda.h" is below:

-------------------------------code begin-------------------------------

73 #if defined(DJGPP) || defined(__CYGWIN32__)
74 #ifdef KERNEL
75 typedef unsigned long u_long;
76 typedef unsigned int u_int;
77 typedef unsigned short u_short;
78 typedef u_long ino_t;
79 typedef u_long dev_t;
80 typedef void * caddr_t;
81 #ifdef DOS
82 typedef unsigned __int64 u_quad_t;
83 #else
84 typedef unsigned long long u_quad_t;
85 #endif
86
87 #define inline
88
89 struct timespec {

 90         long       ts_sec;
 91         long       ts_nsec;

92 };
93 #else /* DJGPP but not KERNEL */
94 #include <sys/time.h>
95 typedef unsigned long long u_quad_t;
96 #endif /* !KERNEL */
97 #endif /* !DJGPP */
98
99
100 #if defined(__linux__)
101 #include <linux/time.h>
102 #define cdev_t u_quad_t
103 #ifndef __KERNEL__
104 #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) 105 #define _UQUAD_T_ 1
106 typedef unsigned long long u_quad_t;
107 #endif
108 #endif /* __KERNEL__ */
109 #else
110 #define cdev_t dev_t
111 #endif
112

-------------------------------code end---------------------------------

Thanks.

Signature · 1 line
Chen Gang
author
#5 lore raw
Quoted 52 lines · Chen Gang
Quoted 14 lines · Joe Perches
Quoted 13 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h +0 -0
index cff544f..d30209b 100644
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
Quoted 11 lines

include/linux/coda.h Mellon the rights to redistribute these changes without encumbrance. · line 65

Quoted 6 lines
include/linux/coda.h +0 -1
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 

Why have the #if at all?

Hmm... some old version compilers do not define __linux__ automatically (e.g. or32-linux-gcc 4.5.1-or32-1.0rc1, which is the latest cross compiler for openrisc, though).

If not define __linux__, the compiler will report error (u_quad_t is not defined).

When we remove "#if defined(__linux__)" from "include/linux/coda.h", the compiler will not report error, and 'cdev_t' will be defined as 'dev_t', not 'u_quad_t' (I guess, it is an implicit bug).

In "uapi/include/*", only "coda.h" has "#if defined(__linux__)", maybe they want multiple OS can share the same "coda.h" file (at least, we can not say it is a bad idea).

Neither suitable to define __linux__ in "include/linux/coda.h".

All together, I think:

the direct cause:
"uapi/include/coda.h" wants to share itself for multiple OS (so they need check __linux__).
(in "uapi/include/*", only coda.h need check __linux__)

Quoted 6 lines

the root cause:
the compiler for linux should define __linux__ automatically, the latest version of gcc has done, but some of the old version is not. most of cross compilers have merged their code into gcc main tree, but still left some (e.g. openrisc).
(at least, I can not build openrisc from gcc main tree correctly, but most of others can)
some of latest cross compilers still use old version of gcc, (still not define __linux__ automatically).

Maybe what I said is incorrect (it is just my current understanding).

Welcome any other members' suggestions or completions for discussing and checking.

Thanks.

Quoted 51 lines

The related code in "uapi/linux/coda.h" is below:

-------------------------------code begin-------------------------------

73 #if defined(DJGPP) || defined(__CYGWIN32__)
74 #ifdef KERNEL
75 typedef unsigned long u_long;
76 typedef unsigned int u_int;
77 typedef unsigned short u_short;
78 typedef u_long ino_t;
79 typedef u_long dev_t;
80 typedef void * caddr_t;
81 #ifdef DOS
82 typedef unsigned __int64 u_quad_t;
83 #else
84 typedef unsigned long long u_quad_t;
85 #endif
86
87 #define inline
88
89 struct timespec {

 90         long       ts_sec;
 91         long       ts_nsec;

92 };
93 #else /* DJGPP but not KERNEL */
94 #include <sys/time.h>
95 typedef unsigned long long u_quad_t;
96 #endif /* !KERNEL */
97 #endif /* !DJGPP */
98
99
100 #if defined(__linux__)
101 #include <linux/time.h>
102 #define cdev_t u_quad_t
103 #ifndef __KERNEL__
104 #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) 105 #define _UQUAD_T_ 1
106 typedef unsigned long long u_quad_t;
107 #endif
108 #endif /* __KERNEL__ */
109 #else
110 #define cdev_t dev_t
111 #endif
112

-------------------------------code end---------------------------------

Thanks.

Signature · 1 line
Chen Gang
#6 lore raw
Quoted 16 lines · Chen Gang
Quoted 15 lines · Chen Gang
Quoted 14 lines · Joe Perches
Quoted 13 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h +0 -0
index cff544f..d30209b 100644
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
Quoted 12 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
include/linux/coda.h +0 -1
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 
Quoted 5 lines
Quoted 4 lines

Why have the #if at all?

OH, sorry, what I said about openrisc cross-compiler is not precise.

Need a patch for openrisc (just like another architectures have done):

-------------------------------diff begin-------------------------------

arch/openrisc/Makefile +1 -1
index 4739b83..89076a6 100644
@@ -24,7 +24,7 @@ OBJCOPYFLAGS    := -O binary -R .note -R .comment -S
 LDFLAGS_vmlinux :=
 LIBGCC 		:= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
-KBUILD_CFLAGS	+= -pipe -ffixed-r10
+KBUILD_CFLAGS	+= -pipe -ffixed-r10 -D__linux__
 
 ifeq ($(CONFIG_OPENRISC_HAVE_INST_MUL),y)
 	KBUILD_CFLAGS += $(call cc-option,-mhard-mul)

-------------------------------diff end---------------------------------

But for "include/linux/coda.h", I still suggest to check __linux__ whether defined, at least it can find the building issues.

And next, I will send the related patch to openrisc mailing list.

:-)

Thanks.

Quoted 92 lines
Quoted 25 lines

Hmm... some old version compilers do not define __linux__ automatically (e.g. or32-linux-gcc 4.5.1-or32-1.0rc1, which is the latest cross compiler for openrisc, though).

If not define __linux__, the compiler will report error (u_quad_t is not defined).

When we remove "#if defined(__linux__)" from "include/linux/coda.h", the compiler will not report error, and 'cdev_t' will be defined as 'dev_t', not 'u_quad_t' (I guess, it is an implicit bug).

In "uapi/include/*", only "coda.h" has "#if defined(__linux__)", maybe they want multiple OS can share the same "coda.h" file (at least, we can not say it is a bad idea).

Neither suitable to define __linux__ in "include/linux/coda.h".

All together, I think:

the direct cause:
"uapi/include/coda.h" wants to share itself for multiple OS (so they need check __linux__).
(in "uapi/include/*", only coda.h need check __linux__)

Quoted 6 lines

the root cause:
the compiler for linux should define __linux__ automatically, the latest version of gcc has done, but some of the old version is not. most of cross compilers have merged their code into gcc main tree, but still left some (e.g. openrisc).
(at least, I can not build openrisc from gcc main tree correctly, but most of others can)
some of latest cross compilers still use old version of gcc, (still not define __linux__ automatically).

Maybe what I said is incorrect (it is just my current understanding).

Welcome any other members' suggestions or completions for discussing and checking.

Thanks.

Quoted 51 lines

The related code in "uapi/linux/coda.h" is below:

-------------------------------code begin-------------------------------

73 #if defined(DJGPP) || defined(__CYGWIN32__)
74 #ifdef KERNEL
75 typedef unsigned long u_long;
76 typedef unsigned int u_int;
77 typedef unsigned short u_short;
78 typedef u_long ino_t;
79 typedef u_long dev_t;
80 typedef void * caddr_t;
81 #ifdef DOS
82 typedef unsigned __int64 u_quad_t;
83 #else
84 typedef unsigned long long u_quad_t;
85 #endif
86
87 #define inline
88
89 struct timespec {

 90         long       ts_sec;
 91         long       ts_nsec;

92 };
93 #else /* DJGPP but not KERNEL */
94 #include <sys/time.h>
95 typedef unsigned long long u_quad_t;
96 #endif /* !KERNEL */
97 #endif /* !DJGPP */
98
99
100 #if defined(__linux__)
101 #include <linux/time.h>
102 #define cdev_t u_quad_t
103 #ifndef __KERNEL__
104 #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) 105 #define _UQUAD_T_ 1
106 typedef unsigned long long u_quad_t;
107 #endif
108 #endif /* __KERNEL__ */
109 #else
110 #define cdev_t dev_t
111 #endif
112

-------------------------------code end---------------------------------

Thanks.

Signature · 1 line
Chen Gang
author
#7 lore raw
Quoted 17 lines · Chen Gang F T
Quoted 16 lines · Chen Gang
Quoted 15 lines · Chen Gang
Quoted 14 lines · Joe Perches
Quoted 13 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h +0 -0
index cff544f..d30209b 100644
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

include/linux/coda.h Mellon the rights to redistribute these changes without encumbrance. · line 65

Quoted 6 lines
include/linux/coda.h +0 -1
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 

Why have the #if at all?

Hmm... if any members have some questions about the fix, commonly it means the related fix need additional improvement.

Is it better to use BUILD_BUG() for the fix ? e.g. the diff may like below (based on the applied patch):

-----------------------------diff begin----------------------------

include/linux/coda.h +6 -1
index d30209b..5f87d5d 100644
@@ -60,6 +60,11 @@ Mellon the rights to redistribute these changes without encumbrance.
 
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#endif
+#else
+#include <linux/bug.h>
+BUILD_BUG();
+#endif /* !__linux__ */
+
 #include <uapi/linux/coda.h>
+
 #endif 

-----------------------------diff end------------------------------

Thanks.

Quoted 129 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

OH, sorry, what I said about openrisc cross-compiler is not precise.

Need a patch for openrisc (just like another architectures have done):

-------------------------------diff begin-------------------------------

arch/openrisc/Makefile +1 -2
index 4739b83..89076a6 100644
@@ -24,7 +24,7 @@ OBJCOPYFLAGS    := -O binary -R .note -R .comment -S
 LDFLAGS_vmlinux :=
 LIBGCC 		:= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 
-KBUILD_CFLAGS	+= -pipe -ffixed-r10
+KBUILD_CFLAGS	+= -pipe -ffixed-r10 -D__linux__
 
 ifeq ($(CONFIG_OPENRISC_HAVE_INST_MUL),y)
 	KBUILD_CFLAGS += $(call cc-option,-mhard-mul)
 
-------------------------------diff end---------------------------------

But for "include/linux/coda.h", I still suggest to check __linux__ whether defined, at least it can find the building issues.

And next, I will send the related patch to openrisc mailing list.

:-)

Thanks.

Quoted 92 lines
Quoted 25 lines

Hmm... some old version compilers do not define __linux__ automatically (e.g. or32-linux-gcc 4.5.1-or32-1.0rc1, which is the latest cross compiler for openrisc, though).

If not define __linux__, the compiler will report error (u_quad_t is not defined).

When we remove "#if defined(__linux__)" from "include/linux/coda.h", the compiler will not report error, and 'cdev_t' will be defined as 'dev_t', not 'u_quad_t' (I guess, it is an implicit bug).

In "uapi/include/*", only "coda.h" has "#if defined(__linux__)", maybe they want multiple OS can share the same "coda.h" file (at least, we can not say it is a bad idea).

Neither suitable to define __linux__ in "include/linux/coda.h".

All together, I think:

the direct cause:
"uapi/include/coda.h" wants to share itself for multiple OS (so they need check __linux__).
(in "uapi/include/*", only coda.h need check __linux__)

Quoted 6 lines

the root cause:
the compiler for linux should define __linux__ automatically, the latest version of gcc has done, but some of the old version is not. most of cross compilers have merged their code into gcc main tree, but still left some (e.g. openrisc).
(at least, I can not build openrisc from gcc main tree correctly, but most of others can)
some of latest cross compilers still use old version of gcc, (still not define __linux__ automatically).

Maybe what I said is incorrect (it is just my current understanding).

Welcome any other members' suggestions or completions for discussing and checking.

Thanks.

Quoted 51 lines

The related code in "uapi/linux/coda.h" is below:

-------------------------------code begin-------------------------------

73 #if defined(DJGPP) || defined(__CYGWIN32__)
74 #ifdef KERNEL
75 typedef unsigned long u_long;
76 typedef unsigned int u_int;
77 typedef unsigned short u_short;
78 typedef u_long ino_t;
79 typedef u_long dev_t;
80 typedef void * caddr_t;
81 #ifdef DOS
82 typedef unsigned __int64 u_quad_t;
83 #else
84 typedef unsigned long long u_quad_t;
85 #endif
86
87 #define inline
88
89 struct timespec {

 90         long       ts_sec;
 91         long       ts_nsec;

92 };
93 #else /* DJGPP but not KERNEL */
94 #include <sys/time.h>
95 typedef unsigned long long u_quad_t;
96 #endif /* !KERNEL */
97 #endif /* !DJGPP */
98
99
100 #if defined(__linux__)
101 #include <linux/time.h>
102 #define cdev_t u_quad_t
103 #ifndef __KERNEL__
104 #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) 105 #define _UQUAD_T_ 1
106 typedef unsigned long long u_quad_t;
107 #endif
108 #endif /* __KERNEL__ */
109 #else
110 #define cdev_t dev_t
111 #endif
112

-------------------------------code end---------------------------------

Thanks.

Signature · 1 line
Chen Gang
#8 lore raw
Quoted 28 lines · Chen Gang
Quoted 17 lines · Chen Gang F T
Quoted 16 lines · Chen Gang
Quoted 15 lines · Chen Gang
Quoted 14 lines · Joe Perches
Quoted 13 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h renamed from include/linux/cod +0 -0
index cff544f..d30209b 100644
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

include/linux/coda.h Mellon the rights to redistribute these changes without encumbrance. · line 70

Quoted 6 lines
include/linux/coda.h renamed from include/linux/cod +0 -1
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 

Why have the #if at all?

Quoted 4 lines

Hmm... if any members have some questions about the fix, commonly it means the related fix need additional improvement.

Is it better to use BUILD_BUG() for the fix ?

Probably not. __linux__ is predefined by gcc.

Using an #ifdef __linux__ might make some sense in in include/uapi, but not in include/linux.

author
#9 lore raw
Quoted 32 lines · Joe Perches
Quoted 31 lines · Chen Gang
Quoted 17 lines · Chen Gang F T
Quoted 16 lines · Chen Gang
Quoted 15 lines · Chen Gang
Quoted 14 lines · Joe Perches
Quoted 13 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h renamed from include/linux/cod +0 -0
index cff544f..d30209b 100644
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

include/linux/coda.h Mellon the rights to redistribute these changes without encumbrance. · line 70

Quoted 6 lines
include/linux/coda.h renamed from include/linux/cod +0 -1
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 

Why have the #if at all?

Hmm... if any members have some questions about the fix, commonly it means the related fix need additional improvement.

Quoted 8 lines
Quoted 1 line

Is it better to use BUILD_BUG() for the fix ?

Probably not. __linux__ is predefined by gcc.

Using an #ifdef __linux__ might make some sense in in include/uapi, but not in include/linux.

Hmm... since "linux/coda.h" will include "uapi/linux/coda.h", it is necessary to check __linux__ whether defined.

For some old compilers which is still widely used, they really do not define __linux__, when use these compilers, we need give a necessary check, if can not pass, need report BUILD_BUG().

e.g. for some versions of openrisc, please ref:
https://lkml.org/lkml/2013/7/30/888. (it is in applying work flow).

Thanks.

Signature · 1 line
Chen Gang
author
#10 lore raw
Quoted 33 lines · Chen Gang
Quoted 32 lines · Joe Perches
Quoted 31 lines · Chen Gang
Quoted 17 lines · Chen Gang F T
Quoted 16 lines · Chen Gang
Quoted 15 lines · Chen Gang
Quoted 14 lines · Joe Perches
Quoted 13 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h renamed from include/linux/cod +0 -0
index cff544f..d30209b 100644
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

include/linux/coda.h Mellon the rights to redistribute these changes without encumbrance. · line 70

Quoted 6 lines
include/linux/coda.h renamed from include/linux/cod +0 -1
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 

Why have the #if at all?

Hmm... if any members have some questions about the fix, commonly it means the related fix need additional improvement.

Quoted 9 lines
Quoted 8 lines
Quoted 1 line

Is it better to use BUILD_BUG() for the fix ?

Probably not. __linux__ is predefined by gcc.

Using an #ifdef __linux__ might make some sense in in include/uapi, but not in include/linux.

In fact, in my opinion "uapi/linux/coda.h" should not content "#ifdef __linux__", since it is already in "uapi/linux/" sub-directory.

If it still wants to universal enough to multiple OS, need move it from "uapi/linux/coda.h" to "uapi/coda/coda.h".

:-)

Quoted 13 lines

Hmm... since "linux/coda.h" will include "uapi/linux/coda.h", it is necessary to check __linux__ whether defined.

For some old compilers which is still widely used, they really do not define __linux__, when use these compilers, we need give a necessary check, if can not pass, need report BUILD_BUG().

e.g. for some versions of openrisc, please ref:
https://lkml.org/lkml/2013/7/30/888. (it is in applying work flow).

Thanks.

Signature · 1 line
Chen Gang
author
#11 lore raw
Quoted 36 lines · Chen Gang
Quoted 35 lines · Chen Gang
Quoted 34 lines · Joe Perches
Quoted 32 lines · Chen Gang
Quoted 17 lines · Chen Gang F T
Quoted 16 lines · Chen Gang
Quoted 15 lines · Chen Gang
Quoted 14 lines · Joe Perches
Quoted 13 lines · Chen Gang

'#else' is useless, need remove.

---
 include/linux/coda.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/coda.h renamed from include/linux/cod +0 -0
index cff544f..d30209b 100644
@@ -60,7 +60,6 @@ Mellon the rights to redistribute these changes without encumbrance.
 
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

include/linux/coda.h Mellon the rights to redistribute these changes without encumbrance. · line 70

Quoted 6 lines
include/linux/coda.h renamed from include/linux/cod +0 -1
 #if defined(__linux__)
 typedef unsigned long long u_quad_t;
-#else
 #endif
 #include <uapi/linux/coda.h>
 #endif 

Why have the #if at all?

Hmm... if any members have some questions about the fix, commonly it means the related fix need additional improvement.

Is it better to use BUILD_BUG() for the fix ?

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Probably not. __linux__ is predefined by gcc.

Using an #ifdef __linux__ might make some sense in in include/uapi, but not in include/linux.

In "include/uapi/", only 2 files contant __linux__: (especially latest compiler has already defined __linux__)

  [root@gchenlinux uapi]# grep -rn __linux__ *
  drm/drm.h:39:#if defined(__KERNEL__) || defined(__linux__)
  linux/coda.h:100:#if defined(__linux__)

So now and future, it is not common enough to check __linux__ globally.

So I still suggest to let the related modules theirselves to check __linux__ whether defined.

Quoted 25 lines

In fact, in my opinion "uapi/linux/coda.h" should not content "#ifdef __linux__", since it is already in "uapi/linux/" sub-directory.

If it still wants to universal enough to multiple OS, need move it from "uapi/linux/coda.h" to "uapi/coda/coda.h".

:-)

Quoted 13 lines

Hmm... since "linux/coda.h" will include "uapi/linux/coda.h", it is necessary to check __linux__ whether defined.

For some old compilers which is still widely used, they really do not define __linux__, when use these compilers, we need give a necessary check, if can not pass, need report BUILD_BUG().

e.g. for some versions of openrisc, please ref:
https://lkml.org/lkml/2013/7/30/888. (it is in applying work flow).

Thanks.

Signature · 1 line
Chen Gang