mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-21 08:29:41 +00:00
init: make label rewriting more flexible
This patch complements the existing 'label' attribute of session-route target nodes with the new 'identity', 'resource', and 'prepend_resource' attributes that allow for the partial rewriting of the label. Fixes #5447
This commit is contained in:
committed by
Christian Helmuth
parent
c5a2b00068
commit
bf2c48f26f
@ -5,12 +5,23 @@
|
|||||||
|
|
||||||
<xs:complexType name="template_service">
|
<xs:complexType name="template_service">
|
||||||
<xs:choice minOccurs="1" maxOccurs="3">
|
<xs:choice minOccurs="1" maxOccurs="3">
|
||||||
<xs:element name="parent"/>
|
<xs:element name="parent">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:attribute name="label" type="Session_label" />
|
||||||
|
<xs:attribute name="identity" type="Session_label" />
|
||||||
|
<xs:attribute name="resource" type="Session_label" />
|
||||||
|
<xs:attribute name="prefix_resource" type="Session_label" />
|
||||||
|
<xs:attribute name="diag" type="Boolean" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
<xs:element name="any-child"/>
|
<xs:element name="any-child"/>
|
||||||
<xs:element name="child">
|
<xs:element name="child">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:attribute name="name" type="xs:string" />
|
<xs:attribute name="name" type="xs:string" />
|
||||||
<xs:attribute name="label" type="Session_label" />
|
<xs:attribute name="label" type="Session_label" />
|
||||||
|
<xs:attribute name="identity" type="Session_label" />
|
||||||
|
<xs:attribute name="resource" type="Session_label" />
|
||||||
|
<xs:attribute name="prefix_resource" type="Session_label" />
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:choice>
|
</xs:choice>
|
||||||
|
@ -559,14 +559,28 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name,
|
|||||||
* Determine session label to be provided to the server
|
* Determine session label to be provided to the server
|
||||||
*
|
*
|
||||||
* By default, the client's identity (accompanied with the a
|
* By default, the client's identity (accompanied with the a
|
||||||
* client-provided label) is presented as session label to the
|
* client-provided label) is presented as session label to the server.
|
||||||
* server. However, the target node can explicitly override the
|
* However, the target node can explicitly override the client's
|
||||||
* client's identity by a custom label via the 'label'
|
* identity and the client's resource selection via the 'label',
|
||||||
* attribute.
|
* 'identity', 'resource', and 'prepend_resource' attributes.
|
||||||
*/
|
*/
|
||||||
using Label = String<Session_label::capacity()>;
|
using Label = String<Session_label::capacity()>;
|
||||||
Label const target_label =
|
auto rewritten_target_label = [&] () -> Label
|
||||||
target.attribute_value("label", Label(label.string()));
|
{
|
||||||
|
if (target.has_attribute("label"))
|
||||||
|
return target.attribute_value("label", Label());
|
||||||
|
|
||||||
|
Label const
|
||||||
|
identity = target.attribute_value("identity", Label(label.prefix())),
|
||||||
|
resource = target.attribute_value("resource", Label(label.last_element())),
|
||||||
|
prepend = target.attribute_value("prepend_resource", Label(""));
|
||||||
|
|
||||||
|
Label const prepended_resource { prepend, resource };
|
||||||
|
|
||||||
|
return identity.length() > 1 ? prefixed_label(identity, prepended_resource)
|
||||||
|
: prepended_resource;
|
||||||
|
};
|
||||||
|
Label const target_label = rewritten_target_label();
|
||||||
|
|
||||||
Session::Diag const
|
Session::Diag const
|
||||||
target_diag { target.attribute_value("diag", diag.enabled) };
|
target_diag { target.attribute_value("diag", diag.enabled) };
|
||||||
|
Reference in New Issue
Block a user