aboutsummaryrefslogtreecommitdiffstats
path: root/libmount/src
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2025-06-30 11:15:30 +0200
committerKarel Zak <kzak@redhat.com>2025-06-30 11:15:30 +0200
commitaa07db0ac1449627b3926669b052b07a1d3986ca (patch)
tree19eb1813174ced00af63f9d67340298cdb6f0c76 /libmount/src
parentf39ffccf2b9b8dcaaf2069346cc50735c2f0f95d (diff)
downloadutil-linux-aa07db0ac1449627b3926669b052b07a1d3986ca.tar.gz
lib/strutils: add ul_ prefix to startswith() and endswith()
Addresses: https://github.com/util-linux/util-linux/issues/3626 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src')
-rw-r--r--libmount/src/context_mount.c4
-rw-r--r--libmount/src/context_umount.c2
-rw-r--r--libmount/src/hook_idmap.c6
-rw-r--r--libmount/src/optmap.c2
-rw-r--r--libmount/src/optstr.c2
-rw-r--r--libmount/src/tab.c4
-rw-r--r--libmount/src/tab_parse.c2
-rw-r--r--libmount/src/tab_update.c2
-rw-r--r--libmount/src/utils.c4
9 files changed, 14 insertions, 14 deletions
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
index 24369857d9..9a1832550c 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -447,7 +447,7 @@ static int exec_helper(struct libmnt_context *cxt)
}
if (type
&& strchr(type, '.')
- && !endswith(cxt->helper, type)) {
+ && !ul_endswith(cxt->helper, type)) {
args[i++] = "-t"; /* 10 */
args[i++] = type; /* 11 */
}
@@ -1457,7 +1457,7 @@ static void join_err_mesgs(struct libmnt_context *cxt, char *buf, size_t bufsz)
if (!bufsz)
break;
- if (!startswith(*s, "e "))
+ if (!ul_startswith(*s, "e "))
continue;
if (n) {
len = xstrncpy(buf, "; ", bufsz);
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 64a1d884ba..27319f77cf 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -725,7 +725,7 @@ static int exec_helper(struct libmnt_context *cxt)
args[i++] = "-r"; /* 7 */
if (type
&& strchr(type, '.')
- && !endswith(cxt->helper, type)) {
+ && !ul_endswith(cxt->helper, type)) {
args[i++] = "-t"; /* 8 */
args[i++] = type; /* 9 */
}
diff --git a/libmount/src/hook_idmap.c b/libmount/src/hook_idmap.c
index e8c4cab5a0..5095de1f6a 100644
--- a/libmount/src/hook_idmap.c
+++ b/libmount/src/hook_idmap.c
@@ -434,15 +434,15 @@ static int hook_prepare_options(
idmap_type_t map_type;
uint32_t nsid = UINT_MAX, hostid = UINT_MAX, range = UINT_MAX;
- if (startswith(tok, "b:")) {
+ if (ul_startswith(tok, "b:")) {
/* b:id-mount:id-host:id-range */
map_type = ID_TYPE_UIDGID;
tok += 2;
- } else if (startswith(tok, "g:")) {
+ } else if (ul_startswith(tok, "g:")) {
/* g:id-mount:id-host:id-range */
map_type = ID_TYPE_GID;
tok += 2;
- } else if (startswith(tok, "u:")) {
+ } else if (ul_startswith(tok, "u:")) {
/* u:id-mount:id-host:id-range */
map_type = ID_TYPE_UID;
tok += 2;
diff --git a/libmount/src/optmap.c b/libmount/src/optmap.c
index d7569a0f03..4ea455d944 100644
--- a/libmount/src/optmap.c
+++ b/libmount/src/optmap.c
@@ -250,7 +250,7 @@ const struct libmnt_optmap *mnt_optmap_get_entry(
for (ent = map; ent && ent->name; ent++) {
if (ent->mask & MNT_PREFIX) {
- if (startswith(name, ent->name)) {
+ if (ul_startswith(name, ent->name)) {
if (mapent)
*mapent = ent;
return map;
diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c
index 30cd1af616..ac20d87557 100644
--- a/libmount/src/optstr.c
+++ b/libmount/src/optstr.c
@@ -914,7 +914,7 @@ int mnt_match_options(const char *optstr, const char *pattern)
if (*name == '+')
name++, namesz--;
- else if ((no = (startswith(name, "no") != NULL))) {
+ else if ((no = (ul_startswith(name, "no") != NULL))) {
name += 2, namesz -= 2;
if (!*name || *name == ',') {
match = 0;
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index a5070f8240..c8433674f9 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -1818,7 +1818,7 @@ struct libmnt_fs *mnt_table_get_fs_root(struct libmnt_table *tb,
DBG(FS, ul_debugobj(fs, "source root: %s, source FS root: %s", root, src_root));
- if (src_root && root && !startswith(root, src_root)) {
+ if (src_root && root && !ul_startswith(root, src_root)) {
if (strcmp(root, "/") == 0) {
free(root);
root = strdup(src_root);
@@ -1948,7 +1948,7 @@ int __mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_f
int flags = 0;
if (!mnt_fs_get_srcpath(fs) ||
- !startswith(mnt_fs_get_srcpath(fs), "/dev/loop"))
+ !ul_startswith(mnt_fs_get_srcpath(fs), "/dev/loop"))
continue; /* does not look like loopdev */
if (mnt_fs_get_option(fstab_fs, "offset", &val, &len) == 0) {
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
index e5db3e385c..3dd8538802 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -395,7 +395,7 @@ static int mnt_parse_swaps_line(struct libmnt_fs *fs, const char *s)
/* (1) source */
p = unmangle(s, &s);
if (p) {
- char *x = (char *) endswith(p, PATH_DELETED_SUFFIX);
+ char *x = (char *) ul_endswith(p, PATH_DELETED_SUFFIX);
if (x && *x)
*x = '\0';
}
diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c
index a256edf858..3cb5b30f95 100644
--- a/libmount/src/tab_update.c
+++ b/libmount/src/tab_update.c
@@ -763,7 +763,7 @@ static int update_modify_target(struct libmnt_update *upd)
char *p;
const char *e;
- e = startswith(mnt_fs_get_target(fs), upd_source);
+ e = ul_startswith(mnt_fs_get_target(fs), upd_source);
if (!e || (*e && *e != '/'))
continue;
if (*e == '/')
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index 8c3151b736..46050ff51f 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -1393,7 +1393,7 @@ static int test_startswith(struct libmnt_test *ts __attribute__((unused)),
char *optstr = argv[1];
char *pattern = argv[2];
- printf("%s\n", startswith(optstr, pattern) ? "YES" : "NOT");
+ printf("%s\n", ul_startswith(optstr, pattern) ? "YES" : "NOT");
return 0;
}
@@ -1406,7 +1406,7 @@ static int test_endswith(struct libmnt_test *ts __attribute__((unused)),
char *optstr = argv[1];
char *pattern = argv[2];
- printf("%s\n", endswith(optstr, pattern) ? "YES" : "NOT");
+ printf("%s\n", ul_endswith(optstr, pattern) ? "YES" : "NOT");
return 0;
}