server/fs_report: do not append '.report to file names

Appending a suffix to report filenames was behavior inherited from
fs_log, it prevents creating files where directories need to be created
later. But unlike logs, only a subset of the hierarchy will report and
those that do append a component-local label, so the risk of collision
is low.

By removing the suffix fs_rom can serve reports back as ROM just as
report_rom does.

Ref #2422
This commit is contained in:
Emery Hemingway 2017-06-16 09:22:33 -05:00 committed by Norman Feske
parent 2b569e37e1
commit 73eb7a52a0
2 changed files with 4 additions and 3 deletions

View File

@ -40,7 +40,7 @@ append config {
<resource name="RAM" quantum="4M"/>
<provides> <service name="File_system"/> </provides>
<config>
<vfs> <dir name="init"> <log name="state.report"/> <ram/> </dir> </vfs>
<vfs> <dir name="init"> <log name="state"/> <ram/> </dir> </vfs>
<policy label_prefix="fs_report" writeable="yes"/>
</config>
</start>

View File

@ -40,6 +40,8 @@ static bool create_parent_dir(Vfs::Directory_service &vfs, Path const &child)
Path parent = child;
parent.strip_last_element();
if (parent == "/")
return true;
Mkdir_result res = vfs.mkdir(parent.base(), 0);
if (res == Mkdir_result::MKDIR_ERR_NO_ENTRY) {
@ -83,7 +85,6 @@ class Fs_report::Session_component : public Genode::Rpc_object<Report::Session>
typedef Vfs::Directory_service::Open_result Open_result;
Path path = path_from_label<Path>(label.string());
path.append(".report");
create_parent_dir(vfs, path);
@ -135,7 +136,7 @@ class Fs_report::Session_component : public Genode::Rpc_object<Report::Session>
_handle->seek(offset);
Write_result res = _handle->fs().write(
_handle, _ds.local_addr<char const>(),
_handle, _ds.local_addr<char const>()+offset,
length - offset, n);
if (res != Write_result::WRITE_OK) {