From: Daan De Meyer Date: Thu, 12 Sep 2024 10:20:56 +0000 (+0200) Subject: mount-util: Make get_submounts() a public function X-Git-Tag: v257-rc1~203^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04f0a17e92a920e1f08fa99642b6209d9bf45374;p=thirdparty%2Fsystemd.git mount-util: Make get_submounts() a public function --- diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index 1353395c896..93f8cf379eb 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -1463,11 +1463,6 @@ int remount_idmap( return remount_idmap_fd(p, userns_fd); } -typedef struct SubMount { - char *path; - int mount_fd; -} SubMount; - static void sub_mount_clear(SubMount *s) { assert(s); @@ -1475,7 +1470,7 @@ static void sub_mount_clear(SubMount *s) { s->mount_fd = safe_close(s->mount_fd); } -static void sub_mount_array_free(SubMount *s, size_t n) { +void sub_mount_array_free(SubMount *s, size_t n) { assert(s || n == 0); for (size_t i = 0; i < n; i++) @@ -1504,10 +1499,7 @@ static void sub_mount_drop(SubMount *s, size_t n) { } } -static int get_sub_mounts( - const char *prefix, - SubMount **ret_mounts, - size_t *ret_n_mounts) { +int get_sub_mounts(const char *prefix, SubMount **ret_mounts, size_t *ret_n_mounts) { _cleanup_(mnt_free_tablep) struct libmnt_table *table = NULL; _cleanup_(mnt_free_iterp) struct libmnt_iter *iter = NULL; diff --git a/src/shared/mount-util.h b/src/shared/mount-util.h index 069378cf4d2..765dbf72f88 100644 --- a/src/shared/mount-util.h +++ b/src/shared/mount-util.h @@ -12,6 +12,15 @@ #include "macro.h" #include "pidref.h" +typedef struct SubMount { + char *path; + int mount_fd; +} SubMount; + +void sub_mount_array_free(SubMount *s, size_t n); + +int get_sub_mounts(const char *prefix, SubMount **ret_mounts, size_t *ret_n_mounts); + int repeat_unmount(const char *path, int flags); int umount_recursive_full(const char *target, int flags, char **keep);