summaryrefslogtreecommitdiff
path: root/src/basic/copy.c
AgeCommit message (Collapse)Author
2016-07-11treewide: fix typos and remove accidental repetition of wordsTorstein Husebø
2016-05-02machined: support non-btrfs file systems with "machinectl clone"Lennart Poettering
Fall back to a normal copy operation when the backing file system isn't btrfs, and hence doesn't support cheap snapshotting. Of course, this will be slow, but given that the execution is asynchronous now, this should be OK. Fixes: #1308
2016-05-02copy: adjust directory times after writing to the directoryLennart Poettering
When recursively copying a directory tree, fix up the file times after having created all contents in it, so that our changes don't end up altering any of the directory times.
2016-05-02copy: return the right error when we can't open a fileLennart Poettering
2016-04-29copy: also copy AF_UNIX socketsLennart Poettering
We previously would fail with EOPNOTSUPP when encountering an AF_UNIX socket in the directory tree to copy. Fix that, and copy them too (even if they are dead in the result). Fixes: #2914
2016-04-25util: copy_file_range() returns EBADF when used on a ttyLennart Poettering
In nspawn we invoke copy_bytes() on a TTY fd. copy_file_range() returns EBADF on a TTY and this error is considered fatal by copy_bytes() so far. Correct that, so that nspawn's copy_bytes() operation works again. This is a follow-up for a44202e98b638024c45e50ad404c7069c7835c04.
2016-04-02basic/copy: remove unnecessary castZbigniew Jędrzejewski-Szmek
Both types are unsigned, so the cast to the longer type is automatic.
2016-04-02test-compress-benchmark: fix argument parsing on 32bitZbigniew Jędrzejewski-Szmek
The patch is not minimal, but a function to parse size_t is probably going to come in handy in other places, so I think it's nicer to define a proper parsing function than to open-code the cast.
2016-03-17basic/copy: use copy_file_range()Zbigniew Jędrzejewski-Szmek
For btrfs, c_f_r() is like BTRFS_IOC_CLONE which we already used, but also works when max_bytes is set. We do call copy_bytes in coredump code with max_bytes set, and for large files, so we might see some benefit from using c_f_r() on btrfs. For other filesystems, c_f_r() falls back to do_splice_direct(), the same as sendfile, which we already call, so there shouldn't be much difference. Tested with test-copy and systemd-coredump on Linux 4.3 (w/o c_f_r) and 4.5 (w/ c_f_r).
2016-03-15basic/copy: use sendfile smarterZbigniew Jędrzejewski-Szmek
We called sendfile with 16kb (a.k.a. COPY_BUFFER_SIZE) as the maximum number of bytes to copy. This seems rather inefficient, especially with large files. Instead, call sendfile with a "large" maximum. What "large" max means is a bit tricky: current file offset + max must fit in loff_t. This means that as we call sendfile more than once, we have to lower the max size. With this patch, test-copy calls sendfile twice, e.g.: sendfile(4, 3, NULL, 9223372036854775807) = 738760 sendfile(4, 3, NULL, 9223372036854037047) = 0 The second call is necessary to determine EOF.
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2015-12-01basic: re-sort includesThomas Hindoe Paaboel Andersen
My previous patch to only include what we use accidentially placed the added inlcudes in non-sorted order.
2015-11-30basic: include only what we useThomas Hindoe Paaboel Andersen
This is a cleaned up result of running iwyu but without forward declarations on src/basic.
2015-10-27util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering
2015-10-27util-lib: split out umask-related code to umask-util.hLennart Poettering
2015-10-27util-lib: move a number of fs operations into fs-util.[ch]Lennart Poettering
2015-10-27util-lib: split out file attribute calls to chattr-util.[ch]Lennart Poettering
2015-10-27util-lib: split xattr-related calls into xattr-util.[ch]Lennart Poettering
2015-10-27util-lib: introduce dirent-util.[ch] for directory entry callsLennart Poettering
Also, move a couple of more path-related functions to path-util.c.
2015-10-27util-lib: move more file I/O related calls into fileio.[ch]Lennart Poettering
2015-10-26util-lib: split out IO related calls to io-util.[ch]Lennart Poettering
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-09-22copy: make copy_bytes() return whether we hit EOF or notLennart Poettering
2015-09-22copy: be more careful when trying to reflinkLennart Poettering
2015-09-10tree-wide: never use the off_t unless glibc makes us use itLennart Poettering
off_t is a really weird type as it is usually 64bit these days (at least in sane programs), but could theoretically be 32bit. We don't support off_t as 32bit builds though, but still constantly deal with safely converting from off_t to other types and back for no point. Hence, never use the type anymore. Always use uint64_t instead. This has various benefits, including that we can expose these values directly as D-Bus properties, and also that the values parse the same in all cases.
2015-08-28copy: add splice() based fallbackLennart Poettering
Apparently, sendfile() does not work between fifos and ttys, but splice() does, hence let's optionally fall back to that. This is useful to implement the fallback pager this way.
2015-07-31tree-wide: introduce mfree()David Herrmann
Pretty trivial helper which wraps free() but returns NULL, so we can simplify this: free(foobar); foobar = NULL; to this: foobar = mfree(foobar);
2015-07-23copy: when we recursively copy a directory tree, copy everythingLennart Poettering
Don't ignore hidden files and directories. Fixes #386
2015-06-15util: when creating temporary file names, allow including extra id string in itLennart Poettering
This adds a "char *extra" parameter to tempfn_xxxxxx(), tempfn_random(), tempfn_ranomd_child(). If non-NULL this string is included in the middle of the newly created file name. This is useful for being able to distuingish the kind of temporary file when we see one. This also adds tests for the three call. For now, we don't make use of this at all, but port all users over.
2015-06-11build-sys: split internal basic/ library from shared/Kay Sievers
basic/ can be used by everything cannot use anything outside of basic/ libsystemd/ can use basic/ cannot use shared/ shared/ can use libsystemd/