From 4619e2e84c0e07cf9ca956c07bfe0ec6942aa980 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 19 Jan 2018 19:22:06 +0100 Subject: [PATCH] init: new label_last attribute for session routes Fixes #2647 --- repos/os/src/init/config.xsd | 1 + repos/os/src/init/utils.h | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/repos/os/src/init/config.xsd b/repos/os/src/init/config.xsd index 9c1a5c6c8..352fc1dec 100644 --- a/repos/os/src/init/config.xsd +++ b/repos/os/src/init/config.xsd @@ -16,6 +16,7 @@ + diff --git a/repos/os/src/init/utils.h b/repos/os/src/init/utils.h index e86a4e624..07d2910e0 100644 --- a/repos/os/src/init/utils.h +++ b/repos/os/src/init/utils.h @@ -69,12 +69,17 @@ namespace Init { if (!service_matches) return false; + typedef String Label; + + char const *unscoped_attr = "unscoped_label"; + char const *label_last_attr = "label_last"; + bool const route_depends_on_child_provided_label = service_node.has_attribute("label") || service_node.has_attribute("label_prefix") || - service_node.has_attribute("label_suffix"); + service_node.has_attribute("label_suffix") || + service_node.has_attribute(label_last_attr); - char const *unscoped_attr = "unscoped_label"; if (service_node.has_attribute(unscoped_attr)) { /* @@ -84,10 +89,12 @@ namespace Init { if (route_depends_on_child_provided_label) warning("service node contains both scoped and unscoped label attributes"); - typedef String Label; return label == service_node.attribute_value(unscoped_attr, Label()); } + if (service_node.has_attribute(label_last_attr)) + return service_node.attribute_value(label_last_attr, Label()) == label.last_element(); + if (!route_depends_on_child_provided_label) return true;