Eliminate exposure of non-public microkernel structures

Renames the include file defining non-public microkernel structures
from k_struct.h to kernel_structures.h, and relocates it to the
microkernel's non-public include file directory. This means that
applications and drivers including the microkernel's public APIs,
using microkernel.h, can no longer access non-public information.

Note: This change also eliminates some redundant #includes by the
microkernel's own subsystems, since the inclusion of minik.h brings
in the vast majority of public and non-public APIs.

Change-Id: Ic7d9ec1ebb8a124ccd0aaad98b50e16c197ffa00
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
Allan Stephens 2015-05-14 09:24:35 -04:00 committed by Anas Nashif
commit a02396098d
38 changed files with 45 additions and 54 deletions

View file

@ -41,8 +41,8 @@ the PendSV exception.
*/ */
#ifdef CONFIG_MICROKERNEL #ifdef CONFIG_MICROKERNEL
#include <microkernel/k_struct.h>
#include <microkernel.h> #include <microkernel.h>
#include <kernel_struct.h>
#endif #endif
#include <nanok.h> #include <nanok.h>

View file

@ -43,7 +43,6 @@ Currently empty, only here for abstraction.
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <nanok.h> #include <nanok.h>
#include <cputype.h> #include <cputype.h>

View file

@ -39,8 +39,8 @@ processor architecture.
/* includes */ /* includes */
#ifdef CONFIG_MICROKERNEL #ifdef CONFIG_MICROKERNEL
#include <microkernel/k_struct.h>
#include <microkernel.h> #include <microkernel.h>
#include <kernel_struct.h>
#endif /* CONFIG_MICROKERNEL */ #endif /* CONFIG_MICROKERNEL */
#include <toolchain.h> #include <toolchain.h>

View file

@ -96,8 +96,8 @@ enable FP resource sharing on its behalf.
*/ */
#ifdef CONFIG_MICROKERNEL #ifdef CONFIG_MICROKERNEL
#include <microkernel/k_struct.h>
#include <microkernel.h> #include <microkernel.h>
#include <kernel_struct.h>
#endif /* CONFIG_MICROKERNEL */ #endif /* CONFIG_MICROKERNEL */
#include <nanok.h> #include <nanok.h>

View file

@ -41,7 +41,6 @@ Intel-specific parts of start_task(). Only FP functionality currently.
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <nanok.h> #include <nanok.h>
#include <cputype.h> #include <cputype.h>

View file

@ -36,7 +36,6 @@
/* includes */ /* includes */
#include <nanokernel.h> #include <nanokernel.h>
#include <microkernel/k_struct.h>
#include <clock_vars.h> #include <clock_vars.h>
/* externs */ /* externs */

View file

@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <ch_buff.h> #include <ch_buff.h>

View file

@ -30,9 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
/*****************************************************************************/ /*****************************************************************************/

View file

@ -32,9 +32,8 @@
/* includes */ /* includes */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
/******************************************************************************* /*******************************************************************************

View file

@ -30,9 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
/*****************************************************************************/ /*****************************************************************************/

View file

@ -32,9 +32,8 @@
/* includes */ /* includes */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <microkernel/chan.h> #include <microkernel/chan.h>
#include <toolchain.h> #include <toolchain.h>

View file

@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>

View file

@ -30,9 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <kchan.h> #include <kchan.h>
#include <toolchain.h> #include <toolchain.h>

View file

@ -30,9 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -30,9 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -30,9 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -30,9 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -30,9 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -30,9 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -32,9 +32,8 @@
/* includes */ /* includes */
#include <microkernel/k_struct.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -33,8 +33,8 @@
/* includes */ /* includes */
#include <microkernel.h> #include <microkernel.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -33,8 +33,8 @@
/* includes */ /* includes */
#include <microkernel.h> #include <microkernel.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -33,8 +33,8 @@
/* includes */ /* includes */
#include <microkernel.h> #include <microkernel.h>
#include <kchan.h>
#include <minik.h> #include <minik.h>
#include <kchan.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>
#include <misc/__assert.h> #include <misc/__assert.h>

View file

@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <kchan.h> #include <kchan.h>
#include <string_s.h> #include <string_s.h>

View file

@ -56,7 +56,6 @@ that have an ISR component should use their own command packet set.
#include <nanokernel.h> #include <nanokernel.h>
#include <nanokernel/cpu.h> #include <nanokernel/cpu.h>
#include <microkernel/k_struct.h>
#include <microkernel/cmdPkt.h> #include <microkernel/cmdPkt.h>
#include <minik.h> #include <minik.h>
#include <sections.h> #include <sections.h>

View file

@ -36,7 +36,6 @@ Microkernel idle logic. Different forms of idling are performed by the idle
task, depending on how the kernel is configured. task, depending on how the kernel is configured.
*/ */
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <nanok.h> #include <nanok.h>
#include <nanokernel/cpu.h> #include <nanokernel/cpu.h>

