mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
xml_node: change with_sub_node signature
The `with_sub_node` method is renamed to `with_optional_sub_node` to better reflect that the non-existence of a sub node with the desired type is ignored. At the same time, the new `with_sub_node` now takes a second functor that is called when no sub node of the desired type exists. genodelabs/genode#4600
This commit is contained in:
committed by
Norman Feske
parent
f0e9881c7e
commit
7d143087c9
@@ -722,7 +722,7 @@ uint64_t genode_cpu_hz()
|
||||
|
||||
if (!cpu_freq) {
|
||||
try {
|
||||
platform_rom().with_sub_node("tsc", [&] (Genode::Xml_node const &tsc) {
|
||||
platform_rom().with_optional_sub_node("tsc", [&] (Genode::Xml_node const &tsc) {
|
||||
cpu_freq = tsc.attribute_value("freq_khz", cpu_freq); });
|
||||
cpu_freq *= 1000ULL;
|
||||
} catch (...) { }
|
||||
|
||||
@@ -690,7 +690,7 @@ uint64_t genode_cpu_hz()
|
||||
|
||||
if (!cpu_freq) {
|
||||
try {
|
||||
platform_rom().with_sub_node("tsc", [&] (Genode::Xml_node const &tsc) {
|
||||
platform_rom().with_optional_sub_node("tsc", [&] (Genode::Xml_node const &tsc) {
|
||||
cpu_freq = tsc.attribute_value("freq_khz", cpu_freq); });
|
||||
cpu_freq *= 1000ULL;
|
||||
} catch (...) { }
|
||||
|
||||
@@ -24,8 +24,8 @@ Sup::Cpu_freq_khz Sup::Drv::_cpu_freq_khz_from_rom()
|
||||
{
|
||||
unsigned khz = 0;
|
||||
|
||||
_platform_info_rom.xml().with_sub_node("hardware", [&] (Xml_node const &node) {
|
||||
node.with_sub_node("tsc", [&] (Xml_node const &node) {
|
||||
_platform_info_rom.xml().with_optional_sub_node("hardware", [&] (Xml_node const &node) {
|
||||
node.with_optional_sub_node("tsc", [&] (Xml_node const &node) {
|
||||
khz = node.attribute_value("freq_khz", khz); });
|
||||
});
|
||||
|
||||
@@ -42,8 +42,8 @@ Sup::Drv::Cpu_virt Sup::Drv::_cpu_virt_from_rom()
|
||||
{
|
||||
Cpu_virt virt = Cpu_virt::NONE;
|
||||
|
||||
_platform_info_rom.xml().with_sub_node("hardware", [&] (Xml_node const &node) {
|
||||
node.with_sub_node("features", [&] (Xml_node const &node) {
|
||||
_platform_info_rom.xml().with_optional_sub_node("hardware", [&] (Xml_node const &node) {
|
||||
node.with_optional_sub_node("features", [&] (Xml_node const &node) {
|
||||
if (node.attribute_value("vmx", false))
|
||||
virt = Cpu_virt::VMX;
|
||||
else if (node.attribute_value("svm", false))
|
||||
|
||||
Reference in New Issue
Block a user