]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mount-util: Make get_submounts() a public function
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 12 Sep 2024 10:20:56 +0000 (12:20 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 16 Oct 2024 10:37:57 +0000 (11:37 +0100)
src/shared/mount-util.c
src/shared/mount-util.h

index 1353395c8962b28da364e25dc092881876c05f33..93f8cf379ebc291e113722b0d2bbf0a04ee00a89 100644 (file)
@@ -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;
index 069378cf4d2020750da58713b56812a2e248f9c6..765dbf72f88e837197ae65954fed4fe28ad96d90 100644 (file)
 #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);