core: change type of distribute_fds() prototype to return void

We can't handle errors of thisc all sanely anyway, and we never actually
return any errors from the unit type that implements the call.  Hence,
let's make this void, in order to simplify things.
This commit is contained in:
Lennart Poettering 2015-11-10 20:42:58 +01:00
parent 5a6158b641
commit 9ff1a6f1d6
3 changed files with 9 additions and 19 deletions

View File

@ -1094,10 +1094,9 @@ fail:
}
static int manager_distribute_fds(Manager *m, FDSet *fds) {
Unit *u;
static void manager_distribute_fds(Manager *m, FDSet *fds) {
Iterator i;
int r;
Unit *u;
assert(m);
@ -1106,14 +1105,11 @@ static int manager_distribute_fds(Manager *m, FDSet *fds) {
if (fdset_size(fds) <= 0)
break;
if (UNIT_VTABLE(u)->distribute_fds) {
r = UNIT_VTABLE(u)->distribute_fds(u, fds);
if (r < 0)
return r;
}
}
if (!UNIT_VTABLE(u)->distribute_fds)
continue;
return 0;
UNIT_VTABLE(u)->distribute_fds(u, fds);
}
}
int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
@ -1157,11 +1153,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
* useful to allow container managers to pass some file
* descriptors to us pre-initialized. This enables
* socket-based activation of entire containers. */
if (fdset_size(fds) > 0) {
q = manager_distribute_fds(m, fds);
if (q < 0 && r == 0)
r = q;
}
manager_distribute_fds(m, fds);
/* We might have deserialized the notify fd, but if we didn't
* then let's create the bus now */

View File

@ -2332,7 +2332,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
return 0;
}
static int socket_distribute_fds(Unit *u, FDSet *fds) {
static void socket_distribute_fds(Unit *u, FDSet *fds) {
Socket *s = SOCKET(u);
SocketPort *p;
@ -2356,8 +2356,6 @@ static int socket_distribute_fds(Unit *u, FDSet *fds) {
}
}
}
return 0;
}
_pure_ static UnitActiveState socket_active_state(Unit *u) {

View File

@ -322,7 +322,7 @@ struct UnitVTable {
int (*deserialize_item)(Unit *u, const char *key, const char *data, FDSet *fds);
/* Try to match up fds with what we need for this unit */
int (*distribute_fds)(Unit *u, FDSet *fds);
void (*distribute_fds)(Unit *u, FDSet *fds);
/* Boils down the more complex internal state of this unit to
* a simpler one that the engine can understand */