Commit Graph

82 Commits

Author SHA1 Message Date
3ef6db31ee Produce libraries with conventional names 2020-05-27 16:24:18 +05:30
Norman Feske
b078224753 Replace Genode::strncpy by Genode::copy_cstring
- Since Genode::strncpy is not 100% compatible with the POSIX
  strncpy function, better use a distinct name.

- Remove bogus return value from the function, easing the potential
  enforcement of mandatory return-value checks later.

Fixes #3752
2020-05-27 11:56:45 +02:00
Christian Prochaska
151828752c vfs: handle read error in fs file system
Issue #3742
2020-04-28 11:43:12 +02:00
Alexander Boettcher
13cd25e7b0 vfs/ram: avoid 2x mutex releases in guard
Issue #3612
2020-04-17 12:40:12 +02:00
Alexander Boettcher
22d71d5a8b os: use Mutex/Blockade
Issue #3612
2020-04-17 12:40:12 +02:00
Josef Söntgen
df553e9360 os: remove catch-all from FS VFS update mtime
Only 'alloc_packet' is supposed to throw an exception, which is already
caught. The 'submit_packet' call does not need further handling.

Issue #3713.
2020-04-17 12:39:32 +02:00
Josef Söntgen
ddc0caa605 os: remove error messages from FS VFS update mtime
The update modification timestamp is implemented as one-shot where
the caller is expected to try again if the first attempt failed (see
current libc implementation). So the message is misleading as further
attempts might succeed.

Issue #3713.
2020-04-17 12:39:32 +02:00
Norman Feske
7f5186d489 vfs/tar: return inode numbers of null records
The tar vfs plugin returns an inode value of zero and a type directory
for null records, which wrongly triggers the file-system loop detection
of the find utility. This patch returns the node pointer as inode value
instead, which is a unique value.

Fixes #3695
2020-03-26 11:38:56 +01:00
Josef Söntgen
a71ef16423 vfs: implement 'sync' in Block VFS plugin
Fixes #3659.
2020-03-26 11:38:55 +01:00
Norman Feske
c6445da654 vfs: watch support for <rom> file system
Fixes #3606
2020-02-04 15:51:10 +01:00
Norman Feske
96cde52838 vfs: make <rom> fs robust against invalid ROMs
An invalid ROM dataspace can occur, for example, when requesting a ROM
from the report_rom service before the first report was posted. Such a
<rom> node can still be useful if it's dynamic. E.g., it can be watched.
Hence, the corner case of an invalid ROM dataspace should be gracefully
handled instead of causing an abort.

Issue #3606
2020-02-04 15:51:09 +01:00
Norman Feske
9f7b8c1a17 vfs/log: allow output redirection via '> /dev/log'
Issue #3578
2019-12-19 17:01:42 +01:00
7f57de1b74 VFS/terminal: fix clang warning
Variable-sized object may not be initialized.

Issue #3564
2019-12-19 16:59:03 +01:00
Norman Feske
23d21d77e9 vfs/terminal: detect user interrupts (control-c)
This patch equips the VFS terminal file system with the ability to
detect user interrupts in the incoming data stream, and propagate this
information via the new pseudo file '.terminal/interrupts'. Each time,
the user presses control-c in the terminal, the value stored in this
pseudo file is increased. Thereby, a VFS client can watch this file to
get notified about the occurrences of user interrupts.

Fixes #3546
2019-11-19 14:45:38 +01:00
Norman Feske
e9762ee25f vfs: 'Rtc_file_system::close' for watch handle
The default implementation of this method throws an exception.
2019-11-19 14:42:23 +01:00
Norman Feske
d516515c7a vfs/terminal: provide meta info as pseudo files
Issue #3519
Fixes #3521
2019-11-19 14:39:09 +01:00
Norman Feske
5ab1505d43 file system: enhanced file status info
This patch extends the 'File_system::Status',
'File_system::Directory_entry', and the related 'Vfs' types with
the following additional information:

