diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-05-28 09:28:28 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-05-28 23:54:35 +0200 |
commit | ccdf03b9c72bada6a9da49ce3597ed5eac88cab8 (patch) | |
tree | e2e0ae329a808eb5c672e99e9d8ccdbfb319aae4 /src/libsystemd/sd-path | |
parent | 4a56315a990b802860170ecd1bbd3eb68e14a38b (diff) | |
download | systemd-ccdf03b9c72bada6a9da49ce3597ed5eac88cab8.tar.gz |
sd-path: drop "-dir" and "-path" suffixes from path enums
Clean up the naming of the sd-path enums. Previously, the more recently
added fields where named in the form SD_PATH_xyz_DIR and
SD_PATH_xyz_PATH, while the older fields where called just SD_PATH_xyz
and SD_PATH_SEARCH_xyz. Let's clean this up, to come to a more unified
way how we name this stuff.
I opted to stick to the old naming, i.e. dropthe suffixes. It's a bit of
a bike-shedding question of course, but I think there's a good reason to
avoid the additional DIR and PATH suffixes: the enum prefix contains
"PATH" anyway (i.e. "SD_PATH_"), so including PATH twice in each name is
redundant. Moreover, the key difference between the enums with the "dir"
and the "path" in the name is that the latter are *seach* paths, and I
think this is better emphasized by sticking to the "SEARCH" in the name.
Moreover dropping the suffixes makes the identifiers a lot shorter, in
particular in the "systemd-path" list output. And that's always good.
This means the naming pkgconfig file and in sd-path slightly deviate
(though the mapping is very simple), but I think that's OK, given that
this is developer facing and not user facing.
Diffstat (limited to 'src/libsystemd/sd-path')
-rw-r--r-- | src/libsystemd/sd-path/sd-path.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c index ea8e167128..736795d1d7 100644 --- a/src/libsystemd/sd-path/sd-path.c +++ b/src/libsystemd/sd-path/sd-path.c @@ -320,73 +320,73 @@ static int get_path(uint64_t type, char **buffer, const char **ret) { case SD_PATH_USER_DESKTOP: return from_user_dir("XDG_DESKTOP_DIR", buffer, ret); - case SD_PATH_SYSTEMD_UTIL_DIR: + case SD_PATH_SYSTEMD_UTIL: *ret = ROOTPREFIX "/lib/systemd"; return 0; - case SD_PATH_SYSTEMD_SYSTEM_UNIT_DIR: + case SD_PATH_SYSTEMD_SYSTEM_UNIT: *ret = SYSTEM_DATA_UNIT_PATH; return 0; - case SD_PATH_SYSTEMD_SYSTEM_PRESET_DIR: + case SD_PATH_SYSTEMD_SYSTEM_PRESET: *ret = ROOTPREFIX "/lib/systemd/system-preset"; return 0; - case SD_PATH_SYSTEMD_USER_UNIT_DIR: + case SD_PATH_SYSTEMD_USER_UNIT: *ret = USER_DATA_UNIT_DIR; return 0; - case SD_PATH_SYSTEMD_USER_PRESET_DIR: + case SD_PATH_SYSTEMD_USER_PRESET: *ret = ROOTPREFIX "/lib/systemd/user-preset"; return 0; - case SD_PATH_SYSTEMD_SYSTEM_CONF_DIR: + case SD_PATH_SYSTEMD_SYSTEM_CONF: *ret = SYSTEM_CONFIG_UNIT_DIR; return 0; - case SD_PATH_SYSTEMD_USER_CONF_DIR: + case SD_PATH_SYSTEMD_USER_CONF: *ret = USER_CONFIG_UNIT_DIR; return 0; - case SD_PATH_SYSTEMD_SYSTEM_GENERATOR_DIR: + case SD_PATH_SYSTEMD_SYSTEM_GENERATOR: *ret = SYSTEM_GENERATOR_DIR; return 0; - case SD_PATH_SYSTEMD_USER_GENERATOR_DIR: + case SD_PATH_SYSTEMD_USER_GENERATOR: *ret = USER_GENERATOR_DIR; return 0; - case SD_PATH_SYSTEMD_SLEEP_DIR: + case SD_PATH_SYSTEMD_SLEEP: *ret = ROOTPREFIX "/lib/systemd/system-sleep"; return 0; - case SD_PATH_SYSTEMD_SHUTDOWN_DIR: + case SD_PATH_SYSTEMD_SHUTDOWN: *ret = ROOTPREFIX "/lib/systemd/system-shutdown"; return 0; /* FIXME: systemd.pc uses ${prefix}, but CONF_PATHS_NULSTR doesn't. * Should ${prefix} use in systemd.pc be removed? */ - case SD_PATH_TMPFILES_DIR: + case SD_PATH_TMPFILES: *ret = "/usr/lib/tmpfiles.d"; return 0; - case SD_PATH_SYSUSERS_DIR: + case SD_PATH_SYSUSERS: *ret = ROOTPREFIX "/lib/sysusers.d"; return 0; - case SD_PATH_SYSCTL_DIR: + case SD_PATH_SYSCTL: *ret = ROOTPREFIX "/lib/sysctl.d"; return 0; - case SD_PATH_BINFMT_DIR: + case SD_PATH_BINFMT: *ret = ROOTPREFIX "/lib/binfmt.d"; return 0; - case SD_PATH_MODULES_LOAD_DIR: + case SD_PATH_MODULES_LOAD: *ret = ROOTPREFIX "/lib/modules-load.d"; return 0; - case SD_PATH_CATALOG_DIR: + case SD_PATH_CATALOG: *ret = "/usr/lib/systemd/catalog"; return 0; } @@ -607,10 +607,10 @@ static int get_search(uint64_t type, char ***list) { case SD_PATH_SEARCH_BINARIES_DEFAULT: return strv_from_nulstr(list, DEFAULT_PATH_NULSTR); - case SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH: - case SD_PATH_SYSTEMD_USER_UNIT_PATH: { + case SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT: + case SD_PATH_SYSTEMD_SEARCH_USER_UNIT: { _cleanup_(lookup_paths_free) LookupPaths lp = {}; - const UnitFileScope scope = type == SD_PATH_SYSTEMD_SYSTEM_UNIT_PATH ? + const UnitFileScope scope = type == SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT ? UNIT_FILE_SYSTEM : UNIT_FILE_USER; r = lookup_paths_init(&lp, scope, 0, NULL); @@ -621,10 +621,10 @@ static int get_search(uint64_t type, char ***list) { return 0; } - case SD_PATH_SYSTEMD_SYSTEM_GENERATOR_PATH: - case SD_PATH_SYSTEMD_USER_GENERATOR_PATH: { + case SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR: + case SD_PATH_SYSTEMD_SEARCH_USER_GENERATOR: { char **t; - const UnitFileScope scope = type == SD_PATH_SYSTEMD_SYSTEM_GENERATOR_PATH ? + const UnitFileScope scope = type == SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR ? UNIT_FILE_SYSTEM : UNIT_FILE_USER; t = generator_binary_paths(scope); @@ -635,7 +635,7 @@ static int get_search(uint64_t type, char ***list) { return 0; } - case SD_PATH_SYSTEMD_NETWORK_PATH: + case SD_PATH_SYSTEMD_SEARCH_NETWORK: return strv_from_nulstr(list, NETWORK_DIRS_NULSTR); } |