1 |
Greg KH wrote: |
2 |
> On Fri, Feb 20, 2004 at 01:19:26AM -0300, Norberto Bensa wrote: |
3 |
> > Ernst Herzberg wrote: |
4 |
> > > in file included from /usr/src/linux/include/linux/cdrom.h:14, |
5 |
> > > from eject.c:66: |
6 |
> > > /usr/src/linux/include/asm/byteorder.h:14: error: syntax error before |
7 |
> > > "__u32" |
8 |
> > > [...] |
9 |
> > > |
10 |
> > > (Reprocducable, try to emerge eject on stable) |
11 |
> > |
12 |
> > That's a know bug. Search {bf}.g.o. BTW, it's a bug in kernel headers; |
13 |
> > complain to LKML. |
14 |
> |
15 |
> Yeah right, that will get you nowhere, they will laugh you out of |
16 |
> there as it's not their problem. Why are you including kernel headers |
17 |
> in a userspace program. That's a huge no-no. |
18 |
|
19 |
I don't know why they do it, and honestly, I don't care. But there's something |
20 |
strange in /usr/src/linux/include/asm/byteorder.h. For example the following |
21 |
snippet: |
22 |
|
23 |
static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val) |
24 |
{ |
25 |
union { |
26 |
struct { __u32 a,b; } s; |
27 |
__u64 u; |
28 |
} v; |
29 |
v.u = val; |
30 |
#ifdef CONFIG_X86_BSWAP |
31 |
asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" |
32 |
: "=r" (v.s.a), "=r" (v.s.b) |
33 |
: "0" (v.s.a), "1" (v.s.b)); |
34 |
#else |
35 |
v.s.a = ___arch__swab32(v.s.a); |
36 |
v.s.b = ___arch__swab32(v.s.b); |
37 |
asm("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), |
38 |
"1" (v.s.b)); |
39 |
#endif |
40 |
return v.u; |
41 |
} |
42 |
|
43 |
|
44 |
Why "__inline__" instead of "inline" ? Or the other way around: why "asm" |
45 |
instead of "__asm__" ? |
46 |
|
47 |
Ok, I know nothing about kernel's internals, so maybe you can enlight me :-) |
48 |
|
49 |
Thanks, |
50 |
Norberto |