core/exec-credential: drop unused unit_add_default_credential_dependencies

This commit is contained in:
Mike Yuan
2024-06-12 00:54:26 +01:00
committed by Luca Boccassi
parent c5087ef510
commit 1899715826
3 changed files with 1 additions and 32 deletions
-25
View File
@@ -119,31 +119,6 @@ int exec_context_get_credential_directory(
return get_credential_directory(params->prefix[EXEC_DIRECTORY_RUNTIME], unit, ret);
}
int unit_add_default_credential_dependencies(Unit *u, const ExecContext *c) {
_cleanup_free_ char *p = NULL, *m = NULL;
int r;
assert(u);
assert(c);
if (!exec_context_has_credentials(c))
return 0;
/* Let's make sure the credentials directory of this service is unmounted *after* the service itself
* shuts down. This only matters if mount namespacing is not used for the service, and hence the
* credentials mount appears on the host. */
r = get_credential_directory(u->manager->prefix[EXEC_DIRECTORY_RUNTIME], u->id, &p);
if (r <= 0)
return r;
r = unit_name_from_path(p, ".mount", &m);
if (r < 0)
return r;
return unit_add_dependency_by_name(u, UNIT_AFTER, m, /* add_reference= */ true, UNIT_DEPENDENCY_FILE);
}
int exec_context_destroy_credentials(const ExecContext *c, const char *runtime_prefix, const char *unit) {
_cleanup_free_ char *p = NULL;
int r;
+1 -3
View File
@@ -9,7 +9,6 @@
typedef struct ExecContext ExecContext;
typedef struct ExecParameters ExecParameters;
typedef struct Unit Unit;
/* A credential configured with LoadCredential= */
typedef struct ExecLoadCredential {
@@ -45,9 +44,8 @@ int exec_context_get_credential_directory(
const char *unit,
char **ret);
int unit_add_default_credential_dependencies(Unit *u, const ExecContext *c);
int exec_context_destroy_credentials(const ExecContext *c, const char *runtime_root, const char *unit);
int exec_setup_credentials(
const ExecContext *context,
const ExecParameters *params,
-4
View File
@@ -1337,10 +1337,6 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
return r;
}
r = unit_add_default_credential_dependencies(u, c);
if (r < 0)
return r;
return 0;
}