View file

@ -33,8 +33,6 @@
#ifndef _ENTRIES_H #ifndef _ENTRIES_H
#define _ENTRIES_H #define _ENTRIES_H
#include <microkernel/k_struct.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View file

@ -1,4 +1,4 @@
/* microkernel/k_struct.h */ /* major non-public microkernel structures */
/* /*
* Copyright (c) 1997-2015 Wind River Systems, Inc. * Copyright (c) 1997-2015 Wind River Systems, Inc.
@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _K_STRUCT_H #ifndef _KERNEL_STRUCT_H
#define _K_STRUCT_H #define _KERNEL_STRUCT_H
#include <microkernel/k_types.h> #include <microkernel/k_types.h>
#include <microkernel/k_chstr.h> #include <microkernel/k_chstr.h>
@ -502,4 +502,4 @@ struct evstr {
} }
#endif #endif
#endif /* _K_STRUCT_H */ #endif /* _KERNEL_STRUCT_H */

View file

@ -33,7 +33,7 @@
#ifndef MINIK_H #ifndef MINIK_H
#define MINIK_H #define MINIK_H
#include <microkernel/k_struct.h> #include <kernel_struct.h>
#include <kernel_main.h> #include <kernel_main.h>
#include <clock_vars.h> #include <clock_vars.h>

View file

@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "microkernel/k_struct.h"
#include "minik.h" #include "minik.h"
#include "microkernel/event.h" #include "microkernel/event.h"
#include <toolchain.h> #include <toolchain.h>

View file

@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "microkernel/k_struct.h"
#include "minik.h" /* _k_mem_map_list, _k_mem_map_count */ #include "minik.h" /* _k_mem_map_list, _k_mem_map_count */
#include <sections.h> #include <sections.h>

View file

@ -40,7 +40,6 @@ single invocation of the K_swapper fiber. However, it can also be used by
a task to measure the overhead involved in issuing a kernel service request. a task to measure the overhead involved in issuing a kernel service request.
*/ */
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <toolchain.h> #include <toolchain.h>
#include <sections.h> #include <sections.h>

View file

@ -30,7 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <string.h> #include <string.h>
#include <toolchain.h> #include <toolchain.h>

View file

@ -32,7 +32,6 @@
/* includes */ /* includes */
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <string_s.h> #include <string_s.h>
#include <toolchain.h> #include <toolchain.h>

View file

@ -32,7 +32,6 @@
#ifdef CONFIG_TASK_MONITOR #ifdef CONFIG_TASK_MONITOR
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <microkernel/ticks.h> #include <microkernel/ticks.h>
#include <drivers/system_timer.h> #include <drivers/system_timer.h>

View file

@ -38,7 +38,6 @@ This module implements the microkernel's tick event handler.
#include <nanokernel.h> #include <nanokernel.h>
#include <nanokernel/cpu.h> #include <nanokernel/cpu.h>
#include <microkernel/k_struct.h>
#include <minik.h> #include <minik.h>
#include <drivers/system_timer.h> #include <drivers/system_timer.h>
#include <microkernel.h> #include <microkernel.h>

View file

@ -38,7 +38,8 @@
# Generates: # Generates:
# - kernel_main.c file # - kernel_main.c file
# - kernel_main.h file # - kernel_main.h file (local copy)
# - kernel_struct.h file (local copy)
# - vxmicro.h file # - vxmicro.h file
import os import os
@ -305,6 +306,7 @@ def kernel_main_c_header():
"\n" + "\n" +
"#include <vxmicro.h>\n" + "#include <vxmicro.h>\n" +
"#include <drivers/system_timer.h>\n" + "#include <drivers/system_timer.h>\n" +
"#include <kernel_struct.h>\n" +
"#include <kernel_main.h>\n" + "#include <kernel_main.h>\n" +
"#include <toolchain.h>\n" + "#include <toolchain.h>\n" +
"#include <sections.h>\n") "#include <sections.h>\n")
@ -1058,6 +1060,24 @@ def kernel_main_h_generate():
output_dir]) output_dir])
#
# GENERATE kernel_struct.h FILE
#
def kernel_struct_h_generate():
""" Generate kernel_struct.h file """
global output_dir
subprocess.check_call([
"cp",
"-f",
os.environ["VXMICRO_BASE"] +
"/kernel/microkernel/include/kernel_struct.h",
output_dir])
# #
# GENERATE vxmicro.h FILE # GENERATE vxmicro.h FILE
# #
@ -1178,4 +1198,5 @@ vpf_parse()
get_output_dir() get_output_dir()
kernel_main_c_generate() kernel_main_c_generate()
kernel_main_h_generate() kernel_main_h_generate()
kernel_struct_h_generate()
vxmicro_h_generate() vxmicro_h_generate()