Automatically generate CONFIG_XENO_OPT_DEBUG stubs
RFC PATCH 1/1 Automatically generate CONFIG_XENO_OPT_DEBUG stubs
This avoids forgetting to add the #ifndef-#define lines for debug switches that shall be used with nucleus/assert.h. Generation takes place during the prepare-kernel step, thus doesn't prolongs the normal build.
Signed-off-by Jan Kiszka <[email protected]>
--- include/asm-generic/system.h | 4 ---- include/native/types.h | 4 ---- include/nucleus/assert.h | 11 +++++++++++ include/nucleus/bheap.h | 4 ---- include/nucleus/heap.h | 4 ---- include/nucleus/queue.h | 4 ---- include/nucleus/sched-sporadic.h | 4 ---- include/nucleus/sched.h | 4 ---- include/nucleus/timer.h | 4 ---- include/psos+/ppd.h | 4 ---- include/rtdm/rtdm_driver.h | 4 ---- include/vxworks/ppd.h | 4 ---- ksrc/nucleus/bufd.c | 4 ---- ksrc/nucleus/pod.c | 4 ---- ksrc/nucleus/registry.c | 4 ---- ksrc/nucleus/sched.c | 4 ---- ksrc/nucleus/shadow.c | 4 ---- ksrc/nucleus/synch.c | 4 ---- ksrc/skins/posix/internal.h | 4 ---- ksrc/skins/rtdm/internal.h | 4 ---- ksrc/skins/uitron/ppd.h | 4 ---- scripts/prepare-kernel.sh | 11 +++++++++++ 22 files changed, 22 insertions(+), 80 deletions(-)
include/asm-generic/system.h +0 -4
@@ -44,10 +44,6 @@/* debug support */ #include <nucleus/assert.h> -#ifndef CONFIG_XENO_OPT_DEBUG_XNLOCK -#define CONFIG_XENO_OPT_DEBUG_XNLOCK 0 -#endif -#ifdef __cplusplusextern "C" {#endif
include/native/types.h +0 -4
@@ -32,10 +32,6 @@#if defined(__KERNEL__) || defined(__XENO_SIM__) -#ifndef CONFIG_XENO_OPT_DEBUG_NATIVE -#define CONFIG_XENO_OPT_DEBUG_NATIVE 0 -#endif -typedef xnticks_t RTIME ;typedef xnsticks_t SRTIME ;
include/nucleus/assert.h +11 -0
@@ -20,7 +20,10 @@#ifndef _XENO_NUCLEUS_ASSERT_H#define _XENO_NUCLEUS_ASSERT_H +#ifdef __KERNEL__ +#include <nucleus/types.h> +#include <nucleus/debug_defines.h> #define XENO_DEBUG (subsystem) (CONFIG_XENO_OPT_DEBUG_##subsystem > 0)
@@ -38,4 +41,12 @@ xnpod_fatal("bug at %s:%d (%s)", __FILE__, __LINE__, (#cond)); \ } while(0) +#else /* !__KERNEL__ */ + +#define XENO_DEBUG (subsystem) (0) +#define XENO_ASSERT (subsystem,cond,action) do { } while (0) +#define XENO_BUGON (subsystem,cond) do { } while (0) + +#endif /* !__KERNEL__ */ +#endif /* !_XENO_NUCLEUS_ASSERT_H */
include/nucleus/bheap.h +0 -4
@@ -25,10 +25,6 @@/* debug support */ #include <nucleus/assert.h> -#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES -#define CONFIG_XENO_OPT_DEBUG_QUEUES 0 -#endif -/* Priority queue implementation, using a binary heap. */ typedef unsigned long long bheap_key_t ;
include/nucleus/heap.h +0 -4
@@ -46,10 +46,6 @@#if defined(__KERNEL__) || defined(__XENO_SIM__) -#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS -#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0 -#endif -#define XNHEAP_PAGE_SIZE 512/* A reasonable value for the xnheap page size */ #define XNHEAP_PAGE_MASK (~(XNHEAP_PAGE_SIZE-1))#define XNHEAP_PAGE_ALIGN (addr) (((addr)+XNHEAP_PAGE_SIZE-1)&XNHEAP_PAGE_MASK)
include/nucleus/queue.h +0 -4
@@ -24,10 +24,6 @@#include <nucleus/types.h> #include <nucleus/assert.h> -#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES -#define CONFIG_XENO_OPT_DEBUG_QUEUES 0 -#endif -/* Basic element holder */ typedef struct xnholder {
include/nucleus/sched-sporadic.h +0 -4
@@ -29,10 +29,6 @@#ifdef CONFIG_XENO_OPT_SCHED_SPORADIC -#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS -#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0 -#endif -#include <nucleus/heap.h> extern struct xnsched_class xnsched_class_sporadic;
include/nucleus/sched.h +0 -4
@@ -36,10 +36,6 @@#include <nucleus/sched-tp.h> #include <nucleus/sched-sporadic.h> -#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS -#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0 -#endif -/* Sched status flags */ #define XNKCOUT 0x80000000/* Sched callout context */ #define XNHTICK 0x40000000/* Host tick pending */
include/nucleus/timer.h +0 -4
@@ -28,10 +28,6 @@#if defined(__KERNEL__) || defined(__XENO_SIM__) -#ifndef CONFIG_XENO_OPT_DEBUG_TIMERS -#define CONFIG_XENO_OPT_DEBUG_TIMERS 0 -#endif -#define XNTIMER_WHEELSIZE 64#define XNTIMER_WHEELMASK (XNTIMER_WHEELSIZE - 1)
include/psos+/ppd.h +0 -4
@@ -25,10 +25,6 @@#include <nucleus/pod.h> #include <nucleus/ppd.h> -#ifndef CONFIG_XENO_OPT_DEBUG_PSOS -#define CONFIG_XENO_OPT_DEBUG_PSOS 0 -#endif - typedef struct psos_resource_holder { xnshadow_ppd_t ppd;
include/rtdm/rtdm_driver.h +0 -4
@@ -47,10 +47,6 @@#include <asm-generic/xenomai/pci_ids.h> #endif /* CONFIG_PCI */ -#ifndef CONFIG_XENO_OPT_DEBUG_RTDM -#define CONFIG_XENO_OPT_DEBUG_RTDM 0 -#endif -struct rtdm_dev_context ;typedef struct xnselector rtdm_selector_t ;enum rtdm_selecttype ;
include/vxworks/ppd.h +0 -4
@@ -25,10 +25,6 @@#include <nucleus/pod.h> #include <nucleus/ppd.h> -#ifndef CONFIG_XENO_OPT_DEBUG_VXWORKS -#define CONFIG_XENO_OPT_DEBUG_VXWORKS 0 -#endif - typedef struct wind_resource_holder { xnshadow_ppd_t ppd;
ksrc/nucleus/bufd.c +0 -4
@@ -146,10 +146,6 @@#include <nucleus/bufd.h> #include <nucleus/assert.h> -#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS -#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0 -#endif -#ifdef CONFIG_XENO_OPT_PERVASIVE #include <asm/xenomai/syscall.h>
ksrc/nucleus/pod.c +0 -4
@@ -46,10 +46,6 @@#include <nucleus/select.h> #include <asm/xenomai/bits/pod.h> -#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS -#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0 -#endif -/* * NOTE: We need to initialize the globals; remember that this code * also runs over the simulator in user-space.
ksrc/nucleus/registry.c +0 -4
@@ -42,10 +42,6 @@#include <nucleus/thread.h> #include <nucleus/assert.h> -#ifndef CONFIG_XENO_OPT_DEBUG_REGISTRY -#define CONFIG_XENO_OPT_DEBUG_REGISTRY 0 -#endif -static xnobject_t *registry_obj_slots;static xnqueue_t registry_obj_freeq;/* Free objects. */
ksrc/nucleus/sched.c +0 -4
@@ -529,10 +529,6 @@ void xnsched_migrate_passive(struct xnthread *thread, struct xnsched *sched)#ifdef CONFIG_XENO_OPT_SCALABLE_SCHED -#ifndef CONFIG_XENO_OPT_DEBUG_QUEUES -#define CONFIG_XENO_OPT_DEBUG_QUEUES 0 -#endif -void initmlq (struct xnsched_mlq *q,int loprio,int hiprio) {int prio;
ksrc/nucleus/shadow.c +0 -4
@@ -55,10 +55,6 @@#include <asm/xenomai/syscall.h> #include <asm/xenomai/bits/shadow.h> -#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS -#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0 -#endif -static int xn_gid_arg =-1 ;module_param_named (xenomai_gid, xn_gid_arg, int,0644 );MODULE_PARM_DESC (xenomai_gid,"GID of the group with access to Xenomai services" );
ksrc/nucleus/synch.c +0 -4
@@ -36,10 +36,6 @@#include <nucleus/thread.h> #include <nucleus/module.h> -#ifndef CONFIG_XENO_OPT_DEBUG_NUCLEUS -#define CONFIG_XENO_OPT_DEBUG_NUCLEUS 0 -#endif -#define w_bprio (t) xnsched_weighted_bprio(t)#define w_cprio (t) xnsched_weighted_cprio(t)
ksrc/skins/posix/internal.h +0 -4
@@ -28,10 +28,6 @@/* debug support */ #include <nucleus/assert.h> -#ifndef CONFIG_XENO_OPT_DEBUG_POSIX -#define CONFIG_XENO_OPT_DEBUG_POSIX 0 -#endif -#define PSE51_MAGIC (n) (0x8686##n##n)#define PSE51_ANY_MAGIC PSE51_MAGIC(00)#define PSE51_THREAD_MAGIC PSE51_MAGIC(01)
ksrc/skins/rtdm/internal.h +0 -4
@@ -28,10 +28,6 @@#include <nucleus/ppd.h> #include <rtdm/rtdm_driver.h> -#ifndef CONFIG_XENO_OPT_DEBUG_RTDM_APPL -#define CONFIG_XENO_OPT_DEBUG_RTDM_APPL 0 -#endif -#define RTDM_FD_MAX CONFIG_XENO_OPT_RTDM_FILDES#define DEF_DEVNAME_HASHTAB_SIZE 256/* entries in name hash table */
ksrc/skins/uitron/ppd.h +0 -4
@@ -25,10 +25,6 @@#include <nucleus/pod.h> #include <nucleus/ppd.h> -#ifndef CONFIG_XENO_OPT_DEBUG_UITRON -#define CONFIG_XENO_OPT_DEBUG_UITRON 0 -#endif - typedef struct ui_resource_holder { xnshadow_ppd_t ppd;
scripts/prepare-kernel.sh +11 -0
@@ -584,6 +584,17 @@ for d in include/* ; do fi done +kconfigs=`find $xenomai_root/ksrc -name Kconfig` +debug_defines=$linux_tree/include/xenomai/nucleus/debug_defines.h +rm -f $debug_defines +for debugopt in `grep XENO_OPT_DEBUG_ $kconfigs | cut -d' ' -f2`; do + cat >>$debug_defines <<EOF +#ifndef CONFIG_$debugopt +#define CONFIG_$debugopt 0 +#endif +EOF +done + if test "x$output_patch" != "x"; then if test x$verbose = x1; then echo 'Generating patch.'