diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-04-29 14:26:07 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-04-30 10:52:07 +0200 |
commit | 7c8fa05c4d5d01748ff2a04edb882afb3119b7d7 (patch) | |
tree | a3dc4d052ac25915fa0b23bf695891d5989aff7e /src/core/load-fragment.c | |
parent | a8ad0f89286b878cbe1f330f72abd2d22813f8ea (diff) |
unit: add new dependency type RequiresMountsFor=
RequiresMountsFor= is a shortcut for adding requires and after
dependencies to all mount units neeed for the specified paths.
This solves a couple of issues regarding dep loop cycles for encrypted
swap.
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r-- | src/core/load-fragment.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 1665be82a0..d24919f998 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -2032,6 +2032,35 @@ int config_parse_unit_blkio_bandwidth(const char *filename, unsigned line, const return 0; } +int config_parse_unit_requires_mounts_for( + const char *filename, + unsigned line, + const char *section, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + + Unit *u = userdata; + int r; + bool empty_before; + + assert(filename); + assert(lvalue); + assert(rvalue); + assert(data); + + empty_before = !u->requires_mounts_for; + + r = config_parse_path_strv(filename, line, section, lvalue, ltype, rvalue, data, userdata); + + /* Make it easy to find units with requires_mounts set */ + if (empty_before && u->requires_mounts_for) + LIST_PREPEND(Unit, has_requires_mounts_for, u->manager->has_requires_mounts_for, u); + + return r; +} #define FOLLOW_MAX 8 @@ -2394,6 +2423,7 @@ void unit_dump_config_items(FILE *f) { { config_parse_socket_bindtodevice, "NETWORKINTERFACE" }, { config_parse_usec, "SECONDS" }, { config_parse_path_strv, "PATH [...]" }, + { config_parse_unit_requires_mounts_for, "PATH [...]" }, { config_parse_exec_mount_flags, "MOUNTFLAG [...]" }, { config_parse_unit_string_printf, "STRING" }, { config_parse_timer, "TIMER" }, |