From 5b44837e4ee001afad2117a95b5c79de5d556544 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Thu, 7 Nov 2024 10:45:47 +0100 Subject: [PATCH] mods: ucmd: replace sid_ucmd_kv_get{,_foreign_mod,foreign_dev,foreign_devmod} with sid_ucmd_kv_va_get --- src/modules/ucmd/block/dm_mpath/dm_mpath.c | 2 +- src/modules/ucmd/type/dm/dm.c | 10 +++++----- src/modules/ucmd/type/dm/lvm/lvm.c | 18 +++++++++++++----- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/modules/ucmd/block/dm_mpath/dm_mpath.c b/src/modules/ucmd/block/dm_mpath/dm_mpath.c index 980791f7..5f82575e 100644 --- a/src/modules/ucmd/block/dm_mpath/dm_mpath.c +++ b/src/modules/ucmd/block/dm_mpath/dm_mpath.c @@ -132,7 +132,7 @@ static int _dm_mpath_scan_next(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd_ctx char *p; int old_valid; - old_valid_str = sid_ucmd_kv_get(mod_res, ucmd_ctx, SID_KV_NS_DEVMOD, X_VALID, NULL, NULL, 0); + old_valid_str = sid_ucmd_kv_va_get(mod_res, ucmd_ctx, .ns = SID_KV_NS_DEVMOD, .key = X_VALID); if (old_valid_str && old_valid_str[0]) { errno = 0; old_valid = strtol(old_valid_str, &p, 10); diff --git a/src/modules/ucmd/type/dm/dm.c b/src/modules/ucmd/type/dm/dm.c index 7579727e..cdd61182 100644 --- a/src/modules/ucmd/type/dm/dm.c +++ b/src/modules/ucmd/type/dm/dm.c @@ -257,7 +257,7 @@ static int _get_cookie_props(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd_ctx, dm_cookie_flags_t flags; char *p; - if (!(str = sid_ucmd_kv_get(mod_res, ucmd_ctx, SID_KV_NS_UDEV, DM_U_COOKIE, NULL, NULL, 0))) { + if (!(str = sid_ucmd_kv_va_get(mod_res, ucmd_ctx, .ns = SID_KV_NS_UDEV, .key = DM_U_COOKIE))) { if (sid_ucmd_kv_va_set(mod_res, ucmd_ctx, .ns = SID_KV_NS_DEVMOD, @@ -537,7 +537,7 @@ static int _dm_submod_common_scan_init(sid_res_t *mod_res, struct sid_ucmd_ctx * const char *submod_name = NULL; dm_mod = sid_mod_get_data(mod_res); - submod_name = sid_ucmd_kv_get(mod_res, ucmd_ctx, SID_KV_NS_DEVICE, DM_SUBMODULES_ID, NULL, NULL, 0); + submod_name = sid_ucmd_kv_va_get(mod_res, ucmd_ctx, .ns = SID_KV_NS_DEVICE, .key = DM_SUBMODULES_ID); if (submod_name) { if (strcmp(submod_name, DM_SUBMODULE_ID_NONE) != 0) { @@ -691,7 +691,7 @@ static int _dm_scan_pre(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd_ctx) goto out; } - if (!(val = sid_ucmd_kv_get(mod_res, ucmd_ctx, SID_KV_NS_UDEV, DM_U_SUSPENDED, NULL, NULL, 0))) { + if (!(val = sid_ucmd_kv_va_get(mod_res, ucmd_ctx, .ns = SID_KV_NS_UDEV, .key = DM_U_SUSPENDED))) { sid_res_log_error(mod_res, _failed_to_get_msg, DM_U_SUSPENDED); r = -1; goto out; @@ -909,7 +909,7 @@ static int _dm_scan_a_exit(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd_ctx) } } - if (!(flags = sid_ucmd_kv_get(mod_res, ucmd_ctx, SID_KV_NS_DEVMOD, DM_X_COOKIE_FLAGS, NULL, NULL, 0))) + if (!(flags = sid_ucmd_kv_va_get(mod_res, ucmd_ctx, .ns = SID_KV_NS_DEVMOD, .key = DM_X_COOKIE_FLAGS))) return 0; for (i = 0; i < COOKIE_FLAGS_SHIFT; i++) { @@ -1051,7 +1051,7 @@ static int _dm_scan_action_current(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd sid_res_log_debug(mod_res, "scan-action-current"); if ((cookie_base_p = - (dm_cookie_base_t *) sid_ucmd_kv_get(mod_res, ucmd_ctx, SID_KV_NS_DEVMOD, DM_X_COOKIE_BASE, NULL, NULL, 0))) { + (dm_cookie_base_t *) sid_ucmd_kv_va_get(mod_res, ucmd_ctx, .ns = SID_KV_NS_DEVMOD, .key = DM_X_COOKIE_BASE))) { if (_udevcomplete(mod_res, *cookie_base_p) < 0) return -1; } diff --git a/src/modules/ucmd/type/dm/lvm/lvm.c b/src/modules/ucmd/type/dm/lvm/lvm.c index 86bd335f..3f46ab0c 100644 --- a/src/modules/ucmd/type/dm/lvm/lvm.c +++ b/src/modules/ucmd/type/dm/lvm/lvm.c @@ -52,7 +52,11 @@ static int _store_component_names(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd_ char *vg_name = NULL, *lv_name, *lv_layer; int r = -1; - if (!(dm_name = sid_ucmd_kv_get_foreign_mod(mod_res, ucmd_ctx, "/type/dm", SID_KV_NS_DEVMOD, DM_X_NAME, NULL, NULL, 0))) + if (!(dm_name = sid_ucmd_kv_va_get(mod_res, + ucmd_ctx, + .foreign_mod_name = "/type/dm", + .ns = SID_KV_NS_DEVMOD, + .key = DM_X_NAME))) goto out; if (!(vg_name = strdup(dm_name))) @@ -244,7 +248,7 @@ static int _lvm_subsys_match_current(sid_res_t *mod_res, struct sid_ucmd_ctx *uc sid_res_log_debug(mod_res, "scan-dm-subsys-match"); - if (!(uuid = sid_ucmd_kv_get_foreign_mod(mod_res, ucmd_ctx, "/type/dm", SID_KV_NS_DEVMOD, "uuid", NULL, NULL, 0))) + if (!(uuid = sid_ucmd_kv_va_get(mod_res, ucmd_ctx, .foreign_mod_name = "/type/dm", .ns = SID_KV_NS_DEVMOD, .key = "uuid"))) return 0; return !strncmp(uuid, LVM_DM_UUID_PREFIX, sizeof(LVM_DM_UUID_PREFIX) - 1); @@ -257,7 +261,7 @@ static int _lvm_subsys_match_next(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd_ sid_res_log_debug(mod_res, "scan-dm-subsys-match-next"); - if (!(type = sid_ucmd_kv_get(mod_res, ucmd_ctx, SID_KV_NS_UDEV, "ID_FS_TYPE", NULL, NULL, 0))) + if (!(type = sid_ucmd_kv_va_get(mod_res, ucmd_ctx, .ns = SID_KV_NS_UDEV, .key = "ID_FS_TYPE"))) return 0; return !strcmp(type, "LVM2_member"); @@ -289,7 +293,11 @@ static int _lvm_scan_pre(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd_ctx) if (ready < _SID_DEV_RDY) return 0; - flags = sid_ucmd_kv_get_foreign_mod(mod_res, ucmd_ctx, "/type/dm", SID_KV_NS_DEVMOD, DM_X_COOKIE_FLAGS, NULL, NULL, 0); + flags = sid_ucmd_kv_va_get(mod_res, + ucmd_ctx, + .foreign_mod_name = "/type/dm", + .ns = SID_KV_NS_DEVMOD, + .key = DM_X_COOKIE_FLAGS); switch (ready) { case SID_DEV_RDY_PUBLIC: @@ -358,7 +366,7 @@ static int _lvm_scan_action_next(sid_res_t *mod_res, struct sid_ucmd_ctx *ucmd_c sid_res_log_debug(mod_res, "scan-action-next"); - if ((val = sid_ucmd_kv_get(mod_res, ucmd_ctx, SID_KV_NS_DEVMOD, LVM_VG_NAME_COMPLETE, NULL, NULL, 0))) { + if ((val = sid_ucmd_kv_va_get(mod_res, ucmd_ctx, .ns = SID_KV_NS_DEVMOD, .key = LVM_VG_NAME_COMPLETE))) { runner_res = sid_mod_get_data(mod_res); if (!(cmd_line = util_str_comb_to_str(NULL, NULL, "vgchange -aay --autoactivation event ", val)))