summaryrefslogtreecommitdiffstats
path: root/src/shared/specifier.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-29 15:55:59 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-03-29 16:17:57 +0200
commitb380b6438361e39ad5076bfa58d2021621a957af (patch)
tree41ef3c9738a5989af15ce0a3626a966716ef9d1f /src/shared/specifier.c
parenttest-systemctl-enable: disable the test for %a for now (diff)
downloadsystemd-b380b6438361e39ad5076bfa58d2021621a957af.tar.xz
systemd-b380b6438361e39ad5076bfa58d2021621a957af.zip
Rename UnitFileScope to LookupScope
As suggested in https://github.com/systemd/systemd/pull/22649/commits/8b3ad3983f5440eef812b34e5ed862ca59fdf7f7#r837345892 The define is generalized and moved to path-lookup.h, where it seems to fit better. This allows a recursive include to be removed and in general makes things simpler.
Diffstat (limited to 'src/shared/specifier.c')
-rw-r--r--src/shared/specifier.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/shared/specifier.c b/src/shared/specifier.c
index 777881b325..16eb8830dc 100644
--- a/src/shared/specifier.c
+++ b/src/shared/specifier.c
@@ -18,11 +18,11 @@
#include "id128-util.h"
#include "macro.h"
#include "os-util.h"
+#include "path-lookup.h"
#include "path-util.h"
#include "specifier.h"
#include "string-util.h"
#include "strv.h"
-#include "unit-file.h"
#include "user-util.h"
/*
@@ -310,15 +310,15 @@ int specifier_os_image_version(char specifier, const void *data, const char *roo
}
int specifier_group_name(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
- UnitFileScope scope = PTR_TO_INT(data);
+ LookupScope scope = PTR_TO_INT(data);
char *t;
assert(ret);
- if (scope == UNIT_FILE_GLOBAL)
+ if (scope == LOOKUP_SCOPE_GLOBAL)
return -EINVAL;
- t = gid_to_name(scope == UNIT_FILE_USER ? getgid() : 0);
+ t = gid_to_name(scope == LOOKUP_SCOPE_USER ? getgid() : 0);
if (!t)
return -ENOMEM;
@@ -327,15 +327,15 @@ int specifier_group_name(char specifier, const void *data, const char *root, con
}
int specifier_group_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
- UnitFileScope scope = PTR_TO_INT(data);
+ LookupScope scope = PTR_TO_INT(data);
gid_t gid;
assert(ret);
- if (scope == UNIT_FILE_GLOBAL)
+ if (scope == LOOKUP_SCOPE_GLOBAL)
return -EINVAL;
- gid = scope == UNIT_FILE_USER ? getgid() : 0;
+ gid = scope == LOOKUP_SCOPE_USER ? getgid() : 0;
if (asprintf(ret, UID_FMT, gid) < 0)
return -ENOMEM;
@@ -344,16 +344,16 @@ int specifier_group_id(char specifier, const void *data, const char *root, const
}
int specifier_user_name(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
- UnitFileScope scope = PTR_TO_INT(data);
+ LookupScope scope = PTR_TO_INT(data);
uid_t uid;
char *t;
assert(ret);
- if (scope == UNIT_FILE_GLOBAL)
+ if (scope == LOOKUP_SCOPE_GLOBAL)
return -EINVAL;
- uid = scope == UNIT_FILE_USER ? getuid() : 0;
+ uid = scope == LOOKUP_SCOPE_USER ? getuid() : 0;
/* If we are UID 0 (root), this will not result in NSS, otherwise it might. This is good, as we want
* to be able to run this in PID 1, where our user ID is 0, but where NSS lookups are not allowed.
@@ -371,15 +371,15 @@ int specifier_user_name(char specifier, const void *data, const char *root, cons
}
int specifier_user_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
- UnitFileScope scope = PTR_TO_INT(data);
+ LookupScope scope = PTR_TO_INT(data);
uid_t uid;
assert(ret);
- if (scope == UNIT_FILE_GLOBAL)
+ if (scope == LOOKUP_SCOPE_GLOBAL)
return -EINVAL;
- uid = scope == UNIT_FILE_USER ? getuid() : 0;
+ uid = scope == LOOKUP_SCOPE_USER ? getuid() : 0;
if (asprintf(ret, UID_FMT, uid) < 0)
return -ENOMEM;