mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-22 06:57:51 +00:00
Catch exceptions when creating VFS
Catch exceptions at File_system_factory::create. Print error message in Dir_file_system. Fixes #1786
This commit is contained in:
parent
4aafa882d8
commit
549f77eafe
@ -210,6 +210,8 @@ class Vfs::Dir_file_system : public File_system
|
|||||||
:
|
:
|
||||||
_first_file_system(0)
|
_first_file_system(0)
|
||||||
{
|
{
|
||||||
|
using namespace Genode;
|
||||||
|
|
||||||
/* remember directory name */
|
/* remember directory name */
|
||||||
if (node.has_type("fstab") || node.has_type("vfs"))
|
if (node.has_type("fstab") || node.has_type("vfs"))
|
||||||
_name[0] = 0;
|
_name[0] = 0;
|
||||||
@ -233,9 +235,16 @@ class Vfs::Dir_file_system : public File_system
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char type_name[64];
|
PERR("failed to create <%s> VFS node", sub_node.type().string());
|
||||||
sub_node.type_name(type_name, sizeof(type_name));
|
try {
|
||||||
PWRN("unknown fstab node type <%s>", type_name);
|
String<64> value;
|
||||||
|
for (unsigned i = 0; i < 16; ++i) {
|
||||||
|
Xml_attribute attr = sub_node.attribute(i);
|
||||||
|
attr.value(&value);
|
||||||
|
|
||||||
|
PERR("\t%s=\"%s\"", attr.name().string(), value.string());
|
||||||
|
}
|
||||||
|
} catch (Xml_node::Nonexistent_attribute) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,16 +169,21 @@ class Default_file_system_factory : public Vfs::Global_file_system_factory
|
|||||||
|
|
||||||
Vfs::File_system *create(Genode::Xml_node node) override
|
Vfs::File_system *create(Genode::Xml_node node) override
|
||||||
{
|
{
|
||||||
/* try if type is handled by the currently registered fs types */
|
try {
|
||||||
if (Vfs::File_system *fs = _try_create(node))
|
/* try if type is handled by the currently registered fs types */
|
||||||
return fs;
|
|
||||||
|
|
||||||
/* probe for file system implementation available as shared lib */
|
|
||||||
if (_probe_external_factory(node)) {
|
|
||||||
/* try again with the new file system type loaded */
|
|
||||||
if (Vfs::File_system *fs = _try_create(node))
|
if (Vfs::File_system *fs = _try_create(node))
|
||||||
return fs;
|
return fs;
|
||||||
}
|
/* if the builtin fails, do not try loading an external */
|
||||||
|
} catch (...) { return 0; }
|
||||||
|
|
||||||
|
try {
|
||||||
|
/* probe for file system implementation available as shared lib */
|
||||||
|
if (_probe_external_factory(node)) {
|
||||||
|
/* try again with the new file system type loaded */
|
||||||
|
if (Vfs::File_system *fs = _try_create(node))
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
} catch (...) { }
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user