Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include/ directory and header cleanup #16539

Closed
nashif opened this issue Jun 1, 2019 · 2 comments
Closed

include/ directory and header cleanup #16539

nashif opened this issue Jun 1, 2019 · 2 comments
Labels
Enhancement Changes/Updates/Additions to existing features

Comments

@nashif
Copy link
Member

nashif commented Jun 1, 2019

First Phase: Namespacing

Move /include/ to /zephyr/include

#include <zephyr/spi.h>

This proposal was rejected by the TSC.

Also see #12129

Add an /include/zephyr.h that includes everything in /include/zephyr/*

Second Phase: Structure Cleanup

Clean up the folder structure everywhere in zephyr so that it reflects the top-level tree structure (with some exceptions):
include/subsys/bluetooth
include/subsys/net
include/drivers/spi.h
include/drivers/pwm.h
samples/subsys/bluetooth
samples/subsys/net
samples/drivers
tests/subsys/bluetooth
tests/subsys/net
tests/drivers

Agreed by the TSC to drop the leading subsys and use the subsystem name directly, similar to net and bluetooth

Edit: Modified proposal:

Clean up the folder structure everywhere in zephyr so that it reflects the top-level tree structure (with some exceptions) and group headers based on subsystems:

keep those as is

include/bluetooth
include/net

group headers based on subsystem

include/<periph/devices>/spi.h
include/<periph/devices>/pwm.h

Cleanup samples/tests and follow subsystem path*

samples/subsys/bluetooth
samples/subsys/net
samples/drivers
tests/subsys/bluetooth
tests/subsys/net
tests/drivers

Get rid of misc
Move all headers from include/misc/ to where they belong, most of the headers will end up in include/sys.
Move some top-level headers to include/sys/

include/sys/...

Third Phase: Internal vs public APIs

Remove include/misc (potentially lib/misc)
Move certain headers to an internal path (example: include/drivers/clock_control/*)
See if it is possible to turn many of the static inline functions into actual functions in the .c files. If there is no performance penalty that would allow us to avoid exposing internal structures like struct spi_driver_api.

Example:
subsys/bluetooth/controller/ and subsys/bluetooth/controller/ll_sw are added to the include path. Instead, the folders that are common should be moved to subsys/bluetooth/controller/include
zephyr_library_include_directories() should not take an argument. Instead, it should directly assume include/.

Reduce “global” -I across all code base

Make sure we are only including the bare minimum in the build system and cmake files.

Cleanup Header file content

Remove non-public content from inside the public .h files, (also includes the struct spi_driver_api in spi.h for example)

@nashif nashif added the Enhancement Changes/Updates/Additions to existing features label Jun 1, 2019
@nashif
Copy link
Member Author

nashif commented Jun 1, 2019

nashif added a commit that referenced this issue Jun 28, 2019
move misc/__assert.h to sys/__assert.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/byteorder.h to sys/byteorder.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/dlist.h to sys/dlist.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/errno_private.h to sys/errno_private.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/fdtable.h to sys/fdtable.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/libc-hooks.h to sys/libc-hooks.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/list_gen.h to sys/list_gen.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/math_extras.h to sys/math_extras.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
…pl.h

move misc/math_extras_impl.h to sys/math_extras_impl.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/mempool_base.h to sys/mempool_base.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/mempool.h to sys/mempool.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/mutex.h to sys/mutex.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/rb.h to sys/rb.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/sflist.h to sys/sflist.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/slist.h to sys/slist.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/speculation.h to sys/speculation.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/gcov.h to debug/gcov.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/stack.h to debug/stack.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit that referenced this issue Jun 28, 2019
move misc/reboot.h to power/reboot.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit to nashif/zephyr that referenced this issue Jul 4, 2019
…/cmsis_os.h

move cmsis_rtos_v1/cmsis_os.h to compat/cmsis_rtos/cmsis_os.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to zephyrproject-rtos#16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit to nashif/zephyr that referenced this issue Jul 4, 2019
…s/cmsis_os2.h

move cmsis_rtos_v2/cmsis_os2.h to compat/cmsis_rtos/cmsis_os2.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to zephyrproject-rtos#16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit to nashif/zephyr that referenced this issue Jul 4, 2019
move shared_irq.h to drivers/shared_irq/shared_irq.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to zephyrproject-rtos#16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit to nashif/zephyr that referenced this issue Jul 4, 2019
…emory/app_memdomain.h

move app_memory/app_memdomain.h to userspace/app_memory/app_memdomain.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to zephyrproject-rtos#16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit to nashif/zephyr that referenced this issue Jul 4, 2019
…ry/partitions.h

move app_memory/partitions.h to userspace/app_memory/partitions.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to zephyrproject-rtos#16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
nashif added a commit to nashif/zephyr that referenced this issue Jul 4, 2019
move syscall.h to userspace/syscall.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to zephyrproject-rtos#16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
@nashif
Copy link
Member Author

nashif commented Mar 17, 2021

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

1 participant