From 1c2e9646e4a1720fc8ad35c705c195ae1a2c5ce0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 30 Apr 2015 01:29:00 +0200 Subject: core: simplify unit type detection logic Introduce a new call unit_type_supported() and make use of it everywhere. Also, drop Manager parameter from per-type supported method prototype. --- src/core/unit.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/core/unit.h') diff --git a/src/core/unit.h b/src/core/unit.h index 1a44271bc6..31b12157c2 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -402,7 +402,7 @@ struct UnitVTable { /* If this function is set and return false all jobs for units * of this type will immediately fail. */ - bool (*supported)(Manager *m); + bool (*supported)(void); /* The interface name */ const char *bus_interface; @@ -601,6 +601,12 @@ int unit_make_transient(Unit *u); int unit_require_mounts_for(Unit *u, const char *path); +bool unit_type_supported(UnitType t); + +static inline bool unit_supported(Unit *u) { + return unit_type_supported(u->type); +} + const char *unit_active_state_to_string(UnitActiveState i) _const_; UnitActiveState unit_active_state_from_string(const char *s) _pure_; -- cgit v1.2.3-54-g00ecf