core/serialization: drop misleadingly-named unit_can_serialize()

All unit types can be serialized. This function was really checking whether the
unit type has custom serialization/deserialization code. But we don't need a
function for this.

Also, the check that both .serialize() and .deserialize_item() are defined is
better written as an assert. Not we have a function which would skip
serialization/deserializaton for the unit if we forgot to set either of the
fields.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-06-10 14:17:58 +02:00
parent fe50aae5e1
commit 1085c0eb69
3 changed files with 4 additions and 10 deletions
-6
View File
@@ -3488,12 +3488,6 @@ void unit_unwatch_bus_name(Unit *u, const char *name) {
u->get_name_owner_slot = sd_bus_slot_unref(u->get_name_owner_slot);
}
bool unit_can_serialize(Unit *u) {
assert(u);
return UNIT_VTABLE(u)->serialize && UNIT_VTABLE(u)->deserialize_item;
}
int unit_add_node_dependency(Unit *u, const char *what, UnitDependency dep, UnitDependencyMask mask) {
_cleanup_free_ char *e = NULL;
Unit *device;