Skip to content

Commit

Permalink
base: uniform base-internal header structure
Browse files Browse the repository at this point in the history
This patch establishes a common organization of header files
internal to the base framework. The internal headers are located at
'<repository>/src/include/base/internal/'. This structure has been
choosen to make the nature of those headers immediately clear when
included:

  #include <base/internal/lock_helper.h>

Issue genodelabs#1832
  • Loading branch information
nfeske authored and chelmuth committed Mar 1, 2016
1 parent 30824b9 commit bdf08df
Show file tree
Hide file tree
Showing 124 changed files with 167 additions and 196 deletions.
3 changes: 1 addition & 2 deletions repos/base-fiasco/lib/mk/base-common.mk
Expand Up @@ -25,8 +25,7 @@ SRC_CC += thread/context_allocator.cc
SRC_CC += entrypoint/entrypoint.cc
SRC_CC += sleep.cc

INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/thread
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include

vpath cap_copy.cc $(BASE_DIR)/src/lib/startup
vpath %.cc $(REP_DIR)/src/base
Expand Down
2 changes: 1 addition & 1 deletion repos/base-fiasco/lib/mk/base.mk
Expand Up @@ -13,7 +13,7 @@ SRC_CC += thread/thread_start.cc
SRC_CC += irq/platform.cc
SRC_CC += server/rpc_cap_alloc.cc

INC_DIR += $(BASE_DIR)/src/base/env
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include

vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base
4 changes: 2 additions & 2 deletions repos/base-fiasco/src/core/target.inc
Expand Up @@ -37,8 +37,8 @@ SRC_CC += context_area.cc \

INC_DIR += $(REP_DIR)/src/core/include \
$(GEN_CORE_DIR)/include \
$(REP_DIR)/src/base/console \
$(BASE_DIR)/src/base/thread
$(REP_DIR)/src/include \
$(BASE_DIR)/src/include

LIBS += base-common

Expand Down
4 changes: 1 addition & 3 deletions repos/base-foc/lib/mk/base-common.mk
Expand Up @@ -25,9 +25,7 @@ SRC_CC += thread/context_allocator.cc
SRC_CC += entrypoint/entrypoint.cc
SRC_CC += sleep.cc

INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/thread
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include

vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base
Expand Down
2 changes: 1 addition & 1 deletion repos/base-foc/lib/mk/base.mk
Expand Up @@ -14,7 +14,7 @@ SRC_CC += thread/thread_start.cc
SRC_CC += irq/platform.cc
SRC_CC += server/rpc_cap_alloc.cc

INC_DIR += $(BASE_DIR)/src/base/env
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include

vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base
6 changes: 4 additions & 2 deletions repos/base-foc/src/base/env/cap_map.cc
Expand Up @@ -13,14 +13,16 @@
* under the terms of the GNU General Public License version 2.
*/

/* Genode includes */
#include <base/cap_map.h>
#include <base/native_types.h>

#include <util/assert.h>

/* Lock implementation local include */
#include <spin_lock.h>
/* base-internal includes */
#include <base/internal/spin_lock.h>

