diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-06-25 11:31:57 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-07-11 12:18:51 +0200 |
commit | 6b7b2ed96b443be7076d599c43b719a608829a67 (patch) | |
tree | 74e5928d182708387ac5103eae4b2b52557fdf15 /src | |
parent | 89f6fe7b303875307e201449d9d821cdbb9eacac (diff) | |
download | systemd-6b7b2ed96b443be7076d599c43b719a608829a67.tar.gz systemd-6b7b2ed96b443be7076d599c43b719a608829a67.tar.bz2 systemd-6b7b2ed96b443be7076d599c43b719a608829a67.zip |
core: add type of resource string table
Diffstat (limited to 'src')
-rw-r--r-- | src/core/execute.c | 16 | ||||
-rw-r--r-- | src/core/execute.h | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 623c86a68e..36a6641421 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -5503,6 +5503,7 @@ static const char* const exec_preserve_mode_table[_EXEC_PRESERVE_MODE_MAX] = { DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(exec_preserve_mode, ExecPreserveMode, EXEC_PRESERVE_YES); +/* This table maps ExecDirectoryType to the setting it is configured with in the unit */ static const char* const exec_directory_type_table[_EXEC_DIRECTORY_TYPE_MAX] = { [EXEC_DIRECTORY_RUNTIME] = "RuntimeDirectory", [EXEC_DIRECTORY_STATE] = "StateDirectory", @@ -5513,6 +5514,21 @@ static const char* const exec_directory_type_table[_EXEC_DIRECTORY_TYPE_MAX] = { DEFINE_STRING_TABLE_LOOKUP(exec_directory_type, ExecDirectoryType); +/* And this table maps ExecDirectoryType too, but to a generic term identifying the type of resource. This + * one is supposed to be generic enough to be used for unit types that don't use ExecContext and per-unit + * directories, specifically .timer units with their timestamp touch file. */ +static const char* const exec_resource_type_table[_EXEC_DIRECTORY_TYPE_MAX] = { + [EXEC_DIRECTORY_RUNTIME] = "runtime", + [EXEC_DIRECTORY_STATE] = "state", + [EXEC_DIRECTORY_CACHE] = "cache", + [EXEC_DIRECTORY_LOGS] = "logs", + [EXEC_DIRECTORY_CONFIGURATION] = "configuration", +}; + +DEFINE_STRING_TABLE_LOOKUP(exec_resource_type, ExecDirectoryType); + +/* And this table also maps ExecDirectoryType, to the environment variable we pass the selected directory to + * the service payload in. */ static const char* const exec_directory_env_name_table[_EXEC_DIRECTORY_TYPE_MAX] = { [EXEC_DIRECTORY_RUNTIME] = "RUNTIME_DIRECTORY", [EXEC_DIRECTORY_STATE] = "STATE_DIRECTORY", diff --git a/src/core/execute.h b/src/core/execute.h index 91595c7f6b..0d5398acfa 100644 --- a/src/core/execute.h +++ b/src/core/execute.h @@ -417,3 +417,6 @@ ExecKeyringMode exec_keyring_mode_from_string(const char *s) _pure_; const char* exec_directory_type_to_string(ExecDirectoryType i) _const_; ExecDirectoryType exec_directory_type_from_string(const char *s) _pure_; + +const char* exec_resource_type_to_string(ExecDirectoryType i) _const_; +ExecDirectoryType exec_resource_type_from_string(const char *s) _pure_; |