core: make unit_set_invocation_id static
No functional change.
This commit is contained in:
+37
-37
@@ -3205,6 +3205,43 @@ char *unit_dbus_path_invocation_id(Unit *u) {
|
||||
return unit_dbus_path_from_name(u->invocation_id_string);
|
||||
}
|
||||
|
||||
static int unit_set_invocation_id(Unit *u, sd_id128_t id) {
|
||||
int r;
|
||||
|
||||
assert(u);
|
||||
|
||||
/* Set the invocation ID for this unit. If we cannot, this will not roll back, but reset the whole thing. */
|
||||
|
||||
if (sd_id128_equal(u->invocation_id, id))
|
||||
return 0;
|
||||
|
||||
if (!sd_id128_is_null(u->invocation_id))
|
||||
(void) hashmap_remove_value(u->manager->units_by_invocation_id, &u->invocation_id, u);
|
||||
|
||||
if (sd_id128_is_null(id)) {
|
||||
r = 0;
|
||||
goto reset;
|
||||
}
|
||||
|
||||
r = hashmap_ensure_allocated(&u->manager->units_by_invocation_id, &id128_hash_ops);
|
||||
if (r < 0)
|
||||
goto reset;
|
||||
|
||||
u->invocation_id = id;
|
||||
sd_id128_to_string(id, u->invocation_id_string);
|
||||
|
||||
r = hashmap_put(u->manager->units_by_invocation_id, &u->invocation_id, u);
|
||||
if (r < 0)
|
||||
goto reset;
|
||||
|
||||
return 0;
|
||||
|
||||
reset:
|
||||
u->invocation_id = SD_ID128_NULL;
|
||||
u->invocation_id_string[0] = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
int unit_set_slice(Unit *u, Unit *slice) {
|
||||
assert(u);
|
||||
assert(slice);
|
||||
@@ -5344,43 +5381,6 @@ void unit_notify_user_lookup(Unit *u, uid_t uid, gid_t gid) {
|
||||
unit_add_to_dbus_queue(u);
|
||||
}
|
||||
|
||||
int unit_set_invocation_id(Unit *u, sd_id128_t id) {
|
||||
int r;
|
||||
|
||||
assert(u);
|
||||
|
||||
/* Set the invocation ID for this unit. If we cannot, this will not roll back, but reset the whole thing. */
|
||||
|
||||
if (sd_id128_equal(u->invocation_id, id))
|
||||
return 0;
|
||||
|
||||
if (!sd_id128_is_null(u->invocation_id))
|
||||
(void) hashmap_remove_value(u->manager->units_by_invocation_id, &u->invocation_id, u);
|
||||
|
||||
if (sd_id128_is_null(id)) {
|
||||
r = 0;
|
||||
goto reset;
|
||||
}
|
||||
|
||||
r = hashmap_ensure_allocated(&u->manager->units_by_invocation_id, &id128_hash_ops);
|
||||
if (r < 0)
|
||||
goto reset;
|
||||
|
||||
u->invocation_id = id;
|
||||
sd_id128_to_string(id, u->invocation_id_string);
|
||||
|
||||
r = hashmap_put(u->manager->units_by_invocation_id, &u->invocation_id, u);
|
||||
if (r < 0)
|
||||
goto reset;
|
||||
|
||||
return 0;
|
||||
|
||||
reset:
|
||||
u->invocation_id = SD_ID128_NULL;
|
||||
u->invocation_id_string[0] = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
int unit_acquire_invocation_id(Unit *u) {
|
||||
sd_id128_t id;
|
||||
int r;
|
||||
|
||||
@@ -829,7 +829,6 @@ void unit_unref_uid_gid(Unit *u, bool destroy_now);
|
||||
|
||||
void unit_notify_user_lookup(Unit *u, uid_t uid, gid_t gid);
|
||||
|
||||
int unit_set_invocation_id(Unit *u, sd_id128_t id);
|
||||
int unit_acquire_invocation_id(Unit *u);
|
||||
|
||||
bool unit_shall_confirm_spawn(Unit *u);
|
||||
|
||||
Reference in New Issue
Block a user