Remove inconsistent use of 'is_' prefix

Fixes #1963
This commit is contained in:
Norman Feske
2016-05-11 18:21:47 +02:00
committed by Christian Helmuth
parent 15141f3ca7
commit 807be83b1b
225 changed files with 876 additions and 705 deletions

View File

@ -55,7 +55,7 @@ Identifiers
* 'Multi_word_identifiers' use underline to separate words. * 'Multi_word_identifiers' use underline to separate words.
* 'CONSTANTS' and template arguments are upper case. * 'CONSTANTS' and template arguments are upper case.
* Private and protected members of a class begin with an '_'-character. * Private and protected members of a class begin with an '_'-character.
* Accessor functions are named after their corresponding attributes: * Accessor methods are named after their corresponding attributes:
! /** ! /**
! * Request private member variable ! * Request private member variable
@ -67,6 +67,10 @@ Identifiers
! */ ! */
! void value(int value) { _value = value; } ! void value(int value) { _value = value; }
* Accessors that return a boolean value do not carry an 'is_' prefix. E.g.,
a method for requesting the validity of an object should be named
'valid()', not 'is_valid()'.
Indentation Indentation
=========== ===========
@ -136,13 +140,13 @@ Braces
! { ! {
! public: ! public:
! !
! void function(void) ! void method(void)
! { ! {
! ... ! ...
! } ! }
! }; ! };
except for single-line functions. except for one-line functions.
* All other occurrences of open braces (for 'if', 'while', 'do', 'for', * All other occurrences of open braces (for 'if', 'while', 'do', 'for',
'namespace', 'enum' etc.) are at the end of a line: 'namespace', 'enum' etc.) are at the end of a line:
@ -153,7 +157,8 @@ Braces
! .. ! ..
! } ! }
* Surprisingly, one-line functions should be written on one line. * One-line functions should be written on a single line as long as the line
length does not exceed approximately 80 characters.
Typically, this applies for accessor functions. Typically, this applies for accessor functions.
If slightly more space than one line is needed, indent as follows: If slightly more space than one line is needed, indent as follows:
@ -164,10 +169,10 @@ Braces
Comments Comments
======== ========
Function header Function/method header
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
Each public or protected (but no private) function in a header-file should be Each public or protected (but no private) method in a header-file should be
prepended by a header as follows: prepended by a header as follows:
! /** ! /**

View File

@ -161,12 +161,12 @@ namespace Genode {
unsigned long badge() const { unsigned long badge() const {
return convert_native_thread_id_to_badge(_last); } return convert_native_thread_id_to_badge(_last); }
bool is_write_fault() const { return (_pf_addr & 2); } bool write_fault() const { return (_pf_addr & 2); }
/** /**
* Return true if last fault was an exception * Return true if last fault was an exception
*/ */
bool is_exception() const bool exception() const
{ {
/* /*
* Reflection of exceptions is not supported on this platform. * Reflection of exceptions is not supported on this platform.

View File

@ -46,7 +46,7 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
/* find appropriate region for mapping */ /* find appropriate region for mapping */
void *local_base = 0; void *local_base = 0;
if (platform()->region_alloc()->alloc_aligned(size, &local_base, alignment).is_error()) if (platform()->region_alloc()->alloc_aligned(size, &local_base, alignment).error())
return 0; return 0;
/* call sigma0 for I/O region */ /* call sigma0 for I/O region */

View File

@ -132,7 +132,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
if (msi) if (msi)
throw Root::Unavailable(); throw Root::Unavailable();
if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).is_error()) { if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).error()) {
PERR("Unavailable IRQ 0x%x requested", _irq_number); PERR("Unavailable IRQ 0x%x requested", _irq_number);
throw Root::Unavailable(); throw Root::Unavailable();
} }

View File