/* kernel includes */
namespace Fiasco {
#include <l4/sys/consts.h>
#include <l4/sys/task.h>
Expand Down
4 changes: 2 additions & 2 deletions repos/base-foc/src/base/env/spin_lock.cc
Expand Up @@ -16,8 +16,8 @@
/* Genode includes */
#include <base/cap_map.h>

/* Lock implementation local include */
#include <spin_lock.h>
/* base-internal includes */
#include <base/internal/spin_lock.h>


Genode::Spin_lock::Spin_lock() : _spinlock(SPINLOCK_UNLOCKED) {}
Expand Down
4 changes: 2 additions & 2 deletions repos/base-foc/src/base/ipc/ipc.cc
Expand Up @@ -27,8 +27,8 @@
#include <base/thread.h>
#include <util/assert.h>

/* base-foc/src/base/lock */
#include <lock_helper.h> /* for 'thread_get_my_native_id()' */
/* base-internal includes */
#include <base/internal/lock_helper.h> /* for 'thread_get_my_native_id()' */

/* Fiasco.OC includes */
namespace Fiasco {
Expand Down
6 changes: 2 additions & 4 deletions repos/base-foc/src/core/target.inc
Expand Up @@ -40,10 +40,8 @@ SRC_CC += context_area.cc \

INC_DIR += $(REP_DIR)/src/core/include \
$(GEN_CORE_DIR)/include \
$(REP_DIR)/src/base/lock \
$(BASE_DIR)/src/base/lock \
$(BASE_DIR)/src/base/thread \
$(REP_DIR)/src/base/console
$(REP_DIR)/src/include \
$(BASE_DIR)/src/include

include $(GEN_CORE_DIR)/version.inc

Expand Down
File renamed without changes.
Expand Up @@ -11,8 +11,8 @@
* under the terms of the GNU General Public License version 2.
*/

#ifndef _LIB__STARTUP___MAIN_PARENT_CAP_H_
#define _LIB__STARTUP___MAIN_PARENT_CAP_H_
#ifndef _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_
#define _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_

#include <base/native_types.h>

Expand Down Expand Up @@ -41,4 +41,4 @@ namespace Genode {
}
}

#endif /* _LIB__STARTUP___MAIN_PARENT_CAP_H_ */
#endif /* _INCLUDE__STARTUP__INTERNAL___MAIN_PARENT_CAP_H_ */
10 changes: 2 additions & 8 deletions repos/base-hw/lib/mk/base-common.inc
@@ -1,14 +1,12 @@
#
# \brief Portions of base library shared by core and non-core processes
# \brief Portions of base library shared by core and non-core components
# \author Norman Feske
# \author Martin Stein
# \date 2013-02-14
#

# add library dependencies
LIBS += cxx

# add C++ sources
SRC_CC += ipc/ipc.cc
SRC_CC += avl_tree/avl_tree.cc
SRC_CC += allocator/slab.cc
Expand All @@ -32,11 +30,7 @@ SRC_CC += kernel/interface.cc
SRC_CC += entrypoint/entrypoint.cc
SRC_CC += sleep.cc

# add include paths
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/thread
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include

# declare source locations
vpath % $(REP_DIR)/src/base
vpath % $(BASE_DIR)/src/base
10 changes: 2 additions & 8 deletions repos/base-hw/lib/mk/base.mk
@@ -1,13 +1,11 @@
#
# \brief Portions of base library that are exclusive to non-core processes
# \brief Portions of base library that are exclusive to non-core components
# \author Norman Feske
# \date 2013-02-14
#

# add library dependencies
LIBS += base-common startup

# add C++ sources
SRC_CC += console/log_console.cc
SRC_CC += cpu/cache.cc
SRC_CC += env/env.cc
Expand All @@ -19,11 +17,7 @@ SRC_CC += env.cc
SRC_CC += capability.cc
SRC_CC += server/rpc_cap_alloc.cc

# add include paths
INC_DIR += $(REP_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/lock
INC_DIR += $(BASE_DIR)/src/base/env
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include

# declare source locations
vpath % $(REP_DIR)/src/base
vpath % $(BASE_DIR)/src/base
7 changes: 2 additions & 5 deletions repos/base-hw/lib/mk/core.inc
Expand Up @@ -11,11 +11,8 @@ LIBS += core-perf_counter
LIBS += base-common

# add include paths
INC_DIR += $(REP_DIR)/src/core/include
INC_DIR += $(BASE_DIR)/src/core/include
INC_DIR += $(BASE_DIR)/src/base/include
INC_DIR += $(BASE_DIR)/src/base/thread
INC_DIR += $(BASE_DIR)/src/lib/startup
INC_DIR += $(REP_DIR)/src/core/include $(BASE_DIR)/src/core/include
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include

# add C++ sources
SRC_CC += console.cc
Expand Down
4 changes: 3 additions & 1 deletion repos/base-hw/src/base/capability.cc
Expand Up @@ -12,9 +12,11 @@
*/

/* Genode includes */
#include <spin_lock.h>
#include <base/capability.h>

/* base-internal includes */
#include <base/internal/spin_lock.h>

static volatile int spinlock = SPINLOCK_UNLOCKED;
static Genode::uint8_t ref_counter[1 << (sizeof(Kernel::capid_t)*8)];

Expand Down
4 changes: 2 additions & 2 deletions repos/base-hw/src/core/console.cc
Expand Up @@ -18,8 +18,8 @@
/* core includes */
#include <serial.h>

/* base includes */
#include <unmanaged_singleton.h>
/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>

namespace Genode
{
Expand Down
4 changes: 3 additions & 1 deletion repos/base-hw/src/core/include/kernel/irq.h
Expand Up @@ -18,9 +18,11 @@
/* Genode includes */
#include <base/native_types.h>
#include <irq_session/irq_session.h>
#include <unmanaged_singleton.h>
#include <util/avl_tree.h>

/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>

/* core includes */
#include <kernel/signal_receiver.h>

Expand Down
4 changes: 3 additions & 1 deletion repos/base-hw/src/core/include/pager.h
Expand Up @@ -19,7 +19,9 @@
#include <base/object_pool.h>
#include <base/signal.h>
#include <pager/capability.h>
#include <unmanaged_singleton.h>

/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>

/* core-local includes */
#include <kernel/signal_receiver.h>
Expand Down
2 changes: 1 addition & 1 deletion repos/base-hw/src/core/include/spec/x86/cpu_support.h
Expand Up @@ -22,7 +22,7 @@
#include <cpu/cpu_state.h>

/* base includes */
#include <unmanaged_singleton.h>
#include <base/internal/unmanaged_singleton.h>

/* core includes */
#include <fpu.h>
Expand Down
4 changes: 2 additions & 2 deletions repos/base-hw/src/core/kernel/cpu.cc
Expand Up @@ -22,8 +22,8 @@
#include <timer.h>
#include <assert.h>

/* base includes */
#include <unmanaged_singleton.h>
/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>

using namespace Kernel;

Expand Down
2 changes: 1 addition & 1 deletion repos/base-hw/src/core/kernel/init.cc
Expand Up @@ -22,7 +22,7 @@
#include <platform_thread.h>

/* base includes */
#include <unmanaged_singleton.h>
#include <base/internal/unmanaged_singleton.h>
#include <base/native_types.h>

using namespace Kernel;
Expand Down
4 changes: 3 additions & 1 deletion repos/base-hw/src/core/kernel/pd.cc
Expand Up @@ -19,7 +19,9 @@
/* Genode includes */
#include <assert.h>
#include <page_flags.h>
#include <unmanaged_singleton.h>

/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>

using namespace Kernel;

Expand Down
4 changes: 3 additions & 1 deletion repos/base-hw/src/core/kernel/thread.cc
Expand Up @@ -14,10 +14,12 @@

/* Genode includes */
#include <base/thread_state.h>
#include <unmanaged_singleton.h>
#include <cpu_session/cpu_session.h>
#include <util/construct_at.h>

/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>

/* core includes */
#include <assert.h>
#include <kernel/kernel.h>
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions repos/base-linux/lib/mk/base-common.mk
Expand Up @@ -24,11 +24,7 @@ SRC_CC += irq/platform.cc
SRC_CC += entrypoint/entrypoint.cc
SRC_CC += sleep.cc

INC_DIR += $(REP_DIR)/src/base/lock $(BASE_DIR)/src/base/lock
INC_DIR += $(REP_DIR)/src/base/ipc
INC_DIR += $(REP_DIR)/src/base/env $(BASE_DIR)/src/base/env
INC_DIR += $(BASE_DIR)/src/lib/startup
INC_DIR += $(BASE_DIR)/src/base/thread
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include

vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base
2 changes: 1 addition & 1 deletion repos/base-linux/lib/mk/base.inc
Expand Up @@ -12,7 +12,7 @@ LIBS += base-common syscall cxx
SRC_CC += console/log_console.cc
SRC_CC += env/env.cc env/platform_env.cc env/context_area.cc

INC_DIR += $(REP_DIR)/src/base/env $(BASE_DIR)/src/base/env
INC_DIR += $(REP_DIR)/src/include $(BASE_DIR)/src/include

vpath %.cc $(REP_DIR)/src/base
vpath %.cc $(BASE_DIR)/src/base
Expand Down
1 change: 1 addition & 0 deletions repos/base-linux/lib/mk/base.mk
Expand Up @@ -5,6 +5,7 @@
#

LIBS += startup cxx

SRC_CC += thread/thread.cc thread/myself.cc thread/thread_linux.cc
SRC_CC += server/rpc_cap_alloc.cc

Expand Down
4 changes: 2 additions & 2 deletions repos/base-linux/src/base/env/platform_env.cc
Expand Up @@ -17,8 +17,8 @@
#include <linux_dataspace/client.h>
#include <linux_syscalls.h>

/* local includes */
#include <platform_env.h>
/* base-internal includes */
#include <base/internal/platform_env.h>

using namespace Genode;

Expand Down
6 changes: 3 additions & 3 deletions repos/base-linux/src/base/env/rm_session_mmap.cc
Expand Up @@ -37,10 +37,10 @@
#include <base/thread.h>
#include <linux_dataspace/client.h>
#include <linux_syscalls.h>
#include <context_area.h>

/* local includes */
#include <platform_env.h>
/* base-internal includes */
#include <base/internal/platform_env.h>
#include <base/internal/context_area.h>

using namespace Genode;

Expand Down
4 changes: 2 additions & 2 deletions repos/base-linux/src/base/ipc/ipc.cc
Expand Up @@ -34,8 +34,8 @@
#include <base/env.h>
#include <linux_cpu_session/linux_cpu_session.h>

/* local includes */
#include <socket_descriptor_registry.h>
/* base-internal includes */
#include <base/internal/socket_descriptor_registry.h>

/* Linux includes */
#include <linux_syscalls.h>
Expand Down
3 changes: 2 additions & 1 deletion repos/base-linux/src/core/context_area.cc
Expand Up @@ -17,7 +17,8 @@
#include <base/printf.h>
#include <base/thread.h>

#include <context_area.h>
/* base-internal includes */
#include <base/internal/context_area.h>


/**
Expand Down
4 changes: 2 additions & 2 deletions repos/base-linux/src/core/include/core_env.h
Expand Up @@ -24,8 +24,8 @@
#include <core_pd_session.h>
#include <ram_session_component.h>

/* internal base includes */
#include <platform_env.h>
/* base-internal includes */
#include <base/internal/platform_env.h>

namespace Genode { void init_context_area(); }

Expand Down
4 changes: 2 additions & 2 deletions repos/base-linux/src/core/include/server_socket_pair.h
Expand Up @@ -19,8 +19,8 @@
#include <sys/socket.h>
#include <sys/un.h>

/* include from 'src/base/ipc' */
#include <socket_descriptor_registry.h>
/* base-internal includes */
#include <base/internal/socket_descriptor_registry.h>

/* core-local includes */
#include <resource_path.h>
Expand Down

0 comments on commit bdf08df

Please sign in to comment.