summaryrefslogtreecommitdiff
path: root/src/import
Commit message (Collapse)AuthorAgeFilesLines
* copy: rename reflink_full() -> reflink_range()Yu Watanabe2023-04-281-1/+1
| | | | | | | | | | | | The commit b640e274a7c363a2b6394c9dce5671d9404d2e2a introduced reflink() and reflink_full(). We usually name function xyz_full() for fully parameterized version of xyz(), and xyz() is typically a inline alias of xyz_full(). But in this case, reflink() and reflink_full() call different ioctl(). Moreover, reflink_full() does partial reflink, while reflink() does full file reflink. That's super confusing. Let's rename reflink_full() to reflink_range(), the new name is consistent with ioctl name, and should be fine.
* copy: Introduce reflink() and reflink_full()Daan De Meyer2023-04-283-4/+4
| | | | | | The kernel has had filesystem independent reflink ioctls for a while now, let's try to use them and fall back to the btrfs specific ones if they're not supported.
* import: use truncate_nl() where appropriateLennart Poettering2023-03-241-3/+2
|
* tree-wide: port various places to find_line_startswith()Lennart Poettering2023-03-241-8/+3
|
* copy: Move chattr arguments to full function signaturesDaan De Meyer2023-03-212-2/+0
| | | | | These are almost never used, so let's move them to the _full() functions signatures.
* meson: Introduce userspace depJan Janssen2023-03-101-1/+2
| | | | This will help in a later commit to separate userspace from EFI builds.
* importd: hook up memory pressure, SIGRTMIN-18 (and in fact SIGINT + SIGTERM)Lennart Poettering2023-03-011-2/+19
|
* Merge pull request #26203 from medhefgo/mesonYu Watanabe2023-02-221-5/+9
|\ | | | | meson: Use dicts for test/fuzzer definitions
| * meson: Use dicts for test definitionsJan Janssen2023-02-211-5/+9
| | | | | | | | | | | | | | Although this slightly more verbose it makes it much easier to reason about. The code that produces the tests heavily benefits from this. Test lists are also now sorted by test name.
* | tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDSYu Watanabe2023-02-213-39/+17
|/
* copy: Make copy_xattr() more genericDaan De Meyer2023-02-143-3/+3
| | | | | Let's make copy_xattr() a little more generic in preparation for copying symlink xattrs.
* tree-wide: set FORK_RLIMIT_NOFILE_SAFE flagYu Watanabe2023-02-071-4/+1
| | | | No functional changes, just refactoring.
* importd: Always specify file unpacked by tarArsen Arsenović2023-01-311-1/+2
| | | | | | | | | | | | | | | Despite popular belief, the default file extracted by GNU tar is not stdin. It is the value of the TAPE environment variable, falling back on a compile-time constant. On my system, the default value is /dev/full, which causes tar to just spin forever due to --ignore-zeros. Always specifying this flag is the safe thing to do. ~$ tar --show-defaults --format=gnu -f/dev/full -b20 --quoting-style=escape --rmt-command=/usr/sbin/grmt See also: ``(tar)defaults'', available via Info viewers, and in HTML form at: https://www.gnu.org/s/tar/manual/html_node/defaults.html
* meson: Do not include headers in source listsJan Janssen2023-01-241-14/+4
| | | | | | Meson+ninja+compiler do this for us and are better at it. https://mesonbuild.com/FAQ.html#do-i-need-to-add-my-headers-to-the-sources-list-like-in-autotools
* import: use CURLOPT_PROTOCOLS_STR with libcurl >= 7.85.0Frantisek Sumsal2023-01-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | CURLOPT_PROTOCOLS [0] was deprecated in libcurl 7.85.0 with CURLOPT_PROTOCOLS_STR [1] as a replacement, causing build warnings/errors: ../build/src/import/curl-util.c: In function ‘curl_glue_make’: ../build/src/import/curl-util.c:255:9: error: ‘CURLOPT_PROTOCOLS’ is deprecated: since 7.85.0. Use CURLOPT_PROTOCOLS_STR [-Werror=deprecated-declarations] 255 | if (curl_easy_setopt(c, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS|CURLPROTO_FILE) != CURLE_OK) | ^~ In file included from ../build/src/import/curl-util.h:4, from ../build/src/import/curl-util.c:6: /usr/include/curl/curl.h:1749:3: note: declared here 1749 | CURLOPTDEPRECATED(CURLOPT_PROTOCOLS, CURLOPTTYPE_LONG, 181, | ^~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Since there's no grace period between the two symbols, let's resort to a light if-def-ery to resolve this. [0] https://curl.se/libcurl/c/CURLOPT_PROTOCOLS.html [1] https://curl.se/libcurl/c/CURLOPT_PROTOCOLS_STR.html
* import: use CURLINFO_SCHEME instead of CURLINFO_PROTOCOLFrantisek Sumsal2023-01-091-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | CURLINFO_PROTOCOL has been deprecated in curl 7.85.0 causing compilation warnings/errors: ../build/src/import/pull-job.c: In function ‘pull_job_curl_on_finished’: ../build/src/import/pull-job.c:142:9: error: ‘CURLINFO_PROTOCOL’ is deprecated: since 7.85.0. Use CURLINFO_SCHEME [-Werror=deprecated-declarations] 142 | code = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol); | ^~~~ In file included from ../build/src/import/curl-util.h:4, from ../build/src/import/pull-job.h:6, from ../build/src/import/pull-common.h:7, from ../build/src/import/pull-job.c:16: /usr/include/curl/curl.h:2896:3: note: declared here 2896 | CURLINFO_PROTOCOL CURL_DEPRECATED(7.85.0, "Use CURLINFO_SCHEME") | ^~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Since both CURLINFO_SCHEME and CURLINFO_PROTOCOL were introduced in the same curl version (7.52.0 [0][1]) we don't have to worry about backwards compatibility. [0] https://curl.se/libcurl/c/CURLINFO_SCHEME.html [1] https://curl.se/libcurl/c/CURLINFO_PROTOCOL.html
* tree-wide: use -EBADF moreYu Watanabe2022-12-212-4/+4
|
* tree-wide: introduce PIPE_EBADF macroYu Watanabe2022-12-203-4/+4
|
* tree-wide: use -EBADF also in pipe initializersZbigniew Jędrzejewski-Szmek2022-12-193-4/+4
| | | | In some places, initialization is dropped when unnecesary.
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-1911-25/+25
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* import: wire up SYSTEMD_IMPORT_BTRFS_{SUBVOL,QUOTA} to importdIvan Shapovalov2022-12-031-4/+36
| | | | | | | | | | | Btrfs quotas are actually being enabled in systemd-importd via setup_machine_directory(), not in systemd-{import,pull} where those environment variables are checked. Therefore, also check them in systemd-importd and avoid enabling quotas if requested by the user. Fixes: #18421 Fixes: #15903 Fixes: #24387
* tree-wide: make constant ratelimit compound actually constLennart Poettering2022-11-221-1/+1
| | | | | | The compiler should recognize that these are constant expressions, but let's better make this explicit, so that the linker can safely share the initializations all over the place.
* copy: Support passing a deny list of files/directories to not copyDaan De Meyer2022-11-101-1/+1
|
* Rename def.h to constants.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
| | | | | | The name "def.h" originates from before the rule of "no needless abbreviations" was established. Let's rename the file to clarify that it contains a collection of various semi-related constants.
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-0811-11/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-084-0/+4
|
* fd-util: rename CLOSE_AND_REPLACE() -> close_and_replace()Yu Watanabe2022-09-172-2/+2
| | | | | | | | We have free_and_replace() and friends, they are all named with lower letters, even they are macros, not functions. For consistency, let's rename CLOSE_AND_REPLACE() with lower letters. This also mekes the macro used more places.
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-135-46/+22
|
* tree-wide: port things dirname_malloc() → path_extract_directory()Lennart Poettering2022-08-231-6/+0
|
* pull: fix PullFlags numberingLudwig Nussel2022-08-041-9/+9
|
* Use https for freedesktop.orgMichael Biebl2022-06-282-2/+2
| | | | grep -l -r http:// | xargs sed -E -i s'#http://(.*).freedesktop.org#https://\1.freedesktop.org#'
* time-util: assume CLOCK_BOOTTIME always existsLennart Poettering2022-03-281-1/+1
| | | | | | | | Let's raise our supported baseline a bit: CLOCK_BOOTTIME started to work with timerfd in kernel 3.15 (i.e. back in 2014), let's require support for it now. This will raise our baseline only modestly from 3.13 → 3.15.
* import: improve error messageLennart Poettering2022-03-151-1/+1
| | | | As suggested: https://github.com/systemd/systemd/pull/20156#discussion_r810941489
* Merge pull request #22092 from keszybz/docs-linksZbigniew Jędrzejewski-Szmek2022-01-121-1/+1
|\ | | | | Add more doc pages, adjust links, add explanatory headers to examples and relax license to CC-0
| * policy files: adjust landing page linkZbigniew Jędrzejewski-Szmek2022-01-121-1/+1
| |
* | meson: Use files() for testsJan Janssen2022-01-111-3/+3
|/ | | | | | Not having to provide the full path in the source tree is much nicer and the produced lists can also be used anywhere in the source tree.
* meson: stop building out convenience libraries by defaultZbigniew Jędrzejewski-Szmek2021-12-161-1/+2
| | | | | | | | | | | | | | | | | The meson default for static_library() are: build_by_default=true, install=false. We never interact with the static libraries, and we only care about them as a stepping-stone towards the installable executables or libraries. Thus let's only build them if they are a dependency of something else we are building. While at it, let's drop install:false, since this appears to be the default. This change would have fixed the issue with lib_import_common failing to build too: we wouldn't attempt to build it. In practice this changes very little, because we generally only declare static libraries where there's something in the default target that will make use of them. But it seems to be a better pattern to set build_by_default to false.
* meson: don't compile import sources four timesZbigniew Jędrzejewski-Szmek2021-12-161-51/+41
| | | | | | | | | | Use a 'convenience library' to do the compilation once and then link the objects into all the files that need it. Those files are small, so this probably doesn't matter too much for speed, but has the advantage that we don't get the same error four times if something goes wrong. The library is conditionalized in the same way importd itself, because we cannot build it without the deps.
* tree-wide: make FOREACH_DIRENT_ALL define the iterator variableZbigniew Jędrzejewski-Szmek2021-12-152-7/+6
| | | | | | | | | The variable is not useful outside of the loop (it'll always be null after the loop is finished), so we can declare it inline in the loop. This saves one variable declaration and reduces the chances that somebody tries to use the variable outside of the loop. For consistency, 'de' is used everywhere for the var name.
* Merge pull request #21170 from keszybz/delibgcryptifyZbigniew Jędrzejewski-Szmek2021-12-032-14/+55
|\ | | | | Allow systemd-resolved and systemd-importd to use libgcrypt or libopenssl
| * import: port importd from libgcrypt to openssl^gcryptZbigniew Jędrzejewski-Szmek2021-11-302-14/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is heavily based on Kevin Kuehler's work, but the logic is also significantly changed: instead of a straighforward port to openssl, both versions of the code are kept, and at compile time we pick one or the other. The code is purposefully kept "dumb" — the idea is that the libgcrypt codepaths are only temporary and will be removed after everybody upgrades to openssl 3. Thus, a separate abstraction layer is not introduced. Instead, very simple ifdefs are used to select one or the other. If we added an abstraction layer, we'd have to remove it again afterwards, and it don't think it makes sense to do that for a temporary solution. Co-authored-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> # Conflicts: # meson.build
* | tree-wide: use ERRNO_IS_TRANSIENT()Yu Watanabe2021-11-301-3/+4
|/
* shared: clean up mkdir.h/label.h situationLennart Poettering2021-11-166-6/+6
| | | | | | | | | | Previously the mkdir_label() family of calls was implemented in src/shared/mkdir-label.c but its functions partly declared ins src/shared/label.h and partly in src/basic/mkdir.h (!!). That's weird (and wrong). Let's clean this up, and add a proper mkdir-label.h matching the .c file.
* tree-wide: use new RET_NERRNO() helper at various placesLennart Poettering2021-11-162-2/+2
|
* tree-wide: always use TAKE_FD() when calling rearrange_stdio()Lennart Poettering2021-11-033-5/+6
| | | | | | | | | | | | rearrange_stdio() invalidates specified fds even on failure, which means we should always invalidate the fds we pass in no matter what. Let's make this explicit by using TAKE_FD() for that everywhere. Note that in many places we such invalidation doesnt get us much behaviour-wise, since we don't use the variables anymore later. But TAKE_FD() in a way is also documentation, it encodes explicitly that the fds are invalidated here, so I think it's a good thing to always make this explicit here.
* tree-wide: port more code to sigkill_wait()Lennart Poettering2021-11-034-16/+8
|
* tree-wide: port various places to use TAKE_PID()Lennart Poettering2021-11-034-8/+4
|
* basic: split out sync() family of calls from fs-util.[ch] into new c/h fileLennart Poettering2021-10-051-1/+1
| | | | No changes in code, just some splitting out.
* import-fs: create paren dirs in --direct mode tooLennart Poettering2021-08-201-1/+2
| | | | There's no reason not to create these in advance if they are missing.
* import: don't attempt full-file clones if we only are supposed to write a ↵Lennart Poettering2021-08-201-0/+3
| | | | | | part of the file Otherwise we'll copy more than we were told to.