summaryrefslogtreecommitdiffstats
path: root/src/import/import-fs.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* terminal-util: split out color macros/helpers into its own headerLennart Poettering2024-07-191-0/+1
| | | | | | | | | This is a lot of stuff, and sometimes quite wild, let's turn this into its own header. All stuff color-related that just generates sequences is now in ansi-color.h (no .c file!), and everything more complex that probes/ineracts with terminals remains in termina-util.[ch]
* import: mention explicitly which image directory we operate onLennart Poettering2024-03-011-0/+2
| | | | | Also, let's move the similar message about sync() mode to more common code.
* importd: validate local image names with the right helperLennart Poettering2024-03-011-1/+1
| | | | | | | | A while back we introduced image_name_is_valid() for validating image file names. It's more liberal than hostname_is_valid() in many ways (and allows version suffixes and such). Since importd deals in offline images (as opposed to machined otherwise which deals in running machines), let's hence use the right helper to validate the identifiers.
* importd: add support for downloading sysext/confext/portable images tooLennart Poettering2024-03-011-3/+18
| | | | | | | | | | | | | This adds "Ex" versions of all bus calls import implements, that make two changes: 1. A "class" parameter is added that allows choosing between machine/sysext/confext/portable images to download. Depending on the chose class the target directory is selected differently (i.e. not just /var/lib/machines/, but alternatively /var/lib/portables/, /var/lib/extensions/, /var/lib/confexts/. 2. The boolean flags are replaced by a 64bit flags parameter.
* importd: trivial modernizationsLennart Poettering2024-03-011-2/+1
|
* btrfs-util: Add btrfs_subvol_snapshot_at()Daan De Meyer2023-06-061-3/+3
|
* copy: Merge copy_directory() and copy_directory_fd() into copy_directory_at()Daan De Meyer2023-06-061-3/+3
| | | | | Let's merge these two into a single function that can handle both variants and more.
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | | | | | | | | | | | | | -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.
* 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.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-0/+1
|
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-5/+2
|
* shared: clean up mkdir.h/label.h situationLennart Poettering2021-11-161-1/+1
| | | | | | | | | | 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.
* 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-fs: make various options controllable via cmdline/env varLennart Poettering2021-08-171-97/+165
| | | | | | | | | This basically does what the previous two commits did for systemd-import + systemd-pull but for systemd-import-fs. This commit is a bit simpler though, as a --direct mode doesn't change that much. It's mostly about not searching for existing, conflicting images and not much else.
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* tree-wide: add FORMAT_BYTES()Zbigniew Jędrzejewski-Szmek2021-07-091-5/+2
|
* shared: rename machine-image.[ch] → discover-image.[ch]Lennart Poettering2021-02-031-1/+1
| | | | | | | | | | The old name originates when this was used to discover "machine" images, as managed by machined/machinectl. But nowadays this is also used by portable services and system extensions, hence let's use a more generic name for this API. Taking inspiration from "dissect-image.[ch]", let's call this "discover-image.[ch]". This is pure renaming, no other changes.
* import: set up btrfs qgroups on correct hierarchyLennart Poettering2021-01-221-0/+1
| | | | | Also, simplify import_assign_pool_quota_and_warn(), don't do the same thing twice. Let's just allow the caller call this twice.
* machine-image: properly support searching for images below some --root= pathLennart Poettering2021-01-191-1/+1
| | | | | systemd-sysext supports --root= for everything but the image discovery. Fix that.
* hostname-util: flagsify hostname_is_valid(), drop machine_name_is_valid()Lennart Poettering2020-12-151-1/+1
| | | | | | | | | | | | Let's clean up hostname_is_valid() a bit: let's turn the second boolean argument into a more explanatory flags field, and add a flag that accepts the special name ".host" as valid. This is useful for the container logic, where the special hostname ".host" refers to the "root container", i.e. the host system itself, and can be specified at various places. let's also get rid of machine_name_is_valid(). It was just an alias, which is confusing and even more so now that we have the flags param.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* tree-wide: assorted coccinelle fixesFrantisek Sumsal2020-10-091-6/+7
|
* tree-wide: Replace assert() by assert_se() when there is side effectBenjamin Robin2020-05-101-2/+2
|
* tree-wide: Fix, replace assert() by assert_se() when there is side effectBenjamin Robin2020-05-061-2/+2
|
* Drop RATELIMIT macrosZbigniew Jędrzejewski-Szmek2019-09-201-1/+1
| | | | | Using plain structure initialization is both shorter _and_ more clearer. We get type safety for free.
* tree-wide: replace strjoina() with prefix_roota()Yu Watanabe2019-06-241-1/+1
|
* util: introduce format_bytes_full()Yu Watanabe2019-06-191-1/+1
| | | | And move it into format-util.c.
* basic: add new helper call empty_or_dash_to_null()Lennart Poettering2019-04-081-4/+2
| | | | | We have a function like this at two places already. Let's unify it in one generic location and let's port a number of users over.
* tree-wide: introduce empty_or_dash() helperLennart Poettering2019-04-081-2/+2
| | | | | At quite a few places we check isempty() || streq(…, "-"), let's add a helper to simplify that, and replace that by a single function call.
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-0/+1
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* util-lib: split out all temporary file related calls into tmpfiles-util.cLennart Poettering2018-12-021-2/+2
| | | | | | | | This splits out a bunch of functions from fileio.c that have to do with temporary files. Simply to make the header files a bit shorter, and to group things more nicely. No code changes, just some rearranging of source files.
* import: rerrange tarball/fs imports that have a single top-level directory ↵Lennart Poettering2018-11-261-0/+4
| | | | | | | | | | containing the OS tree Let's handle tarball imports nicer that have a single top-level directory containing the OS tree: let's move everything down during import, so that the OS tree is ready to use automatically. Fixes: #2116
* machine: add support for importing containers from plain directoriesLennart Poettering2018-11-261-0/+323
Fixes: #2728 This is also supposed to be preparation for doing #10234 eventually, where a very similar operation is requested: instead of importing a tree to /var/lib/machines it would need to be imported into /var/lib/portables/.