base: pass separate label to Local_connection

This patch extends the constructor of 'Local_connection' with an
optional 'label' argument, which was previously passed implicitly as
part of the 'args' argument. Keeping the label separate from 'args'
enables us to distinguish the client-specified label from a label that
resulted from a server-side label as it is used when rewriting a label
of an environment session (i.e., the binary name) in init's routing
policy. In principle, this patch eliminates the need for init's
explicite handling of the binary name via the '<binary>' node, or
at least allows us to simplity the binary-node handling.
This commit is contained in:
Norman Feske 2017-03-02 12:28:16 +01:00 committed by Christian Helmuth
parent 39e409f756
commit 48174ab974
2 changed files with 13 additions and 10 deletions

View File

@ -523,7 +523,8 @@ class Genode::Child : protected Rpc_object<Parent>,
_env_service.construct(_child, route.service);
_connection.construct(*_env_service, _child._id_space, _client_id,
_args, _child._policy.filter_session_affinity(Affinity()));
_args, _child._policy.filter_session_affinity(Affinity()),
route.label);
}
typedef typename CONNECTION::Session_type SESSION;

View File

@ -54,16 +54,16 @@ struct Genode::Local_connection_base : Noncopyable
protected:
Local_connection_base(Service &service,
Id_space<Parent::Client> &id_space,
Parent::Client::Id id,
Local_connection_base(Service &service,
Id_space<Parent::Client> &id_space,
Parent::Client::Id id,
Args const &args, Affinity const &affinity,
size_t ram_quota)
Session_label const &label,
size_t ram_quota)
{
enum { NUM_ATTEMPTS = 10 };
for (unsigned i = 0; i < NUM_ATTEMPTS; i++) {
_session_state.construct(service, id_space, id,
label_from_args(args.string()),
_session_state.construct(service, id_space, id, label,
_init_args(args, ram_quota), affinity);
_session_state->service().initiate_request(*_session_state);
@ -137,10 +137,12 @@ class Genode::Local_connection : Local_connection_base
Local_connection(Service &service, Id_space<Parent::Client> &id_space,
Parent::Client::Id id, Args const &args,
Affinity const &affinity)
Affinity const &affinity,
Session_label const &label = Session_label())
:
Local_connection_base(service, id_space, id, args,
affinity, CONNECTION::RAM_QUOTA)
Local_connection_base(service, id_space, id, args, affinity,
label.valid() ? label : label_from_args(args.string()),
CONNECTION::RAM_QUOTA)
{
service.wakeup();
}