summaryrefslogtreecommitdiffstats
path: root/src/shared/copy.h
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-09-23 21:07:41 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-11-10 16:40:31 +0100
commita424958aa6a95ce037976a9b065e4c88e97992c7 (patch)
tree2920f91be1a6bcba6485634fe1a4e87e21a16fea /src/shared/copy.h
parentstat-util: Move inode_hash_ops to stat-util (diff)
downloadsystemd-a424958aa6a95ce037976a9b065e4c88e97992c7.tar.xz
systemd-a424958aa6a95ce037976a9b065e4c88e97992c7.zip
copy: Support passing a deny list of files/directories to not copy
Diffstat (limited to 'src/shared/copy.h')
-rw-r--r--src/shared/copy.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/shared/copy.h b/src/shared/copy.h
index d755916bd9..d19361c9a2 100644
--- a/src/shared/copy.h
+++ b/src/shared/copy.h
@@ -9,6 +9,8 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include "set.h"
+
typedef enum CopyFlags {
COPY_REFLINK = 1 << 0, /* Try to reflink */
COPY_MERGE = 1 << 1, /* Merge existing trees with our new one to copy */
@@ -45,12 +47,12 @@ static inline int copy_file_atomic(const char *from, const char *to, mode_t mode
return copy_file_atomic_full(from, to, mode, chattr_flags, chattr_mask, copy_flags, NULL, NULL);
}
-int copy_tree_at_full(int fdf, const char *from, int fdt, const char *to, uid_t override_uid, gid_t override_gid, CopyFlags copy_flags, copy_progress_path_t progress_path, copy_progress_bytes_t progress_bytes, void *userdata);
-static inline int copy_tree_at(int fdf, const char *from, int fdt, const char *to, uid_t override_uid, gid_t override_gid, CopyFlags copy_flags) {
- return copy_tree_at_full(fdf, from, fdt, to, override_uid, override_gid, copy_flags, NULL, NULL, NULL);
+int copy_tree_at_full(int fdf, const char *from, int fdt, const char *to, uid_t override_uid, gid_t override_gid, CopyFlags copy_flags, const Set *denylist, copy_progress_path_t progress_path, copy_progress_bytes_t progress_bytes, void *userdata);
+static inline int copy_tree_at(int fdf, const char *from, int fdt, const char *to, uid_t override_uid, gid_t override_gid, CopyFlags copy_flags, const Set *denylist) {
+ return copy_tree_at_full(fdf, from, fdt, to, override_uid, override_gid, copy_flags, denylist, NULL, NULL, NULL);
}
-static inline int copy_tree(const char *from, const char *to, uid_t override_uid, gid_t override_gid, CopyFlags copy_flags) {
- return copy_tree_at_full(AT_FDCWD, from, AT_FDCWD, to, override_uid, override_gid, copy_flags, NULL, NULL, NULL);
+static inline int copy_tree(const char *from, const char *to, uid_t override_uid, gid_t override_gid, CopyFlags copy_flags, const Set *denylist) {
+ return copy_tree_at_full(AT_FDCWD, from, AT_FDCWD, to, override_uid, override_gid, copy_flags, denylist, NULL, NULL, NULL);
}
int copy_directory_fd_full(int dirfd, const char *to, CopyFlags copy_flags, copy_progress_path_t progress_path, copy_progress_bytes_t progress_bytes, void *userdata);