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

@ -66,7 +66,7 @@ class Fs_log::Unlabeled_session_component : public Session_component
size_t write(Log_session::String const &msg)
{
if (!msg.is_valid_string()) {
if (!msg.valid_string()) {
PERR("corrupted string");
return 0;
}
@ -103,7 +103,7 @@ class Fs_log::Labeled_session_component : public Session_component
size_t write(Log_session::String const &msg)
{
if (!msg.is_valid_string()) {
if (!msg.valid_string()) {
PERR("corrupted string");
return 0;
}

View File

@ -86,7 +86,7 @@ class Backing_store
/**
* Return true if block is in use
*/
bool is_occupied() const { return _user != 0; }
bool occupied() const { return _user != 0; }
/**
* Return user of the block
@ -192,7 +192,7 @@ class Backing_store
}
/* evict block if needed */
if (_curr_block()->is_occupied())
if (_curr_block()->occupied())
_curr_block()->evict();
/* reserve allocated block (prevent eviction prior assignment) */

View File

@ -274,7 +274,7 @@ namespace Iso {
}
/* describes this record a directory */
bool is_directory() { return file_flags() & DIR_FLAG; }
bool directory() { return file_flags() & DIR_FLAG; }
};
@ -301,10 +301,10 @@ namespace Iso {
Directory_record * root_record() { return ptr<Directory_record *>(156); }
/* check for primary descriptor */
bool is_primary() { return type() == PRIMARY; }
bool primary() { return type() == PRIMARY; }
/* check for terminating descriptor */
bool is_terminator() { return type() == TERMINATOR; }
bool terminator() { return type() == TERMINATOR; }
/* copy the root record */
Directory_record *copy_root_record()
@ -334,10 +334,10 @@ namespace Iso {
if (verbose)
PDBG("Volume: type %u", vol->type());
if (vol->is_primary())
if (vol->primary())
return vol->copy_root_record();
if (vol->is_terminator())
if (vol->terminator())
return 0;
}
}
@ -444,7 +444,7 @@ namespace Iso {
if (verbose)
PDBG("Found %s", level);
if (!dir->is_directory()) {
if (!dir->directory()) {
blk_nr = dir->blk_nr();
data_length = dir->data_length();
}

View File

@ -69,7 +69,7 @@ class Input::Session_component : public Rpc_object<Session>
Dataspace_capability dataspace() override { return _real_input.dataspace(); }
bool is_pending() const override { return _real_input.is_pending(); }
bool pending() const override { return _real_input.pending(); }
int flush() override
{

View File

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

View File

@ -245,7 +245,7 @@ class Domain_registry
_insert(domain);
if (domain.is_last(type))
if (domain.last(type))
break;
}
}

View File

@ -33,13 +33,13 @@ static unsigned num_consecutive_events(Input::Event const *ev, unsigned max)
if (max < 1) return 0;
if (ev->type() != Input::Event::MOTION) return 1;
bool first_is_absolute = ev->is_absolute_motion();
bool const first_absolute = ev->absolute_motion();
/* iterate until we get a different event type, start at second */
unsigned cnt = 1;
for (ev++ ; cnt < max; cnt++, ev++) {
if (ev->type() != Input::Event::MOTION) break;
if (first_is_absolute != ev->is_absolute_motion()) break;
if (first_absolute != ev->absolute_motion()) break;
}
return cnt;
}
@ -72,7 +72,7 @@ static Input::Event merge_motion_events(Input::Event const *ev, unsigned n)
static bool import_input_events(Input::Event *ev_buf, unsigned num_ev,
User_state &user_state)
{
bool user_is_active = false;
bool user_active = false;
if (num_ev > 0) {
/*
@ -97,7 +97,7 @@ static bool import_input_events(Input::Event *ev_buf, unsigned num_ev,
* a zero-motion event, drop it. Otherwise, it would be
* misinterpreted as absolute event pointing to (0, 0).
*/
if (e->is_relative_motion() && curr.rx() == 0 && curr.ry() == 0)
if (e->relative_motion() && curr.rx() == 0 && curr.ry() == 0)
continue;
/*
@ -105,7 +105,7 @@ static bool import_input_events(Input::Event *ev_buf, unsigned num_ev,
* we regard the user as active. This check captures the presence
* of press-release combinations within one batch of input events.
*/
user_is_active |= user_state.key_is_pressed();
user_active |= user_state.key_pressed();
/* pass event to user state */
user_state.handle_event(curr);
@ -122,9 +122,9 @@ static bool import_input_events(Input::Event *ev_buf, unsigned num_ev,
/*
* If at least one key is kept pressed, we regard the user as active.
*/
user_is_active |= user_state.key_is_pressed();
user_active |= user_state.key_pressed();
return user_is_active;
return user_active;
}
#endif /* _INPUT_H_ */

View File

@ -79,7 +79,7 @@ Framebuffer::Session *tmp_fb;
static void report_session(Genode::Reporter &reporter, Session *session,
bool active = false)
{
if (!reporter.is_enabled())
if (!reporter.enabled())
return;
Genode::Reporter::Xml_generator xml(reporter, [&] ()
@ -277,7 +277,7 @@ class Input::Session_component : public Genode::Rpc_object<Session>
Dataspace_capability dataspace() override { return _ev_ram_ds.cap(); }
bool is_pending() const override { return _num_ev > 0; }
bool pending() const override { return _num_ev > 0; }
int flush() override
{
@ -527,7 +527,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
case Command::OP_GEOMETRY:
{
Locked_ptr<View> view(_view_handle_registry.lookup(command.geometry.view));
if (!view.is_valid())
if (!view.valid())
return;
Point pos = command.geometry.rect.p1();
@ -536,7 +536,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
if (view->top_level())
pos = ::Session::phys_pos(pos, _view_stack.size());
if (view.is_valid())
if (view.valid())
_view_stack.geometry(*view, Rect(pos, command.geometry.rect.area()));
return;
@ -546,7 +546,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
{
Locked_ptr<View> view(_view_handle_registry.lookup(command.geometry.view));
if (view.is_valid())
if (view.valid())
_view_stack.buffer_offset(*view, command.offset.offset);
return;
@ -558,7 +558,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
return;
Locked_ptr<View> view(_view_handle_registry.lookup(command.to_front.view));
if (!view.is_valid())
if (!view.valid())
return;
/* bring to front if no neighbor is specified */
@ -569,7 +569,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
/* stack view relative to neighbor */
Locked_ptr<View> neighbor(_view_handle_registry.lookup(command.to_front.neighbor));
if (neighbor.is_valid())
if (neighbor.valid())
_view_stack.stack(*view, &(*neighbor), false);
return;
@ -581,7 +581,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
return;
Locked_ptr<View> view(_view_handle_registry.lookup(command.to_back.view));
if (!view.is_valid())
if (!view.valid())
return;
/* bring to front if no neighbor is specified */
@ -592,7 +592,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
/* stack view relative to neighbor */
Locked_ptr<View> neighbor(_view_handle_registry.lookup(command.to_back.neighbor));
if (neighbor.is_valid())
if (neighbor.valid())
_view_stack.stack(*view, &(*neighbor), true);
return;
@ -602,7 +602,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
{
if (_provides_default_bg) {
Locked_ptr<View> view(_view_handle_registry.lookup(command.to_front.view));
if (!view.is_valid())
if (!view.valid())
return;
view->background(true);
@ -616,7 +616,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
/* assign session background */
Locked_ptr<View> view(_view_handle_registry.lookup(command.to_front.view));
if (!view.is_valid())
if (!view.valid())
return;
::Session::background(&(*view));
@ -632,7 +632,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
{
Locked_ptr<View> view(_view_handle_registry.lookup(command.title.view));
if (view.is_valid())
if (view.valid())
_view_stack.title(*view, command.title.title.string());
return;
@ -764,7 +764,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
try {
Locked_ptr<View> parent(_view_handle_registry.lookup(parent_handle));
if (!parent.is_valid())
if (!parent.valid())
return View_handle();
view = new (_view_alloc)
@ -849,7 +849,7 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
{
try {
Locked_ptr<View> view(_view_handle_registry.lookup(handle));
return view.is_valid() ? view->cap() : View_capability();
return view.valid() ? view->cap() : View_capability();
}
catch (View_handle_registry::Lookup_failed) {
return View_capability();
@ -1272,7 +1272,7 @@ void Nitpicker::Main::handle_input(unsigned)
user_active = false;
/* report mouse-position updates */
if (pointer_reporter.is_enabled() && old_pointer_pos != new_pointer_pos) {
if (pointer_reporter.enabled() && old_pointer_pos != new_pointer_pos) {
Genode::Reporter::Xml_generator xml(pointer_reporter, [&] ()
{
@ -1282,7 +1282,7 @@ void Nitpicker::Main::handle_input(unsigned)
}
/* report hover changes */
if (!user_state.Mode::key_is_pressed()
if (!user_state.Mode::key_pressed()
&& old_pointed_session != new_pointed_session) {
report_session(hover_reporter, new_pointed_session);
}

View File

@ -51,7 +51,7 @@ class Mode
bool has_key_cnt(unsigned cnt) const { return cnt == _key_cnt; }
bool key_is_pressed() const { return _key_cnt > 0; }
bool key_pressed() const { return _key_cnt > 0; }
Session *focused_session() { return _focused_session; }
Session const *focused_session() const { return _focused_session; }
@ -62,7 +62,7 @@ class Mode
_next_focused_session = session;
}
bool is_focused(Session const &session) const { return &session == _focused_session; }
bool focused(Session const &session) const { return &session == _focused_session; }
void next_focused_session(Session *session) { _next_focused_session = session; }
@ -77,7 +77,7 @@ class Mode
* inconsistent press and release events. However, focus changes
* during global key sequences are fine.
*/
if (key_is_pressed() && !_global_key_sequence)
if (key_pressed() && !_global_key_sequence)
return;
if (_focused_session != _next_focused_session)

View File

@ -75,7 +75,7 @@ void User_state::handle_event(Input::Event ev)
ax = ev.ax();
ay = ev.ay();
ev = Input::Event::create_touch_event(ax, ay, ev.code(),
ev.is_touch_release());
ev.touch_release());
} else
ev = Input::Event(type, keycode, ax, ay, rx, ry);

View File

@ -206,7 +206,7 @@ class View : public Same_buffer_list_elem,
{
if (!_session.label_visible()) return 0;
return mode.is_focused(_session) ? 5 : 3;
return mode.focused(_session) ? 5 : 3;
}
/**
@ -236,10 +236,10 @@ class View : public Same_buffer_list_elem,
/**
* Set view as background
*
* \param is_bg true if view is background
* \param bg true if view is background
*/
void background(bool is_bg) {
_background = is_bg ? BACKGROUND : NOT_BACKGROUND; }
void background(bool bg) {
_background = bg ? BACKGROUND : NOT_BACKGROUND; }
/**
* Accessors

View File

@ -126,7 +126,7 @@ class Gpt : public Block::Partition_table
PLOGV(" gpe crc: %x", _gpe_crc);
}
bool is_valid(bool check_primary = true)
bool valid(bool check_primary = true)
{
dump_hdr(check_primary);
@ -156,7 +156,7 @@ class Gpt : public Block::Partition_table
if (check_primary) {
/* check backup gpt header */
Sector backup_hdr(_backup_hdr_lba, 1);
if (!backup_hdr.addr<Gpt_hdr*>()->is_valid(false)) {
if (!backup_hdr.addr<Gpt_hdr*>()->valid(false)) {
PWRN("Backup GPT header is corrupted");
}
}
@ -181,7 +181,7 @@ class Gpt : public Block::Partition_table
Genode::uint64_t _attr; /* partition attributes */
Genode::uint16_t _name[NAME_LEN]; /* partition name in UNICODE-16 */
bool is_valid()
bool valid()
{
if (_type.time_low == 0x00000000)
return false;
@ -226,7 +226,7 @@ class Gpt : public Block::Partition_table
*/
void _parse_gpt(Gpt_hdr *gpt)
{
if (!(gpt->is_valid()))
if (!(gpt->valid()))
throw Genode::Exception();
Sector entry_array(gpt->_gpe_lba,
@ -236,7 +236,7 @@ class Gpt : public Block::Partition_table
for (int i = 0; i < MAX_PARTITIONS; i++) {
Gpt_entry *e = (entries + i);
if (!e->is_valid())
if (!e->valid())
continue;
Genode::uint64_t start = e->_lba_start;

View File

@ -46,9 +46,9 @@ struct Mbr_partition_table : public Block::Partition_table
Genode::uint32_t _lba; /* logical block address */
Genode::uint32_t _sectors; /* number of sectors */
bool is_valid() { return _type != INVALID; }
bool is_extented() { return _type == EXTENTED; }
bool is_protective() { return _type == PROTECTIVE; }
bool valid() { return _type != INVALID; }
bool extented() { return _type == EXTENTED; }
bool protective() { return _type == PROTECTIVE; }
} __attribute__((packed));
@ -61,7 +61,7 @@ struct Mbr_partition_table : public Block::Partition_table
Partition_record _records[4];
Genode::uint16_t _magic;
bool is_valid()
bool valid()
{
/* magic number of partition table */
enum { MAGIC = 0xaa55 };
@ -86,13 +86,13 @@ struct Mbr_partition_table : public Block::Partition_table
Sector s(lba, 1);
Mbr *ebr = s.addr<Mbr *>();
if (!(ebr->is_valid()))
if (!(ebr->valid()))
return;
/* The first record is the actual logical partition. The lba of this
* partition is relative to the lba of the current EBR */
Partition_record *logical = &(ebr->_records[0]);
if (logical->is_valid() && nr < MAX_PARTITIONS) {
if (logical->valid() && nr < MAX_PARTITIONS) {
_part_list[nr++] = new (Genode::env()->heap())
Block::Partition(logical->_lba + lba, logical->_sectors);
@ -107,29 +107,29 @@ struct Mbr_partition_table : public Block::Partition_table
r = &(ebr->_records[1]);
lba += ebr->_records[1]._lba;
} while (r->is_valid());
} while (r->valid());
}
void _parse_mbr(Mbr *mbr)
{
/* no partition table, use whole disc as partition 0 */
if (!(mbr->is_valid()))
if (!(mbr->valid()))
_part_list[0] = new(Genode::env()->heap())
Block::Partition(0, Block::Driver::driver().blk_cnt() - 1);
for (int i = 0; i < 4; i++) {
Partition_record *r = &(mbr->_records[i]);
if (!r->is_valid())
if (!r->valid())
continue;
PINF("Partition %d: LBA %u (%u blocks) type: %x",
i + 1, r->_lba, r->_sectors, r->_type);
if (r->is_protective())
if (r->protective())
throw Protective_mbr_found();
if (r->is_extented()) {
if (r->extented()) {
_parse_extented(r);
continue;
}

View File

@ -256,7 +256,7 @@ namespace File_system {
if (!_writable)
throw Permission_denied();
if (!path.is_valid_string())
if (!path.valid_string())
throw Name_too_long();
Directory *parent = _root.lookup_and_lock_parent(path_str);

View File

@ -77,7 +77,7 @@ struct Rom::Registry : Registry_for_reader, Registry_for_writer, Genode::Noncopy
void _try_to_destroy(Module const &module)
{
if (module._is_in_use())
if (module._in_use())
return;
_modules.remove(&module);

View File

@ -77,7 +77,7 @@ class Rom_filter::Input_rom_registry
void _handle_rom_changed(unsigned)
{
_rom_ds.update();
if (!_rom_ds.is_valid())
if (!_rom_ds.valid())
return;
try {

View File

@ -87,7 +87,7 @@ class Rom_filter::Session_component : public Rpc_object<Genode::Rom_session>,
using namespace Genode;
/* replace dataspace by new one as needed */
if (!_ram_ds.is_constructed()
if (!_ram_ds.constructed()
|| _output_buffer.content_size() > _ram_ds->size()) {
_ram_ds.construct(env()->ram_session(), _output_buffer.content_size());
@ -180,7 +180,7 @@ struct Rom_filter::Main : Input_rom_registry::Input_rom_changed_fn,
xml_ds_size = Genode::config()->xml_node().attribute_value("buffer", xml_ds_size);
if (!_xml_ds.is_constructed() || xml_ds_size != _xml_ds->size())
if (!_xml_ds.constructed() || xml_ds_size != _xml_ds->size())
_xml_ds.construct(env()->ram_session(), xml_ds_size);
/*

View File

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

View File

@ -45,7 +45,7 @@ namespace File_system {
void assert_valid_range(seek_off_t start, size_t len,
file_size_t chunk_size) const
{
if (is_zero()) return;
if (zero()) return;
if (start < _base_offset)
throw Index_out_of_range();
@ -77,7 +77,7 @@ namespace File_system {
/**
* Return true if chunk is a read-only zero chunk
*/
bool is_zero() const { return _base_offset == (seek_off_t)(~0L); }
bool zero() const { return _base_offset == (seek_off_t)(~0L); }
/**
* Return true if chunk has no allocated sub chunks
@ -318,7 +318,7 @@ namespace File_system {
void operator () (Entry &entry, char *dst, size_t len,
seek_off_t seek_offset) const
{
if (entry.is_zero())
if (entry.zero())
memset(dst, 0, len);
else
entry.read(dst, len, seek_offset);

View File

@ -125,7 +125,7 @@ namespace File_system {
if (!sub_node)
throw Lookup_failed();
if (is_basename(path)) {
if (!contains_path_delimiter(path)) {
/*
* Because 'path' is a basename that corresponds to an

View File

@ -68,7 +68,7 @@ namespace Trace_fs {
bool last_entry() const
{
return current_entry.is_last();
return current_entry.last();
}
void rewind() { current_entry = buffer->first(); }

View File

@ -840,7 +840,7 @@ class File_system::Session_component : public Session_rpc_object
if (create)
throw Permission_denied();
if (!path.is_valid_string())
if (!path.valid_string())
throw Name_too_long();
Directory *dir = dynamic_cast<Directory*>(_root_dir.lookup(path_str + 1));

View File

@ -323,7 +323,7 @@ class Vfs_server::Session_component :
/* make sure a handle is free before allocating */
auto slot = _next_slot();
if (!create && !_vfs.is_directory(path_str))
if (!create && !_vfs.directory(path_str))
throw Lookup_failed();
Directory *dir;
@ -653,7 +653,7 @@ class Vfs_server::Root :
ram_quota -= session_size;
/* check if the session root exists */
if (!((session_root == "/") || _vfs.is_directory(session_root.base()))) {
if (!((session_root == "/") || _vfs.directory(session_root.base()))) {
PERR("session root '%s' not found for '%s'", session_root.base(), label.string());
throw Root::Unavailable();
}