aboutsummaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2025-06-26 13:47:00 +0200
committerKarel Zak <kzak@redhat.com>2025-06-26 13:49:37 +0200
commitf39ffccf2b9b8dcaaf2069346cc50735c2f0f95d (patch)
treea858ce55b377a85bc8adbe071f4c7091a262d2ff /sys-utils
parentba5c614edc4407d5dacea6ce29c0a41f39883f02 (diff)
downloadutil-linux-f39ffccf2b9b8dcaaf2069346cc50735c2f0f95d.tar.gz
lib/strv: use ul_ prefix for strv functions
The functions are originally from systemd/udev, so it's possible that during static linking, they may collide with other systemd-based components. Fixes: https://github.com/util-linux/util-linux/issues/3626 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/chmem.c8
-rw-r--r--sys-utils/lscpu-riscv.c10
-rw-r--r--sys-utils/mount.c2
-rw-r--r--sys-utils/rtcwake.c6
-rw-r--r--sys-utils/wdctl.c4
-rw-r--r--sys-utils/zramctl.c8
6 files changed, 19 insertions, 19 deletions
diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c
index 932d0af13d..52e6f49b3f 100644
--- a/sys-utils/chmem.c
+++ b/sys-utils/chmem.c
@@ -319,14 +319,14 @@ static void parse_parameter(struct chmem_desc *desc, char *param)
{
char **split;
- split = strv_split(param, "-");
- if (strv_length(split) > 2)
+ split = ul_strv_split(param, "-");
+ if (ul_strv_length(split) > 2)
errx(EXIT_FAILURE, _("Invalid parameter: %s"), param);
- if (strv_length(split) == 1)
+ if (ul_strv_length(split) == 1)
parse_single_param(desc, split[0]);
else
parse_range_param(desc, split[0], split[1]);
- strv_free(split);
+ ul_strv_free(split);
if (desc->start > desc->end)
errx(EXIT_FAILURE, _("Invalid range: %s"), param);
}
diff --git a/sys-utils/lscpu-riscv.c b/sys-utils/lscpu-riscv.c
index 649f332ba6..3d01762064 100644
--- a/sys-utils/lscpu-riscv.c
+++ b/sys-utils/lscpu-riscv.c
@@ -40,19 +40,19 @@ void lscpu_format_isa_riscv(struct lscpu_cputype *ct)
char **split;
size_t i;
- split = strv_split(ct->isa, "_");
+ split = ul_strv_split(ct->isa, "_");
/* Sort multi-letter extensions alphabetically */
- if (strv_length(split) > 1)
- qsort(&split[1], strv_length(split) - 1, sizeof(char *), riscv_cmp_func);
+ if (ul_strv_length(split) > 1)
+ qsort(&split[1], ul_strv_length(split) - 1, sizeof(char *), riscv_cmp_func);
/* Keep Base ISA and single-letter extensions at the start */
strcpy(ct->isa, split[0]);
- for (i = 1; i < strv_length(split); i++) {
+ for (i = 1; i < ul_strv_length(split); i++) {
strcat(ct->isa, " ");
strcat(ct->isa, split[i]);
}
- strv_free(split);
+ ul_strv_free(split);
}
diff --git a/sys-utils/mount.c b/sys-utils/mount.c
index 86800a1270..875d249b47 100644
--- a/sys-utils/mount.c
+++ b/sys-utils/mount.c
@@ -390,7 +390,7 @@ static size_t libmount_mesgs(struct libmnt_context *cxt, char type)
}
/* Messages */
- STRV_FOREACH(s, mesgs) {
+ UL_STRV_FOREACH(s, mesgs) {
switch (type) {
case 'e':
if (!startswith(*s, "e "))
diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index 49dab17bdd..d01f5ed343 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -267,7 +267,7 @@ static char **get_sys_power_states(struct rtcwake_control *ctl)
if (ss <= 0)
goto nothing;
buf[ss] = '\0';
- ctl->possible_modes = strv_split(buf, " \n");
+ ctl->possible_modes = ul_strv_split(buf, " \n");
close(fd);
}
return ctl->possible_modes;
@@ -385,7 +385,7 @@ static int get_rtc_mode(struct rtcwake_control *ctl, const char *s)
size_t i;
char **modes = get_sys_power_states(ctl), **m;
- STRV_FOREACH(m, modes) {
+ UL_STRV_FOREACH(m, modes) {
if (strcmp(s, *m) == 0)
return SYSFS_MODE;
}
@@ -421,7 +421,7 @@ static void list_modes(struct rtcwake_control *ctl)
if (!modes)
errx(EXIT_FAILURE, _("could not read: %s"), SYS_POWER_STATE_PATH);
- STRV_FOREACH(m, modes)
+ UL_STRV_FOREACH(m, modes)
printf("%s ", *m);
for (i = 0; i < ARRAY_SIZE(rtcwake_mode_string); i++)
diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c
index 9290eb3120..b3203d4611 100644
--- a/sys-utils/wdctl.c
+++ b/sys-utils/wdctl.c
@@ -594,7 +594,7 @@ static int read_governors(struct wd_device *wd)
while ((sz = getline(&line, &dummy, f)) >= 0) {
if (rtrim_whitespace((unsigned char *) line) == 0)
continue;
- strv_consume(&wd->available_governors, line);
+ ul_strv_consume(&wd->available_governors, line);
dummy = 0;
line = NULL;
}
@@ -663,7 +663,7 @@ static void show_governors(struct wd_device *wd)
if (wd->governor)
printf(_("%-14s %s\n"), _("Pre-timeout governor:"), wd->governor);
if (wd->available_governors) {
- char *tmp = strv_join(wd->available_governors, " ");
+ char *tmp = ul_strv_join(wd->available_governors, " ");
if (tmp)
printf(_("%-14s %s\n"),
diff --git a/sys-utils/zramctl.c b/sys-utils/zramctl.c
index 175ad98d51..e9eea4d1e2 100644
--- a/sys-utils/zramctl.c
+++ b/sys-utils/zramctl.c
@@ -308,7 +308,7 @@ static void zram_unlock(struct zram *z) {
static void zram_reset_stat(struct zram *z)
{
if (z) {
- strv_free(z->mm_stat);
+ ul_strv_free(z->mm_stat);
z->mm_stat = NULL;
z->mm_stat_probed = 0;
}
@@ -525,11 +525,11 @@ static int get_mm_stat(struct zram *z,
if (!z->mm_stat && !z->mm_stat_probed) {
char *str = NULL;
if (ul_path_read_string(sysfs, &str, "mm_stat") > 0 && str) {
- z->mm_stat = strv_split(str, " ");
+ z->mm_stat = ul_strv_split(str, " ");
/* make sure kernel provides mm_stat as expected */
- if (strv_length(z->mm_stat) < ARRAY_SIZE(mm_stat_names)) {
- strv_free(z->mm_stat);
+ if (ul_strv_length(z->mm_stat) < ARRAY_SIZE(mm_stat_names)) {
+ ul_strv_free(z->mm_stat);
z->mm_stat = NULL;
}
}