From 24b1f269be5190b36d659c3ccffe4fa5ba58c78a Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Thu, 17 Sep 2015 15:33:46 +0200 Subject: [PATCH] Remove Packet_ref from File_system::Packet_descriptor The intention of Packet_ref was to allow clients to place opaque references into the packet descriptor itself, which could be observed on packet completion. Currently no component in our sources uses this feature and beyond that it is questionable if it should be used at all: If the server tampers with the ref the client may easily be confused into observing an incorrect or invalid context. It seems better to remove the opaque context from the descriptor and leave the actual implementation to the client and its needs. --- repos/os/include/file_system/util.h | 2 -- .../file_system_session/file_system_session.h | 17 ++--------------- repos/os/include/vfs/fs_file_system.h | 4 ---- repos/os/src/server/fs_log/log_file.h | 3 +-- 4 files changed, 3 insertions(+), 23 deletions(-) diff --git a/repos/os/include/file_system/util.h b/repos/os/include/file_system/util.h index 3bd5c192c2..ffc879ab37 100644 --- a/repos/os/include/file_system/util.h +++ b/repos/os/include/file_system/util.h @@ -121,7 +121,6 @@ namespace File_system { Packet_descriptor packet(source.alloc_packet(curr_packet_size), - 0, node_handle, File_system::Packet_descriptor::READ, curr_packet_size, @@ -178,7 +177,6 @@ namespace File_system { Packet_descriptor packet(source.alloc_packet(curr_packet_size), - 0, node_handle, File_system::Packet_descriptor::WRITE, curr_packet_size, diff --git a/repos/os/include/file_system_session/file_system_session.h b/repos/os/include/file_system_session/file_system_session.h index 1112fddfa5..d1a03938c6 100644 --- a/repos/os/include/file_system_session/file_system_session.h +++ b/repos/os/include/file_system_session/file_system_session.h @@ -28,15 +28,6 @@ namespace File_system { struct Dir_handle; struct Symlink_handle; - /** - * Type of client context embedded in each packet descriptor - * - * Using the opaque refererence, the client is able to attribute incoming - * packet acknowledgements to a context that is meaningful for the client. - * It has no meaning at the server side. - */ - struct Packet_ref; - typedef Genode::uint64_t seek_off_t; typedef Genode::uint64_t file_size_t; @@ -123,8 +114,6 @@ class File_system::Packet_descriptor : public Genode::Packet_descriptor seek_off_t _position; /* seek offset in bytes */ size_t _length; /* transaction length in bytes */ bool _success; /* indicates success of operation */ - Packet_ref *_ref; /* opaque reference used at the client side - for recognizing acknowledgements */ public: @@ -141,14 +130,13 @@ class File_system::Packet_descriptor : public Genode::Packet_descriptor * * \param position seek offset in bytes (by default, append) */ - Packet_descriptor(Packet_descriptor p, Packet_ref *ref, + Packet_descriptor(Packet_descriptor p, Node_handle handle, Opcode op, size_t length, seek_off_t position = ~0) : Genode::Packet_descriptor(p.offset(), p.size()), _handle(handle), _op(op), - _position(position), _length(length), _success(false), - _ref(ref) + _position(position), _length(length), _success(false) { } Node_handle handle() const { return _handle; } @@ -156,7 +144,6 @@ class File_system::Packet_descriptor : public Genode::Packet_descriptor seek_off_t position() const { return _position; } size_t length() const { return _length; } bool succeeded() const { return _success; } - Packet_ref *ref() const { return _ref; } /* * Accessors called at the server side diff --git a/repos/os/include/vfs/fs_file_system.h b/repos/os/include/vfs/fs_file_system.h index 3817aabdd0..5322d8898d 100644 --- a/repos/os/include/vfs/fs_file_system.h +++ b/repos/os/include/vfs/fs_file_system.h @@ -100,7 +100,6 @@ class Vfs::Fs_file_system : public File_system ::File_system::Packet_descriptor const packet_in(source.alloc_packet(clipped_count), - 0, node_handle, ::File_system::Packet_descriptor::READ, clipped_count, @@ -137,7 +136,6 @@ class Vfs::Fs_file_system : public File_system ::File_system::Packet_descriptor packet(source.alloc_packet(count), - 0, node_handle, ::File_system::Packet_descriptor::WRITE, count, @@ -217,7 +215,6 @@ class Vfs::Fs_file_system : public File_system ::File_system::Packet_descriptor packet(source.alloc_packet(count), - 0, file, ::File_system::Packet_descriptor::READ, count, @@ -298,7 +295,6 @@ class Vfs::Fs_file_system : public File_system ::File_system::Packet_descriptor packet(source.alloc_packet(DIRENT_SIZE), - 0, dir_handle, ::File_system::Packet_descriptor::READ, DIRENT_SIZE, diff --git a/repos/os/src/server/fs_log/log_file.h b/repos/os/src/server/fs_log/log_file.h index 44b06797ea..a7680d4b24 100644 --- a/repos/os/src/server/fs_log/log_file.h +++ b/repos/os/src/server/fs_log/log_file.h @@ -74,7 +74,6 @@ class Fs_log::Log_file : public List::Element File_system::Packet_descriptor packet(raw_packet, - 0, /* The result struct. */ _handle, File_system::Packet_descriptor::WRITE, msg_len, _offset); @@ -88,4 +87,4 @@ class Fs_log::Log_file : public List::Element } }; -#endif \ No newline at end of file +#endif