mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-17 22:58:26 +00:00
os: Split Session_label from Session_policy
By splitting Session_policy into two classes, we make it more flexible. Originally, the constructor accepted solely an args string, which made it unusable for situations where we already have extracted the session label (e.g., stored in the session meta data of a server). Now, the extraction of the label from the args string is performed by the new Session_label class instead, which, in turn, can be passed to the constructor of Session_policy. This change causes a minor API change. The following code Session_policy policy(session_args); Must be turned into Session_label label(session_args); Session_policy policy(label);
This commit is contained in:
@ -171,7 +171,6 @@ namespace Net {
|
||||
|
||||
enum { MAX_IP_ADDR_LENGTH = 16, };
|
||||
char ip_addr[MAX_IP_ADDR_LENGTH];
|
||||
char label[256];
|
||||
|
||||
Session_component *_create_session(const char *args)
|
||||
{
|
||||
@ -180,11 +179,11 @@ namespace Net {
|
||||
memset(ip_addr, 0, MAX_IP_ADDR_LENGTH);
|
||||
|
||||
try {
|
||||
Genode::Arg_string::find_arg(args, "label").string(label, sizeof(label), "");
|
||||
Session_policy policy(args);
|
||||
Session_label label(args);
|
||||
Session_policy policy(label);
|
||||
policy.attribute("ip_addr").value(ip_addr, sizeof(ip_addr));
|
||||
|
||||
if (verbose) PDBG("policy: %s ip_addr = %s", label, ip_addr);
|
||||
if (verbose) PDBG("policy: %s ip_addr = %s", label.string(), ip_addr);
|
||||
} catch (Xml_node::Nonexistent_attribute) {
|
||||
if (verbose) PDBG("Missing \"ip_addr\" attribute in policy definition");
|
||||
} catch (Session_policy::No_policy_defined) {
|
||||
|
@ -70,7 +70,8 @@ static Color session_color(char const *session_args)
|
||||
Color color = WHITE;
|
||||
|
||||
try {
|
||||
Session_policy policy(session_args);
|
||||
Session_label label(session_args);
|
||||
Session_policy policy(label);
|
||||
|
||||
/* read color attribute */
|
||||
policy.attribute("color").value(&color);
|
||||
|
@ -437,7 +437,8 @@ namespace File_system {
|
||||
root[0] = 0;
|
||||
|
||||
try {
|
||||
Session_policy policy(args);
|
||||
Session_label label(args);
|
||||
Session_policy policy(label);
|
||||
|
||||
/*
|
||||
* Determine directory that is used as root directory of
|
||||
|
@ -450,7 +450,8 @@ namespace File_system {
|
||||
root[0] = 0;
|
||||
|
||||
try {
|
||||
Session_policy policy(args);
|
||||
Session_label label(args);
|
||||
Session_policy policy(label);
|
||||
|
||||
/*
|
||||
* Determine directory that is used as root directory of
|
||||
|
Reference in New Issue
Block a user