]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
condition: introduce condition_takes_path()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 29 Dec 2017 08:04:23 +0000 (17:04 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 1 Jan 2018 17:23:26 +0000 (02:23 +0900)
The function will be used in later commits.

src/shared/condition.h

index 98af2daaeeee6ba37d6556decfd87b23d2aaba6f..a84d993370a94fa46e1d7484529996feb3e3470a 100644 (file)
@@ -99,3 +99,17 @@ ConditionType assert_type_from_string(const char *s) _pure_;
 
 const char* condition_result_to_string(ConditionResult r) _const_;
 ConditionResult condition_result_from_string(const char *s) _pure_;
+
+static inline bool condition_takes_path(ConditionType t) {
+        return IN_SET(t,
+                      CONDITION_PATH_EXISTS,
+                      CONDITION_PATH_EXISTS_GLOB,
+                      CONDITION_PATH_IS_DIRECTORY,
+                      CONDITION_PATH_IS_SYMBOLIC_LINK,
+                      CONDITION_PATH_IS_MOUNT_POINT,
+                      CONDITION_PATH_IS_READ_WRITE,
+                      CONDITION_DIRECTORY_NOT_EMPTY,
+                      CONDITION_FILE_NOT_EMPTY,
+                      CONDITION_FILE_IS_EXECUTABLE,
+                      CONDITION_NEEDS_UPDATE);
+}