Merge shared/exec-directory-util.? into basic/unit-def.?
Suggested in https://github.com/systemd/systemd/pull/35892#discussion_r2180322856. This is a tiny amount of code and does not warrant having a separate file and spawning a separate instance of the compiler during the build. Note: it took me a while to confirm that the contents of that table and function don't end up in libsystemd.so. The issue is that they _are_ present in it, unless LTO is used. We actually use link_whole[libbasic_static] for libsystemd, so we end up with all that code there. LTO is needed to clean that up.
This commit is contained in:
@@ -361,6 +361,17 @@ static const char* const job_mode_table[_JOB_MODE_MAX] = {
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(job_mode, JobMode);
|
||||
|
||||
/* 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",
|
||||
[EXEC_DIRECTORY_CACHE] = "CacheDirectory",
|
||||
[EXEC_DIRECTORY_LOGS] = "LogsDirectory",
|
||||
[EXEC_DIRECTORY_CONFIGURATION] = "ConfigurationDirectory",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(exec_directory_type, ExecDirectoryType);
|
||||
|
||||
Glyph unit_active_state_to_glyph(UnitActiveState state) {
|
||||
static const Glyph map[_UNIT_ACTIVE_STATE_MAX] = {
|
||||
[UNIT_ACTIVE] = GLYPH_BLACK_CIRCLE,
|
||||
|
||||
@@ -296,6 +296,16 @@ typedef enum JobMode {
|
||||
_JOB_MODE_INVALID = -EINVAL,
|
||||
} JobMode;
|
||||
|
||||
typedef enum ExecDirectoryType {
|
||||
EXEC_DIRECTORY_RUNTIME,
|
||||
EXEC_DIRECTORY_STATE,
|
||||
EXEC_DIRECTORY_CACHE,
|
||||
EXEC_DIRECTORY_LOGS,
|
||||
EXEC_DIRECTORY_CONFIGURATION,
|
||||
_EXEC_DIRECTORY_TYPE_MAX,
|
||||
_EXEC_DIRECTORY_TYPE_INVALID = -EINVAL,
|
||||
} ExecDirectoryType;
|
||||
|
||||
char* unit_dbus_path_from_name(const char *name);
|
||||
int unit_name_from_dbus_path(const char *path, char **name);
|
||||
|
||||
@@ -361,4 +371,7 @@ NotifyAccess notify_access_from_string(const char *s) _pure_;
|
||||
const char* job_mode_to_string(JobMode t) _const_;
|
||||
JobMode job_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_;
|
||||
|
||||
Glyph unit_active_state_to_glyph(UnitActiveState state);
|
||||
|
||||
Reference in New Issue
Block a user