From e0200d2c0f80062a4bb1631d6560f04ece521fde Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Tue, 30 Jul 2024 12:38:15 +0200 Subject: [PATCH] res: ucmd-module: fix sid_ucmd_dev_alias_get_foreign_{mod,dev_mod} to return all aliases if given mod name is NULL --- src/resource/ubridge.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/resource/ubridge.c b/src/resource/ubridge.c index a82a09f7..a3ddd975 100644 --- a/src/resource/ubridge.c +++ b/src/resource/ubridge.c @@ -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) { @@ -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}), @@ -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, @@ -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,