summaryrefslogtreecommitdiff
path: root/src/machine/machined-dbus.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: introduce PIPE_EBADF macroYu Watanabe2022-12-201-1/+1
|
* tree-wide: use -EBADF also in pipe initializersZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | In some places, initialization is dropped when unnecesary.
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-5/+5
| | | | | | | | | | | | | | | | -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.
* machine: propagate error from machine_newDavid Tardon2022-12-141-3/+4
|
* import: wire up SYSTEMD_IMPORT_BTRFS_{SUBVOL,QUOTA} to importdIvan Shapovalov2022-12-031-1/+1
| | | | | | | | | | | 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: use ASSERT_PTR moreDavid Tardon2022-09-131-22/+11
|
* machinectl: Add plumbing for a `--force` flag for file copyAlexander Wilson2022-07-271-0/+10
| | | | | | machine: Add APIs CopyTo[Machine]WithFlags + CopyFrom[Machine]WithFlags - Same API to those without `WithFlags` (except this can take flags) - Initially, only a flag to allow replacing a file if it already exists
* machine: update to use new-style sd-bus macros (#23012)Amarjargal2022-04-081-304/+188
| | | | | | | | | | * machine: update to use new-style sd-bus macros Replace old SD_BUS_METHOD_WITH_NAMES and SD_BUS_SIGNAL_WITH_NAMES macros to the new SD_BUS_METHOD_WITH_ARGS and SD_BUS_SIGNAL_WITH_ARGS macros. Meson test, mkosi test image and running machinectl after build returned no error. But since I don't have any virtual machines or containers, I'm not sure how to test the changes thoroughly.
* machined: provide more details to polkit authLudwig Nussel2022-01-181-2/+13
|
* tree-wide: sd_bus_error_setf → set_bus_error_setZbigniew Jędrzejewski-Szmek2021-04-071-10/+10
| | | | strdup() is more efficient than asprintf().
* tree-wide: use UINT64_MAX or friendsYu Watanabe2021-03-051-2/+2
|
* Move os-util.[ch] to basic/Zbigniew Jędrzejewski-Szmek2021-02-221-0/+1
| | | | parse_os_release() will be used basic/hostname-util.c later on.
* 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.
* machine-image: properly support searching for images below some --root= pathLennart Poettering2021-01-191-4/+4
| | | | | systemd-sysext supports --root= for everything but the image discovery. Fix that.
* machine: machined-dbus - tighten variable scope used in loopSusant Sahani2021-01-171-3/+1
|
* 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: define iterator inside of the macroZbigniew Jędrzejewski-Szmek2020-09-081-8/+4
|
* tree-wide: use sd_bus_error_has_names() in more placesZbigniew Jędrzejewski-Szmek2020-08-241-8/+8
|
* machined: refactor UID/GID machine translationLennart Poettering2020-07-141-168/+42
| | | | | | | Let's move the heavy lifting out of the bus call implemntations, and into generic code. This allows us to expose them easily via Varlink too in a later commit.
* shared: split out property get helpersLennart Poettering2020-06-301-0/+1
| | | | No code changes, just some refactoring.
* shared: actually move all BusLocator related calls to bus-locator.cLennart Poettering2020-06-301-1/+1
|
* machine: switch to BusLocator-oriented helpersVito Caputo2020-05-071-28/+3
| | | | Mechanical substitution reducing some verbosity
* tree-wide: Mark as _unused_ variables that are only used in assert()Benjamin Robin2020-05-061-2/+2
| | | | Allow to build without any warning with NDEBUG defined
* machined: convert to the new scheme and add --bus-introspectZbigniew Jędrzejewski-Szmek2020-05-051-0/+8
|
* machined: add dbus parameter namesZbigniew Jędrzejewski-Szmek2020-04-121-39/+307
|
* *: convert amenable fdopen calls to take_fdopenVito Caputo2020-03-311-3/+1
| | | | | Mechanical change to eliminate some cruft by using the new take_fdopen{_unlocked}() wrappers where trivial.
* shared: split out polkit stuff from bus-util.c → bus-polkit.cLennart Poettering2020-01-221-0/+1
| | | | | | It's enough, complex stuff to warrant its own source file. No other changes, just splitting out.
* machine: make machine_start_scope() staticZbigniew Jędrzejewski-Szmek2019-11-221-92/+0
| | | | | | Having this function which is called only from one place in a separate file makes the code harder to follow. In preparation for subsequent changes, let's make it static.
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-041-1/+0
|
* machined: add UnregisterMachine methodZbigniew Jędrzejewski-Szmek2019-10-291-0/+5
| | | | | | This is the opposite of RegisterMachine: machined knows that the machine is "gone", but doesn't do anything on its own. We already had TerminateMachine, but that would stop the unit, which isn't always wanted.
* tree-wide: make use of errno_or_else() everywhereLennart Poettering2019-07-111-10/+11
|
* fileio: replace read_nul_string() by read_line() with a special flagLennart Poettering2018-12-181-4/+4
| | | | | | | read_line() is a lot more careful and optimized than read_nul_string() but does mostly the same thing. let's replace the latter by the former, just with a special flag that toggles between the slightly different EOL rules if both.
* tree-wide: Remove O_CLOEXEC from fdopenChris Down2018-12-121-1/+1
| | | | | | | | | | | | fdopen doesn't accept "e", it's ignored. Let's not mislead people into believing that it actually sets O_CLOEXEC. From `man 3 fdopen`: > e (since glibc 2.7): > Open the file with the O_CLOEXEC flag. See open(2) for more information. This flag is ignored for fdopen() As mentioned by @jlebon in #11131.
* lockfile: drop unnecessary headers from lockfile-util.hYu Watanabe2018-12-061-0/+1
|
* Merge pull request #10920 from yuwata/hashmap-destructorLennart Poettering2018-12-031-4/+4
|\ | | | | hashmap: make hashmap_free() call destructors of key or value
| * machine-image: introduce image_hash_ops and use itYu Watanabe2018-12-021-4/+4
| |
* | util-lib: split out all temporary file related calls into tmpfiles-util.cLennart Poettering2018-12-021-0/+1
|/ | | | | | | | 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: drop logic of setting up /var/lib/machines as btrfs loopback mountLennart Poettering2018-11-261-30/+1
| | | | | | | | | | | | | | | | | | | Let's simplify things and drop the logic that /var/lib/machines is setup as auto-growing btrfs loopback file /var/lib/machines.raw. THis was done in order to make quota available for machine management, but quite frankly never really worked properly, as we couldn't grow the file system in sync with its use properly. Moreover philosophically it's problematic overriding the admin's choice of file system like this. Let's hence drop this, and simplify things. Deleting code is a good feeling. Now that regular file systems provide project quota we could probably add per-machine quota support based on that, hence the btrfs quota argument is not that interesting anymore (though btrfs quota is a bit more powerful as it allows recursive quota, i.e. that the machine pool gets an overall quota in addition to per-machine quota).
* machined: rework referencing of machine scopes from machined, tooLennart Poettering2018-11-091-9/+26
| | | | | | | | When a machine scope is registered by machined, let's add a reference to it, and change the GC mode so that the unit is cleaned up as soon as machined drops the reference, regardless of the fail state. Fixes: #2809
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* machine: ignore containers which disable private user namespace in ↵Yu Watanabe2018-06-131-0/+8
| | | | | | MapToMachine{User,Group} Fixes #9286.
* machined: move bus_reply_pair_array() into generic utilitiesLennart Poettering2018-05-241-27/+0
| | | | This way, we can reuse it in portabled.
* machined: unify how we forward image method calls from manager to image objectLennart Poettering2018-05-241-171/+17
| | | | | Much like the previous commit, but for Image objects rather than Machine objects.
* machined: introduce a common function for redirecting machine method calls ↵Lennart Poettering2018-05-241-174/+17
| | | | | | | | from manager to machine object Let's shorten the code a bit, and unify how we forward executoin from the machine functions that take a machine name as first argument to the matching functions on the machine object.
* machine-image: rework error handlingLennart Poettering2018-05-241-19/+19
| | | | | | | | | | | Let's rework error handling a bit in image_find() and friends: when we can't find an image, return -ENOENT rather than 0. That's better as before we violated the usual rule in our codebase that return parameters are initialized when the return value is >= 0 and otherwise not touched. This also makes enumeration and validation a bit more strict: we'll only accept ".raw" as suffix for regular files, and filter out this suffix handling on directories/subvolumes, where it makes no sense.
* machine-image: introduce two different classes of imagesLennart Poettering2018-05-241-12/+12
| | | | | | | | | | This distuingishes two different classes of images, one for the purpose of npsawn-like containers, i.e. "machines", and one for portable services. This distinction is mostly about search paths. We look for machine images in /var/lib/machines and for portable images in /var/lib/portables.
* machine: use BUS_DEFINE_PROPERTY_GET* macrosYu Watanabe2018-05-151-14/+1
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.