From d21bc8268b0d597fad7ca24f84cb9cabfb68dc16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Fri, 14 Aug 2020 15:44:22 +0200 Subject: [PATCH] vfs: add raw option to terminal plugin When the 'raw' attribute is set to 'yes' the terminal VFS plugin will ignore control characters. This in necessary for terminal connections that transport data that contain such characters as part of message. Fixes #3860. --- repos/os/src/lib/vfs/terminal_file_system.h | 42 ++++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/repos/os/src/lib/vfs/terminal_file_system.h b/repos/os/src/lib/vfs/terminal_file_system.h index a776891a67..dc0fa909c0 100644 --- a/repos/os/src/lib/vfs/terminal_file_system.h +++ b/repos/os/src/lib/vfs/terminal_file_system.h @@ -62,6 +62,8 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system Interrupt_handler &_interrupt_handler; + bool const _raw; + enum { READ_BUFFER_SIZE = 4000 }; typedef Genode::Ring_buffer")), _name(name), _ep(ep), _terminal(terminal), - _interrupt_handler(interrupt_handler) + _interrupt_handler(interrupt_handler), + _raw(raw) { /* register for read-avail notification */ _terminal.read_avail_sigh(_read_avail_handler); @@ -224,7 +234,8 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system try { *out_handle = new (alloc) Registered_handle(_handle_registry, _terminal, _read_buffer, - _interrupt_handler, *this, *this, alloc, flags); + _interrupt_handler, *this, *this, alloc, flags, + _raw); return OPEN_OK; } catch (Genode::Out_of_ram) { return OPEN_ERR_OUT_OF_RAM; } @@ -271,7 +282,9 @@ struct Vfs::Terminal_file_system::Local_factory : File_system_factory, Terminal::Connection _terminal { _env, _label.string() }; - Data_file_system _data_fs { _env.ep(), _terminal, _name, *this }; + bool const _raw; + + Data_file_system _data_fs { _env.ep(), _terminal, _name, *this, _raw }; struct Info { @@ -328,7 +341,8 @@ struct Vfs::Terminal_file_system::Local_factory : File_system_factory, : _label(config.attribute_value("label", Label(""))), _name(name(config)), - _env(env.env()) + _env(env.env()), + _raw(config.attribute_value("raw", false)) { _terminal.size_changed_sigh(_size_changed_handler); _handle_size_changed();