File-system interface, ram_fs, libc-fs
This patch introduces the file-system-session interface, provides an
implementation of this interface in the form of an in-memory file
system, and enables the libc to use the new file-system facility.
The new interface resides in 'os/include/file_system_session/'. It
uses synchronous RPC calls for functions referring to directory
and meta-data handling. For transferring payload from/to files, the
packet-stream interface is used. I envision that the asynchronous design
of the packet-stream interface fits well will the block-session
interface. Compared to Unix-like file-system APIs, Genode's file-system
session interface is much simpler. In particular, it does not support
per-file permissions. On Genode, we facilitate binding policy (such as
write-permission) is sessions rather than individual file objects.
As a reference implementation of the new interface, there is the
new 'ram_fs' service at 'os/src/server/ram_fs'. It stores sparse
files in memory. At the startup, 'ram_fs' is able to populate the
file-system content with directories and ROM modules as specified
in its configuration.
To enable libc-using programs to access the new file-system interface,
there is the new libc plugin at 'libports/src/lib/libc-fs'. Using this
plugin, files stored on a native Genode file system can be accessed
using the traditional POSIX file API.
To see how the three parts described above fit together, the test
case at 'libports/run/libc_fs' can be taken as reference. It reuses
the original 'libc_ffat' test to exercise several file operations
on a RAM file-system using the libc API.
:Known limitations:
The current state should be regarded as work in progress. In particular
the error handling is not complete yet. Not all of the session functions
return the proper exceptions in the event of an error. I plan to
successively refine the interface while advancing the file-system
implementations. Also the support for truncating files and symlink
handling are not yet implemented.
Furthermore, there is much room for optimization, in particular for the
handling of directory entries. Currently, we communicate only one dir
entry at a time, which is bad when traversing large trees. However, I
decided to focus on functionality first and defer optimizations (such as
batching dir entries) to a later stage.
The current implementation does not handle file modification times at
all, which may be a severe limitation for tools that depend on this
information such as GNU make. Support for time will be added after we
have revisited Genode's timer-session interface (issue #1).
Fixes #54
Fixes #171
2012-04-11 13:46:33 +00:00
|
|
|
#
|
|
|
|
# \brief Unit test for chunk data structure used by RAM fs
|
|
|
|
# \author Norman Feske
|
|
|
|
# \date 2012-04-19
|
|
|
|
#
|
|
|
|
|
|
|
|
build "core init test/ram_fs_chunk"
|
|
|
|
|
|
|
|
create_boot_directory
|
|
|
|
|
|
|
|
install_config {
|
|
|
|
<config>
|
|
|
|
<parent-provides>
|
2014-01-22 17:12:37 +00:00
|
|
|
<service name="RM"/>
|
File-system interface, ram_fs, libc-fs
This patch introduces the file-system-session interface, provides an
implementation of this interface in the form of an in-memory file
system, and enables the libc to use the new file-system facility.
The new interface resides in 'os/include/file_system_session/'. It
uses synchronous RPC calls for functions referring to directory
and meta-data handling. For transferring payload from/to files, the
packet-stream interface is used. I envision that the asynchronous design
of the packet-stream interface fits well will the block-session
interface. Compared to Unix-like file-system APIs, Genode's file-system
session interface is much simpler. In particular, it does not support
per-file permissions. On Genode, we facilitate binding policy (such as
write-permission) is sessions rather than individual file objects.
As a reference implementation of the new interface, there is the
new 'ram_fs' service at 'os/src/server/ram_fs'. It stores sparse
files in memory. At the startup, 'ram_fs' is able to populate the
file-system content with directories and ROM modules as specified
in its configuration.
To enable libc-using programs to access the new file-system interface,
there is the new libc plugin at 'libports/src/lib/libc-fs'. Using this
plugin, files stored on a native Genode file system can be accessed
using the traditional POSIX file API.
To see how the three parts described above fit together, the test
case at 'libports/run/libc_fs' can be taken as reference. It reuses
the original 'libc_ffat' test to exercise several file operations
on a RAM file-system using the libc API.
:Known limitations:
The current state should be regarded as work in progress. In particular
the error handling is not complete yet. Not all of the session functions
return the proper exceptions in the event of an error. I plan to
successively refine the interface while advancing the file-system
implementations. Also the support for truncating files and symlink
handling are not yet implemented.
Furthermore, there is much room for optimization, in particular for the
handling of directory entries. Currently, we communicate only one dir
entry at a time, which is bad when traversing large trees. However, I
decided to focus on functionality first and defer optimizations (such as
batching dir entries) to a later stage.
The current implementation does not handle file modification times at
all, which may be a severe limitation for tools that depend on this
information such as GNU make. Support for time will be added after we
have revisited Genode's timer-session interface (issue #1).
Fixes #54
Fixes #171
2012-04-11 13:46:33 +00:00
|
|
|
<service name="LOG"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> </any-service>
|
|
|
|
</default-route>
|
|
|
|
<start name="test-ram_fs_chunk">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
</start>
|
|
|
|
</config>
|
|
|
|
}
|
|
|
|
|
|
|
|
build_boot_image "core init test-ram_fs_chunk"
|
|
|
|
|
|
|
|
append qemu_args "-nographic -m 64"
|
|
|
|
|
|
|
|
run_genode_until "child exited with exit value 0.*\n" 10
|
|
|
|
|
|
|
|
grep_output {^\[init -> test-ram_fs_chunk\]}
|
2014-01-22 17:12:37 +00:00
|
|
|
unify_output { sizeof=[0-9]+} {}
|
File-system interface, ram_fs, libc-fs
This patch introduces the file-system-session interface, provides an
implementation of this interface in the form of an in-memory file
system, and enables the libc to use the new file-system facility.
The new interface resides in 'os/include/file_system_session/'. It
uses synchronous RPC calls for functions referring to directory
and meta-data handling. For transferring payload from/to files, the
packet-stream interface is used. I envision that the asynchronous design
of the packet-stream interface fits well will the block-session
interface. Compared to Unix-like file-system APIs, Genode's file-system
session interface is much simpler. In particular, it does not support
per-file permissions. On Genode, we facilitate binding policy (such as
write-permission) is sessions rather than individual file objects.
As a reference implementation of the new interface, there is the
new 'ram_fs' service at 'os/src/server/ram_fs'. It stores sparse
files in memory. At the startup, 'ram_fs' is able to populate the
file-system content with directories and ROM modules as specified
in its configuration.
To enable libc-using programs to access the new file-system interface,
there is the new libc plugin at 'libports/src/lib/libc-fs'. Using this
plugin, files stored on a native Genode file system can be accessed
using the traditional POSIX file API.
To see how the three parts described above fit together, the test
case at 'libports/run/libc_fs' can be taken as reference. It reuses
the original 'libc_ffat' test to exercise several file operations
on a RAM file-system using the libc API.
:Known limitations:
The current state should be regarded as work in progress. In particular
the error handling is not complete yet. Not all of the session functions
return the proper exceptions in the event of an error. I plan to
successively refine the interface while advancing the file-system
implementations. Also the support for truncating files and symlink
handling are not yet implemented.
Furthermore, there is much room for optimization, in particular for the
handling of directory entries. Currently, we communicate only one dir
entry at a time, which is bad when traversing large trees. However, I
decided to focus on functionality first and defer optimizations (such as
batching dir entries) to a later stage.
The current implementation does not handle file modification times at
all, which may be a severe limitation for tools that depend on this
information such as GNU make. Support for time will be added after we
have revisited Genode's timer-session interface (issue #1).
Fixes #54
Fixes #171
2012-04-11 13:46:33 +00:00
|
|
|
|
|
|
|
compare_output_to {
|
|
|
|
[init -> test-ram_fs_chunk] --- ram_fs_chunk test ---
|
2014-01-22 17:12:37 +00:00
|
|
|
[init -> test-ram_fs_chunk] chunk sizes
|
|
|
|
[init -> test-ram_fs_chunk] level 0: payload=120
|
|
|
|
[init -> test-ram_fs_chunk] level 1: payload=24
|
|
|
|
[init -> test-ram_fs_chunk] level 2: payload=6
|
|
|
|
[init -> test-ram_fs_chunk] level 3: payload=2
|
File-system interface, ram_fs, libc-fs
This patch introduces the file-system-session interface, provides an
implementation of this interface in the form of an in-memory file
system, and enables the libc to use the new file-system facility.
The new interface resides in 'os/include/file_system_session/'. It
uses synchronous RPC calls for functions referring to directory
and meta-data handling. For transferring payload from/to files, the
packet-stream interface is used. I envision that the asynchronous design
of the packet-stream interface fits well will the block-session
interface. Compared to Unix-like file-system APIs, Genode's file-system
session interface is much simpler. In particular, it does not support
per-file permissions. On Genode, we facilitate binding policy (such as
write-permission) is sessions rather than individual file objects.
As a reference implementation of the new interface, there is the
new 'ram_fs' service at 'os/src/server/ram_fs'. It stores sparse
files in memory. At the startup, 'ram_fs' is able to populate the
file-system content with directories and ROM modules as specified
in its configuration.
To enable libc-using programs to access the new file-system interface,
there is the new libc plugin at 'libports/src/lib/libc-fs'. Using this
plugin, files stored on a native Genode file system can be accessed
using the traditional POSIX file API.
To see how the three parts described above fit together, the test
case at 'libports/run/libc_fs' can be taken as reference. It reuses
the original 'libc_ffat' test to exercise several file operations
on a RAM file-system using the libc API.
:Known limitations:
The current state should be regarded as work in progress. In particular
the error handling is not complete yet. Not all of the session functions
return the proper exceptions in the event of an error. I plan to
successively refine the interface while advancing the file-system
implementations. Also the support for truncating files and symlink
handling are not yet implemented.
Furthermore, there is much room for optimization, in particular for the
handling of directory entries. Currently, we communicate only one dir
entry at a time, which is bad when traversing large trees. However, I
decided to focus on functionality first and defer optimizations (such as
batching dir entries) to a later stage.
The current implementation does not handle file modification times at
all, which may be a severe limitation for tools that depend on this
information such as GNU make. Support for time will be added after we
have revisited Genode's timer-session interface (issue #1).
Fixes #54
Fixes #171
2012-04-11 13:46:33 +00:00
|
|
|
[init -> test-ram_fs_chunk] write "five-o-one" at offset 0 -> content (size=10): "five-o-one"
|
|
|
|
[init -> test-ram_fs_chunk] write "five" at offset 7 -> content (size=11): "five-o-five"
|
|
|
|
[init -> test-ram_fs_chunk] write "Nuance" at offset 17 -> content (size=23): "five-o-five......Nuance"
|
|
|
|
[init -> test-ram_fs_chunk] write "YM-2149" at offset 35 -> content (size=42): "five-o-five......Nuance............YM-2149"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(30) -> content (size=30): "five-o-five......Nuance......."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(29) -> content (size=24): "five-o-five......Nuance."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(28) -> content (size=24): "five-o-five......Nuance."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(27) -> content (size=24): "five-o-five......Nuance."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(26) -> content (size=24): "five-o-five......Nuance."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(25) -> content (size=24): "five-o-five......Nuance."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(24) -> content (size=24): "five-o-five......Nuance."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(23) -> content (size=23): "five-o-five......Nuance"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(22) -> content (size=22): "five-o-five......Nuanc"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(21) -> content (size=21): "five-o-five......Nuan"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(20) -> content (size=20): "five-o-five......Nua"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(19) -> content (size=19): "five-o-five......Nu"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(18) -> content (size=18): "five-o-five......N"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(17) -> content (size=17): "five-o-five......"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(16) -> content (size=14): "five-o-five..."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(15) -> content (size=14): "five-o-five..."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(14) -> content (size=14): "five-o-five..."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(13) -> content (size=12): "five-o-five."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(12) -> content (size=12): "five-o-five."
|
|
|
|
[init -> test-ram_fs_chunk] trunc(11) -> content (size=11): "five-o-five"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(10) -> content (size=10): "five-o-fiv"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(9) -> content (size=9): "five-o-fi"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(8) -> content (size=8): "five-o-f"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(7) -> content (size=7): "five-o-"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(6) -> content (size=6): "five-o"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(5) -> content (size=5): "five-"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(4) -> content (size=4): "five"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(3) -> content (size=3): "fiv"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(2) -> content (size=2): "fi"
|
|
|
|
[init -> test-ram_fs_chunk] trunc(1) -> content (size=1): "f"
|
|
|
|
[init -> test-ram_fs_chunk] allocator: sum=0
|
|
|
|
}
|
|
|
|
|
|
|
|
|