Skip to content

Commit

Permalink
xen-dom-mgmt: rework return value handling for dom0 initcall
Browse files Browse the repository at this point in the history
Some return codes in dom0 initcall were ignored. Also return value
from initcall was improper (positive integer from last call, when
Zephyr initcall expects it to be 0 in success case).
Add error handling in initcall and add proper return value xs_init_root
to return proper result to initcall instead of just 0.

Signed-off-by: Dmytro Firsov <[email protected]>
  • Loading branch information
firscity committed Apr 11, 2024
1 parent 6b01811 commit 0ac8bbe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 14 additions & 3 deletions xen-dom-mgmt/src/xen-dom-mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,10 +945,21 @@ static int init_domain0(const struct device *d)
dom0->max_mem_kb = 0;
#endif

xs_init_root();
xss_write("/tool/xenstored", "");
xs_initialize_xenstore(0, dom0);
ret = xs_init_root();
if (ret) {
LOG_ERR("Failed to init Xenstore root node");
goto out;
}

ret = xss_write("/tool/xenstored", "");
if (ret) {
LOG_ERR("Failed to create /tool/xenstored node, err = %d", ret);
}

ret = xs_initialize_xenstore(0, dom0);
if (ret) {
LOG_ERR("Failed to add Domain-0 xenstore entries, err = %d", ret);
}
out:
#ifdef CONFIG_XSTAT
k_free(dom0stat);
Expand Down
3 changes: 1 addition & 2 deletions xenstore-srv/src/xenstore_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2121,8 +2121,7 @@ int xs_init_root(void)

sys_dlist_init(&root_xenstore.child_list);
sys_dnode_init(&root_xenstore.node);
set_perms_by_array(&root_xenstore, &permissions, 1);

return 0;
return set_perms_by_array(&root_xenstore, &permissions, 1);
}

0 comments on commit 0ac8bbe

Please sign in to comment.