basic: add RuntimeScope enum
In various tools and services we have a per-system and per-user concept. So far we sometimes used a boolean indicating whether we are in system mode, or a reversed boolean indicating whether we are in user mode, or the LookupScope enum used by the lookup path logic. Let's address that, in introduce a common enum for this, we can use all across the board. This is mostly just search/replace, no actual code changes.
This commit is contained in:
@@ -71,7 +71,7 @@ char **arg_properties = NULL;
|
||||
bool arg_all = false;
|
||||
enum dependency arg_dependency = DEPENDENCY_FORWARD;
|
||||
const char *_arg_job_mode = NULL;
|
||||
LookupScope arg_scope = LOOKUP_SCOPE_SYSTEM;
|
||||
RuntimeScope arg_runtime_scope = RUNTIME_SCOPE_SYSTEM;
|
||||
bool arg_wait = false;
|
||||
bool arg_no_block = false;
|
||||
int arg_legend = -1; /* -1: true, unless --quiet is passed, 1: true */
|
||||
@@ -646,15 +646,15 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case ARG_USER:
|
||||
arg_scope = LOOKUP_SCOPE_USER;
|
||||
arg_runtime_scope = RUNTIME_SCOPE_USER;
|
||||
break;
|
||||
|
||||
case ARG_SYSTEM:
|
||||
arg_scope = LOOKUP_SCOPE_SYSTEM;
|
||||
arg_runtime_scope = RUNTIME_SCOPE_SYSTEM;
|
||||
break;
|
||||
|
||||
case ARG_GLOBAL:
|
||||
arg_scope = LOOKUP_SCOPE_GLOBAL;
|
||||
arg_runtime_scope = RUNTIME_SCOPE_GLOBAL;
|
||||
break;
|
||||
|
||||
case ARG_WAIT:
|
||||
@@ -992,10 +992,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
||||
|
||||
/* If we are in --user mode, there's no point in talking to PolicyKit or the infra to query system
|
||||
* passwords */
|
||||
if (arg_scope != LOOKUP_SCOPE_SYSTEM)
|
||||
if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM)
|
||||
arg_ask_password = false;
|
||||
|
||||
if (arg_transport == BUS_TRANSPORT_REMOTE && arg_scope != LOOKUP_SCOPE_SYSTEM)
|
||||
if (arg_transport == BUS_TRANSPORT_REMOTE && arg_runtime_scope != RUNTIME_SCOPE_SYSTEM)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Cannot access user instance remotely.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user