summaryrefslogtreecommitdiff
path: root/src/shared/copy.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-02-01 17:48:32 +0100
committerLennart Poettering <lennart@poettering.net>2021-08-02 17:24:03 +0200
commit06a40b52d966143aa2d8e61e7fb6336f3f20e515 (patch)
treeed4d1c37088c887f08839ed6307b2e9badd51e29 /src/shared/copy.h
parent2f782044986a30bf73f1fe00209dbd204b3efe33 (diff)
downloadsystemd-06a40b52d966143aa2d8e61e7fb6336f3f20e515.tar.gz
copy: optionally fsync() files after copying them
As a safety precaution it makes sense to fsync() files after copying them, and maybe even the directories they are contained in. Let's add a flag for these two cases.
Diffstat (limited to 'src/shared/copy.h')
-rw-r--r--src/shared/copy.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/shared/copy.h b/src/shared/copy.h
index b36ddfcb01..81990d3743 100644
--- a/src/shared/copy.h
+++ b/src/shared/copy.h
@@ -10,15 +10,17 @@
#include <sys/types.h>
typedef enum CopyFlags {
- COPY_REFLINK = 1 << 0, /* Try to reflink */
- COPY_MERGE = 1 << 1, /* Merge existing trees with our new one to copy */
- COPY_REPLACE = 1 << 2, /* Replace an existing file if there's one */
- COPY_SAME_MOUNT = 1 << 3, /* Don't descend recursively into other file systems, across mount point boundaries */
- COPY_MERGE_EMPTY = 1 << 4, /* Merge an existing, empty directory with our new tree to copy */
- COPY_CRTIME = 1 << 5, /* Generate a user.crtime_usec xattr off the source crtime if there is one, on copying */
- COPY_SIGINT = 1 << 6, /* Check for SIGINT regularly and return EINTR if seen (caller needs to block SIGINT) */
- COPY_MAC_CREATE = 1 << 7, /* Create files with the correct MAC label (currently SELinux only) */
- COPY_HARDLINKS = 1 << 8, /* Try to reproduce hard links */
+ COPY_REFLINK = 1 << 0, /* Try to reflink */
+ COPY_MERGE = 1 << 1, /* Merge existing trees with our new one to copy */
+ COPY_REPLACE = 1 << 2, /* Replace an existing file if there's one */
+ COPY_SAME_MOUNT = 1 << 3, /* Don't descend recursively into other file systems, across mount point boundaries */
+ COPY_MERGE_EMPTY = 1 << 4, /* Merge an existing, empty directory with our new tree to copy */
+ COPY_CRTIME = 1 << 5, /* Generate a user.crtime_usec xattr off the source crtime if there is one, on copying */
+ COPY_SIGINT = 1 << 6, /* Check for SIGINT regularly and return EINTR if seen (caller needs to block SIGINT) */
+ COPY_MAC_CREATE = 1 << 7, /* Create files with the correct MAC label (currently SELinux only) */
+ COPY_HARDLINKS = 1 << 8, /* Try to reproduce hard links */
+ COPY_FSYNC = 1 << 9, /* fsync() after we are done */
+ COPY_FSYNC_FULL = 1 << 10, /* fsync_full() after we are done */
} CopyFlags;
typedef int (*copy_progress_bytes_t)(uint64_t n_bytes, void *userdata);