core: add UNIT_GET_SLICE() helper
In a later commit we intend to move the slice logic to use proper dependencies instead of a "UnitRef" object. This preparatory commit drops direct use of the slice UnitRef object for a static inline function UNIT_GET_SLICE() that is both easier to grok, and allows us to easily replace its internal implementation later on.
This commit is contained in:
+2
-2
@@ -53,7 +53,7 @@ static int slice_add_parent_slice(Slice *s) {
|
||||
|
||||
assert(s);
|
||||
|
||||
if (UNIT_ISSET(u->slice))
|
||||
if (UNIT_GET_SLICE(u))
|
||||
return 0;
|
||||
|
||||
r = slice_build_parent_slice(u->id, &a);
|
||||
@@ -101,7 +101,7 @@ static int slice_verify(Slice *s) {
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(UNIT(s), r, "Failed to determine parent slice: %m");
|
||||
|
||||
if (parent ? !unit_has_name(UNIT_DEREF(UNIT(s)->slice), parent) : UNIT_ISSET(UNIT(s)->slice))
|
||||
if (parent ? !unit_has_name(UNIT_GET_SLICE(UNIT(s)), parent) : !!UNIT_GET_SLICE(UNIT(s)))
|
||||
return log_unit_error_errno(UNIT(s), SYNTHETIC_ERRNO(ENOEXEC), "Located outside of parent slice. Refusing.");
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user