diff --git a/repos/ports/src/noux/args.h b/repos/ports/src/noux/args.h index fcb1038a01..3eb4209e13 100644 --- a/repos/ports/src/noux/args.h +++ b/repos/ports/src/noux/args.h @@ -73,7 +73,7 @@ class Noux::Args size_t len() const { return _len; } - char const * const base() const { return _buf; } + char const *base() const { return _buf; } void append(char const *arg) { diff --git a/repos/ports/src/noux/armed_timeout.h b/repos/ports/src/noux/armed_timeout.h index 9ab5aecb6b..e4725d5f7f 100644 --- a/repos/ports/src/noux/armed_timeout.h +++ b/repos/ports/src/noux/armed_timeout.h @@ -23,7 +23,7 @@ class Noux::Armed_timeout : Noncopyable { public: - struct State : Noncopyable { bool timed_out; }; + struct State : Noncopyable { bool timed_out { }; }; private: diff --git a/repos/ports/src/noux/child.h b/repos/ports/src/noux/child.h index 13977b959b..f24db9d67e 100644 --- a/repos/ports/src/noux/child.h +++ b/repos/ports/src/noux/child.h @@ -70,13 +70,11 @@ class Noux::Pid_allocator { private: - Lock _lock; - int _num_pids; + Lock _lock { }; + int _num_pids { 0 }; public: - Pid_allocator() : _num_pids(0) { } - int alloc() { Lock::Guard guard(_lock); @@ -110,6 +108,12 @@ class Noux::Child : public Rpc_object, { private: + /* + * Noncopyable + */ + Child(Child const &); + Child &operator = (Child const &); + Child_policy::Name const _name; Verbose const &_verbose; @@ -127,7 +131,7 @@ class Noux::Child : public Rpc_object, Vfs::File_system &_root_dir; Vfs_io_waiter_registry &_vfs_io_waiter_registry; - Vfs_handle_context _vfs_handle_context; + Vfs_handle_context _vfs_handle_context { }; Destruct_queue &_destruct_queue; @@ -210,7 +214,7 @@ class Noux::Child : public Rpc_object, typedef Ring_buffer Signal_queue; - Signal_queue _pending_signals; + Signal_queue _pending_signals { }; Parent_services &_parent_services; diff --git a/repos/ports/src/noux/child_env.h b/repos/ports/src/noux/child_env.h index be4ea52d61..749dfc52b1 100644 --- a/repos/ports/src/noux/child_env.h +++ b/repos/ports/src/noux/child_env.h @@ -37,9 +37,9 @@ class Noux::Child_env { private: - enum { MAX_LEN_INTERPRETER_LINE = 128 }; + static unsigned constexpr MAX_LEN_INTERPRETER_LINE = 128; - char const *_binary_name; + char const *_binary_name { nullptr }; char _args[ARGS_SIZE + MAX_LEN_INTERPRETER_LINE]; Sysio::Env _env; diff --git a/repos/ports/src/noux/child_policy.h b/repos/ports/src/noux/child_policy.h index caad94efa3..6c65e1fd4e 100644 --- a/repos/ports/src/noux/child_policy.h +++ b/repos/ports/src/noux/child_policy.h @@ -41,6 +41,12 @@ class Noux::Child_policy : public Genode::Child_policy { private: + /** + * Noncopyable + */ + Child_policy(Child_policy const &); + Child_policy &operator = (Child_policy const &); + Name const _name; bool _forked; Init::Child_policy_provide_rom_file _args_policy; @@ -124,7 +130,7 @@ class Noux::Child_policy : public Genode::Child_policy Pd_session &ref_pd() override { return _ref_pd; } Pd_session_capability ref_pd_cap() const override { return _ref_pd_cap; } - void init(Pd_session &session, Pd_session_capability cap) override + void init(Pd_session &session, Pd_session_capability) override { session.ref_account(_ref_pd_cap); } diff --git a/repos/ports/src/noux/cpu_session_component.h b/repos/ports/src/noux/cpu_session_component.h index 2ed668f93c..6435c9ce21 100644 --- a/repos/ports/src/noux/cpu_session_component.h +++ b/repos/ports/src/noux/cpu_session_component.h @@ -50,10 +50,10 @@ class Noux::Cpu_session_component : public Rpc_object enum { MAX_THREADS = 8, MAIN_THREAD_IDX = 0 }; Thread_capability _threads[MAX_THREADS]; - Dataspace_capability _trace_control; + Dataspace_capability _trace_control { }; Dataspace_registry &_registry; - Constructible _ds_info; + Constructible _ds_info { }; public: diff --git a/repos/ports/src/noux/dataspace_registry.h b/repos/ports/src/noux/dataspace_registry.h index 9952f3dd4a..3c02eeb703 100644 --- a/repos/ports/src/noux/dataspace_registry.h +++ b/repos/ports/src/noux/dataspace_registry.h @@ -29,8 +29,11 @@ namespace Noux { } -struct Noux::Dataspace_user : List::Element +struct Noux::Dataspace_user : Interface, private List::Element { + friend class Dataspace_info; + friend class List; + virtual void dissolve(Dataspace_info &ds) = 0; }; @@ -41,8 +44,8 @@ class Noux::Dataspace_info : public Object_pool::Entry size_t _size; Dataspace_capability _ds_cap; - Lock _users_lock; - List _users; + Lock _users_lock { }; + List _users { }; public: @@ -126,7 +129,7 @@ class Noux::Dataspace_info : public Object_pool::Entry * * \param addr address that is covered by the requested region map */ - virtual Capability lookup_region_map(addr_t const addr) + virtual Capability lookup_region_map(addr_t) { /* by default a dataspace is no sub region map, so return invalid */ return Capability(); diff --git a/repos/ports/src/noux/destruct_queue.h b/repos/ports/src/noux/destruct_queue.h index 8057625778..b60bde2bfd 100644 --- a/repos/ports/src/noux/destruct_queue.h +++ b/repos/ports/src/noux/destruct_queue.h @@ -25,8 +25,9 @@ class Noux::Destruct_queue { public: - struct Element_base : Genode::List::Element + struct Element_base : Interface, private Genode::List::Element { + friend class List; virtual void destroy() = 0; }; @@ -67,8 +68,8 @@ class Noux::Destruct_queue private: - Genode::List _destruct_list; - Genode::Lock _destruct_list_lock; + Genode::List _destruct_list { }; + Genode::Lock _destruct_list_lock { }; Signal_context_capability _sigh; public: diff --git a/repos/ports/src/noux/empty_rom_service.h b/repos/ports/src/noux/empty_rom_service.h index 5eef383aa2..79ce17a4fd 100644 --- a/repos/ports/src/noux/empty_rom_service.h +++ b/repos/ports/src/noux/empty_rom_service.h @@ -42,7 +42,7 @@ class Noux::Empty_rom_factory : public Empty_rom_service::Factory Empty_rom_factory(Allocator &alloc, Rpc_entrypoint &ep) : _alloc(alloc), _ep(ep) { } - Empty_rom_session_component &create(Args const &args, Affinity) override + Empty_rom_session_component &create(Args const &, Affinity) override { try { return *new (_alloc) Empty_rom_session_component(_ep); } diff --git a/repos/ports/src/noux/environment.h b/repos/ports/src/noux/environment.h index 434d5aabed..98da6c7e42 100644 --- a/repos/ports/src/noux/environment.h +++ b/repos/ports/src/noux/environment.h @@ -27,11 +27,13 @@ namespace Noux { } -class Noux::Environment : private Attached_ram_dataspace +class Noux::Environment : Noncopyable { private: - Sysio::Env *_env; + Attached_ram_dataspace _ds; + + Sysio::Env &_env { *_ds.local_addr() }; public: @@ -41,19 +43,17 @@ class Noux::Environment : private Attached_ram_dataspace * \param env comma-separated list of environment variables */ Environment(Ram_allocator &ram, Region_map &local_rm, Sysio::Env const &env) - : - Attached_ram_dataspace(ram, local_rm, sizeof(Sysio::Env)), - _env(local_addr()) + : _ds(ram, local_rm, sizeof(Sysio::Env)) { - memcpy(_env, env, sizeof(Sysio::Env)); + memcpy(&_env, &env, sizeof(Sysio::Env)); } - using Attached_ram_dataspace::cap; + Dataspace_capability cap() { return _ds.cap(); } /** * Return list of environment variables as zero-separated list */ - Sysio::Env const &env() { return *_env; } + Sysio::Env const &env() { return _env; } }; #endif /* _NOUX__ENVIRONMENT_H_ */ diff --git a/repos/ports/src/noux/family_member.h b/repos/ports/src/noux/family_member.h index c5a115bf81..b6eb9ec17e 100644 --- a/repos/ports/src/noux/family_member.h +++ b/repos/ports/src/noux/family_member.h @@ -25,17 +25,19 @@ namespace Noux { class Family_member; } -class Noux::Family_member : public List::Element, +class Noux::Family_member : private List::Element, public Parent_exit, public Parent_execve { private: + friend class List; + int const _pid; - Lock _lock; - List _list; - bool _has_exited; - int _exit_status; + Lock _lock { }; + List _list { }; + bool _has_exited { false }; + int _exit_status { 0 }; protected: @@ -43,13 +45,11 @@ class Noux::Family_member : public List::Element, * Lock used for implementing blocking syscalls, * i.e., select, wait4, ... */ - Lock _blocker; + Lock _blocker { }; public: - Family_member(int pid) - : _pid(pid), _has_exited(false), _exit_status(0) - { } + Family_member(int pid) : _pid(pid) { } virtual ~Family_member() { } diff --git a/repos/ports/src/noux/file_descriptor_registry.h b/repos/ports/src/noux/file_descriptor_registry.h index cb91fb757f..e698152c1d 100644 --- a/repos/ports/src/noux/file_descriptor_registry.h +++ b/repos/ports/src/noux/file_descriptor_registry.h @@ -32,7 +32,7 @@ class Noux::File_descriptor_registry bool allocated; bool close_on_execve; Shared_pointer io_channel; - } _fds[MAX_FILE_DESCRIPTORS]; + } _fds[MAX_FILE_DESCRIPTORS] { }; bool _valid_fd(int fd) const { @@ -71,6 +71,8 @@ class Noux::File_descriptor_registry flush(); } + virtual ~File_descriptor_registry() { } + /** * Associate I/O channel with file descriptor * diff --git a/repos/ports/src/noux/interrupt_handler.h b/repos/ports/src/noux/interrupt_handler.h index 4d43840f7d..86132e89eb 100644 --- a/repos/ports/src/noux/interrupt_handler.h +++ b/repos/ports/src/noux/interrupt_handler.h @@ -18,7 +18,7 @@ namespace Noux { - struct Interrupt_handler + struct Interrupt_handler : Genode::Interface { virtual void handle_interrupt(Sysio::Signal) = 0; }; diff --git a/repos/ports/src/noux/io_channel.h b/repos/ports/src/noux/io_channel.h index 82302c0862..02e625d753 100644 --- a/repos/ports/src/noux/io_channel.h +++ b/repos/ports/src/noux/io_channel.h @@ -53,18 +53,20 @@ struct Noux::Io_channel_backend /** * Input/output channel interface */ -class Noux::Io_channel : public Reference_counter +class Noux::Io_channel : private Reference_counter { private: + friend class Shared_pointer; + /** * List of notifiers (i.e., processes) used by threads that block * for an I/O-channel event */ - List _notifiers; - Lock _notifiers_lock; - List _interrupt_handlers; - Lock _interrupt_handlers_lock; + List _notifiers { }; + Lock _notifiers_lock { }; + List _interrupt_handlers { }; + Lock _interrupt_handlers_lock { }; public: @@ -72,14 +74,14 @@ class Noux::Io_channel : public Reference_counter virtual Io_channel_backend *backend() { return nullptr; } - virtual bool write(Sysio &sysio) { return false; } - virtual bool read(Sysio &sysio) { return false; } - virtual bool fstat(Sysio &sysio) { return false; } - virtual bool ftruncate(Sysio &sysio) { return false; } - virtual bool fcntl(Sysio &sysio) { return false; } - virtual bool dirent(Sysio &sysio) { return false; } - virtual bool ioctl(Sysio &sysio) { return false; } - virtual bool lseek(Sysio &sysio) { return false; } + virtual bool write(Sysio &) { return false; } + virtual bool read(Sysio &) { return false; } + virtual bool fstat(Sysio &) { return false; } + virtual bool ftruncate(Sysio &) { return false; } + virtual bool fcntl(Sysio &) { return false; } + virtual bool dirent(Sysio &) { return false; } + virtual bool ioctl(Sysio &) { return false; } + virtual bool lseek(Sysio &) { return false; } /** * Return true if an unblocking condition of the channel is satisfied @@ -88,7 +90,7 @@ class Noux::Io_channel : public Reference_counter * \param wr if true, check for readiness for writing * \param ex if true, check for exceptions */ - virtual bool check_unblock(bool rd, bool wr, bool ex) const { + virtual bool check_unblock(bool /* rd */, bool /* wr */, bool /* ex */) const { return false; } /** @@ -193,7 +195,7 @@ class Noux::Io_channel : public Reference_counter * This function is used to simplify the implemenation of SYSCALL_FSTAT * and is only implemented by Vfs_io_channel. */ - virtual bool path(char *path, size_t len) { return false; } + virtual bool path(char * /* path */, size_t /* len */) { return false; } }; #endif /* _NOUX__IO_CHANNEL_H_ */ diff --git a/repos/ports/src/noux/io_receptor_registry.h b/repos/ports/src/noux/io_receptor_registry.h index 422fef9401..7277028479 100644 --- a/repos/ports/src/noux/io_receptor_registry.h +++ b/repos/ports/src/noux/io_receptor_registry.h @@ -47,8 +47,8 @@ class Noux::Io_receptor_registry { private: - List _receptors; - Lock _receptors_lock; + List _receptors { }; + Lock _receptors_lock { }; public: diff --git a/repos/ports/src/noux/kill_broadcaster.h b/repos/ports/src/noux/kill_broadcaster.h index 4bd0e78484..91c45a67bf 100644 --- a/repos/ports/src/noux/kill_broadcaster.h +++ b/repos/ports/src/noux/kill_broadcaster.h @@ -19,7 +19,7 @@ namespace Noux { - struct Kill_broadcaster + struct Kill_broadcaster : Genode::Interface { virtual bool kill(int pid, Noux::Sysio::Signal sig) = 0; }; diff --git a/repos/ports/src/noux/main.cc b/repos/ports/src/noux/main.cc index b558491322..6837f4bfb0 100644 --- a/repos/ports/src/noux/main.cc +++ b/repos/ports/src/noux/main.cc @@ -95,7 +95,6 @@ connect_stdio(Genode::Env &env, Genode::Constructible &terminal, Genode::Xml_node config, Vfs::File_system &root, - Noux::Vfs_handle_context &vfs_handle_context, Noux::Vfs_io_waiter_registry &vfs_io_waiter_registry, Noux::Terminal_io_channel::Type type, Genode::Allocator &alloc) @@ -141,7 +140,7 @@ connect_stdio(Genode::Env &env, } return *new (alloc) - Vfs_io_channel(path.string(), root.leaf_path(path.string()), &root, + Vfs_io_channel(path.string(), root.leaf_path(path.string()), vfs_handle, vfs_io_waiter_registry, env.ep()); } @@ -170,7 +169,7 @@ struct Noux::Main Heap _heap { _env.ram(), _env.rm() }; /* whitelist of service requests to be routed to the parent */ - Noux::Parent_services _parent_services; + Noux::Parent_services _parent_services { }; Noux::Parent_service _log_parent_service { _parent_services, "LOG" }; Noux::Parent_service _timer_parent_service { _parent_services, "Timer" }; @@ -215,7 +214,7 @@ struct Noux::Main struct Io_response_handler : Vfs::Io_response_handler { - Vfs_io_waiter_registry io_waiter_registry; + Vfs_io_waiter_registry io_waiter_registry { }; void handle_io_response(Vfs::Vfs_handle::Context *context) override { @@ -230,7 +229,7 @@ struct Noux::Main }); } - } _io_response_handler; + } _io_response_handler { }; struct Vfs_env : Vfs::Env, Vfs::Watch_response_handler { @@ -260,9 +259,7 @@ struct Noux::Main Vfs::File_system &_root_dir = _vfs_env.root_dir(); - Vfs_handle_context _vfs_handle_context; - - Pid_allocator _pid_allocator; + Pid_allocator _pid_allocator { }; Timer::Connection _timer_connection { _env }; @@ -295,7 +292,7 @@ struct Noux::Main return init_process->deliver_kill(pid, sig); } - } _kill_broadcaster; + } _kill_broadcaster { }; Noux::Child _init_child { _name_of_init_process(), _verbose, @@ -318,7 +315,7 @@ struct Noux::Main false, _destruct_queue }; - Constructible _terminal; + Constructible _terminal { }; /* * I/O channels must be dynamically allocated to handle cases where the @@ -328,13 +325,13 @@ struct Noux::Main Shared_pointer _channel_0 { &connect_stdio(_env, _terminal, _config.xml(), _root_dir, - _vfs_handle_context, _io_response_handler.io_waiter_registry, + _io_response_handler.io_waiter_registry, Tio::STDIN, _heap), _heap }, _channel_1 { &connect_stdio(_env, _terminal, _config.xml(), _root_dir, - _vfs_handle_context, _io_response_handler.io_waiter_registry, + _io_response_handler.io_waiter_registry, Tio::STDOUT, _heap), _heap }, _channel_2 { &connect_stdio(_env, _terminal, _config.xml(), _root_dir, - _vfs_handle_context, _io_response_handler.io_waiter_registry, + _io_response_handler.io_waiter_registry, Tio::STDERR, _heap), _heap }; Main(Env &env) : _env(env) diff --git a/repos/ports/src/noux/parent_execve.h b/repos/ports/src/noux/parent_execve.h index b9e5ac6665..6effe1d061 100644 --- a/repos/ports/src/noux/parent_execve.h +++ b/repos/ports/src/noux/parent_execve.h @@ -23,7 +23,7 @@ namespace Noux { } -struct Noux::Parent_execve +struct Noux::Parent_execve : Genode::Interface { virtual void execve_child(Family_member &child, const char *filename, diff --git a/repos/ports/src/noux/parent_exit.h b/repos/ports/src/noux/parent_exit.h index 2ad6129b2f..0cf6725369 100644 --- a/repos/ports/src/noux/parent_exit.h +++ b/repos/ports/src/noux/parent_exit.h @@ -14,11 +14,13 @@ #ifndef _NOUX__PARENT_EXIT__H_ #define _NOUX__PARENT_EXIT__H_ +#include + namespace Noux { struct Family_member; - struct Parent_exit + struct Parent_exit : Genode::Interface { /* * Handle the exiting of a child diff --git a/repos/ports/src/noux/pd_session_component.h b/repos/ports/src/noux/pd_session_component.h index 2511939e06..c2e935bd87 100644 --- a/repos/ports/src/noux/pd_session_component.h +++ b/repos/ports/src/noux/pd_session_component.h @@ -40,8 +40,10 @@ namespace Noux { struct Noux::Ram_dataspace_info : Dataspace_info, - List::Element + private List::Element { + friend class List; + Ram_dataspace_info(Ram_dataspace_capability ds_cap) : Dataspace_info(ds_cap) { } @@ -111,7 +113,7 @@ class Noux::Pd_session_component : public Rpc_object Ram_quota _used_ram_quota { 0 }; - List _ds_list; + List _ds_list { }; Dataspace_registry &_ds_registry; @@ -259,9 +261,9 @@ class Noux::Pd_session_component : public Rpc_object Capability linker_area() override { return _linker_area.Rpc_object::cap(); } - void ref_account(Capability pd) override { } + void ref_account(Capability) override { } - void transfer_quota(Capability pd, Cap_quota amount) override { } + void transfer_quota(Capability, Cap_quota) override { } Cap_quota cap_quota() const { return _pd.cap_quota(); } Cap_quota used_caps() const { return _pd.used_caps(); } diff --git a/repos/ports/src/noux/pipe_io_channel.h b/repos/ports/src/noux/pipe_io_channel.h index 654035c90f..efffb51040 100644 --- a/repos/ports/src/noux/pipe_io_channel.h +++ b/repos/ports/src/noux/pipe_io_channel.h @@ -28,18 +28,18 @@ class Noux::Pipe : public Reference_counter { private: - Lock mutable _lock; + Lock mutable _lock { }; enum { BUFFER_SIZE = 4096 }; char _buffer[BUFFER_SIZE]; - unsigned _read_offset; - unsigned _write_offset; + unsigned _read_offset { 0 }; + unsigned _write_offset { 0 }; - Signal_context_capability _read_ready_sigh; - Signal_context_capability _write_ready_sigh; + Signal_context_capability _read_ready_sigh { }; + Signal_context_capability _write_ready_sigh { }; - bool _writer_is_gone; + bool _writer_is_gone { false }; /** * Return space available in the buffer for writing, in bytes @@ -75,9 +75,6 @@ class Noux::Pipe : public Reference_counter public: - Pipe() - : _read_offset(0), _write_offset(0), _writer_is_gone(false) { } - ~Pipe() { Lock::Guard guard(_lock); @@ -237,7 +234,7 @@ class Noux::Pipe_sink_io_channel : public Io_channel ~Pipe_sink_io_channel() { _pipe->writer_close(); } - bool check_unblock(bool rd, bool wr, bool ex) const override + bool check_unblock(bool, bool wr, bool) const override { return wr && _pipe->any_space_avail_for_writing(); } @@ -292,7 +289,7 @@ class Noux::Pipe_source_io_channel : public Io_channel ~Pipe_source_io_channel() { _pipe->reader_close(); } - bool check_unblock(bool rd, bool wr, bool ex) const override + bool check_unblock(bool rd, bool, bool) const override { /* unblock if the writer has already closed its pipe end */ if (_pipe->writer_is_gone()) diff --git a/repos/ports/src/noux/range_checked_index.h b/repos/ports/src/noux/range_checked_index.h index 018dd2dbc1..c3de0fdc15 100644 --- a/repos/ports/src/noux/range_checked_index.h +++ b/repos/ports/src/noux/range_checked_index.h @@ -29,14 +29,14 @@ struct Noux::Range_checked_index Range_checked_index(T value, T max) : value(value), max(max) { } - T operator++ (int) + Range_checked_index operator++ (int) { T old_value = value; if (++value >= max) throw Index_out_of_range(); - return old_value; + return Range_checked_index(old_value, max); } operator T () { return value; } diff --git a/repos/ports/src/noux/region_map_component.h b/repos/ports/src/noux/region_map_component.h index af0b61748d..89a94535f4 100644 --- a/repos/ports/src/noux/region_map_component.h +++ b/repos/ports/src/noux/region_map_component.h @@ -46,8 +46,11 @@ class Noux::Region_map_component : public Rpc_object, /** * Record of an attached dataspace */ - struct Region : List::Element, Dataspace_user + struct Region : private List::Element, private Dataspace_user { + friend class Region_map_component; /* list operations */ + friend class List; + Region_map_component &rm; Dataspace_capability ds; size_t size; @@ -76,11 +79,11 @@ class Noux::Region_map_component : public Rpc_object, return List::Element::next(); } - inline void dissolve(Dataspace_info &ds); + void dissolve(Dataspace_info &ds) override; }; - Lock _region_lock; - List _regions; + Lock _region_lock { }; + List _regions { }; Region *_lookup_region_by_addr(addr_t local_addr) { @@ -413,7 +416,7 @@ class Noux::Region_map_component : public Rpc_object, }; -inline void Noux::Region_map_component::Region::dissolve(Dataspace_info &ds) +inline void Noux::Region_map_component::Region::dissolve(Dataspace_info &) { rm.detach(local_addr); } diff --git a/repos/ports/src/noux/rom_session_component.h b/repos/ports/src/noux/rom_session_component.h index aef48da3d1..12f3d94224 100644 --- a/repos/ports/src/noux/rom_session_component.h +++ b/repos/ports/src/noux/rom_session_component.h @@ -44,7 +44,7 @@ struct Noux::Vfs_dataspace Genode::Region_map &rm; Genode::Allocator &alloc; - Dataspace_capability ds; + Dataspace_capability ds { }; bool got_ds_from_vfs { true }; Vfs_dataspace(Vfs::File_system &root_dir, @@ -154,7 +154,7 @@ struct Noux::Rom_dataspace_info : Dataspace_info return ds_cap(); } - void poke(Region_map &, addr_t dst_offset, char const *src, size_t len) + void poke(Region_map &, addr_t, char const *, size_t) override { error("attempt to poke onto a ROM dataspace"); } @@ -183,12 +183,12 @@ class Noux::Rom_session_component : public Rpc_object Vfs_io_waiter_registry &_vfs_io_waiter_registry; Dataspace_registry &_ds_registry; - Constructible _rom_from_vfs; + Constructible _rom_from_vfs { }; /** * Wrapped ROM session at core */ - Constructible _rom_from_parent; + Constructible _rom_from_parent { }; Dataspace_capability _init_ds_cap(Env &env, Name const &name) { diff --git a/repos/ports/src/noux/shared_pointer.h b/repos/ports/src/noux/shared_pointer.h index ca692aa26f..90297ddd19 100644 --- a/repos/ports/src/noux/shared_pointer.h +++ b/repos/ports/src/noux/shared_pointer.h @@ -33,7 +33,7 @@ class Noux::Reference_counter { private: - Lock _lock; + Lock _lock { }; long _value; friend class Shared_pointer_base; diff --git a/repos/ports/src/noux/syscall.cc b/repos/ports/src/noux/syscall.cc index c0a0cda007..21337a9f1b 100644 --- a/repos/ports/src/noux/syscall.cc +++ b/repos/ports/src/noux/syscall.cc @@ -227,7 +227,7 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc) Shared_pointer channel(new (_heap) Vfs_io_channel(_sysio.open_in.path, - leaf_path, &_root_dir, + leaf_path, vfs_handle, _vfs_io_waiter_registry, _env.ep()), diff --git a/repos/ports/src/noux/target.mk b/repos/ports/src/noux/target.mk index 5bede43093..f1323a308a 100644 --- a/repos/ports/src/noux/target.mk +++ b/repos/ports/src/noux/target.mk @@ -3,6 +3,4 @@ LIBS = base vfs SRC_CC = main.cc syscall.cc INC_DIR += $(PRG_DIR) -vpath %.cc $(PRG_DIR) - -CC_CXX_WARN_STRICT = +vpath %.cc $(PRG_DIR) diff --git a/repos/ports/src/noux/terminal_io_channel.h b/repos/ports/src/noux/terminal_io_channel.h index 72a509aa91..76ad18cb7b 100644 --- a/repos/ports/src/noux/terminal_io_channel.h +++ b/repos/ports/src/noux/terminal_io_channel.h @@ -41,7 +41,7 @@ struct Noux::Terminal_io_channel : Io_channel enum Type { STDIN, STDOUT, STDERR } type; - Ring_buffer read_buffer; + Ring_buffer read_buffer { }; Terminal_io_channel(Terminal::Session &terminal, Type type, Entrypoint &ep) @@ -160,7 +160,7 @@ struct Noux::Terminal_io_channel : Io_channel return true; } - bool check_unblock(bool rd, bool wr, bool ex) const override + bool check_unblock(bool rd, bool wr, bool) const override { /* never block for writing */ if (wr) return true; diff --git a/repos/ports/src/noux/vfs_io_channel.h b/repos/ports/src/noux/vfs_io_channel.h index bb65a486d6..de16f42647 100644 --- a/repos/ports/src/noux/vfs_io_channel.h +++ b/repos/ports/src/noux/vfs_io_channel.h @@ -31,24 +31,18 @@ class Noux::Vfs_io_waiter { private: - Genode::Semaphore _sem; + Genode::Semaphore _sem { }; public: - void wait_for_io() - { - _sem.down(); - } + void wait_for_io() { _sem.down(); } - void wakeup() - { - _sem.up(); - } + void wakeup() { _sem.up(); } }; struct Noux::Vfs_handle_context : Vfs::Vfs_handle::Context { - Vfs_io_waiter vfs_io_waiter; + Vfs_io_waiter vfs_io_waiter { }; }; struct Noux::Vfs_io_channel : Io_channel @@ -60,24 +54,24 @@ struct Noux::Vfs_io_channel : Io_channel Io_channel::invoke_all_notifiers(); } - Vfs::Vfs_handle *_fh; + Vfs::Vfs_handle &_fh; Vfs_io_waiter_registry &_vfs_io_waiter_registry; Absolute_path _path; Absolute_path _leaf_path; - bool const _dir = _fh->ds().directory(_leaf_path.base()); + bool const _dir = _fh.ds().directory(_leaf_path.base()); void _sync() { Registered_no_delete vfs_io_waiter(_vfs_io_waiter_registry); - while (!_fh->fs().queue_sync(_fh)) + while (!_fh.fs().queue_sync(&_fh)) vfs_io_waiter.wait_for_io(); - while (_fh->fs().complete_sync(_fh) == Vfs::File_io_service::SYNC_QUEUED) + while (_fh.fs().complete_sync(&_fh) == Vfs::File_io_service::SYNC_QUEUED) vfs_io_waiter.wait_for_io(); /* wake up threads blocking for 'queue_*()' or 'write()' */ @@ -87,22 +81,22 @@ struct Noux::Vfs_io_channel : Io_channel } Vfs_io_channel(char const *path, char const *leaf_path, - Vfs::File_system *root_dir, Vfs::Vfs_handle *vfs_handle, + Vfs::Vfs_handle *vfs_handle, Vfs_io_waiter_registry &vfs_io_waiter_registry, Entrypoint &ep) : _read_avail_handler(ep, *this, &Vfs_io_channel::_handle_read_avail), - _fh(vfs_handle), _vfs_io_waiter_registry(vfs_io_waiter_registry), + _fh(*vfs_handle), _vfs_io_waiter_registry(vfs_io_waiter_registry), _path(path), _leaf_path(leaf_path) { - _fh->fs().register_read_ready_sigh(_fh, _read_avail_handler); + _fh.fs().register_read_ready_sigh(&_fh, _read_avail_handler); } ~Vfs_io_channel() { _sync(); - _fh->ds().close(_fh); + _fh.ds().close(&_fh); } bool write(Sysio &sysio) override @@ -120,8 +114,8 @@ struct Noux::Vfs_io_channel : Io_channel for (;;) { try { - sysio.error.write = _fh->fs().write(_fh, sysio.write_in.chunk, - count, out_count); + sysio.error.write = _fh.fs().write(&_fh, sysio.write_in.chunk, + count, out_count); break; } catch (Vfs::File_io_service::Insufficient_buffer) { vfs_io_waiter.wait_for_io(); @@ -136,7 +130,7 @@ struct Noux::Vfs_io_channel : Io_channel if (sysio.error.write != Vfs::File_io_service::WRITE_OK) return false; - _fh->advance_seek(out_count); + _fh.advance_seek(out_count); sysio.write_out.count = out_count; @@ -157,12 +151,12 @@ struct Noux::Vfs_io_channel : Io_channel Registered_no_delete vfs_io_waiter(_vfs_io_waiter_registry); - while (!_fh->fs().queue_read(_fh, count)) + while (!_fh.fs().queue_read(&_fh, count)) vfs_io_waiter.wait_for_io(); for (;;) { - sysio.error.read = _fh->fs().complete_read(_fh, sysio.read_out.chunk, count, out_count); + sysio.error.read = _fh.fs().complete_read(&_fh, sysio.read_out.chunk, count, out_count); if (sysio.error.read != Vfs::File_io_service::READ_QUEUED) break; @@ -180,7 +174,7 @@ struct Noux::Vfs_io_channel : Io_channel sysio.read_out.count = out_count; - _fh->advance_seek(out_count); + _fh.advance_seek(out_count); return true; } @@ -190,12 +184,12 @@ struct Noux::Vfs_io_channel : Io_channel _sync(); /* - * 'sysio.stat_in' is not used in '_fh->ds().stat()', + * 'sysio.stat_in' is not used in '_fh.ds().stat()', * so no 'sysio' member translation is needed here */ Vfs::Directory_service::Stat stat; - sysio.error.stat = _fh->ds().stat(_leaf_path.base(), stat); + sysio.error.stat = _fh.ds().stat(_leaf_path.base(), stat); sysio.fstat_out.st = stat; return (sysio.error.stat == Vfs::Directory_service::STAT_OK); @@ -205,7 +199,7 @@ struct Noux::Vfs_io_channel : Io_channel { _sync(); - sysio.error.ftruncate = _fh->fs().ftruncate(_fh, sysio.ftruncate_in.length); + sysio.error.ftruncate = _fh.fs().ftruncate(&_fh, sysio.ftruncate_in.length); return (sysio.error.ftruncate == Vfs::File_io_service::FTRUNCATE_OK); } @@ -216,11 +210,11 @@ struct Noux::Vfs_io_channel : Io_channel case Sysio::FCNTL_CMD_GET_FILE_STATUS_FLAGS: - sysio.fcntl_out.result = _fh->status_flags(); + sysio.fcntl_out.result = _fh.status_flags(); return true; case Sysio::FCNTL_CMD_SET_FILE_STATUS_FLAGS: - _fh->status_flags(sysio.fcntl_in.long_arg); + _fh.status_flags(sysio.fcntl_in.long_arg); return true; default: @@ -242,7 +236,7 @@ struct Noux::Vfs_io_channel : Io_channel /* * Return artificial dir entries for "." and ".." */ - unsigned const index = _fh->seek() / sizeof(Sysio::Dirent); + unsigned const index = _fh.seek() / sizeof(Sysio::Dirent); if (index < 2) { sysio.dirent_out.entry.type = Vfs::Directory_service::DIRENT_TYPE_DIRECTORY; strncpy(sysio.dirent_out.entry.name, @@ -250,7 +244,7 @@ struct Noux::Vfs_io_channel : Io_channel sizeof(sysio.dirent_out.entry.name)); sysio.dirent_out.entry.fileno = 1; - _fh->advance_seek(sizeof(Sysio::Dirent)); + _fh.advance_seek(sizeof(Sysio::Dirent)); return true; } @@ -261,15 +255,15 @@ struct Noux::Vfs_io_channel : Io_channel Vfs::Directory_service::Dirent dirent; - Vfs::file_size noux_dirent_seek = _fh->seek(); - _fh->seek((index - 2) * sizeof(dirent)); + Vfs::file_size noux_dirent_seek = _fh.seek(); + _fh.seek((index - 2) * sizeof(dirent)); Vfs::file_size const count = sizeof(dirent); Registered_no_delete vfs_io_waiter(_vfs_io_waiter_registry); - while (!_fh->fs().queue_read(_fh, count)) + while (!_fh.fs().queue_read(&_fh, count)) vfs_io_waiter.wait_for_io(); Vfs::File_io_service::Read_result read_result; @@ -277,8 +271,8 @@ struct Noux::Vfs_io_channel : Io_channel for (;;) { - read_result = _fh->fs().complete_read(_fh, (char*)&dirent, - count, out_count); + read_result = _fh.fs().complete_read(&_fh, (char*)&dirent, + count, out_count); if (read_result != Vfs::File_io_service::READ_QUEUED) break; @@ -296,11 +290,11 @@ struct Noux::Vfs_io_channel : Io_channel dirent = Vfs::Directory_service::Dirent(); } - _fh->seek(noux_dirent_seek); + _fh.seek(noux_dirent_seek); sysio.dirent_out.entry = dirent; - _fh->advance_seek(sizeof(Sysio::Dirent)); + _fh.advance_seek(sizeof(Sysio::Dirent)); return true; } @@ -323,7 +317,7 @@ struct Noux::Vfs_io_channel : Io_channel { Vfs::File_system::Ioctl_arg arg = (Vfs::File_system::Ioctl_arg)sysio.ioctl_in.argp; - sysio.error.ioctl = _fh->fs().ioctl(_fh, sysio.ioctl_in.request, arg, sysio.ioctl_out); + sysio.error.ioctl = _fh.fs().ioctl(&_fh, sysio.ioctl_in.request, arg, sysio.ioctl_out); return (sysio.error.ioctl == Vfs::File_io_service::IOCTL_OK); } @@ -331,21 +325,21 @@ struct Noux::Vfs_io_channel : Io_channel bool lseek(Sysio &sysio) override { switch (sysio.lseek_in.whence) { - case Sysio::LSEEK_SET: _fh->seek(sysio.lseek_in.offset); break; - case Sysio::LSEEK_CUR: _fh->advance_seek(sysio.lseek_in.offset); break; + case Sysio::LSEEK_SET: _fh.seek(sysio.lseek_in.offset); break; + case Sysio::LSEEK_CUR: _fh.advance_seek(sysio.lseek_in.offset); break; case Sysio::LSEEK_END: off_t offset = sysio.lseek_in.offset; sysio.fstat_in.fd = sysio.lseek_in.fd; - _fh->seek(size(sysio) + offset); + _fh.seek(size(sysio) + offset); break; } - sysio.lseek_out.offset = _fh->seek(); + sysio.lseek_out.offset = _fh.seek(); return true; } bool check_unblock(bool rd, bool wr, bool ex) const override { - return _fh->fs().check_unblock(_fh, rd, wr, ex); + return _fh.fs().check_unblock(&_fh, rd, wr, ex); } bool path(char *path, size_t len) override