Skip to content

Commit

Permalink
res: ucmd-module: fix sid_ucmd_dev_alias_get_foreign_{mod,dev_mod} to…
Browse files Browse the repository at this point in the history
… return all aliases if given mod name is NULL
  • Loading branch information
prajnoha committed Jul 30, 2024
1 parent 97a1c7d commit e0200d2
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/resource/ubridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -3576,7 +3576,7 @@ int sid_ucmd_dev_alias_del(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd_ctx, co
const char **_do_sid_ucmd_dev_alias_get(sid_res_t *mod_res,
struct sid_ucmd_ctx *ucmd_ctx,
const char *foreign_dev_id,
const char *foreign_mod_name,
const char *mod_name,
const char *alias_key,
size_t *count)
{
Expand Down Expand Up @@ -3609,8 +3609,7 @@ const char **_do_sid_ucmd_dev_alias_get(sid_res_t *mod_res,
.op = KV_OP_SET,
.dom = KV_KEY_DOM_ALIAS,
.ns = SID_KV_NS_MODULE,
.ns_part =
foreign_mod_name ?: _get_ns_part(ucmd_ctx, _owner_name(mod_res), SID_KV_NS_MODULE),
.ns_part = mod_name,
.id_cat = alias_key ?: NULL,
.id = NULL,
.core = NULL}),
Expand All @@ -3621,7 +3620,12 @@ const char **_do_sid_ucmd_dev_alias_get(sid_res_t *mod_res,

const char **sid_ucmd_dev_alias_get(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd_ctx, const char *alias_key, size_t *count)
{
return _do_sid_ucmd_dev_alias_get(mod_res, ucmd_ctx, NULL, NULL, alias_key, count);
return _do_sid_ucmd_dev_alias_get(mod_res,
ucmd_ctx,
NULL,
_get_ns_part(ucmd_ctx, _owner_name(mod_res), SID_KV_NS_MODULE),
alias_key,
count);
}

const char **sid_ucmd_dev_alias_get_foreign_dev(sid_res_t *mod_res,
Expand All @@ -3630,7 +3634,12 @@ const char **sid_ucmd_dev_alias_get_foreign_dev(sid_res_t *mod_res,
const char *alias_key,
size_t *count)
{
return _do_sid_ucmd_dev_alias_get(mod_res, ucmd_ctx, foreign_dev_id, NULL, alias_key, count);
return _do_sid_ucmd_dev_alias_get(mod_res,
ucmd_ctx,
foreign_dev_id,
_get_ns_part(ucmd_ctx, _owner_name(mod_res), SID_KV_NS_MODULE),
alias_key,
count);
}

const char **sid_ucmd_dev_alias_get_foreign_mod(sid_res_t *mod_res,
Expand Down

0 comments on commit e0200d2

Please sign in to comment.