linux/spinlock_api_up.h has incomplete definitions
From: Martin Drab
Date: Fri Jan 06 2006 - 00:12:28 EST
Hi,
linux/spinlock_api_up.h uses local_bh_disable() in definition of
__LOCK_BH(lock) for instance, but it doesn't include linux/interrupt.h, in
which the local_bh_disable() is defined. So when you compile for instance
the net/ipv4/ipvs/ip_vs_sched.c or ip_vs_est.c (which doesn't include
linux/interrupt.h in any direct or indirect way) in a UP configuration,
you get an unresolved symbol in the resulting objects (though
local_bh_disable() is just a macro).
However when I tried to include the linux/interrupt.h directly in the
linux/spinlock.h or linux/spinlock_api_up.h, nothing is able to compile
with following complaints:
-----------------------------------------------------------
In file included from include/asm/hardirq.h:6,
from include/linux/hardirq.h:7,
from include/linux/interrupt.h:11,
from include/linux/spinlock.h:56,
from include/linux/capability.h:45,
from include/linux/sched.h:7,
from arch/x86_64/kernel/asm-offsets.c:7:
include/linux/irq.h:79: error: expected specifier-qualifier-list before
`spinlock_t'
In file included from include/asm/vsyscall.h:4,
from include/asm/fixmap.h:18,
from include/asm/apic.h:6,
from include/asm/hardirq.h:8,
from include/linux/hardirq.h:7,
from include/linux/interrupt.h:11,
from include/linux/spinlock.h:56,
from include/linux/capability.h:45,
from include/linux/sched.h:7,
from arch/x86_64/kernel/asm-offsets.c:7:
include/linux/seqlock.h:35: error: expected specifier-qualifier-list before `spinlock_t'
include/linux/seqlock.h: In function `write_seqloc':
include/linux/seqlock.h:52: warning: implicit declaration of function `spin_lock'
include/linux/seqlock.h:52: error: `seqlock_' has no member named `lock'
include/linux/seqlock.h: In function `write_sequnloc':
include/linux/seqlock.h:61: warning: implicit declaration of function `spin_unlock'
include/linux/seqlock.h:61: error: `seqlock_' has no member named `lock'
include/linux/seqlock.h: In function `write_tryseqloc':
include/linux/seqlock.h:66: warning: implicit declaration of function `spin_trylock'
include/linux/seqlock.h:66: error: âseqlock_tâ has no member name`lock'
make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
------------------------------------------------------------
So I'm not quite sure how to fix this best. But I think that ideally all
publically used includes should be self sufficient and include all stuff
they use.
Martin
P.S.: I'm not really sure who's the maintainer of the spinlocks, and
though to whom should I direct this bugreport.
P.P.S.: I also filed it as bug #5840.