X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Funit-name.h;h=daeb56a860d8b0cd1b4c883a118a42347e15da75;hp=20138df0897b5e218a00b710c3eedd7849f05faa;hb=cb87a73b45503eaa6bead291423a529b00d27156;hpb=fb6becb4436ae4078337011b2017ce294e7361cf diff --git a/src/shared/unit-name.h b/src/shared/unit-name.h index 20138df08..daeb56a86 100644 --- a/src/shared/unit-name.h +++ b/src/shared/unit-name.h @@ -29,17 +29,19 @@ typedef enum UnitType UnitType; typedef enum UnitLoadState UnitLoadState; +typedef enum UnitDependency UnitDependency; enum UnitType { UNIT_SERVICE = 0, UNIT_SOCKET, + UNIT_BUSNAME, UNIT_TARGET, + UNIT_SNAPSHOT, UNIT_DEVICE, UNIT_MOUNT, UNIT_AUTOMOUNT, - UNIT_SNAPSHOT, - UNIT_TIMER, UNIT_SWAP, + UNIT_TIMER, UNIT_PATH, UNIT_SLICE, UNIT_SCOPE, @@ -58,6 +60,53 @@ enum UnitLoadState { _UNIT_LOAD_STATE_INVALID = -1 }; +enum UnitDependency { + /* Positive dependencies */ + UNIT_REQUIRES, + UNIT_REQUIRES_OVERRIDABLE, + UNIT_REQUISITE, + UNIT_REQUISITE_OVERRIDABLE, + UNIT_WANTS, + UNIT_BINDS_TO, + UNIT_PART_OF, + + /* Inverse of the above */ + UNIT_REQUIRED_BY, /* inverse of 'requires' and 'requisite' is 'required_by' */ + UNIT_REQUIRED_BY_OVERRIDABLE, /* inverse of 'requires_overridable' and 'requisite_overridable' is 'soft_required_by' */ + UNIT_WANTED_BY, /* inverse of 'wants' */ + UNIT_BOUND_BY, /* inverse of 'binds_to' */ + UNIT_CONSISTS_OF, /* inverse of 'part_of' */ + + /* Negative dependencies */ + UNIT_CONFLICTS, /* inverse of 'conflicts' is 'conflicted_by' */ + UNIT_CONFLICTED_BY, + + /* Order */ + UNIT_BEFORE, /* inverse of 'before' is 'after' and vice versa */ + UNIT_AFTER, + + /* On Failure */ + UNIT_ON_FAILURE, + + /* Triggers (i.e. a socket triggers a service) */ + UNIT_TRIGGERS, + UNIT_TRIGGERED_BY, + + /* Propagate reloads */ + UNIT_PROPAGATES_RELOAD_TO, + UNIT_RELOAD_PROPAGATED_FROM, + + /* Joins namespace of */ + UNIT_JOINS_NAMESPACE_OF, + + /* Reference information for GC logic */ + UNIT_REFERENCES, /* Inverse of 'references' is 'referenced_by' */ + UNIT_REFERENCED_BY, + + _UNIT_DEPENDENCY_MAX, + _UNIT_DEPENDENCY_INVALID = -1 +}; + const char *unit_type_to_string(UnitType i) _const_; UnitType unit_type_from_string(const char *s) _pure_; @@ -68,7 +117,12 @@ int unit_name_to_instance(const char *n, char **instance); char* unit_name_to_prefix(const char *n); char* unit_name_to_prefix_and_instance(const char *n); -bool unit_name_is_valid(const char *n, bool template_ok) _pure_; +enum template_valid { + TEMPLATE_INVALID, + TEMPLATE_VALID, +}; + +bool unit_name_is_valid(const char *n, enum template_valid template_ok) _pure_; bool unit_prefix_is_valid(const char *p) _pure_; bool unit_instance_is_valid(const char *i) _pure_; @@ -97,7 +151,15 @@ char *unit_name_to_path(const char *name); char *unit_dbus_path_from_name(const char *name); int unit_name_from_dbus_path(const char *path, char **name); -char *unit_name_mangle(const char *name); -char *unit_name_mangle_with_suffix(const char *name, const char *suffix); +enum unit_name_mangle { + MANGLE_NOGLOB, + MANGLE_GLOB, +}; + +char *unit_name_mangle(const char *name, enum unit_name_mangle allow_globs); +char *unit_name_mangle_with_suffix(const char *name, enum unit_name_mangle allow_globs, const char *suffix); int build_subslice(const char *slice, const char*name, char **subslice); + +const char *unit_dependency_to_string(UnitDependency i) _const_; +UnitDependency unit_dependency_from_string(const char *s) _pure_;