@ -172,12 +172,12 @@ namespace Genode {
*/ */
unsigned long badge() { return _badge; } unsigned long badge() { return _badge; }
bool is_write_fault() const { return (_pf_addr & 2); } bool write_fault() const { return (_pf_addr & 2); }
/** /**
* Return true if last fault was an exception * Return true if last fault was an exception
*/ */
bool is_exception() const bool exception() const
{ {
return _type == Ipc_pager::EXCEPTION; return _type == Ipc_pager::EXCEPTION;
} }

View File

@ -35,7 +35,7 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
/* find appropriate region for mapping */ /* find appropriate region for mapping */
void *local_base = 0; void *local_base = 0;
if (platform()->region_alloc()->alloc_aligned(size, &local_base, alignment).is_error()) if (platform()->region_alloc()->alloc_aligned(size, &local_base, alignment).error())
return 0; return 0;
if (!map_local_io(base, (addr_t)local_base, size >> get_page_size_log2())) { if (!map_local_io(base, (addr_t)local_base, size >> get_page_size_log2())) {

View File

@ -194,7 +194,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
} }
msi_alloc.set(irq_number, 1); msi_alloc.set(irq_number, 1);
} else { } else {
if (!irq_alloc || irq_alloc->alloc_addr(1, irq_number).is_error()) { if (!irq_alloc || irq_alloc->alloc_addr(1, irq_number).error()) {
PERR("Unavailable IRQ %ld requested.", irq_number); PERR("Unavailable IRQ %ld requested.", irq_number);
throw Root::Unavailable(); throw Root::Unavailable();
} }

View File

@ -57,7 +57,7 @@ void Pager_entrypoint::entry()
case Ipc_pager::PAGEFAULT: case Ipc_pager::PAGEFAULT:
case Ipc_pager::EXCEPTION: case Ipc_pager::EXCEPTION:
{ {
if (_pager.is_exception()) { if (_pager.exception()) {
Lock::Guard guard(obj->state.lock); Lock::Guard guard(obj->state.lock);
_pager.get_regs(&obj->state); _pager.get_regs(&obj->state);
obj->state.exceptions++; obj->state.exceptions++;

View File

@ -34,7 +34,7 @@ using namespace Genode;
void Signal_source_component::release(Signal_context_component *context) void Signal_source_component::release(Signal_context_component *context)
{ {
if (context && context->is_enqueued()) if (context && context->enqueued())
_signal_queue.remove(context); _signal_queue.remove(context);
} }
@ -44,7 +44,7 @@ void Signal_source_component::submit(Signal_context_component *context,
/* enqueue signal to context */ /* enqueue signal to context */
context->increment_signal_cnt(cnt); context->increment_signal_cnt(cnt);
if (!context->is_enqueued()) { if (!context->enqueued()) {
_signal_queue.enqueue(context); _signal_queue.enqueue(context);
/* wake up client */ /* wake up client */

View File

@ -51,7 +51,7 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
void *virt_addr; void *virt_addr;
if (!platform()->region_alloc()->alloc_aligned(page_rounded_size, if (!platform()->region_alloc()->alloc_aligned(page_rounded_size,
&virt_addr, &virt_addr,
get_page_size_log2()).is_ok()) { get_page_size_log2()).ok()) {
PERR("Could not allocate virtual address range in core of size %zd\n", PERR("Could not allocate virtual address range in core of size %zd\n",
page_rounded_size); page_rounded_size);
return nullptr; return nullptr;
@ -61,7 +61,7 @@ Core_region_map::attach(Dataspace_capability ds_cap, size_t size,
unsigned num_pages = page_rounded_size >> get_page_size_log2(); unsigned num_pages = page_rounded_size >> get_page_size_log2();
Page_flags const flags = Page_flags::apply_mapping(ds->writable(), Page_flags const flags = Page_flags::apply_mapping(ds->writable(),
ds->cacheability(), ds->cacheability(),
ds->is_io_mem()); ds->io_mem());
if (!map_local(ds->phys_addr(), (addr_t)virt_addr, num_pages, flags)) if (!map_local(ds->phys_addr(), (addr_t)virt_addr, num_pages, flags))
return nullptr; return nullptr;

View File

@ -113,7 +113,7 @@ class Genode::Ipc_pager
/** /**
* Access direction of current page fault * Access direction of current page fault
*/ */
bool is_write_fault() const; bool write_fault() const;
/** /**
* Input mapping data as reply to current page fault * Input mapping data as reply to current page fault

View File

@ -80,7 +80,7 @@ Irq_session_component::Irq_session_component(Range_allocator * const irq_alloc,
} }
/* allocate interrupt */ /* allocate interrupt */
if (_irq_alloc->alloc_addr(1, _irq_number).is_error()) { if (_irq_alloc->alloc_addr(1, _irq_number).error()) {
PERR("unavailable interrupt %d requested", _irq_number); PERR("unavailable interrupt %d requested", _irq_number);
throw Root::Invalid_args(); throw Root::Invalid_args();
} }

View File

@ -166,7 +166,7 @@ Signal_context::Signal_context(Signal_receiver * const r, unsigned const imprint
void Signal_receiver::_add_deliverable(Signal_context * const c) void Signal_receiver::_add_deliverable(Signal_context * const c)
{ {
if (!c->_deliver_fe.is_enqueued()) { if (!c->_deliver_fe.enqueued()) {
_deliver.enqueue(&c->_deliver_fe); _deliver.enqueue(&c->_deliver_fe);
} }
_listen(); _listen();
@ -199,7 +199,7 @@ void Signal_receiver::_listen()
void Signal_receiver::_context_destructed(Signal_context * const c) void Signal_receiver::_context_destructed(Signal_context * const c)
{ {
_contexts.remove(&c->_contexts_fe); _contexts.remove(&c->_contexts_fe);
if (!c->_deliver_fe.is_enqueued()) { return; } if (!c->_deliver_fe.enqueued()) { return; }
_deliver.remove(&c->_deliver_fe); _deliver.remove(&c->_deliver_fe);
} }

View File

@ -53,7 +53,7 @@ addr_t Ipc_pager::fault_ip() const { return _fault.ip; }
addr_t Ipc_pager::fault_addr() const { return _fault.addr; } addr_t Ipc_pager::fault_addr() const { return _fault.addr; }
bool Ipc_pager::is_write_fault() const { return _fault.writes; } bool Ipc_pager::write_fault() const { return _fault.writes; }
void Ipc_pager::set_reply_mapping(Mapping m) { _mapping = m; } void Ipc_pager::set_reply_mapping(Mapping m) { _mapping = m; }

View File

@ -38,7 +38,7 @@ void * Hw::Address_space::_table_alloc()
{ {
void * ret; void * ret;
if (!_cma()->alloc_aligned(sizeof(Translation_table), (void**)&ret, if (!_cma()->alloc_aligned(sizeof(Translation_table), (void**)&ret,
Translation_table::ALIGNM_LOG2).is_ok()) Translation_table::ALIGNM_LOG2).ok())
throw Root::Quota_exceeded(); throw Root::Quota_exceeded();
return ret; return ret;
} }

View File

@ -41,7 +41,7 @@ Platform_thread::~Platform_thread()
/* detach UTCB of main threads */ /* detach UTCB of main threads */
if (_main_thread) { if (_main_thread) {
Locked_ptr<Address_space> locked_ptr(_address_space); Locked_ptr<Address_space> locked_ptr(_address_space);
if (locked_ptr.is_valid()) if (locked_ptr.valid())
locked_ptr->flush((addr_t)_utcb_pd_addr, sizeof(Native_utcb)); locked_ptr->flush((addr_t)_utcb_pd_addr, sizeof(Native_utcb));
} }
@ -137,7 +137,7 @@ int Platform_thread::start(void * const ip, void * const sp)
/* lock the address space */ /* lock the address space */
Locked_ptr<Address_space> locked_ptr(_address_space); Locked_ptr<Address_space> locked_ptr(_address_space);
if (!locked_ptr.is_valid()) { if (!locked_ptr.valid()) {
PERR("invalid RM client"); PERR("invalid RM client");
return -1; return -1;
}; };

View File

@ -31,7 +31,7 @@ void Rm_client::unmap(addr_t, addr_t virt_base, size_t size)
{ {
Locked_ptr<Address_space> locked_address_space(_address_space); Locked_ptr<Address_space> locked_address_space(_address_space);
if (locked_address_space.is_valid()) if (locked_address_space.valid())
locked_address_space->flush(virt_base, size); locked_address_space->flush(virt_base, size);
} }
@ -76,7 +76,7 @@ void Pager_entrypoint::entry()
/* apply mapping that was determined by the local region managers */ /* apply mapping that was determined by the local region managers */
{ {
Locked_ptr<Address_space> locked_ptr(pt->address_space()); Locked_ptr<Address_space> locked_ptr(pt->address_space());
if (!locked_ptr.is_valid()) return; if (!locked_ptr.valid()) return;
Hw::Address_space * as = static_cast<Hw::Address_space*>(&*locked_ptr); Hw::Address_space * as = static_cast<Hw::Address_space*>(&*locked_ptr);
Page_flags const flags = Page_flags const flags =

View File

@ -85,7 +85,7 @@ Vm_session_component::Vm_session_component(Rpc_entrypoint *ds_ep,
/* get some aligned space for the translation table */ /* get some aligned space for the translation table */
if (!cma->alloc_aligned(sizeof(Translation_table), (void**)&tt, if (!cma->alloc_aligned(sizeof(Translation_table), (void**)&tt,
Translation_table::ALIGNM_LOG2).is_ok()) { Translation_table::ALIGNM_LOG2).ok()) {
PERR("failed to allocate kernel object"); PERR("failed to allocate kernel object");
throw Root::Quota_exceeded(); throw Root::Quota_exceeded();
} }

View File

@ -23,7 +23,7 @@ addr_t Vm_session_component::_alloc_ds(size_t &ram_quota)
addr_t addr; addr_t addr;
if (_ds_size() > ram_quota || if (_ds_size() > ram_quota ||
platform()->ram_alloc()->alloc_aligned(_ds_size(), (void**)&addr, platform()->ram_alloc()->alloc_aligned(_ds_size(), (void**)&addr,
get_page_size_log2()).is_error()) get_page_size_log2()).error())
throw Root::Quota_exceeded(); throw Root::Quota_exceeded();
ram_quota -= _ds_size(); ram_quota -= _ds_size();
return addr; return addr;

View File

@ -86,7 +86,7 @@ Child::Process::Process(Dataspace_capability elf_ds,
if (!elf.valid()) if (!elf.valid())
throw Invalid_executable(); throw Invalid_executable();
bool const dynamically_linked = elf.is_dynamically_linked(); bool const dynamically_linked = elf.dynamically_linked();
local_rm.detach(elf_addr); local_rm.detach(elf_addr);

View File

@ -397,8 +397,8 @@ Thread *Thread::myself()
if (tls != 0) if (tls != 0)
return ((Native_thread::Meta_data *)tls)->thread_base; return ((Native_thread::Meta_data *)tls)->thread_base;
bool const is_main_thread = (lx_getpid() == lx_gettid()); bool const called_by_main_thread = (lx_getpid() == lx_gettid());
if (is_main_thread) if (called_by_main_thread)
return 0; return 0;
/* /*

View File

@ -18,18 +18,18 @@
#include <base/thread_state_base.h> #include <base/thread_state_base.h>
namespace Genode { namespace Genode { struct Thread_state; }
struct Thread_state : Thread_state_base
{
bool is_vcpu;
addr_t sel_exc_base;
Thread_state() : is_vcpu(false), sel_exc_base(~0UL) { } struct Genode::Thread_state : Thread_state_base
{
bool vcpu;
addr_t sel_exc_base;
Thread_state(bool is_vcpu, addr_t sel_exc_base) Thread_state() : vcpu(false), sel_exc_base(~0UL) { }
: is_vcpu(is_vcpu), sel_exc_base(sel_exc_base) { }
}; Thread_state(bool vcpu, addr_t sel_exc_base)
} : vcpu(vcpu), sel_exc_base(sel_exc_base) { }
};
#endif /* _INCLUDE__BASE__THREAD_STATE_H_ */ #endif /* _INCLUDE__BASE__THREAD_STATE_H_ */

View File

@ -30,7 +30,7 @@ struct Genode::Native_thread
addr_t ec_sel; /* selector for execution context */ addr_t ec_sel; /* selector for execution context */
addr_t exc_pt_sel; /* base of event portal window */ addr_t exc_pt_sel; /* base of event portal window */
bool is_vcpu; bool vcpu; /* true if thread is a virtual CPU */
/* receive window for capability selectors received at the server side */ /* receive window for capability selectors received at the server side */
Receive_window rcv_window; Receive_window rcv_window;
@ -38,7 +38,7 @@ struct Genode::Native_thread
Native_capability pager_cap; Native_capability pager_cap;
Native_thread() : ec_sel(INVALID_INDEX), Native_thread() : ec_sel(INVALID_INDEX),
exc_pt_sel(INVALID_INDEX), is_vcpu(false) { } exc_pt_sel(INVALID_INDEX), vcpu(false) { }
}; };
#endif /* _INCLUDE__NOVA__NATIVE_THREAD_H_ */ #endif /* _INCLUDE__NOVA__NATIVE_THREAD_H_ */

View File

@ -40,7 +40,7 @@ static inline void * alloc_region(Dataspace_component *ds, const size_t size)
size_t align_log2 = log2(ds->size()); size_t align_log2 = log2(ds->size());
for (; align_log2 >= get_page_size_log2(); align_log2--) { for (; align_log2 >= get_page_size_log2(); align_log2--) {
if (platform()->region_alloc()->alloc_aligned(size, if (platform()->region_alloc()->alloc_aligned(size,
&virt_addr, align_log2).is_ok()) &virt_addr, align_log2).ok())
break; break;
} }

View File

@ -126,12 +126,12 @@ namespace Genode {
/** /**
* Return true if fault was a write fault * Return true if fault was a write fault
*/ */
bool is_write_fault() const { return _fault_type & ERR_W; } bool write_fault() const { return _fault_type & ERR_W; }
/** /**
* Return true if last fault was an exception * Return true if last fault was an exception
*/ */
bool is_exception() const bool exception() const
{ {
/* /*
* Reflection of exceptions is not supported on this platform. * Reflection of exceptions is not supported on this platform.

View File

@ -56,9 +56,9 @@ namespace Genode {
addr_t _sel_sc() const { return _id_base + 2; } addr_t _sel_sc() const { return _id_base + 2; }
/* convenience function to access _feature variable */ /* convenience function to access _feature variable */
inline bool is_main_thread() const { return _features & MAIN_THREAD; } inline bool main_thread() const { return _features & MAIN_THREAD; }
inline bool is_vcpu() const { return _features & VCPU; } inline bool vcpu() const { return _features & VCPU; }
inline bool is_worker() const { return _features & WORKER; } inline bool worker() const { return _features & WORKER; }
public: public:

View File

@ -70,7 +70,7 @@ static bool msi(Genode::addr_t irq_sel, Genode::addr_t phys_mem,
Genode::Signal_context_capability sig_cap) Genode::Signal_context_capability sig_cap)
{ {
void * virt = 0; void * virt = 0;
if (platform()->region_alloc()->alloc_aligned(4096, &virt, 12).is_error()) if (platform()->region_alloc()->alloc_aligned(4096, &virt, 12).error())
return false; return false;
Genode::addr_t virt_addr = reinterpret_cast<Genode::addr_t>(virt); Genode::addr_t virt_addr = reinterpret_cast<Genode::addr_t>(virt);
@ -216,7 +216,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
throw Root::Unavailable(); throw Root::Unavailable();
} }
if (!irq_alloc || irq_alloc->alloc_addr(1, irq_number).is_error()) { if (!irq_alloc || irq_alloc->alloc_addr(1, irq_number).error()) {
PERR("Unavailable IRQ 0x%lx requested", irq_number); PERR("Unavailable IRQ 0x%lx requested", irq_number);
throw Root::Unavailable(); throw Root::Unavailable();
} }

View File

@ -611,7 +611,7 @@ Platform::Platform() :
addr_t const virt = mapped_cmd_line + get_page_size() * 2; addr_t const virt = mapped_cmd_line + get_page_size() * 2;
addr_t const phys = round_page(mem_desc->aux); addr_t const phys = round_page(mem_desc->aux);
if (region_alloc()->alloc_addr(get_page_size(), virt).is_ok()) { if (region_alloc()->alloc_addr(get_page_size(), virt).ok()) {
/* we got the virtual region */ /* we got the virtual region */
err = map_local(__main_thread_utcb, phys, virt, 1, err = map_local(__main_thread_utcb, phys, virt, 1,
Nova::Rights(true, false, false), true); Nova::Rights(true, false, false), true);

View File

@ -55,7 +55,7 @@ int Platform_thread::start(void *ip, void *sp)
return -1; return -1;
} }
if (!_pd || (is_main_thread() && !is_vcpu() && if (!_pd || (main_thread() && !vcpu() &&
_pd->parent_pt_sel() == Native_thread::INVALID_INDEX)) { _pd->parent_pt_sel() == Native_thread::INVALID_INDEX)) {
PERR("protection domain undefined"); PERR("protection domain undefined");
return -2; return -2;
@ -68,9 +68,9 @@ int Platform_thread::start(void *ip, void *sp)
return -8; return -8;
} }
if (!is_main_thread()) { if (!main_thread()) {
addr_t const initial_sp = reinterpret_cast<addr_t>(sp); addr_t const initial_sp = reinterpret_cast<addr_t>(sp);
addr_t const utcb = is_vcpu() ? 0 : round_page(initial_sp); addr_t const utcb = vcpu() ? 0 : round_page(initial_sp);
if (_sel_exc_base == Native_thread::INVALID_INDEX) { if (_sel_exc_base == Native_thread::INVALID_INDEX) {
PERR("exception base not specified"); PERR("exception base not specified");
@ -114,9 +114,9 @@ int Platform_thread::start(void *ip, void *sp)
addr_t pd_core_sel = Platform_pd::pd_core_sel(); addr_t pd_core_sel = Platform_pd::pd_core_sel();
addr_t pd_utcb = 0; addr_t pd_utcb = 0;
_sel_exc_base = is_vcpu() ? _pager->exc_pt_vcpu() : _pager->exc_pt_sel_client(); _sel_exc_base = vcpu() ? _pager->exc_pt_vcpu() : _pager->exc_pt_sel_client();
if (!is_vcpu()) { if (!vcpu()) {
pd_utcb = stack_area_virtual_base() + stack_virtual_size() - get_page_size(); pd_utcb = stack_area_virtual_base() + stack_virtual_size() - get_page_size();
addr_t remap_src[] = { _pd->parent_pt_sel(), _pager->Object_pool<Pager_object>::Entry::cap().local_name() }; addr_t remap_src[] = { _pd->parent_pt_sel(), _pager->Object_pool<Pager_object>::Entry::cap().local_name() };
@ -136,7 +136,7 @@ int Platform_thread::start(void *ip, void *sp)
addr_t const rights = Obj_crd::RIGHT_EC_RECALL | addr_t const rights = Obj_crd::RIGHT_EC_RECALL |
Obj_crd::RIGHT_PT_CTRL | Obj_crd::RIGHT_PT_CALL | Obj_crd::RIGHT_PT_CTRL | Obj_crd::RIGHT_PT_CALL |
Obj_crd::RIGHT_SM_UP | Obj_crd::RIGHT_SM_DOWN; Obj_crd::RIGHT_SM_UP | Obj_crd::RIGHT_SM_DOWN;
unsigned pts = is_vcpu() ? NUM_INITIAL_VCPU_PT_LOG2 : NUM_INITIAL_PT_LOG2; unsigned pts = vcpu() ? NUM_INITIAL_VCPU_PT_LOG2 : NUM_INITIAL_PT_LOG2;
enum { KEEP_FREE_PAGES_NOT_AVAILABLE_FOR_UPGRADE = 2, UPPER_LIMIT_PAGES = 32 }; enum { KEEP_FREE_PAGES_NOT_AVAILABLE_FOR_UPGRADE = 2, UPPER_LIMIT_PAGES = 32 };
Obj_crd initial_pts(_sel_exc_base, pts, rights); Obj_crd initial_pts(_sel_exc_base, pts, rights);
@ -215,7 +215,7 @@ Native_capability Platform_thread::pause()
cancel_blocking(); cancel_blocking();
/* local thread may never get be canceled if it doesn't receive an IPC */ /* local thread may never get be canceled if it doesn't receive an IPC */
if (is_worker()) return Native_capability(); if (worker()) return Native_capability();
return notify_sm; return notify_sm;
} }
@ -225,7 +225,7 @@ void Platform_thread::resume()
{ {
using namespace Nova; using namespace Nova;
if (!is_worker()) { if (!worker()) {
uint8_t res; uint8_t res;
do { do {
if (!_pd) { if (!_pd) {
@ -256,7 +256,7 @@ Thread_state Platform_thread::state()
if (_pager->copy_thread_state(&s)) if (_pager->copy_thread_state(&s))
return s; return s;
if (is_worker()) { if (worker()) {
s.sp = _pager->initial_esp(); s.sp = _pager->initial_esp();
return s; return s;
} }
@ -274,18 +274,18 @@ void Platform_thread::state(Thread_state s)
/* /*
* s.sel_exc_base exception base of thread in caller * s.sel_exc_base exception base of thread in caller
* protection domain - not in Core ! * protection domain - not in Core !
* s.is_vcpu If true it will run as vCPU, * s.vcpu If true it will run as vCPU,
* otherwise it will be a thread. * otherwise it will be a thread.
*/ */
if (!is_main_thread()) if (!main_thread())
_sel_exc_base = s.sel_exc_base; _sel_exc_base = s.sel_exc_base;
if (!s.is_vcpu) if (!s.vcpu)
return; return;
_features |= VCPU; _features |= VCPU;
if (is_main_thread() && _pager) if (main_thread() && _pager)
_pager->prepare_vCPU_portals(); _pager->prepare_vCPU_portals();
} }
@ -304,7 +304,7 @@ Native_capability Platform_thread::single_step_sync(bool on)
Native_capability cap = _pager->single_step(on); Native_capability cap = _pager->single_step(on);
if (is_worker()) return Native_capability(); if (worker()) return Native_capability();
return cap; return cap;
} }
@ -334,7 +334,7 @@ unsigned long long Platform_thread::execution_time() const
* For local ECs, we simply return 0 as local ECs are executed with the * For local ECs, we simply return 0 as local ECs are executed with the
* time of their callers. * time of their callers.
*/ */
if (is_worker()) if (worker())
return time; return time;
uint8_t res = Nova::sc_ctrl(_sel_sc(), time); uint8_t res = Nova::sc_ctrl(_sel_sc(), time);

View File

@ -42,7 +42,7 @@ static inline void * alloc_region(Dataspace_component *ds, const size_t size)
size_t align_log2 = log2(ds->size()); size_t align_log2 = log2(ds->size());
for (; align_log2 >= get_page_size_log2(); align_log2--) { for (; align_log2 >= get_page_size_log2(); align_log2--) {
if (platform()->region_alloc()->alloc_aligned(size, if (platform()->region_alloc()->alloc_aligned(size,
&virt_addr, align_log2).is_ok()) &virt_addr, align_log2).ok())
break; break;
} }

View File

@ -26,6 +26,6 @@ void Rm_client::unmap(addr_t, addr_t virt_base, size_t size)
{ {
Locked_ptr<Address_space> locked_address_space(_address_space); Locked_ptr<Address_space> locked_address_space(_address_space);
if (locked_address_space.is_valid()) if (locked_address_space.valid())
locked_address_space->flush(virt_base, size); locked_address_space->flush(virt_base, size);
} }

View File

@ -160,7 +160,7 @@ void Thread::start()
/* create EC at core */ /* create EC at core */
Thread_state state; Thread_state state;
state.sel_exc_base = native_thread().exc_pt_sel; state.sel_exc_base = native_thread().exc_pt_sel;
state.is_vcpu = native_thread().is_vcpu; state.vcpu = native_thread().vcpu;
/* local thread have no start instruction pointer - set via portal entry */ /* local thread have no start instruction pointer - set via portal entry */
addr_t thread_ip = global ? reinterpret_cast<addr_t>(_thread_start) : 0; addr_t thread_ip = global ? reinterpret_cast<addr_t>(_thread_start) : 0;
@ -183,7 +183,7 @@ void Thread::start()
using namespace Nova; using namespace Nova;
/* request exception portals for normal threads */ /* request exception portals for normal threads */
if (!native_thread().is_vcpu) { if (!native_thread().vcpu) {
request_event_portal(pager_cap, native_thread().exc_pt_sel, 0, NUM_INITIAL_PT_LOG2); request_event_portal(pager_cap, native_thread().exc_pt_sel, 0, NUM_INITIAL_PT_LOG2);
/* default: we don't accept any mappings or translations */ /* default: we don't accept any mappings or translations */

View File

@ -161,12 +161,12 @@ namespace Genode {
/** /**
* Return true if last fault was a write fault * Return true if last fault was a write fault
*/ */
bool is_write_fault() const { return L4_Label(_faulter_tag) & 2; } bool write_fault() const { return L4_Label(_faulter_tag) & 2; }
/** /**
* Return true if last fault was an exception * Return true if last fault was an exception
*/ */
bool is_exception() const bool exception() const
{ {
/* /*
* A page-fault message has one of the op bits (lower 3 bits of the * A page-fault message has one of the op bits (lower 3 bits of the

View File

@ -144,7 +144,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
if (msi) if (msi)
throw Root::Unavailable(); throw Root::Unavailable();
if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).is_error()) { if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).error()) {
PERR("Unavailable IRQ 0x%x requested", _irq_number); PERR("Unavailable IRQ 0x%x requested", _irq_number);
throw Root::Unavailable(); throw Root::Unavailable();
} }

View File

@ -100,7 +100,7 @@ void Ipc_pager::wait_for_fault()
*/ */
/* exception */ /* exception */
if (is_exception()) { if (exception()) {
L4_StoreMR(1, &_fault_ip); L4_StoreMR(1, &_fault_ip);
if (verbose_exception) if (verbose_exception)

View File

@ -24,6 +24,6 @@ void Rm_client::unmap(addr_t, addr_t virt_base, size_t size)
{ {
Locked_ptr<Address_space> locked_address_space(_address_space); Locked_ptr<Address_space> locked_address_space(_address_space);
if (locked_address_space.is_valid()) if (locked_address_space.valid())
locked_address_space->flush(virt_base, size); locked_address_space->flush(virt_base, size);
} }

View File

@ -168,12 +168,12 @@ namespace Genode {
/** /**
* Return true if last fault was a write fault * Return true if last fault was a write fault
*/ */
bool is_write_fault() const { return (_flags & 2); } bool write_fault() const { return (_flags & 2); }
/** /**
* Return true if last fault was an exception * Return true if last fault was an exception
*/ */
bool is_exception() const bool exception() const
{ {
/* /*
* Reflection of exceptions is not supported on this platform. * Reflection of exceptions is not supported on this platform.

View File

@ -83,7 +83,7 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
/* find appropriate region for mapping */ /* find appropriate region for mapping */
void *result = 0; void *result = 0;
if (platform()->region_alloc()->alloc_aligned(size, &result, alignment).is_error()) if (platform()->region_alloc()->alloc_aligned(size, &result, alignment).error())
PERR("alloc_aligned failed!"); PERR("alloc_aligned failed!");
local_base = (addr_t)result; local_base = (addr_t)result;

View File

@ -137,7 +137,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
if (msi) if (msi)
throw Root::Unavailable(); throw Root::Unavailable();
if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).is_error()) { if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).error()) {
PERR("Unavailable IRQ 0x%x requested", _irq_number); PERR("Unavailable IRQ 0x%x requested", _irq_number);
throw Root::Unavailable(); throw Root::Unavailable();
} }

View File

@ -63,7 +63,7 @@ enum { PAGER_STACK_ELEMENTS = 512 };
static unsigned long _core_pager_stack[PAGER_STACK_ELEMENTS]; static unsigned long _core_pager_stack[PAGER_STACK_ELEMENTS];
static inline bool is_write_fault(Pistachio::L4_Word_t flags) { static inline bool write_fault(Pistachio::L4_Word_t flags) {
return (flags & 2) == 1; } return (flags & 2) == 1; }
@ -169,7 +169,7 @@ static void _core_pager_loop()
/* check for NULL pointer */ /* check for NULL pointer */
if (pf_addr < page_size) { if (pf_addr < page_size) {
PERR("possible null pointer %s at address %lx at EIP %lx in", PERR("possible null pointer %s at address %lx at EIP %lx in",
is_write_fault(flags) ? "WRITE" : "READ/EXEC", pf_addr, pf_ip); write_fault(flags) ? "WRITE" : "READ/EXEC", pf_addr, pf_ip);
print_l4_thread_id(t); print_l4_thread_id(t);
/* do not unblock faulter */ /* do not unblock faulter */
break; break;
@ -177,7 +177,7 @@ static void _core_pager_loop()
/* page-fault address is not in RAM */ /* page-fault address is not in RAM */
PERR("%s access outside of RAM at %lx IP %lx", PERR("%s access outside of RAM at %lx IP %lx",
is_write_fault(flags) ? "WRITE" : "READ", pf_addr, pf_ip); write_fault(flags) ? "WRITE" : "READ", pf_addr, pf_ip);
print_l4_thread_id(t); print_l4_thread_id(t);
/* do not unblock faulter */ /* do not unblock faulter */
break; break;

View File

@ -141,12 +141,12 @@ namespace Genode {
/** /**
* Return true if page fault was a write fault * Return true if page fault was a write fault
*/ */
bool is_write_fault() const { return _pf_write; } bool write_fault() const { return _pf_write; }
/** /**
* Return true if last fault was an exception * Return true if last fault was an exception
*/ */
bool is_exception() const bool exception() const
{ {
/* /*
* Reflection of exceptions is not supported on this platform. * Reflection of exceptions is not supported on this platform.

View File

@ -38,7 +38,7 @@ struct Genode::Untyped_memory
phys_alloc.alloc_aligned(num_pages*get_page_size(), &out_ptr, phys_alloc.alloc_aligned(num_pages*get_page_size(), &out_ptr,
get_page_size_log2()); get_page_size_log2());
if (alloc_ret.is_error()) { if (alloc_ret.error()) {
PERR("%s: allocation of untyped memory failed", __FUNCTION__); PERR("%s: allocation of untyped memory failed", __FUNCTION__);
throw Phys_alloc_failed(); throw Phys_alloc_failed();
} }

View File

@ -61,7 +61,7 @@ Irq_session_component::Irq_session_component(Range_allocator *irq_alloc,
if (msi) if (msi)
throw Root::Unavailable(); throw Root::Unavailable();
if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).is_error()) { if (!irq_alloc || irq_alloc->alloc_addr(1, _irq_number).error()) {
PERR("Unavailable IRQ 0x%x requested", _irq_number); PERR("Unavailable IRQ 0x%x requested", _irq_number);
throw Root::Unavailable(); throw Root::Unavailable();
} }

View File

@ -302,7 +302,7 @@ void Platform::_init_rom_modules()
Range_allocator::Alloc_return const alloc_ret = Range_allocator::Alloc_return const alloc_ret =
_unused_phys_alloc.alloc_aligned(modules_size, &out_ptr, get_page_size_log2()); _unused_phys_alloc.alloc_aligned(modules_size, &out_ptr, get_page_size_log2());
if (alloc_ret.is_error()) { if (alloc_ret.error()) {
PERR("could not reserve phys CNode space for boot modules"); PERR("could not reserve phys CNode space for boot modules");
struct Init_rom_modules_failed { }; struct Init_rom_modules_failed { };
throw Init_rom_modules_failed(); throw Init_rom_modules_failed();

View File

@ -21,6 +21,6 @@ void Rm_client::unmap(addr_t core_local_base, addr_t virt_base, size_t size)
{ {
Locked_ptr<Address_space> locked_address_space(_address_space); Locked_ptr<Address_space> locked_address_space(_address_space);
if (locked_address_space.is_valid()) if (locked_address_space.valid())
locked_address_space->flush(virt_base, size); locked_address_space->flush(virt_base, size);
} }

View File

@ -150,8 +150,14 @@ struct Genode::Range_allocator : Allocator
Value const value; Value const value;
Alloc_return(Value value) : value(value) { } Alloc_return(Value value) : value(value) { }
bool is_ok() const { return value == OK; } bool ok() const { return value == OK; }
bool is_error() const { return !is_ok(); } bool error() const { return !ok(); }
/*
* \deprecated use 'ok' and 'error' instead
*/
bool is_ok() const { return ok(); }
bool is_error() const { return error(); }
}; };
/** /**

View File

@ -282,7 +282,7 @@ class Genode::Allocator_avl_base : public Range_allocator
bool alloc(size_t size, void **out_addr) override bool alloc(size_t size, void **out_addr) override
{ {
return (Allocator_avl_base::alloc_aligned( return (Allocator_avl_base::alloc_aligned(
size, out_addr, log2(sizeof(addr_t))).is_ok()); size, out_addr, log2(sizeof(addr_t))).ok());
} }
void free(void *addr, size_t) override { free(addr); } void free(void *addr, size_t) override { free(addr); }

View File

@ -109,7 +109,7 @@ class Genode::Attached_rom_dataspace
* the existing dataspace, we can keep everything in place. The * the existing dataspace, we can keep everything in place. The
* dataspace content gets updated by the call of '_rom.update'. * dataspace content gets updated by the call of '_rom.update'.
*/ */
if (_ds.is_constructed() && _rom.update() == true) if (_ds.constructed() && _rom.update() == true)
return; return;
/* /*
@ -123,7 +123,15 @@ class Genode::Attached_rom_dataspace
/** /**
* Return true of content is present * Return true of content is present
*/ */
bool is_valid() const { return _ds.is_constructed(); } bool valid() const { return _ds.constructed(); }
/**
* Return true of content is present
*
* \noapi
* \deprecated use 'valid' instead
*/
bool is_valid() const { return valid(); }
/** /**
* Return dataspace content as XML node * Return dataspace content as XML node
@ -135,7 +143,7 @@ class Genode::Attached_rom_dataspace
Xml_node xml() const Xml_node xml() const
{ {
try { try {
if (is_valid() && local_addr<void const>()) if (valid() && local_addr<void const>())
return Xml_node(local_addr<char>(), size()); return Xml_node(local_addr<char>(), size());
} catch (Xml_node::Invalid_syntax) { } } catch (Xml_node::Invalid_syntax) { }

View File

@ -140,7 +140,7 @@ class Genode::Object_pool
{ {
Locked_ptr lock_ptr(ptr); Locked_ptr lock_ptr(ptr);
Object_pointer op = lock_ptr.is_valid() Object_pointer op = lock_ptr.valid()
? dynamic_cast<Object_pointer>(&lock_ptr->obj) : nullptr; ? dynamic_cast<Object_pointer>(&lock_ptr->obj) : nullptr;
return func(op); return func(op);
} }
@ -170,7 +170,7 @@ class Genode::Object_pool
Weak_ptr ptr = obj->_lock.weak_ptr(); Weak_ptr ptr = obj->_lock.weak_ptr();
{ {
Locked_ptr lock_ptr(ptr); Locked_ptr lock_ptr(ptr);
if (!lock_ptr.is_valid()) return; if (!lock_ptr.valid()) return;
_tree.remove(obj); _tree.remove(obj);
} }

View File

@ -106,9 +106,17 @@ class Genode::Rpc_in_buffer : public Rpc_in_buffer_base
/** /**
* Return true if buffer contains a valid null-terminated string * Return true if buffer contains a valid null-terminated string
*/ */
bool is_valid_string() const { bool valid_string() const {
return (_size <= MAX_SIZE) && (_size > 0) && (_base[_size - 1] == '\0'); } return (_size <= MAX_SIZE) && (_size > 0) && (_base[_size - 1] == '\0'); }
/**
* Return true if buffer contains a valid null-terminated string
*
* \noapi
* \deprecated use valid_string instead
*/
bool is_valid_string() const { return valid_string(); }
/** /**
* Return buffer content as null-terminated string * Return buffer content as null-terminated string
* *
@ -117,9 +125,9 @@ class Genode::Rpc_in_buffer : public Rpc_in_buffer_base
* The method returns an empty string if the buffer does not hold * The method returns an empty string if the buffer does not hold
* a valid null-terminated string. To distinguish a buffer holding * a valid null-terminated string. To distinguish a buffer holding
* an invalid string from a buffer holding a valid empty string, * an invalid string from a buffer holding a valid empty string,
* the function 'is_valid_string' can be used. * the function 'valid_string' can be used.
*/ */
char const *string() const { return is_valid_string() ? base() : ""; } char const *string() const { return valid_string() ? base() : ""; }
}; };
#endif /* _INCLUDE__BASE__RPC_ARGS_H_ */ #endif /* _INCLUDE__BASE__RPC_ARGS_H_ */

View File

@ -118,9 +118,14 @@ class Genode::Trace::Buffer
public: public:
size_t length() const { return _entry->len; } size_t length() const { return _entry->len; }
char const *data() const { return _entry->data; } char const *data() const { return _entry->data; }
bool is_last() const { return _entry == 0; } bool last() const { return _entry == 0; }
/*
* \deprecated use 'last' instead
*/
bool is_last() const { return last(); }
}; };
Entry first() const Entry first() const
@ -130,7 +135,7 @@ class Genode::Trace::Buffer
Entry next(Entry entry) const Entry next(Entry entry) const
{ {
if (entry.is_last()) if (entry.last())
return Entry(0); return Entry(0);
if (entry.length() == 0) if (entry.length() == 0)

View File

@ -49,9 +49,9 @@ struct Genode::Trace::Logger
Logger(); Logger();
bool is_initialized() { return control != 0; } bool initialized() { return control != 0; }
bool is_init_pending() { return pending_init; } bool init_pending() { return pending_init; }
void init_pending(bool val) { pending_init = val; } void init_pending(bool val) { pending_init = val; }

View File

@ -313,7 +313,7 @@ struct Genode::Weak_object : Genode::Weak_object_base
* Locked pointer * Locked pointer
* *
* A locked pointer is constructed from a weak pointer. After construction, * A locked pointer is constructed from a weak pointer. After construction,
* its validity can (and should) be checked by calling the 'is_valid' * its validity can (and should) be checked by calling the 'valid'
* method. If the locked pointer is valid, the pointed-to object is known to * method. If the locked pointer is valid, the pointed-to object is known to
* be locked until the locked pointer is destroyed. During this time, the * be locked until the locked pointer is destroyed. During this time, the
* locked pointer can safely be de-referenced. * locked pointer can safely be de-referenced.
@ -338,7 +338,15 @@ struct Genode::Locked_ptr : Genode::Locked_ptr_base
* Only if valid, the locked pointer can be de-referenced. Otherwise, * Only if valid, the locked pointer can be de-referenced. Otherwise,
* the attempt will result in a null-pointer access. * the attempt will result in a null-pointer access.
*/ */
bool is_valid() const { return curr != nullptr; } bool valid() const { return curr != nullptr; }
/**
* Returns true if the locked pointer is valid
*
* \noapi
* \deprecated use 'valid' instead
*/
bool is_valid() const { return valid(); }
}; };

View File

@ -202,7 +202,7 @@ class Genode::Root_component : public Rpc_object<Typed_root<SESSION_TYPE> >,
Session_capability session(Root::Session_args const &args, Session_capability session(Root::Session_args const &args,
Affinity const &affinity) override Affinity const &affinity) override
{ {
if (!args.is_valid_string()) throw Root::Invalid_args(); if (!args.valid_string()) throw Root::Invalid_args();
POLICY::aquire(args.string()); POLICY::aquire(args.string());
@ -246,7 +246,7 @@ class Genode::Root_component : public Rpc_object<Typed_root<SESSION_TYPE> >,
void upgrade(Session_capability session, Root::Upgrade_args const &args) override void upgrade(Session_capability session, Root::Upgrade_args const &args) override
{ {
if (!args.is_valid_string()) throw Root::Invalid_args(); if (!args.valid_string()) throw Root::Invalid_args();
_ep->apply(session, [&] (SESSION_TYPE *s) { _ep->apply(session, [&] (SESSION_TYPE *s) {
if (!s) return; if (!s) return;

View File

@ -39,17 +39,25 @@ class Genode::Fifo
friend class Fifo; friend class Fifo;
QT *_next; QT *_next;
bool _is_enqueued; bool _enqueued;
public: public:
Element(): _next(0), _is_enqueued(false) { } Element(): _next(0), _enqueued(false) { }
/** /**
* Return true is fifo element is enqueued in a fifo * Return true is fifo element is enqueued in a fifo
*/ */
bool is_enqueued() { return _is_enqueued; } bool enqueued() { return _enqueued; }
/**
* Return true is fifo element is enqueued in a fifo
*
* \noapi
* \deprecated use 'enqueued' instead
*/
bool is_enqueued() { return enqueued(); }
/** /**
* Return next element in queue * Return next element in queue
@ -107,7 +115,7 @@ class Genode::Fifo
} }
qe->Element::_next = 0; qe->Element::_next = 0;
qe->Element::_is_enqueued = 0; qe->Element::_enqueued = 0;
} }
/** /**
@ -116,7 +124,7 @@ class Genode::Fifo
void enqueue(QT *e) void enqueue(QT *e)
{ {
e->Fifo::Element::_next = 0; e->Fifo::Element::_next = 0;
e->Fifo::Element::_is_enqueued = true; e->Fifo::Element::_enqueued = true;
if (empty()) { if (empty()) {
_tail = _head = e; _tail = _head = e;
@ -146,7 +154,7 @@ class Genode::Fifo
/* mark fifo queue element as free */ /* mark fifo queue element as free */
if (result) { if (result) {
result->Fifo::Element::_next = 0; result->Fifo::Element::_next = 0;
result->Fifo::Element::_is_enqueued = false; result->Fifo::Element::_enqueued = false;
} }
return result; return result;

View File

@ -130,7 +130,14 @@ class Genode::Volatile_object
/** /**
* Return true of volatile object contains a constructed object * Return true of volatile object contains a constructed object
*/ */
bool is_constructed() const { return _constructed; } bool constructed() const { return _constructed; }
/**
* Return true of volatile object contains a constructed object
*
* \deprecated use 'constructed' instead
*/
bool is_constructed() const { return constructed(); }
/** /**
* Access contained object * Access contained object

View File

@ -304,7 +304,7 @@ class Genode::Xml_node
/** /**
* Return true if tag is the start of a valid XML node * Return true if tag is the start of a valid XML node
*/ */
bool is_node() const { return _type == START || _type == EMPTY; } bool node() const { return _type == START || _type == EMPTY; }
/** /**
* Return first token of tag * Return first token of tag
@ -507,7 +507,7 @@ class Genode::Xml_node
} }
/* count sub nodes at depth 1 */ /* count sub nodes at depth 1 */
if (depth == 1 && curr_tag.is_node()) if (depth == 1 && curr_tag.node())
_num_sub_nodes++; _num_sub_nodes++;
/* keep track of the current depth */ /* keep track of the current depth */
@ -758,12 +758,20 @@ class Genode::Xml_node
/** /**
* Return true if node is the last of a node sequence * Return true if node is the last of a node sequence
*/ */
bool is_last(const char *type = 0) const bool last(const char *type = 0) const
{ {
try { next(type); return false; } try { next(type); return false; }
catch (Nonexistent_sub_node) { return true; } catch (Nonexistent_sub_node) { return true; }
} }
/**
* Return true if node is the last of a node sequence
*
* \noapi
* \deprecated use 'last' instead
*/
bool is_last(const char *type = 0) const { return last(); }
/** /**
* Return sub node with specified index * Return sub node with specified index
* *

View File

@ -45,7 +45,7 @@ Mapped_mem_allocator::alloc_aligned(size_t size, void **out_addr, int align, add
/* allocate physical pages */ /* allocate physical pages */
Alloc_return ret1 = _phys_alloc->alloc_aligned(page_rounded_size, Alloc_return ret1 = _phys_alloc->alloc_aligned(page_rounded_size,
&phys_addr, align, from, to); &phys_addr, align, from, to);
if (!ret1.is_ok()) { if (!ret1.ok()) {
PERR("Could not allocate physical memory region of size %zu\n", PERR("Could not allocate physical memory region of size %zu\n",
page_rounded_size); page_rounded_size);
return ret1; return ret1;
@ -54,7 +54,7 @@ Mapped_mem_allocator::alloc_aligned(size_t size, void **out_addr, int align, add
/* allocate range in core's virtual address space */ /* allocate range in core's virtual address space */
Alloc_return ret2 = _virt_alloc->alloc_aligned(page_rounded_size, Alloc_return ret2 = _virt_alloc->alloc_aligned(page_rounded_size,
out_addr, align); out_addr, align);
if (!ret2.is_ok()) { if (!ret2.ok()) {
PERR("Could not allocate virtual address range in core of size %zu\n", PERR("Could not allocate virtual address range in core of size %zu\n",
page_rounded_size); page_rounded_size);

View File

@ -174,7 +174,7 @@ class Genode::Mapped_mem_allocator : public Genode::Core_mem_translator
*************************/ *************************/
bool alloc(size_t size, void **out_addr) override { bool alloc(size_t size, void **out_addr) override {
return alloc_aligned(size, out_addr, log2(sizeof(addr_t))).is_ok(); } return alloc_aligned(size, out_addr, log2(sizeof(addr_t))).ok(); }
void free(void *addr, size_t) override; void free(void *addr, size_t) override;
size_t consumed() const override { return _phys_alloc->consumed(); } size_t consumed() const override { return _phys_alloc->consumed(); }
size_t overhead(size_t size) const override { size_t overhead(size_t size) const override {
@ -300,7 +300,7 @@ class Genode::Core_mem_allocator : public Genode::Core_mem_translator
*************************/ *************************/
bool alloc(size_t size, void **out_addr) override { bool alloc(size_t size, void **out_addr) override {
return alloc_aligned(size, out_addr, log2(sizeof(addr_t))).is_ok(); } return alloc_aligned(size, out_addr, log2(sizeof(addr_t))).ok(); }
void free(void *addr, size_t size) override void free(void *addr, size_t size) override
{ {

View File

@ -40,7 +40,7 @@ namespace Genode {
addr_t const _phys_addr; /* address of dataspace in physical memory */ addr_t const _phys_addr; /* address of dataspace in physical memory */
addr_t _core_local_addr; /* address of core-local mapping */ addr_t _core_local_addr; /* address of core-local mapping */
size_t const _size; /* size of dataspace in bytes */ size_t const _size; /* size of dataspace in bytes */
bool const _is_io_mem; /* dataspace is I/O mem, not to be touched */ bool const _io_mem; /* dataspace is I/O mem, not to be touched */
Cache_attribute const _cache; /* access memory cached, write-combined, or Cache_attribute const _cache; /* access memory cached, write-combined, or
uncached respectively */ uncached respectively */
bool const _writable; /* false if dataspace is read-only */ bool const _writable; /* false if dataspace is read-only */
@ -73,7 +73,7 @@ namespace Genode {
Dataspace_component() Dataspace_component()
: :
_phys_addr(0), _core_local_addr(0), _size(0), _phys_addr(0), _core_local_addr(0), _size(0),
_is_io_mem(false), _cache(CACHED), _writable(false), _io_mem(false), _cache(CACHED), _writable(false),
_owner(0), _managed(false) { } _owner(0), _managed(false) { }
/** /**
@ -86,7 +86,7 @@ namespace Genode {
Dataspace_owner *owner) Dataspace_owner *owner)
: :
_phys_addr(core_local_addr), _core_local_addr(core_local_addr), _phys_addr(core_local_addr), _core_local_addr(core_local_addr),
_size(round_page(size)), _is_io_mem(false), _size(round_page(size)), _io_mem(false),
_cache(cache), _writable(writable), _cache(cache), _writable(writable),
_owner(owner), _managed(false) { } _owner(owner), _managed(false) { }
@ -105,7 +105,7 @@ namespace Genode {
bool writable, Dataspace_owner *owner) bool writable, Dataspace_owner *owner)
: :
_phys_addr(phys_addr), _core_local_addr(core_local_addr), _phys_addr(phys_addr), _core_local_addr(core_local_addr),
_size(size), _is_io_mem(true), _cache(cache), _size(size), _io_mem(true), _cache(cache),
_writable(writable), _owner(owner), _managed(false) { } _writable(writable), _owner(owner), _managed(false) { }
/** /**
@ -121,7 +121,7 @@ namespace Genode {
virtual Native_capability sub_rm() { return Dataspace_capability(); } virtual Native_capability sub_rm() { return Dataspace_capability(); }
addr_t core_local_addr() const { return _core_local_addr; } addr_t core_local_addr() const { return _core_local_addr; }
bool is_io_mem() const { return _is_io_mem; } bool io_mem() const { return _io_mem; }
Cache_attribute cacheability() const { return _cache; } Cache_attribute cacheability() const { return _cache; }
/** /**
@ -156,10 +156,11 @@ namespace Genode {
** Dataspace interface ** ** Dataspace interface **
*************************/ *************************/
size_t size() { return _size; } size_t size() override { return _size; }
addr_t phys_addr() { return _phys_addr; } addr_t phys_addr() override { return _phys_addr; }
bool writable() { return _writable; } bool writable() override { return _writable; }
bool is_managed() { return _managed; }
bool managed() { return _managed; }
}; };
} }

View File

@ -46,7 +46,7 @@ namespace Genode {
size_t write(String const &string_buf) size_t write(String const &string_buf)
{ {
if (!(string_buf.is_valid_string())) { if (!(string_buf.valid_string())) {
PERR("corrupted string"); PERR("corrupted string");
return 0; return 0;
} }

View File

@ -136,7 +136,7 @@ class Genode::Signal_source_component : public Signal_source_rpc_object
Genode::Signal_context_component::~Signal_context_component() Genode::Signal_context_component::~Signal_context_component()
{ {
if (is_enqueued() && _source) if (enqueued() && _source)
_source->release(this); _source->release(this);
} }

View File

@ -53,7 +53,7 @@ class Genode::Trace::Policy : public Genode::List<Genode::Trace::Policy>::Elemen
Allocator &md_alloc() { return _md_alloc; } Allocator &md_alloc() { return _md_alloc; }
bool is_owned_by(Policy_owner const &owner) const bool owned_by(Policy_owner const &owner) const
{ {
return &_owner == &owner; return &_owner == &owner;
} }
@ -81,7 +81,7 @@ class Genode::Trace::Policy_registry
Policy *_unsynchronized_lookup(Policy_owner const &owner, Policy_id id) Policy *_unsynchronized_lookup(Policy_owner const &owner, Policy_id id)
{ {
for (Policy *p = _policies.first(); p; p = p->next()) for (Policy *p = _policies.first(); p; p = p->next())
if (p->is_owned_by(owner) && p->has_id(id)) if (p->owned_by(owner) && p->has_id(id))
return p; return p;
throw Nonexistent_policy(); throw Nonexistent_policy();
@ -90,7 +90,7 @@ class Genode::Trace::Policy_registry
Policy *_any_policy_owned_by(Policy_owner const &owner) Policy *_any_policy_owned_by(Policy_owner const &owner)
{ {
for (Policy *p = _policies.first(); p; p = p->next()) for (Policy *p = _policies.first(); p; p = p->next())
if (p->is_owned_by(owner)) if (p->owned_by(owner))
return p; return p;
return 0; return 0;
@ -123,7 +123,7 @@ class Genode::Trace::Policy_registry
Policy *tmp = p; Policy *tmp = p;
p = p->next(); p = p->next();
if (tmp->is_owned_by(owner) && tmp->has_id(id)) { if (tmp->owned_by(owner) && tmp->has_id(id)) {
_policies.remove(tmp); _policies.remove(tmp);
destroy(&tmp->md_alloc(), tmp); destroy(&tmp->md_alloc(), tmp);
} }

View File

@ -115,16 +115,16 @@ class Genode::Trace::Source
return true; return true;
} }
bool is_owned_by(Source_owner const *owner) { return owner == _owner; } bool owned_by(Source_owner const *owner) { return owner == _owner; }
void release_ownership(Source_owner const *owner) void release_ownership(Source_owner const *owner)
{ {
if (is_owned_by(owner)) if (owned_by(owner))
_owner = 0; _owner = 0;
} }
bool error() const { return _control.has_error(); } bool error() const { return _control.has_error(); }
bool enabled() const { return _control.is_enabled(); } bool enabled() const { return _control.enabled(); }
/*********************************** /***********************************

View File

@ -144,12 +144,12 @@ class Genode::Trace::Subject
Locked_ptr<Source> source(_source); Locked_ptr<Source> source(_source);
/* source vanished */ /* source vanished */
if (!source.is_valid()) if (!source.valid())
return Subject_info::DEAD; return Subject_info::DEAD;
if (source->enabled()) if (source->enabled())
return source->is_owned_by(this) ? Subject_info::TRACED return source->owned_by(this) ? Subject_info::TRACED
: Subject_info::FOREIGN; : Subject_info::FOREIGN;
if (source->error()) if (source->error())
return Subject_info::ERROR; return Subject_info::ERROR;
@ -200,7 +200,7 @@ class Genode::Trace::Subject
/* inform trace source about the new buffer */ /* inform trace source about the new buffer */
Locked_ptr<Source> source(_source); Locked_ptr<Source> source(_source);
if (!source.is_valid()) if (!source.valid())
throw Source_is_dead(); throw Source_is_dead();
if (!source->try_acquire(this)) if (!source->try_acquire(this))
@ -214,7 +214,7 @@ class Genode::Trace::Subject
/* inform trace source about the new buffer */ /* inform trace source about the new buffer */
Locked_ptr<Source> source(_source); Locked_ptr<Source> source(_source);
if (source.is_valid()) if (source.valid())
source->disable(); source->disable();
} }
@ -228,7 +228,7 @@ class Genode::Trace::Subject
/* inform trace source about the new buffer */ /* inform trace source about the new buffer */
Locked_ptr<Source> source(_source); Locked_ptr<Source> source(_source);
if (!source.is_valid()) if (!source.valid())
throw Source_is_dead(); throw Source_is_dead();
source->enable(); source->enable();
@ -242,7 +242,7 @@ class Genode::Trace::Subject
{ {
Locked_ptr<Source> source(_source); Locked_ptr<Source> source(_source);
if (source.is_valid()) { if (source.valid()) {
Trace::Source::Info const info = source->info(); Trace::Source::Info const info = source->info();
execution_time = info.execution_time; execution_time = info.execution_time;
affinity = info.affinity; affinity = info.affinity;
@ -261,7 +261,7 @@ class Genode::Trace::Subject
Locked_ptr<Source> source(_source); Locked_ptr<Source> source(_source);
/* source vanished */ /* source vanished */
if (!source.is_valid()) if (!source.valid())
return 0; return 0;
return _buffer.flush() + _policy.flush(); return _buffer.flush() + _policy.flush();

View File

@ -35,7 +35,7 @@ void Pager_entrypoint::entry()
Pool::apply(_pager.badge(), [&] (Pager_object *obj) { Pool::apply(_pager.badge(), [&] (Pager_object *obj) {
if (obj) { if (obj) {
if (_pager.is_exception()) if (_pager.exception())
obj->submit_exception_signal(); obj->submit_exception_signal();
else else
/* send reply if page-fault handling succeeded */ /* send reply if page-fault handling succeeded */

View File

@ -157,7 +157,7 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, Cache_attr
bool alloc_succeeded = false; bool alloc_succeeded = false;
for (size_t align_log2 = log2(ds_size); align_log2 >= 12; align_log2--) { for (size_t align_log2 = log2(ds_size); align_log2 >= 12; align_log2--) {
if (_ram_alloc->alloc_aligned(ds_size, &ds_addr, align_log2, if (_ram_alloc->alloc_aligned(ds_size, &ds_addr, align_log2,
_phys_start, _phys_end).is_ok()) { _phys_start, _phys_end).ok()) {
alloc_succeeded = true; alloc_succeeded = true;
break; break;
} }

View File

@ -162,8 +162,8 @@ int Rm_client::pager(Ipc_pager &pager)
{ {
using Fault_area = Region_map_component::Fault_area; using Fault_area = Region_map_component::Fault_area;
Region_map::State::Fault_type pf_type = pager.is_write_fault() ? Region_map::State::WRITE_FAULT Region_map::State::Fault_type pf_type = pager.write_fault() ? Region_map::State::WRITE_FAULT
: Region_map::State::READ_FAULT; : Region_map::State::READ_FAULT;
addr_t pf_addr = pager.fault_addr(); addr_t pf_addr = pager.fault_addr();
addr_t pf_ip = pager.fault_ip(); addr_t pf_ip = pager.fault_ip();
@ -231,7 +231,7 @@ int Rm_client::pager(Ipc_pager &pager)
} }
Mapping mapping(dst_fault_area.base(), src_fault_area.base(), Mapping mapping(dst_fault_area.base(), src_fault_area.base(),
dsc->cacheability(), dsc->is_io_mem(), dsc->cacheability(), dsc->io_mem(),
map_size_log2, dsc->writable()); map_size_log2, dsc->writable());
/* /*
@ -242,7 +242,7 @@ int Rm_client::pager(Ipc_pager &pager)
* pages that are not locally mapped, the 'map_core_local' function may be * pages that are not locally mapped, the 'map_core_local' function may be
* empty. * empty.
*/ */
if (!dsc->is_io_mem()) if (!dsc->io_mem())
mapping.prepare_map_operation(); mapping.prepare_map_operation();
/* answer page fault with a flex-page mapping */ /* answer page fault with a flex-page mapping */
@ -359,7 +359,7 @@ Region_map_component::attach(Dataspace_capability ds_cap, size_t size,
Range_allocator::Alloc_return alloc_return = Range_allocator::Alloc_return alloc_return =
_map.alloc_aligned(size, &r, align_log2); _map.alloc_aligned(size, &r, align_log2);
if (alloc_return.is_ok()) if (alloc_return.ok())
break; break;
else if (alloc_return.value == Range_allocator::Alloc_return::OUT_OF_METADATA) { else if (alloc_return.value == Range_allocator::Alloc_return::OUT_OF_METADATA) {
_map.free(r); _map.free(r);
@ -499,7 +499,7 @@ void Region_map_component::detach(Local_addr local_addr)
* base-class's function. Hence, we cannot check the return value of this * base-class's function. Hence, we cannot check the return value of this
* function to determine if the dataspace is a managed dataspace. Instead, * function to determine if the dataspace is a managed dataspace. Instead,
* we introduced a dataspace member '_managed' with the non-virtual accessor * we introduced a dataspace member '_managed' with the non-virtual accessor
* function 'is_managed'. * function 'managed'.
*/ */
/* /*
@ -521,7 +521,7 @@ void Region_map_component::detach(Local_addr local_addr)
* client. * client.
*/ */
if (!platform()->supports_direct_unmap() if (!platform()->supports_direct_unmap()
&& dsc->is_managed() && dsc->core_local_addr() == 0) { && dsc->managed() && dsc->core_local_addr() == 0) {
PWRN("unmapping of managed dataspaces not yet supported"); PWRN("unmapping of managed dataspaces not yet supported");
break; break;
} }

View File

@ -27,7 +27,7 @@ using namespace Genode;
void Signal_source_component::release(Signal_context_component *context) void Signal_source_component::release(Signal_context_component *context)
{ {
if (context && context->is_enqueued()) if (context && context->enqueued())
_signal_queue.remove(context); _signal_queue.remove(context);
} }
@ -59,7 +59,7 @@ void Signal_source_component::submit(Signal_context_component *context,
} else { } else {
if (!context->is_enqueued()) if (!context->enqueued())
_signal_queue.enqueue(context); _signal_queue.enqueue(context);
} }
} }

View File

@ -78,7 +78,7 @@ class Stack_area_region_map : public Region_map
void *phys_base; void *phys_base;
Range_allocator *ra = platform_specific()->ram_alloc(); Range_allocator *ra = platform_specific()->ram_alloc();
if (ra->alloc_aligned(size, &phys_base, if (ra->alloc_aligned(size, &phys_base,
get_page_size_log2()).is_error()) { get_page_size_log2()).error()) {
PERR("could not allocate backing store for new stack"); PERR("could not allocate backing store for new stack");
return (addr_t)0; return (addr_t)0;
} }

View File

@ -63,7 +63,7 @@ class Genode::Elf_binary
/** /**
* Check for dynamic elf * Check for dynamic elf
*/ */
bool is_dynamically_linked() { return (_dynamic && _interp); } bool dynamically_linked() { return (_dynamic && _interp); }
/************************ /************************

View File

@ -161,7 +161,18 @@ class Genode::Trace::Control
bool has_error() const { return _acknowledged_state == ERROR; } bool has_error() const { return _acknowledged_state == ERROR; }
bool is_enabled() const { return _acknowledged_state == ENABLED; } /**
* Return true if tracing is enabled
*/
bool enabled() const { return _acknowledged_state == ENABLED; }
/**
* Return true if tracing is enabled
*
* \noapi
* \deprecated use 'enabled' instead
*/
bool is_enabled() const { return enabled(); }
}; };
#endif /* _INCLUDE__BASE__INTERNAL__TRACE_CONTROL_H_ */ #endif /* _INCLUDE__BASE__INTERNAL__TRACE_CONTROL_H_ */

View File

@ -301,7 +301,7 @@ void Child::notify_resource_avail() const
void Child::announce(Parent::Service_name const &name, Root_capability root) void Child::announce(Parent::Service_name const &name, Root_capability root)
{ {
if (!name.is_valid_string()) return; if (!name.valid_string()) return;
_policy.announce_service(name.string(), root, heap(), &_server); _policy.announce_service(name.string(), root, heap(), &_server);
} }
@ -311,7 +311,7 @@ Session_capability Child::session(Parent::Service_name const &name,
Parent::Session_args const &args, Parent::Session_args const &args,
Affinity const &affinity) Affinity const &affinity)
{ {
if (!name.is_valid_string() || !args.is_valid_string()) throw Unavailable(); if (!name.valid_string() || !args.valid_string()) throw Unavailable();
/* return sessions that we created for the child */ /* return sessions that we created for the child */
if (!strcmp("Env::ram_session", name.string())) return _ram; if (!strcmp("Env::ram_session", name.string())) return _ram;
@ -382,7 +382,7 @@ void Child::upgrade(Session_capability to_session, Parent::Upgrade_args const &a
return; return;
} }
if (!args.is_valid_string()) { if (!args.valid_string()) {
PWRN("no valid session-upgrade arguments"); PWRN("no valid session-upgrade arguments");
return; return;
} }

View File

@ -49,7 +49,7 @@ Child::Process::Loaded_executable::Loaded_executable(Dataspace_capability elf_ds
* If the specified executable is a dynamically linked program, we load * If the specified executable is a dynamically linked program, we load
* the dynamic linker instead. * the dynamic linker instead.
*/ */
if (elf.is_dynamically_linked()) { if (elf.dynamically_linked()) {
local_rm.detach(elf_addr); local_rm.detach(elf_addr);

View File

@ -108,7 +108,7 @@ Heap::Dataspace *Heap::_allocate_dataspace(size_t size, bool enforce_separate_me
_alloc->add_range((addr_t)ds_addr, size); _alloc->add_range((addr_t)ds_addr, size);
/* allocate the Dataspace structure */ /* allocate the Dataspace structure */
if (_alloc->alloc_aligned(sizeof(Heap::Dataspace), &ds_meta_data_addr, log2(sizeof(addr_t))).is_error()) { if (_alloc->alloc_aligned(sizeof(Heap::Dataspace), &ds_meta_data_addr, log2(sizeof(addr_t))).error()) {
PWRN("could not allocate dataspace meta data - this should never happen"); PWRN("could not allocate dataspace meta data - this should never happen");
return 0; return 0;
} }
@ -125,7 +125,7 @@ Heap::Dataspace *Heap::_allocate_dataspace(size_t size, bool enforce_separate_me
bool Heap::_try_local_alloc(size_t size, void **out_addr) bool Heap::_try_local_alloc(size_t size, void **out_addr)
{ {
if (_alloc->alloc_aligned(size, out_addr, log2(sizeof(addr_t))).is_error()) if (_alloc->alloc_aligned(size, out_addr, log2(sizeof(addr_t))).error())
return false; return false;
_quota_used += size; _quota_used += size;

View File

@ -192,11 +192,11 @@ Trace::Logger *Thread::_logger()
: main_trace_logger(); : main_trace_logger();
/* logger is already being initialized */ /* logger is already being initialized */
if (logger->is_init_pending()) if (logger->init_pending())
return logger; return logger;
/* lazily initialize trace object */ /* lazily initialize trace object */
if (!logger->is_initialized()) { if (!logger->initialized()) {
logger->init_pending(true); logger->init_pending(true);
Thread_capability thread_cap = myself ? myself->_thread_cap Thread_capability thread_cap = myself ? myself->_thread_cap

View File

@ -87,11 +87,11 @@ class Linker::Rm_area
{ {
addr_t addr = vaddr; addr_t addr = vaddr;
if (addr && (_range.alloc_addr(size, addr).is_error())) if (addr && (_range.alloc_addr(size, addr).error()))
throw Region_conflict(); throw Region_conflict();
else if (!addr && else if (!addr &&
_range.alloc_aligned(size, (void **)&addr, _range.alloc_aligned(size, (void **)&addr,
get_page_size_log2()).is_error()) get_page_size_log2()).error())
{ {
throw Region_conflict(); throw Region_conflict();
} }

View File

@ -35,12 +35,12 @@ void Genode::Weak_object_base::debug_info() const
} }
static int weak_ptr_is_valid; static int weak_ptr_valid;
void Genode::Weak_ptr_base::debug_info() const void Genode::Weak_ptr_base::debug_info() const
{ {
weak_ptr_is_valid = (_obj != nullptr); weak_ptr_valid = (_obj != nullptr);
} }
@ -64,7 +64,7 @@ static void assert_weak_ptr_valid(Genode::Weak_ptr_base const &ptr, bool valid)
{ {
ptr.debug_info(); ptr.debug_info();
if (weak_ptr_is_valid == valid) if (weak_ptr_valid == valid)
return; return;
PERR("weak pointer unexpectedly %s", valid ? "valid" : "invalid"); PERR("weak pointer unexpectedly %s", valid ? "valid" : "invalid");
@ -76,17 +76,17 @@ static void assert_weak_ptr_valid(Genode::Weak_ptr_base const &ptr, bool valid)
** Test for the tracking of weak pointers ** ** Test for the tracking of weak pointers **
********************************************/ ********************************************/
static bool object_is_constructed; static bool object_constructed;
struct Object : Genode::Weak_object<Object> struct Object : Genode::Weak_object<Object>
{ {
Object() { object_is_constructed = true; } Object() { object_constructed = true; }
~Object() ~Object()
{ {
Weak_object<Object>::lock_for_destruction(); Weak_object<Object>::lock_for_destruction();
object_is_constructed = false; object_constructed = false;
} }
}; };
@ -161,11 +161,11 @@ struct Destruct_thread : Genode::Thread_deprecated<4096>
static void assert_constructed(bool expect_constructed) static void assert_constructed(bool expect_constructed)
{ {
if (object_is_constructed == expect_constructed) if (object_constructed == expect_constructed)
return; return;
PERR("object unexpectedly %sconstructed", PERR("object unexpectedly %sconstructed",
!object_is_constructed ? "not" : ""); !object_constructed ? "not" : "");
throw Fatal_error(); throw Fatal_error();
} }
@ -230,7 +230,7 @@ static void test_acquisition_failure()
{ {
Locked_ptr<Object> locked_ptr(ptr); Locked_ptr<Object> locked_ptr(ptr);
if (!locked_ptr.is_valid()) { if (!locked_ptr.valid()) {
PERR("locked pointer unexpectedly invalid"); PERR("locked pointer unexpectedly invalid");
throw Fatal_error(); throw Fatal_error();
} }
@ -245,7 +245,7 @@ static void test_acquisition_failure()
{ {
Locked_ptr<Object> locked_ptr(ptr); Locked_ptr<Object> locked_ptr(ptr);
if (locked_ptr.is_valid()) { if (locked_ptr.valid()) {
PERR("locked pointer unexpectedly valid"); PERR("locked pointer unexpectedly valid");
throw Fatal_error(); throw Fatal_error();
} }
@ -262,13 +262,13 @@ struct Object_with_delayed_destruction
{ {
Timer::Connection timer; Timer::Connection timer;
Object_with_delayed_destruction() { object_is_constructed = true; } Object_with_delayed_destruction() { object_constructed = true; }
~Object_with_delayed_destruction() ~Object_with_delayed_destruction()
{ {
Weak_object<Object_with_delayed_destruction>::lock_for_destruction(); Weak_object<Object_with_delayed_destruction>::lock_for_destruction();
timer.msleep(2000); timer.msleep(2000);
object_is_constructed = false; object_constructed = false;
} }
}; };

View File

@ -86,7 +86,7 @@ class Pci_driver : public Bsd::Bus_driver
} }
void *ptr = nullptr; void *ptr = nullptr;
bool err = Allocator_avl::alloc_aligned(size, &ptr, align).is_error(); bool err = Allocator_avl::alloc_aligned(size, &ptr, align).error();
return err ? 0 : (addr_t)ptr; return err ? 0 : (addr_t)ptr;
} }

View File

@ -365,7 +365,7 @@ extern "C" void *dde_dma_alloc(dde_size_t size, dde_size_t align,
dde_size_t offset) dde_size_t offset)
{ {
void *ptr; void *ptr;
if (allocator().alloc_aligned(size, &ptr, Genode::log2(align)).is_error()) { if (allocator().alloc_aligned(size, &ptr, Genode::log2(align)).error()) {
PERR("memory allocation failed in alloc_memblock (size=%zu, align=%zx," PERR("memory allocation failed in alloc_memblock (size=%zu, align=%zx,"
" offset=%zx)", (Genode::size_t)size, (Genode::size_t)align, (Genode::size_t)offset); " offset=%zx)", (Genode::size_t)size, (Genode::size_t)align, (Genode::size_t)offset);
return 0; return 0;

View File

@ -94,17 +94,17 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
{ {
_in_update = false; _in_update = false;
if (_fb_ds.is_constructed()) if (_fb_ds.constructed())
_fb_ds.destruct(); _fb_ds.destruct();
_fb_ds.construct(framebuffer_dataspace()); _fb_ds.construct(framebuffer_dataspace());
if (!_fb_ds.is_constructed()) if (!_fb_ds.constructed())
PERR("framebuffer dataspace not initialized"); PERR("framebuffer dataspace not initialized");
if (_buffered) { if (_buffered) {
_bb_ds.construct(Genode::env()->ram_session(), _bb_ds.construct(Genode::env()->ram_session(),
_width * _height * _bytes_per_pixel); _width * _height * _bytes_per_pixel);
if (!_bb_ds.is_constructed()) { if (!_bb_ds.constructed()) {
PERR("buffered mode enabled, but buffer not initialized"); PERR("buffered mode enabled, but buffer not initialized");
return Genode::Dataspace_capability(); return Genode::Dataspace_capability();
} }

View File

@ -1205,7 +1205,7 @@ void update_genode_report()
reporter.enabled(false); reporter.enabled(false);
} }
if (!reporter.is_enabled()) return; if (!reporter.enabled()) return;
try { try {

View File

@ -151,7 +151,7 @@ struct Wlan_configration
* configuration yet to fool wpa_supplicant to keep it scanning * configuration yet to fool wpa_supplicant to keep it scanning
* for the non exisiting network. * for the non exisiting network.
*/ */
if (!config_rom.is_valid()) { if (!config_rom.valid()) {
_active_dummy_configuration(); _active_dummy_configuration();
return; return;
} }

View File

@ -118,7 +118,7 @@ struct Device : List<Device>::Element
{ {
list()->insert(this); list()->insert(this);
if (device_list_reporter().is_enabled()) if (device_list_reporter().enabled())
report_device_list(); report_device_list();
} }
@ -126,7 +126,7 @@ struct Device : List<Device>::Element
{ {
list()->remove(this); list()->remove(this);
if (device_list_reporter().is_enabled()) if (device_list_reporter().enabled())
report_device_list(); report_device_list();
} }
@ -756,7 +756,7 @@ class Usb::Root : public Genode::Root_component<Session_component>
Genode::Xml_node config = Genode::config()->xml_node(); Genode::Xml_node config = Genode::config()->xml_node();
if (!_config_reporter.is_enabled()) if (!_config_reporter.enabled())
_config_reporter.enabled(true); _config_reporter.enabled(true);
bool const uhci = config.attribute_value<bool>("uhci", false); bool const uhci = config.attribute_value<bool>("uhci", false);

View File

@ -98,7 +98,7 @@ struct Usb::Pl2303_driver : Completion
Interface iface = device.interface(0); Interface iface = device.interface(0);
/* error or write packet */ /* error or write packet */
if (!p.succeded || !p.is_read_transfer()) { if (!p.succeded || !p.read_transfer()) {
iface.release(p); iface.release(p);
return; return;
} }

View File

@ -140,13 +140,13 @@ namespace Allocator {
{ {
void *addr; void *addr;
if (!_range.alloc_aligned(size, &addr, align).is_error()) if (!_range.alloc_aligned(size, &addr, align).error())
return addr; return addr;
if (!_alloc_block()) if (!_alloc_block())
return 0; return 0;
if (_range.alloc_aligned(size, &addr, align).is_error()) { if (_range.alloc_aligned(size, &addr, align).error()) {
PERR("Backend allocator: Unable to allocate memory (size: %zu align: %d:)", PERR("Backend allocator: Unable to allocate memory (size: %zu align: %d:)",
size, align); size, align);
return 0; return 0;

View File

@ -222,7 +222,7 @@ class File_system::Session_component : public Session_rpc_object
if (!_writable && create) if (!_writable && create)
throw Permission_denied(); throw Permission_denied();
if (!path.is_valid_string()) if (!path.valid_string())
throw Name_too_long(); throw Name_too_long();
Directory *dir = _root.subdir(path_str, create); Directory *dir = _root.subdir(path_str, create);

View File

@ -65,10 +65,10 @@ class Scout::Element
/** /**
* Accessor functionse * Accessor functionse
*/ */
Point position() const { return _position; } Point position() const { return _position; }
Area size() const { return _size; } Area size() const { return _size; }
Area min_size() const { return _min_size; } Area min_size() const { return _min_size; }
bool is_bottom() const { return _flags.bottom; } bool bottom() const { return _flags.bottom; }
void findable(int flag) { _flags.findable = flag; } void findable(int flag) { _flags.findable = flag; }

View File

@ -119,7 +119,7 @@ class Scout::Platform
void _import_events() void _import_events()
{ {
if (_input.is_pending() == false) return; if (_input.pending() == false) return;
for (int i = 0, num = _input.flush(); i < num; i++) for (int i = 0, num = _input.flush(); i < num; i++)
{ {

View File

@ -198,7 +198,7 @@ void Parent_element::geometry(Rect rect)
{ {
::Element::geometry(rect); ::Element::geometry(rect);
if (!_last || !_last->is_bottom()) return; if (!_last || !_last->bottom()) return;
_last->geometry(Rect(Point(_last->position().x(), _last->geometry(Rect(Point(_last->position().x(),
rect.h() - _last->size().h()), _last->size())); rect.h() - _last->size().h()), _last->size()));

View File

@ -294,7 +294,7 @@ class Log_session_component : public Genode::Rpc_object<Genode::Log_session>
Genode::size_t write(String const &log_text) Genode::size_t write(String const &log_text)
{ {
if (!log_text.is_valid_string()) { if (!log_text.valid_string()) {
PERR("corrupted string"); PERR("corrupted string");
return 0; return 0;
} }
@ -441,7 +441,7 @@ int main(int argc, char **argv)
unsigned key_cnt = 0; unsigned key_cnt = 0;
while (1) { while (1) {
while (!nitpicker.input()->is_pending()) { while (!nitpicker.input()->pending()) {
if (log_window.draw()) if (log_window.draw())
nitpicker.framebuffer()->refresh(0, 0, log_win_w, log_win_h); nitpicker.framebuffer()->refresh(0, 0, log_win_w, log_win_h);
timer.msleep(20); timer.msleep(20);

View File

@ -99,7 +99,7 @@ class Cpu_load_display::Timeline : public Genode::List<Timeline>::Element
bool idle() const { return _sum_activity == 0; } bool idle() const { return _sum_activity == 0; }
bool is_kernel() const bool kernel() const
{ {
return _label == Label("kernel"); return _label == Label("kernel");
} }
@ -293,7 +293,7 @@ class Cpu_load_display::Scene : public Nano3d::Scene<PT>
{ {
_trace_subjects.update(); _trace_subjects.update();
if (!_trace_subjects.is_valid()) if (!_trace_subjects.valid())
return; return;
_cpu_registry.advance(++_now); _cpu_registry.advance(++_now);
@ -348,7 +348,7 @@ class Cpu_load_display::Scene : public Nano3d::Scene<PT>
cpu.for_each_timeline([&] (Timeline const &timeline) { cpu.for_each_timeline([&] (Timeline const &timeline) {
if (timeline.is_kernel()) if (timeline.kernel())
return; return;
bool first = true; bool first = true;

View File

@ -252,7 +252,7 @@ void Decorator::Main::handle_nitpicker_sync(unsigned)
bool model_updated = false; bool model_updated = false;
if (window_layout_update_needed && window_layout.is_valid()) { if (window_layout_update_needed && window_layout.valid()) {
try { try {
Xml_node xml(window_layout.local_addr<char>(), Xml_node xml(window_layout.local_addr<char>(),
@ -265,7 +265,7 @@ void Decorator::Main::handle_nitpicker_sync(unsigned)
* A decorator element might have appeared or disappeared under * A decorator element might have appeared or disappeared under
* the pointer. * the pointer.
*/ */
if (pointer.is_valid()) if (pointer.valid())
update_hover_report(Xml_node(pointer.local_addr<char>()), update_hover_report(Xml_node(pointer.local_addr<char>()),
window_stack, hover, hover_reporter); window_stack, hover, hover_reporter);
@ -309,7 +309,7 @@ void Decorator::Main::handle_pointer_update(unsigned)
{ {
pointer.update(); pointer.update();
if (pointer.is_valid()) if (pointer.valid())
update_hover_report(Xml_node(pointer.local_addr<char>()), update_hover_report(Xml_node(pointer.local_addr<char>()),
window_stack, hover, hover_reporter); window_stack, hover, hover_reporter);
} }

View File

@ -434,7 +434,7 @@ class Decorator::Window : public Window_base
outer_geometry().cut(geometry(), top, left, right, bottom); outer_geometry().cut(geometry(), top, left, right, bottom);
} }
bool is_in_front_of(Window_base const &neighbor) const override bool in_front_of(Window_base const &neighbor) const override
{ {
return _neighbor == neighbor.frontmost_view(); return _neighbor == neighbor.frontmost_view();
} }

View File

@ -144,7 +144,7 @@ struct Floating_window_layouter::Main : Operations
if (!window) if (!window)
return; return;
window->is_maximized(!window->is_maximized()); window->maximized(!window->maximized());
generate_resize_request_model(); generate_resize_request_model();
} }
@ -250,7 +250,7 @@ struct Floating_window_layouter::Main : Operations
*/ */
void handle_input(unsigned) void handle_input(unsigned)
{ {
while (input.is_pending()) while (input.pending())
_user_state.handle_input(input_ds.local_addr<Input::Event>(), _user_state.handle_input(input_ds.local_addr<Input::Event>(),
input.flush(), Genode::config()->xml_node()); input.flush(), Genode::config()->xml_node());
} }
@ -297,10 +297,10 @@ struct Floating_window_layouter::Main : Operations
Reporter focus_reporter = { "focus" }; Reporter focus_reporter = { "focus" };
bool focused_window_is_maximized() const bool focused_window_maximized() const
{ {
Window const *w = lookup_window_by_id(_user_state.focused_window_id()); Window const *w = lookup_window_by_id(_user_state.focused_window_id());
return w && w->is_maximized(); return w && w->maximized();
} }
void import_window_list(Xml_node); void import_window_list(Xml_node);
@ -376,7 +376,7 @@ void Floating_window_layouter::Main::import_window_list(Xml_node window_list_xml
if (policy.has_attribute("xpos") && policy.has_attribute("ypos")) if (policy.has_attribute("xpos") && policy.has_attribute("ypos"))
initial_position = point_attribute(node); initial_position = point_attribute(node);
win->is_maximized(policy.attribute_value("maximized", false)); win->maximized(policy.attribute_value("maximized", false));
} catch (Genode::Session_policy::No_policy_defined) { } } catch (Genode::Session_policy::No_policy_defined) { }
@ -387,10 +387,10 @@ void Floating_window_layouter::Main::import_window_list(Xml_node window_list_xml
win->title(string_attribute(node, "title", Window::Title(""))); win->title(string_attribute(node, "title", Window::Title("")));
win->has_alpha(node.has_attribute("has_alpha") win->has_alpha(node.has_attribute("has_alpha")
&& node.attribute("has_alpha").has_value("yes")); && node.attribute("has_alpha").has_value("yes"));
win->is_hidden(node.has_attribute("hidden") win->hidden(node.has_attribute("hidden")
&& node.attribute("hidden").has_value("yes")); && node.attribute("hidden").has_value("yes"));
win->is_resizeable(node.has_attribute("resizeable") win->resizeable(node.has_attribute("resizeable")
&& node.attribute("resizeable").has_value("yes")); && node.attribute("resizeable").has_value("yes"));
} }
} catch (...) { } } catch (...) { }
} }
@ -402,13 +402,13 @@ void Floating_window_layouter::Main::generate_window_layout_model()
{ {
for (Window *w = windows.first(); w; w = w->next()) { for (Window *w = windows.first(); w; w = w->next()) {
bool const is_hovered = w->has_id(_user_state.hover_state().window_id); bool const hovered = w->has_id(_user_state.hover_state().window_id);
bool const is_focused = w->has_id(_user_state.focused_window_id()); bool const focused = w->has_id(_user_state.focused_window_id());
Window::Element const highlight = Window::Element const highlight =
is_hovered ? _user_state.hover_state().element : Window::Element::UNDEFINED; hovered ? _user_state.hover_state().element : Window::Element::UNDEFINED;
w->serialize(xml, is_focused, highlight); w->serialize(xml, focused, highlight);
} }
}); });
} }

View File

@ -75,7 +75,7 @@ class Floating_window_layouter::User_state
Focus_history &_focus_history; Focus_history &_focus_history;
bool _is_key(Input::Event const &ev) const bool _key(Input::Event const &ev) const
{ {
if (ev.type() != Input::Event::PRESS if (ev.type() != Input::Event::PRESS
&& ev.type() != Input::Event::RELEASE) && ev.type() != Input::Event::RELEASE)
@ -286,7 +286,7 @@ void Floating_window_layouter::User_state::_handle_event(Input::Event const &e,
} }
/* handle key sequences */ /* handle key sequences */
if (_is_key(e)) { if (_key(e)) {
if (e.type() == Input::Event::PRESS && _key_cnt == 1) if (e.type() == Input::Event::PRESS && _key_cnt == 1)
_key_sequence_tracker.reset(); _key_sequence_tracker.reset();

View File

@ -97,13 +97,13 @@ class Floating_window_layouter::Window : public List<Window>::Element
/** /**
* Window is temporarily not visible * Window is temporarily not visible
*/ */
bool _is_hidden = false; bool _hidden = false;
bool _is_resizeable = false; bool _resizeable = false;
bool _is_maximized = false; bool _maximized = false;
bool _is_dragged = false; bool _dragged = false;
/* /*
* Number of times the window has been topped. This value is used by * Number of times the window has been topped. This value is used by
@ -146,7 +146,7 @@ class Floating_window_layouter::Window : public List<Window>::Element
_requested_size = _geometry.area(); _requested_size = _geometry.area();
_is_dragged = true; _dragged = true;
} }
/** /**
@ -204,9 +204,9 @@ class Floating_window_layouter::Window : public List<Window>::Element
void has_alpha(bool has_alpha) { _has_alpha = has_alpha; } void has_alpha(bool has_alpha) { _has_alpha = has_alpha; }
void is_hidden(bool is_hidden) { _is_hidden = is_hidden; } void hidden(bool hidden) { _hidden = hidden; }
void is_resizeable(bool is_resizeable) { _is_resizeable = is_resizeable; } void resizeable(bool resizeable) { _resizeable = resizeable; }
bool label_matches(Label const &label) const { return label == _label; } bool label_matches(Label const &label) const { return label == _label; }
@ -217,7 +217,7 @@ class Floating_window_layouter::Window : public List<Window>::Element
*/ */
void size(Area size) void size(Area size)
{ {
if (_is_maximized) { if (_maximized) {
_geometry = Rect(_maximized_geometry.p1(), size); _geometry = Rect(_maximized_geometry.p1(), size);
return; return;
} }
@ -251,7 +251,7 @@ class Floating_window_layouter::Window : public List<Window>::Element
void serialize(Xml_generator &xml, bool focused, Element highlight) void serialize(Xml_generator &xml, bool focused, Element highlight)
{ {
/* omit window from the layout if hidden */ /* omit window from the layout if hidden */
if (_is_hidden) if (_hidden)
return; return;
xml.node("window", [&]() { xml.node("window", [&]() {
@ -289,7 +289,7 @@ class Floating_window_layouter::Window : public List<Window>::Element
if (_has_alpha) if (_has_alpha)
xml.attribute("has_alpha", "yes"); xml.attribute("has_alpha", "yes");
if (_is_resizeable) { if (_resizeable) {
xml.attribute("maximizer", "yes"); xml.attribute("maximizer", "yes");
xml.attribute("closer", "yes"); xml.attribute("closer", "yes");
} }
@ -299,10 +299,10 @@ class Floating_window_layouter::Window : public List<Window>::Element
void drag(Window::Element element, Point clicked, Point curr) void drag(Window::Element element, Point clicked, Point curr)
{ {
/* prevent maximized windows from being dragged */ /* prevent maximized windows from being dragged */
if (is_maximized()) if (maximized())
return; return;
if (!_is_dragged) if (!_dragged)
_initiate_drag_operation(element); _initiate_drag_operation(element);
_apply_drag_operation(curr - clicked); _apply_drag_operation(curr - clicked);
@ -311,7 +311,7 @@ class Floating_window_layouter::Window : public List<Window>::Element
void finalize_drag_operation() void finalize_drag_operation()
{ {
_requested_size = _geometry.area(); _requested_size = _geometry.area();
_is_dragged = false; _dragged = false;
_drag_left_border = false; _drag_left_border = false;
_drag_right_border = false; _drag_right_border = false;
_drag_top_border = false; _drag_top_border = false;
@ -322,23 +322,23 @@ class Floating_window_layouter::Window : public List<Window>::Element
void close() { _requested_size = Area(0, 0); } void close() { _requested_size = Area(0, 0); }
bool is_maximized() const { return _is_maximized; } bool maximized() const { return _maximized; }
void is_maximized(bool is_maximized) void maximized(bool maximized)
{ {
/* enter maximized state */ /* enter maximized state */
if (!_is_maximized && is_maximized) { if (!_maximized && maximized) {
_unmaximized_geometry = _geometry; _unmaximized_geometry = _geometry;
_requested_size = _maximized_geometry.area(); _requested_size = _maximized_geometry.area();
} }
/* leave maximized state */ /* leave maximized state */
if (_is_maximized && !is_maximized) { if (_maximized && !maximized) {
_requested_size = _unmaximized_geometry.area(); _requested_size = _unmaximized_geometry.area();
_geometry = Rect(_unmaximized_geometry.p1(), _geometry.area()); _geometry = Rect(_unmaximized_geometry.p1(), _geometry.area());
} }
_is_maximized = is_maximized; _maximized = maximized;
} }
}; };

View File

@ -96,7 +96,7 @@ struct Launcher::Dialog_nitpicker_session : Wrapped_nitpicker_session
Input::Event const * const events = Input::Event const * const events =
_nitpicker_input_ds.local_addr<Input::Event>(); _nitpicker_input_ds.local_addr<Input::Event>();
while (_nitpicker_input.is_pending()) { while (_nitpicker_input.pending()) {
size_t const num_events = _nitpicker_input.flush(); size_t const num_events = _nitpicker_input.flush();
for (size_t i = 0; i < num_events; i++) { for (size_t i = 0; i < num_events; i++) {

View File

@ -103,8 +103,8 @@ class Launcher::Fading_dialog : private Input_event_handler
void _handle_hover_update(unsigned) void _handle_hover_update(unsigned)
{ {
try { try {
if (!_hover_ds.is_constructed() || _hover_rom.update() == false) { if (!_hover_ds.constructed() || _hover_rom.update() == false) {
if (_hover_ds.is_constructed()) if (_hover_ds.constructed())
_hover_ds->invalidate(); _hover_ds->invalidate();
_hover_ds.construct(_hover_rom.dataspace()); _hover_ds.construct(_hover_rom.dataspace());
} }

View File

@ -58,7 +58,7 @@ class Launcher::Panel_dialog : Input_event_handler, Dialog_generator,
Element _menu_button { _menu_button_label(), "Menu" }; Element _menu_button { _menu_button_label(), "Menu" };
bool _is_focused(Element const &e) bool _focused(Element const &e)
{ {
size_t const label_len = strlen(e.label.string()); size_t const label_len = strlen(e.label.string());
@ -93,7 +93,7 @@ class Launcher::Panel_dialog : Input_event_handler, Dialog_generator,
|| (e.hovered && e.touched)) || (e.hovered && e.touched))
xml.attribute("hovered", "yes"); xml.attribute("hovered", "yes");
if (e.selected || e.touched || _is_focused(e)) if (e.selected || e.touched || _focused(e))
xml.attribute("selected", "yes"); xml.attribute("selected", "yes");
xml.node("label", [&] () { xml.node("label", [&] () {
@ -536,7 +536,7 @@ class Launcher::Panel_dialog : Input_event_handler, Dialog_generator,
/* find focused element */ /* find focused element */
Element *e = _elements.first(); Element *e = _elements.first();
for (; e && !_is_focused(*e); e = e->next()); for (; e && !_focused(*e); e = e->next());
/* none of our subsystems is focused, start with the first one */ /* none of our subsystems is focused, start with the first one */
if (!e) if (!e)

Some files were not shown because too many files have changed in this diff Show More