mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-22 16:59:03 +00:00
core: introduce 'Core' namespace
The namespace draws a clear line between the base library and the core component. It is declared at the new core-local header <types.h>, which is expected to be included by all code of the core component. It is thereby a natural place for kernel-agnostic general types like commonly used C++ utilities. Fixes #4777
This commit is contained in:
committed by
Christian Helmuth
parent
487aad6db1
commit
2e6dd010ae
@ -17,4 +17,4 @@
|
||||
/* Linux syscall bindings */
|
||||
#include <linux_syscalls.h>
|
||||
|
||||
void Genode::Core_log::out(char const c) { lx_write(1, &c, sizeof(c)); }
|
||||
void Core::Core_log::out(char const c) { lx_write(1, &c, sizeof(c)); }
|
||||
|
@ -17,7 +17,10 @@
|
||||
/* base-internal includes */
|
||||
#include <base/internal/native_thread.h>
|
||||
|
||||
using namespace Genode;
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
|
||||
Native_capability Rpc_entrypoint::_alloc_rpc_cap(Pd_session &, Native_capability,
|
||||
|
@ -17,10 +17,13 @@
|
||||
/* base-internal includes */
|
||||
#include <base/internal/region_map_mmap.h>
|
||||
|
||||
namespace Genode { class Core_region_map; }
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
namespace Core { class Core_region_map; }
|
||||
|
||||
|
||||
struct Genode::Core_region_map : Region_map_mmap
|
||||
struct Core::Core_region_map : Region_map_mmap
|
||||
{
|
||||
Core_region_map(Rpc_entrypoint &) : Region_map_mmap(false) { }
|
||||
};
|
||||
|
@ -19,15 +19,19 @@
|
||||
#ifndef _CORE__INCLUDE__DATASPACE_COMPONENT_H_
|
||||
#define _CORE__INCLUDE__DATASPACE_COMPONENT_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <linux_dataspace/linux_dataspace.h>
|
||||
#include <util/string.h>
|
||||
#include <util/misc_math.h>
|
||||
#include <base/rpc_server.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/capability_space_tpl.h>
|
||||
|
||||
namespace Genode {
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class Dataspace_owner;
|
||||
class Dataspace_component;
|
||||
}
|
||||
@ -36,10 +40,10 @@ namespace Genode {
|
||||
/**
|
||||
* Deriving classes can own a dataspace to implement conditional behavior
|
||||
*/
|
||||
class Genode::Dataspace_owner : Interface { };
|
||||
class Core::Dataspace_owner : Interface { };
|
||||
|
||||
|
||||
class Genode::Dataspace_component : public Rpc_object<Linux_dataspace>
|
||||
class Core::Dataspace_component : public Rpc_object<Linux_dataspace>
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -22,10 +22,10 @@
|
||||
/* core includes */
|
||||
#include <dataspace_component.h>
|
||||
|
||||
namespace Genode { class Io_mem_session_component; }
|
||||
namespace Core { class Io_mem_session_component; }
|
||||
|
||||
|
||||
class Genode::Io_mem_session_component : public Rpc_object<Io_mem_session>
|
||||
class Core::Io_mem_session_component : public Rpc_object<Io_mem_session>
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -14,12 +14,16 @@
|
||||
#ifndef _IRQ_OBJECT_H_
|
||||
#define _IRQ_OBJECT_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/thread.h>
|
||||
|
||||
namespace Genode { class Irq_object; };
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
namespace Core { class Irq_object; };
|
||||
|
||||
|
||||
class Genode::Irq_object : public Thread
|
||||
class Core::Irq_object : public Thread
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -14,17 +14,20 @@
|
||||
#ifndef _CORE__INCLUDE__IRQ_SESSION_COMPONENT_H_
|
||||
#define _CORE__INCLUDE__IRQ_SESSION_COMPONENT_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <util/list.h>
|
||||
#include <base/rpc_server.h>
|
||||
#include <base/allocator.h>
|
||||
#include <irq_session/irq_session.h>
|
||||
|
||||
/* core includes */
|
||||
#include <irq_object.h>
|
||||
|
||||
namespace Genode { class Irq_session_component; }
|
||||
namespace Core { class Irq_session_component; }
|
||||
|
||||
|
||||
class Genode::Irq_session_component : public Rpc_object<Irq_session>,
|
||||
private List<Irq_session_component>::Element
|
||||
class Core::Irq_session_component : public Rpc_object<Irq_session>,
|
||||
private List<Irq_session_component>::Element
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -19,14 +19,18 @@
|
||||
/* Genode includes */
|
||||
#include <linux_native_cpu/linux_native_cpu.h>
|
||||
|
||||
namespace Genode {
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class Cpu_session_component;
|
||||
class Native_cpu_component;
|
||||
}
|
||||
|
||||
|
||||
class Genode::Native_cpu_component : public Rpc_object<Cpu_session::Native_cpu,
|
||||
Native_cpu_component>
|
||||
class Core::Native_cpu_component : public Rpc_object<Cpu_session::Native_cpu,
|
||||
Native_cpu_component>
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -17,15 +17,19 @@
|
||||
/* Genode includes */
|
||||
#include <linux_native_pd/linux_native_pd.h>
|
||||
|
||||
namespace Genode {
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class Dataspace_component;
|
||||
class Pd_session_component;
|
||||
class Native_pd_component;
|
||||
}
|
||||
|
||||
|
||||
class Genode::Native_pd_component : public Rpc_object<Pd_session::Native_pd,
|
||||
Native_pd_component>
|
||||
class Core::Native_pd_component : public Rpc_object<Pd_session::Native_pd,
|
||||
Native_pd_component>
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -20,16 +20,19 @@
|
||||
#include <cpu_session/cpu_session.h> /* for 'Thread_capability' type */
|
||||
#include <pager/capability.h>
|
||||
|
||||
/* core-local includes */
|
||||
/* core includes */
|
||||
#include <rpc_cap_factory.h>
|
||||
|
||||
namespace Genode {
|
||||
namespace Core {
|
||||
|
||||
struct Pager_object;
|
||||
struct Pager_entrypoint;
|
||||
|
||||
using Pager_capability = Capability<Pager_object>;
|
||||
}
|
||||
|
||||
|
||||
struct Genode::Pager_object
|
||||
struct Core::Pager_object
|
||||
{
|
||||
Thread_capability _thread_cap { };
|
||||
Signal_context_capability _sigh { };
|
||||
@ -47,7 +50,7 @@ struct Genode::Pager_object
|
||||
};
|
||||
|
||||
|
||||
struct Genode::Pager_entrypoint
|
||||
struct Core::Pager_entrypoint
|
||||
{
|
||||
Pager_entrypoint(Rpc_cap_factory &) { }
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <base/allocator_avl.h>
|
||||
#include <util/arg_string.h>
|
||||
|
||||
/* core-local includes */
|
||||
/* core includes */
|
||||
#include <platform_generic.h>
|
||||
#include <platform_pd.h>
|
||||
#include <platform_thread.h>
|
||||
@ -51,7 +51,7 @@ static unsigned long ram_quota_from_env()
|
||||
}
|
||||
|
||||
|
||||
class Genode::Platform : public Platform_generic
|
||||
class Core::Platform : public Platform_generic
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -14,16 +14,21 @@
|
||||
#ifndef _CORE__INCLUDE__PLATFORM_PD_H_
|
||||
#define _CORE__INCLUDE__PLATFORM_PD_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator.h>
|
||||
#include <parent/parent.h>
|
||||
|
||||
namespace Genode {
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
struct Platform_pd;
|
||||
struct Platform_thread;
|
||||
}
|
||||
|
||||
|
||||
struct Genode::Platform_pd
|
||||
struct Core::Platform_pd
|
||||
{
|
||||
Platform_pd(Allocator &, char const *) { }
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
/* core includes */
|
||||
#include <pager.h>
|
||||
|
||||
namespace Genode { class Platform_thread; }
|
||||
namespace Core { class Platform_thread; }
|
||||
|
||||
|
||||
/*
|
||||
@ -34,7 +34,7 @@ namespace Genode { class Platform_thread; }
|
||||
* turn, we find the exception handler's 'Signal_context_capability'.
|
||||
*/
|
||||
|
||||
class Genode::Platform_thread : public List<Platform_thread>::Element
|
||||
class Core::Platform_thread : public List<Platform_thread>::Element
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -25,15 +25,16 @@
|
||||
#include <pager.h>
|
||||
#include <platform_thread.h>
|
||||
|
||||
namespace Genode {
|
||||
namespace Core {
|
||||
|
||||
struct Rm_client;
|
||||
struct Rm_member;
|
||||
class Region_map_component;
|
||||
}
|
||||
|
||||
|
||||
class Genode::Region_map_component : public Rpc_object<Region_map>,
|
||||
private List<Region_map_component>::Element
|
||||
class Core::Region_map_component : public Rpc_object<Region_map>,
|
||||
private List<Region_map_component>::Element
|
||||
{
|
||||
private:
|
||||
|
||||
@ -74,7 +75,7 @@ class Genode::Region_map_component : public Rpc_object<Region_map>,
|
||||
};
|
||||
|
||||
|
||||
struct Genode::Rm_client : Pager_object
|
||||
struct Core::Rm_client : Pager_object
|
||||
{
|
||||
Rm_client(Cpu_session_capability, Thread_capability,
|
||||
Region_map_component &, unsigned long,
|
||||
|
@ -14,12 +14,17 @@
|
||||
#ifndef _CORE__INCLUDE__RPC_CAP_FACTORY_H_
|
||||
#define _CORE__INCLUDE__RPC_CAP_FACTORY_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/allocator.h>
|
||||
#include <base/capability.h>
|
||||
|
||||
namespace Genode { class Rpc_cap_factory; }
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
class Genode::Rpc_cap_factory
|
||||
namespace Core { class Rpc_cap_factory; }
|
||||
|
||||
|
||||
class Core::Rpc_cap_factory
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -17,4 +17,7 @@
|
||||
/* base-internal includes */
|
||||
#include <base/internal/page_size.h>
|
||||
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
#endif /* _CORE__INCLUDE__UTIL_H_ */
|
||||
|
@ -11,14 +11,14 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
/* core-local includes */
|
||||
/* core includes */
|
||||
#include <cpu_session_component.h>
|
||||
#include <native_cpu_component.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/capability_space_tpl.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
void Native_cpu_component::thread_id(Thread_capability thread_cap, int pid, int tid)
|
||||
|
@ -13,11 +13,10 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <util/arg_string.h>
|
||||
#include <base/log.h>
|
||||
#include <base/snprintf.h>
|
||||
#include <cpu/consts.h>
|
||||
|
||||
/* core-local includes */
|
||||
/* core includes */
|
||||
#include <pd_session_component.h>
|
||||
#include <dataspace_component.h>
|
||||
|
||||
@ -28,7 +27,7 @@
|
||||
/* Linux includes */
|
||||
#include <core_linux_syscalls.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
/***************
|
||||
@ -122,7 +121,7 @@ void Native_pd_component::_start(Dataspace_component &ds)
|
||||
* the dataspace content into a temporary file whose path is passed to
|
||||
* 'execve()'.
|
||||
*/
|
||||
if (strcmp(filename, "") == 0) {
|
||||
if (Genode::strcmp(filename, "") == 0) {
|
||||
|
||||
filename = tmp_filename;
|
||||
|
||||
@ -174,7 +173,7 @@ void Native_pd_component::_start(Dataspace_component &ds)
|
||||
_pid = lx_create_process((int (*)())_exec_child,
|
||||
_execve_args_and_stack().initial_sp());
|
||||
|
||||
if (strcmp(filename, tmp_filename) == 0)
|
||||
if (Genode::strcmp(filename, tmp_filename) == 0)
|
||||
lx_unlink(filename);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
/* Linux includes */
|
||||
#include <core_linux_syscalls.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -14,13 +14,12 @@
|
||||
/* Genode includes */
|
||||
#include <util/token.h>
|
||||
#include <util/misc_math.h>
|
||||
#include <base/log.h>
|
||||
|
||||
/* local includes */
|
||||
#include "platform_thread.h"
|
||||
/* core includes */
|
||||
#include <platform_thread.h>
|
||||
#include <linux_syscalls.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
typedef Token<Scanner_policy_identifier_with_underline> Tid_token;
|
||||
@ -77,7 +76,7 @@ Platform_thread::Registry &Platform_thread::_registry()
|
||||
Platform_thread::Platform_thread(size_t, const char *name, unsigned,
|
||||
Affinity::Location, addr_t)
|
||||
{
|
||||
copy_cstring(_name, name, min(sizeof(_name), strlen(name) + 1));
|
||||
copy_cstring(_name, name, min(sizeof(_name), Genode::strlen(name) + 1));
|
||||
|
||||
_registry().insert(this);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <core_linux_syscalls.h>
|
||||
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
static int ram_ds_cnt = 0; /* counter for creating unique dataspace IDs */
|
||||
|
@ -30,7 +30,7 @@
|
||||
/* local includes */
|
||||
#include "rom_session_component.h"
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -14,7 +14,7 @@
|
||||
/* core includes */
|
||||
#include <rpc_cap_factory.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
Native_capability Rpc_cap_factory::alloc(Native_capability)
|
||||
|
@ -29,7 +29,7 @@
|
||||
/* local includes */
|
||||
#include "dataspace_component.h"
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
Linux_dataspace::Filename Dataspace_component::_file_name(const char *args)
|
||||
@ -54,7 +54,7 @@ Linux_dataspace::Filename Dataspace_component::_file_name(const char *args)
|
||||
|
||||
size_t Dataspace_component::_file_size()
|
||||
{
|
||||
uint64_t size = 0;
|
||||
Genode::uint64_t size = 0;
|
||||
if (lx_stat_size(_fname.buf, size) < 0)
|
||||
throw Service_denied();
|
||||
|
||||
|
@ -12,17 +12,16 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <linux_dataspace/client.h>
|
||||
#include <io_mem_session_component.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/page_size.h>
|
||||
|
||||
/* core-local includes */
|
||||
/* core includes */
|
||||
#include <core_linux_syscalls.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
size_t Io_mem_session_component::get_arg_size(const char *)
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include <io_port_session_component.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
Io_port_session_component::Io_port_session_component(Range_allocator &io_port_alloc,
|
||||
|
@ -14,14 +14,13 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/thread.h>
|
||||
#include <irq_session_component.h>
|
||||
|
||||
/* core-local includes */
|
||||
/* core includes */
|
||||
#include <core_linux_syscalls.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
Irq_session_component::Irq_session_component(Range_allocator &, const char *)
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include <platform_services.h>
|
||||
|
||||
|
||||
void Genode::platform_add_local_services(Rpc_entrypoint &,
|
||||
Sliced_heap &,
|
||||
Registry<Service> &,
|
||||
Trace::Source_registry &)
|
||||
void Core::platform_add_local_services(Rpc_entrypoint &,
|
||||
Sliced_heap &,
|
||||
Registry<Service> &,
|
||||
Trace::Source_registry &)
|
||||
{ }
|
||||
|
@ -25,10 +25,10 @@
|
||||
#include <root/root.h>
|
||||
#include <base/session_label.h>
|
||||
|
||||
/* local includes */
|
||||
#include "dataspace_component.h"
|
||||
/* core includes */
|
||||
#include <dataspace_component.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
Linux_dataspace::Filename Dataspace_component::_file_name(const char *args)
|
||||
@ -51,9 +51,9 @@ Linux_dataspace::Filename Dataspace_component::_file_name(const char *args)
|
||||
}
|
||||
|
||||
|
||||
Genode::size_t Dataspace_component::_file_size()
|
||||
size_t Dataspace_component::_file_size()
|
||||
{
|
||||
uint64_t size = 0;
|
||||
Genode::uint64_t size = 0;
|
||||
if (lx_stat_size(_fname.buf, size) < 0)
|
||||
throw Service_denied();
|
||||
|
||||
|
@ -12,15 +12,14 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <linux_dataspace/client.h>
|
||||
#include <base/internal/page_size.h>
|
||||
#include <io_mem_session_component.h>
|
||||
|
||||
/* core-local includes */
|
||||
/* core includes */
|
||||
#include <core_linux_syscalls.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
size_t Io_mem_session_component::get_arg_size(const char *args)
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <util/arg_string.h>
|
||||
#include <io_port_session_component.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
Io_port_session_component::Io_port_session_component(Range_allocator &io_port_alloc,
|
||||
|
@ -13,15 +13,14 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/thread.h>
|
||||
|
||||
/* core-local includes */
|
||||
/* core includes */
|
||||
#include <irq_session_component.h>
|
||||
#include <irq_object.h>
|
||||
#include <core_linux_syscalls.h>
|
||||
|
||||
using namespace Genode;
|
||||
using namespace Core;
|
||||
|
||||
|
||||
Irq_session_component::Irq_session_component(Range_allocator &, const char *args)
|
||||
|
@ -22,10 +22,13 @@
|
||||
#include <io_port_root.h>
|
||||
#include <core_linux_syscalls.h>
|
||||
|
||||
void Genode::platform_add_local_services(Rpc_entrypoint &,
|
||||
Sliced_heap &md,
|
||||
Registry<Service> ®,
|
||||
Trace::Source_registry &)
|
||||
using namespace Core;
|
||||
|
||||
|
||||
void Core::platform_add_local_services(Rpc_entrypoint &,
|
||||
Sliced_heap &md,
|
||||
Registry<Service> ®,
|
||||
Core::Trace::Source_registry &)
|
||||
{
|
||||
if (!lx_iopl(3)) {
|
||||
static Io_port_root io_port_root(*core_env().pd_session(),
|
||||
|
Reference in New Issue
Block a user