- Distinction between continuous and transactional files (Node_type)
  (issue #3507)
- Readable, writeable, and executable attributes (Node_rwx),
  replacing the former 'mode' bits
  (issue #3030)

The types 'Node_rwx', 'Node_type' are defined twice,
once for the VFS (vfs/types.h) and once for the 'File_system'
session (file_system_session/file_system_session.h).
Similarly, there is a direct correspondance between
'Vfs::Directory_service::Dirent' and 'File_system::Directory_entry'.

This duplication of types follows the existing pattern of keeping the
VFS and file-system session independent from each other.
2019-11-19 14:23:56 +01:00
Josef Söntgen
9a82bbb54d vfs: add modification time member to directory_service
Issue #1784.
2019-11-19 14:17:30 +01:00
Alexander Boettcher
32323abe8e vfs: handle unsupported watch exception 2019-08-21 13:25:25 +02:00
Christian Helmuth
1fdd5b636b vfs: watch set-rtc signal in RTC file system
Issue #3450
2019-08-21 12:37:02 +02:00
Christian Helmuth
45f3ccc42a vfs: fix empty-node handling in inline fs
Now <inline></inline> as well as <inline/> are supported.
2019-06-13 12:22:49 +02:00
Norman Feske
e5f27b44b5 block_session: turn 'Connection' into template
As a preparatory step for introducing the new block-client API, we have
to turn the 'Block::Connection' into a class template. The template
argument will be used to tie an application-defined job type to the
block connection.

Issue #3283
2019-05-06 16:15:25 +02:00
Norman Feske
bbe3ee8dc5 block_session: server-defined payload alignment
This patch replaces the formerly fixed 2 KiB data alignment within the
packet-stream buffer by a server-defined alignment. This has two
benefits.

First, when using block servers that provide small block sizes like 512
bytes, we avoid fragmenting the packet-stream buffer, which occurs when
aligning 512-byte requests at 2 KiB boundaries. This reduces meta data
costs for the packet-stream allocator and also allows fitting more
requests into the buffer.

Second, block drivers with alignment constraints dictated by the
hardware can now pass those constraints to the client, thereby easing
the use of zero-copy DMA directly into the packet stream.

The alignment is determined by the Block::Session_client at construction
time and applied by the Block::Session_client::alloc_packet method.
Block-session clients should always use this method, not the 'alloc_packet'
method of the packet stream (tx source) directly. The latter merely
applies a default alignment of 2 KiB.

At the server side, the alignment is automatically checked by
block/component.h (old API) and block/request_stream.h (new API).

Issue #3274
2019-05-03 13:53:12 +02:00
Norman Feske
2208220c12 block session: remove Block::Session::Operations
This patch modernizes the 'Block::Session::info' interface. Instead of
using out parameters, the 'init' RPC function returns a compound 'Info'
object now. The rather complicated 'Operations' struct is replaced by
a 'writeable' attribute in the 'Info' object.

Fixes #3275
2019-05-03 13:53:12 +02:00
a635873568 VFS: Replace global response handlers with local handlers
Replace the I/O response handler that is passed to the VFS at
construction with an object that is dynamically attached to handles.
This object shall also accept read-ready notifications, and plugins are
encouraged to keep handles awaiting ready-ready notifications separate
from handles that await I/O progress.

Replace the use of handle lists in plugins with handle queues, this
makes the code easier to understand and the ordering of notifications to
the application more explicit.

These changes replace the use of the Post_signal_hook from all VFS
plugins, applications must assume that read-ready and I/O notifications
occur during I/O signal dispatch and use an Io_progress_handler at its
entrypoints to defer response until after signal dispatching.

Fix #3257
2019-04-09 12:30:34 +02:00
800b4e44b1 Reduce Vfs::Vfs_handle::Context to empty struct type
The "Vfs::Vfs_handle" type should not contain any public members that
can be initialized by the VFS internally and by the application, so
remove inheritance from the "Genode::list::Element" class. The VFS
plugins must instead use lists of "Vfs::Vfs_handle" sub-classes, the
lifetime of which are always managed by the plugin.

Ref #3036
2019-04-01 19:33:47 +02:00
Norman Feske
4f99224255 ram_fs: increase max file size on 64 bit to 8 GiB
Fixes #2315
2019-03-18 15:57:00 +01:00
57fd4e9148 Add Io_progress_handler to Entrypoint interface
The "schedule_post_signal_hook" method of the Genode::Entrypoint class
is problematic because the signal hook can be scheduled and replaced
multiple times during the signal dispatch cycle. Add an alternative to
this method with "register_io_progress_handler" and the "Post_signal_
hook" class with "Io_progress_handler". The difference being an
"Io_progress_handler" may be registered once during the lifetime of an
entrypoint to prevent arbitrary libraries from replacing a pending hook.

The "register_io_progress_handler" remains as a deprecated API, and is
now invoked for every I/O signal received and only for I/O signals
rather than for any signal.

Ref #3132
2019-03-18 15:56:22 +01:00
6c7356072d Catch session exceptions during VFS File_system stat
Fix #3173
2019-02-26 14:45:13 +01:00
2f33d44713 VFS: Configure File_system client buffer at runtime
Make the size of the packet buffer at the VFS File_system client
configurable. This allows larger reads to be completed in a single
packet cycle.

Example: <vfs> <fs buffer_size="512K"/> </vfs>

Fix #3167
2019-02-19 11:12:12 +01:00
Norman Feske
b3727a9b46 Add missing override annotations
Issue #3159
2019-02-19 11:12:11 +01:00
Norman Feske
6b94e65a95 os: avoid using deprecated APIs
Issue #1987
Issue #3125
2019-01-30 13:49:54 +01:00
Sebastian Sumpf
48e07d7dff vfs: support files names of with exactly 100 characters
GNU tar does not null terminate or create a long name for file names of
exactly 100 characters.

issue #3060
2018-11-29 11:54:30 +01:00
Christian Prochaska
fd7ab79fe0 vfs: implement 'complete_sync()' in 'Single_file_system'
Fixes #3047
2018-11-27 11:38:13 +01:00
64a63885d1 VFS: line buffer LOG file-system
Buffer data written to log file handles until newline or overflow.

Ref #2467
Ref #2919
2018-09-13 15:21:10 +02:00
e0a97d5642 VFS: Send notifications on RAM file rename
Fix #2937
2018-08-28 17:10:54 +02:00
Norman Feske
89d0d648ed vfs: fix formatting in fs_file_system.h 2018-08-28 17:10:52 +02:00
08b774e318 VFS: add an error to to the Sync_result enum
Sync errors can be used to indicate failed writes across the File_system
session.

Ref #2920
2018-08-02 14:36:49 +02:00
Christian Prochaska
e3005266b6 vfs: no 'handle_io_response()' in regular VFS functions
Calling 'handle_io_response()' in a regular VFS function (in contrast to a
post-signal hook) can cause problems if the caller of the VFS function holds
a lock which prevents the io response handler from returning.

With this commit, the user of the VFS becomes responsible for unblocking
threads which might be blocking after a failed 'queue_read()', 'queue_sync()'
or 'write()' call.

Fixes #2896
2018-08-02 14:36:43 +02:00
59ac5b10c7 Plugin for importing VFS content
This new vfs_import plugin allows a VFS instance to be populated during
construction using a sub-VFS configured in an '<import>' configuration
node. This allows the ram_fs File_system server to be replaced by the
VFS server by reimplementing the ram_fs 'content' feature.  At the
moment the copying of symlinks is not enabled, and the resources
obtained by the import file-system may not be freed after the import is
finished.

Fix #2906
2018-08-02 14:36:42 +02:00
ca042e4e6e Fix VFS notifications for ram file removal
The ram plugin to the VFS must send notifications to watch handles on
files when they are removed. This brings the VFS server to parity with
the ram_fs server for the sake of notifications.

Move run/fs_report to gems and use the vfs server and the vfs init
plugin in the test.

Ref #2902
2018-08-02 14:36:39 +02:00
Johannes Schlatow
c43ed44b17 Add vfs file size detection to ROM modules
When mounting a ROM module with binary="no", the
vfs will detect the 0-termination to calculate the
file size instead of using the dataspace size.

Fixes #2903
2018-08-02 14:36:37 +02:00
Sebastian Sumpf
abe76e0d93 vfs rom: return 0555 file permissions
issue #2791
2018-05-30 13:36:06 +02:00
Norman Feske
6a12a6b4ba vfs: reduce ROM-update rate Rom_file_system::stat
The 'stat' method is called for all paths, not just the specific file
system node of the ROM module. The ROM update is needed only in the
latter case.

Otherwise, when always updating the ROM on stat, stat calls on the VFS
become very expensive in the presence of a mounted ROM module if the ROM
is obtained from fs_rom (which re-watches the file and all its
individual path elements whenever the 'update' RPC function is called).
2018-04-19 13:38:33 +02:00
82a683eccc VFS: construct file-systems using Vfs::Env object
Reduce the size and forward compatibility of VFS file-system
constructors by passing an object holding accessors for 'Genode::Env',
'Genode::Allocator', response handlers, and the root file-system.

Fix #2742
2018-04-19 12:38:27 +02:00
9c6b720ec1 Notification support for the VFS library
Add a new 'Vfs_watch_handle' type to the VFS interface. This handle type
will pass a handle context up through the I/O handler to the application
when a notification event occurs.

Watch support implemented for RAM and File_system plugins, all other
file-systems return WATCH_ERR_STATIC by default.

Test at run/fs_rom_update_ram and run/fs_rom_update_fs.

Fix #1934
2018-04-10 11:11:51 +02:00
Norman Feske
b0b92e4ee2 vfs: pass root directory to plugins
This patch enables the use of the VFS from VFS plugins by passing a
reference of the root directory to the constructors of file-system
instances. Since it changes the signature of 'Vfs::Dir_file_system',
any code that uses the VFS directly requires an adaptation.

Fixes #2701
2018-04-10 11:09:17 +02:00
Alexander Boettcher
f4e9c94bf2 vfs lib: complain about unsuccessful fs packets
Issue #2672
2018-02-15 10:22:08 +01:00
Alexander Boettcher
bfd24de4ad vfs: notify all blockers in fs adapter
if requested so ( by _post_signal_hook.arm(nullptr) )

Issue #2664
2018-02-14 20:41:10 +01:00
Alexander Boettcher
f05c4df36a vfs: handle submit_ready signal in fs adapter
to avoid starvation.

Issue #2664
2018-02-14 20:41:09 +01:00