mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
list: declare iterator of LIST_FOREACH() in the loop
This commit is contained in:
parent
40f35786b0
commit
03677889f0
@ -136,33 +136,36 @@
|
||||
#define LIST_JUST_US(name,item) \
|
||||
(!(item)->name##_prev && !(item)->name##_next)
|
||||
|
||||
/* The type of the iterator 'i' is automatically determined by the type of 'head', and declared in the
|
||||
* loop. Hence, do not declare the same variable in the outer scope. Sometimes, we set 'head' through
|
||||
* hashmap_get(). In that case, you need to explicitly cast the result. */
|
||||
#define LIST_FOREACH(name,i,head) \
|
||||
for ((i) = (head); (i); (i) = (i)->name##_next)
|
||||
for (typeof(*(head)) *i = (head); i; i = i->name##_next)
|
||||
|
||||
#define LIST_FOREACH_SAFE(name,i,n,head) \
|
||||
for ((i) = (head); (i) && (((n) = (i)->name##_next), 1); (i) = (n))
|
||||
for (typeof(*(head)) *n, *i = (head); i && ((n = i->name##_next), 1); i = n)
|
||||
|
||||
#define LIST_FOREACH_BACKWARDS(name,i,p) \
|
||||
for ((i) = (p); (i); (i) = (i)->name##_prev)
|
||||
for (typeof(*(p)) *i = (p); i; i = i->name##_prev)
|
||||
|
||||
/* Iterate through all the members of the list p is included in, but skip over p */
|
||||
#define LIST_FOREACH_OTHERS(name,i,p) \
|
||||
for (({ \
|
||||
(i) = (p); \
|
||||
while ((i) && (i)->name##_prev) \
|
||||
(i) = (i)->name##_prev; \
|
||||
if ((i) == (p)) \
|
||||
(i) = (p)->name##_next; \
|
||||
}); \
|
||||
(i); \
|
||||
(i) = (i)->name##_next == (p) ? (p)->name##_next : (i)->name##_next)
|
||||
for (typeof(*(p)) *_p = (p), *i = ({ \
|
||||
typeof(*_p) *_j = _p; \
|
||||
while (_j && _j->name##_prev) \
|
||||
_j = _j->name##_prev; \
|
||||
if (_j == _p) \
|
||||
_j = _p->name##_next; \
|
||||
_j; \
|
||||
}); \
|
||||
i; \
|
||||
i = i->name##_next == _p ? _p->name##_next : i->name##_next)
|
||||
|
||||
/* Loop starting from p->next until p->prev.
|
||||
p can be adjusted meanwhile. */
|
||||
/* Loop starting from p->next until p->prev. p can be adjusted meanwhile. */
|
||||
#define LIST_LOOP_BUT_ONE(name,i,head,p) \
|
||||
for ((i) = (p)->name##_next ? (p)->name##_next : (head); \
|
||||
(i) != (p); \
|
||||
(i) = (i)->name##_next ? (i)->name##_next : (head))
|
||||
for (typeof(*(p)) *i = (p)->name##_next ? (p)->name##_next : (head); \
|
||||
i != (p); \
|
||||
i = i->name##_next ? i->name##_next : (head))
|
||||
|
||||
#define LIST_IS_EMPTY(head) \
|
||||
(!(head))
|
||||
|
@ -123,7 +123,6 @@ static int bpf_foreign_prepare(
|
||||
|
||||
int bpf_foreign_install(Unit *u) {
|
||||
_cleanup_free_ char *cgroup_path = NULL;
|
||||
CGroupBPFForeignProgram *p;
|
||||
CGroupContext *cc;
|
||||
int r;
|
||||
|
||||
|
@ -27,7 +27,6 @@ static int update_rules_map(
|
||||
int map_fd,
|
||||
CGroupSocketBindItem *head) {
|
||||
|
||||
CGroupSocketBindItem *item;
|
||||
uint32_t i = 0;
|
||||
|
||||
assert(map_fd >= 0);
|
||||
@ -58,7 +57,6 @@ static int prepare_socket_bind_bpf(
|
||||
_cleanup_(socket_bind_bpf_freep) struct socket_bind_bpf *obj = NULL;
|
||||
size_t allow_count = 0, deny_count = 0;
|
||||
int allow_map_fd, deny_map_fd, r;
|
||||
CGroupSocketBindItem *item;
|
||||
|
||||
assert(ret_obj);
|
||||
|
||||
|
@ -414,15 +414,7 @@ static char *format_cgroup_memory_limit_comparison(char *buf, size_t l, Unit *u,
|
||||
|
||||
void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) {
|
||||
_cleanup_free_ char *disable_controllers_str = NULL, *cpuset_cpus = NULL, *cpuset_mems = NULL, *startup_cpuset_cpus = NULL, *startup_cpuset_mems = NULL;
|
||||
CGroupIODeviceLimit *il;
|
||||
CGroupIODeviceWeight *iw;
|
||||
CGroupIODeviceLatency *l;
|
||||
CGroupBlockIODeviceBandwidth *b;
|
||||
CGroupBlockIODeviceWeight *w;
|
||||
CGroupBPFForeignProgram *p;
|
||||
CGroupDeviceAllow *a;
|
||||
CGroupContext *c;
|
||||
CGroupSocketBindItem *bi;
|
||||
struct in_addr_prefix *iaai;
|
||||
char **path;
|
||||
|
||||
@ -1219,7 +1211,6 @@ static int cgroup_apply_devices(Unit *u) {
|
||||
_cleanup_(bpf_program_freep) BPFProgram *prog = NULL;
|
||||
const char *path;
|
||||
CGroupContext *c;
|
||||
CGroupDeviceAllow *a;
|
||||
CGroupDevicePolicy policy;
|
||||
int r;
|
||||
|
||||
@ -1440,10 +1431,6 @@ static void cgroup_context_apply(
|
||||
set_io_weight(u, weight);
|
||||
|
||||
if (has_io) {
|
||||
CGroupIODeviceLatency *latency;
|
||||
CGroupIODeviceLimit *limit;
|
||||
CGroupIODeviceWeight *w;
|
||||
|
||||
LIST_FOREACH(device_weights, w, c->io_device_weights)
|
||||
cgroup_apply_io_device_weight(u, w->path, w->weight);
|
||||
|
||||
@ -1454,9 +1441,6 @@ static void cgroup_context_apply(
|
||||
cgroup_apply_io_device_latency(u, latency->path, latency->target_usec);
|
||||
|
||||
} else if (has_blockio) {
|
||||
CGroupBlockIODeviceWeight *w;
|
||||
CGroupBlockIODeviceBandwidth *b;
|
||||
|
||||
LIST_FOREACH(device_weights, w, c->blockio_device_weights) {
|
||||
weight = cgroup_weight_blkio_to_io(w->weight);
|
||||
|
||||
@ -1509,9 +1493,7 @@ static void cgroup_context_apply(
|
||||
|
||||
set_blkio_weight(u, weight);
|
||||
|
||||
if (has_io) {
|
||||
CGroupIODeviceWeight *w;
|
||||
|
||||
if (has_io)
|
||||
LIST_FOREACH(device_weights, w, c->io_device_weights) {
|
||||
weight = cgroup_weight_io_to_blkio(w->weight);
|
||||
|
||||
@ -1520,32 +1502,24 @@ static void cgroup_context_apply(
|
||||
|
||||
cgroup_apply_blkio_device_weight(u, w->path, weight);
|
||||
}
|
||||
} else if (has_blockio) {
|
||||
CGroupBlockIODeviceWeight *w;
|
||||
|
||||
else if (has_blockio)
|
||||
LIST_FOREACH(device_weights, w, c->blockio_device_weights)
|
||||
cgroup_apply_blkio_device_weight(u, w->path, w->weight);
|
||||
}
|
||||
}
|
||||
|
||||
/* The bandwidth limits are something that make sense to be applied to the host's root but not container
|
||||
* roots, as there we want the container manager to handle it */
|
||||
if (is_host_root || !is_local_root) {
|
||||
if (has_io) {
|
||||
CGroupIODeviceLimit *l;
|
||||
|
||||
if (has_io)
|
||||
LIST_FOREACH(device_limits, l, c->io_device_limits) {
|
||||
log_cgroup_compat(u, "Applying IO{Read|Write}Bandwidth=%" PRIu64 " %" PRIu64 " as BlockIO{Read|Write}BandwidthMax= for %s",
|
||||
l->limits[CGROUP_IO_RBPS_MAX], l->limits[CGROUP_IO_WBPS_MAX], l->path);
|
||||
|
||||
cgroup_apply_blkio_device_limit(u, l->path, l->limits[CGROUP_IO_RBPS_MAX], l->limits[CGROUP_IO_WBPS_MAX]);
|
||||
}
|
||||
} else if (has_blockio) {
|
||||
CGroupBlockIODeviceBandwidth *b;
|
||||
|
||||
else if (has_blockio)
|
||||
LIST_FOREACH(device_bandwidths, b, c->blockio_device_bandwidths)
|
||||
cgroup_apply_blkio_device_limit(u, b->path, b->rbps, b->wbps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,9 +157,7 @@ static int build_managed_oom_cgroups_json(Manager *m, JsonVariant **ret) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
for (size_t i = 0; i < ELEMENTSOF(supported_unit_types); i++) {
|
||||
Unit *u;
|
||||
|
||||
for (size_t i = 0; i < ELEMENTSOF(supported_unit_types); i++)
|
||||
LIST_FOREACH(units_by_type, u, m->units_by_type[supported_unit_types[i]]) {
|
||||
CGroupContext *c;
|
||||
|
||||
@ -188,7 +186,6 @@ static int build_managed_oom_cgroups_json(Manager *m, JsonVariant **ret) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
r = json_build(&v, JSON_BUILD_OBJECT(JSON_BUILD_PAIR("cgroups", JSON_BUILD_VARIANT(arr))));
|
||||
if (r < 0)
|
||||
|
@ -112,7 +112,6 @@ static int property_get_io_device_weight(
|
||||
sd_bus_error *error) {
|
||||
|
||||
CGroupContext *c = userdata;
|
||||
CGroupIODeviceWeight *w;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -142,7 +141,6 @@ static int property_get_io_device_limits(
|
||||
sd_bus_error *error) {
|
||||
|
||||
CGroupContext *c = userdata;
|
||||
CGroupIODeviceLimit *l;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -178,7 +176,6 @@ static int property_get_io_device_latency(
|
||||
sd_bus_error *error) {
|
||||
|
||||
CGroupContext *c = userdata;
|
||||
CGroupIODeviceLatency *l;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -208,7 +205,6 @@ static int property_get_blockio_device_weight(
|
||||
sd_bus_error *error) {
|
||||
|
||||
CGroupContext *c = userdata;
|
||||
CGroupBlockIODeviceWeight *w;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -238,7 +234,6 @@ static int property_get_blockio_device_bandwidths(
|
||||
sd_bus_error *error) {
|
||||
|
||||
CGroupContext *c = userdata;
|
||||
CGroupBlockIODeviceBandwidth *b;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -278,7 +273,6 @@ static int property_get_device_allow(
|
||||
sd_bus_error *error) {
|
||||
|
||||
CGroupContext *c = userdata;
|
||||
CGroupDeviceAllow *a;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -364,7 +358,6 @@ static int property_get_bpf_foreign_program(
|
||||
void *userdata,
|
||||
sd_bus_error *error) {
|
||||
CGroupContext *c = userdata;
|
||||
CGroupBPFForeignProgram *p;
|
||||
int r;
|
||||
|
||||
r = sd_bus_message_open_container(reply, 'a', "(ss)");
|
||||
@ -390,7 +383,8 @@ static int property_get_socket_bind(
|
||||
sd_bus_message *reply,
|
||||
void *userdata,
|
||||
sd_bus_error *error) {
|
||||
CGroupSocketBindItem **items = userdata, *i;
|
||||
|
||||
CGroupSocketBindItem **items = userdata;
|
||||
int r;
|
||||
|
||||
assert(items);
|
||||
@ -720,7 +714,6 @@ static int bus_cgroup_set_transient_property(
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
CGroupBPFForeignProgram *fp;
|
||||
size_t size = 0;
|
||||
|
||||
if (n == 0)
|
||||
@ -1228,14 +1221,13 @@ int bus_cgroup_set_property(
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path '%s' specified in %s= is not normalized.", name, path);
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
CGroupIODeviceLimit *a = NULL, *b;
|
||||
CGroupIODeviceLimit *a = NULL;
|
||||
|
||||
LIST_FOREACH(device_limits, b, c->io_device_limits) {
|
||||
LIST_FOREACH(device_limits, b, c->io_device_limits)
|
||||
if (path_equal(path, b->path)) {
|
||||
a = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!a) {
|
||||
CGroupIOLimitType type;
|
||||
@ -1269,15 +1261,13 @@ int bus_cgroup_set_property(
|
||||
return r;
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
CGroupIODeviceLimit *a;
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
size_t size = 0;
|
||||
|
||||
if (n == 0) {
|
||||
if (n == 0)
|
||||
LIST_FOREACH(device_limits, a, c->io_device_limits)
|
||||
a->limits[iol_type] = cgroup_io_limit_defaults[iol_type];
|
||||
}
|
||||
|
||||
unit_invalidate_cgroup(u, CGROUP_MASK_IO);
|
||||
|
||||
@ -1287,8 +1277,8 @@ int bus_cgroup_set_property(
|
||||
|
||||
fprintf(f, "%s=\n", name);
|
||||
LIST_FOREACH(device_limits, a, c->io_device_limits)
|
||||
if (a->limits[iol_type] != cgroup_io_limit_defaults[iol_type])
|
||||
fprintf(f, "%s=%s %" PRIu64 "\n", name, a->path, a->limits[iol_type]);
|
||||
if (a->limits[iol_type] != cgroup_io_limit_defaults[iol_type])
|
||||
fprintf(f, "%s=%s %" PRIu64 "\n", name, a->path, a->limits[iol_type]);
|
||||
|
||||
r = fflush_and_check(f);
|
||||
if (r < 0)
|
||||
@ -1316,14 +1306,13 @@ int bus_cgroup_set_property(
|
||||
return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "IODeviceWeight= value out of range");
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
CGroupIODeviceWeight *a = NULL, *b;
|
||||
CGroupIODeviceWeight *a = NULL;
|
||||
|
||||
LIST_FOREACH(device_weights, b, c->io_device_weights) {
|
||||
LIST_FOREACH(device_weights, b, c->io_device_weights)
|
||||
if (path_equal(b->path, path)) {
|
||||
a = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!a) {
|
||||
a = new0(CGroupIODeviceWeight, 1);
|
||||
@ -1351,13 +1340,11 @@ int bus_cgroup_set_property(
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
CGroupIODeviceWeight *a;
|
||||
size_t size = 0;
|
||||
|
||||
if (n == 0) {
|
||||
if (n == 0)
|
||||
while (c->io_device_weights)
|
||||
cgroup_context_free_io_device_weight(c, c->io_device_weights);
|
||||
}
|
||||
|
||||
unit_invalidate_cgroup(u, CGROUP_MASK_IO);
|
||||
|
||||
@ -1392,14 +1379,13 @@ int bus_cgroup_set_property(
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path '%s' specified in %s= is not normalized.", name, path);
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
CGroupIODeviceLatency *a = NULL, *b;
|
||||
CGroupIODeviceLatency *a = NULL;
|
||||
|
||||
LIST_FOREACH(device_latencies, b, c->io_device_latencies) {
|
||||
LIST_FOREACH(device_latencies, b, c->io_device_latencies)
|
||||
if (path_equal(b->path, path)) {
|
||||
a = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!a) {
|
||||
a = new0(CGroupIODeviceLatency, 1);
|
||||
@ -1427,13 +1413,11 @@ int bus_cgroup_set_property(
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
CGroupIODeviceLatency *a;
|
||||
size_t size = 0;
|
||||
|
||||
if (n == 0) {
|
||||
if (n == 0)
|
||||
while (c->io_device_latencies)
|
||||
cgroup_context_free_io_device_latency(c, c->io_device_latencies);
|
||||
}
|
||||
|
||||
unit_invalidate_cgroup(u, CGROUP_MASK_IO);
|
||||
|
||||
@ -1473,14 +1457,13 @@ int bus_cgroup_set_property(
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path '%s' specified in %s= is not normalized.", name, path);
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
CGroupBlockIODeviceBandwidth *a = NULL, *b;
|
||||
CGroupBlockIODeviceBandwidth *a = NULL;
|
||||
|
||||
LIST_FOREACH(device_bandwidths, b, c->blockio_device_bandwidths) {
|
||||
LIST_FOREACH(device_bandwidths, b, c->blockio_device_bandwidths)
|
||||
if (path_equal(path, b->path)) {
|
||||
a = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!a) {
|
||||
a = new0(CGroupBlockIODeviceBandwidth, 1);
|
||||
@ -1514,19 +1497,17 @@ int bus_cgroup_set_property(
|
||||
return r;
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
CGroupBlockIODeviceBandwidth *a;
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
size_t size = 0;
|
||||
|
||||
if (n == 0) {
|
||||
if (n == 0)
|
||||
LIST_FOREACH(device_bandwidths, a, c->blockio_device_bandwidths) {
|
||||
if (read)
|
||||
a->rbps = CGROUP_LIMIT_MAX;
|
||||
else
|
||||
a->wbps = CGROUP_LIMIT_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
unit_invalidate_cgroup(u, CGROUP_MASK_BLKIO);
|
||||
|
||||
@ -1573,14 +1554,13 @@ int bus_cgroup_set_property(
|
||||
return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "BlockIODeviceWeight= out of range");
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
CGroupBlockIODeviceWeight *a = NULL, *b;
|
||||
CGroupBlockIODeviceWeight *a = NULL;
|
||||
|
||||
LIST_FOREACH(device_weights, b, c->blockio_device_weights) {
|
||||
LIST_FOREACH(device_weights, b, c->blockio_device_weights)
|
||||
if (path_equal(b->path, path)) {
|
||||
a = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!a) {
|
||||
a = new0(CGroupBlockIODeviceWeight, 1);
|
||||
@ -1608,13 +1588,11 @@ int bus_cgroup_set_property(
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
CGroupBlockIODeviceWeight *a;
|
||||
size_t size = 0;
|
||||
|
||||
if (n == 0) {
|
||||
if (n == 0)
|
||||
while (c->blockio_device_weights)
|
||||
cgroup_context_free_blockio_device_weight(c, c->blockio_device_weights);
|
||||
}
|
||||
|
||||
unit_invalidate_cgroup(u, CGROUP_MASK_BLKIO);
|
||||
|
||||
@ -1674,14 +1652,13 @@ int bus_cgroup_set_property(
|
||||
return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, "DeviceAllow= requires combination of rwm flags");
|
||||
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
CGroupDeviceAllow *a = NULL, *b;
|
||||
CGroupDeviceAllow *a = NULL;
|
||||
|
||||
LIST_FOREACH(device_allow, b, c->device_allow) {
|
||||
LIST_FOREACH(device_allow, b, c->device_allow)
|
||||
if (path_equal(b->path, path)) {
|
||||
a = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!a) {
|
||||
a = new0(CGroupDeviceAllow, 1);
|
||||
@ -1714,13 +1691,11 @@ int bus_cgroup_set_property(
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
CGroupDeviceAllow *a;
|
||||
size_t size = 0;
|
||||
|
||||
if (n == 0) {
|
||||
if (n == 0)
|
||||
while (c->device_allow)
|
||||
cgroup_context_free_device_allow(c, c->device_allow);
|
||||
}
|
||||
|
||||
unit_invalidate_cgroup(u, CGROUP_MASK_DEVICES);
|
||||
|
||||
@ -1995,7 +1970,6 @@ int bus_cgroup_set_property(
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
CGroupSocketBindItem *item;
|
||||
size_t size = 0;
|
||||
|
||||
if (n == 0)
|
||||
|
@ -960,7 +960,6 @@ static int property_get_root_image_options(
|
||||
sd_bus_error *error) {
|
||||
|
||||
ExecContext *c = userdata;
|
||||
MountOptions *m;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -1005,8 +1004,6 @@ static int property_get_mount_images(
|
||||
return r;
|
||||
|
||||
for (size_t i = 0; i < c->n_mount_images; i++) {
|
||||
MountOptions *m;
|
||||
|
||||
r = sd_bus_message_open_container(reply, SD_BUS_TYPE_STRUCT, "ssba(ss)");
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -1060,8 +1057,6 @@ static int property_get_extension_images(
|
||||
return r;
|
||||
|
||||
for (size_t i = 0; i < c->n_extension_images; i++) {
|
||||
MountOptions *m;
|
||||
|
||||
r = sd_bus_message_open_container(reply, SD_BUS_TYPE_STRUCT, "sba(ss)");
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -1449,7 +1444,7 @@ int bus_property_get_exec_command_list(
|
||||
void *userdata,
|
||||
sd_bus_error *ret_error) {
|
||||
|
||||
ExecCommand *c = *(ExecCommand**) userdata;
|
||||
ExecCommand *exec_command = *(ExecCommand**) userdata;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -1459,7 +1454,7 @@ int bus_property_get_exec_command_list(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
LIST_FOREACH(command, c, c) {
|
||||
LIST_FOREACH(command, c, exec_command) {
|
||||
r = append_exec_command(reply, c);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -1477,7 +1472,7 @@ int bus_property_get_exec_ex_command_list(
|
||||
void *userdata,
|
||||
sd_bus_error *ret_error) {
|
||||
|
||||
ExecCommand *c, *exec_command = *(ExecCommand**) userdata;
|
||||
ExecCommand *exec_command = *(ExecCommand**) userdata;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -1587,7 +1582,6 @@ int bus_set_transient_exec_command(
|
||||
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
ExecCommand *c;
|
||||
size_t size = 0;
|
||||
|
||||
if (n == 0)
|
||||
|
@ -22,7 +22,6 @@ static int property_get_paths(
|
||||
sd_bus_error *error) {
|
||||
|
||||
Path *p = userdata;
|
||||
PathSpec *k;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
|
@ -32,7 +32,6 @@ static int property_get_listen(
|
||||
sd_bus_error *error) {
|
||||
|
||||
Socket *s = SOCKET(userdata);
|
||||
SocketPort *p;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
|
@ -20,7 +20,6 @@ static int property_get_monotonic_timers(
|
||||
sd_bus_error *error) {
|
||||
|
||||
Timer *t = userdata;
|
||||
TimerValue *v;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -69,7 +68,6 @@ static int property_get_calendar_timers(
|
||||
sd_bus_error *error) {
|
||||
|
||||
Timer *t = userdata;
|
||||
TimerValue *v;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
|
@ -273,7 +273,7 @@ static int property_get_conditions(
|
||||
sd_bus_error *error) {
|
||||
|
||||
const char *(*to_string)(ConditionType type) = NULL;
|
||||
Condition **list = userdata, *c;
|
||||
Condition **list = userdata;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
|
@ -710,7 +710,7 @@ static void device_update_found_one(Device *d, DeviceFound found, DeviceFound ma
|
||||
}
|
||||
|
||||
static void device_update_found_by_sysfs(Manager *m, const char *sysfs, DeviceFound found, DeviceFound mask) {
|
||||
Device *d, *l, *n;
|
||||
Device *l;
|
||||
|
||||
assert(m);
|
||||
assert(sysfs);
|
||||
@ -765,7 +765,7 @@ static bool device_is_ready(sd_device *dev) {
|
||||
|
||||
static Unit *device_following(Unit *u) {
|
||||
Device *d = DEVICE(u);
|
||||
Device *other, *first = NULL;
|
||||
Device *first = NULL;
|
||||
|
||||
assert(d);
|
||||
|
||||
@ -788,7 +788,7 @@ static Unit *device_following(Unit *u) {
|
||||
}
|
||||
|
||||
static int device_following_set(Unit *u, Set **_set) {
|
||||
Device *d = DEVICE(u), *other;
|
||||
Device *d = DEVICE(u);
|
||||
_cleanup_set_free_ Set *set = NULL;
|
||||
int r;
|
||||
|
||||
@ -898,7 +898,7 @@ fail:
|
||||
}
|
||||
|
||||
static void device_propagate_reload_by_sysfs(Manager *m, const char *sysfs) {
|
||||
Device *d, *l, *n;
|
||||
Device *l;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
@ -5423,12 +5423,9 @@ void exec_command_reset_status_array(ExecCommand *c, size_t n) {
|
||||
}
|
||||
|
||||
void exec_command_reset_status_list_array(ExecCommand **c, size_t n) {
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
ExecCommand *z;
|
||||
|
||||
for (size_t i = 0; i < n; i++)
|
||||
LIST_FOREACH(command, z, c[i])
|
||||
exec_status_reset(&z->exec_status);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct InvalidEnvInfo {
|
||||
@ -5713,8 +5710,6 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
fprintf(f, "%sRootImage: %s\n", prefix, c->root_image);
|
||||
|
||||
if (c->root_image_options) {
|
||||
MountOptions *o;
|
||||
|
||||
fprintf(f, "%sRootImageOptions:", prefix);
|
||||
LIST_FOREACH(mount_options, o, c->root_image_options)
|
||||
if (!isempty(o->options))
|
||||
@ -6113,8 +6108,6 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < c->n_mount_images; i++) {
|
||||
MountOptions *o;
|
||||
|
||||
fprintf(f, "%sMountImages: %s%s:%s", prefix,
|
||||
c->mount_images[i].ignore_enoent ? "-": "",
|
||||
c->mount_images[i].source,
|
||||
@ -6127,8 +6120,6 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < c->n_extension_images; i++) {
|
||||
MountOptions *o;
|
||||
|
||||
fprintf(f, "%sExtensionImages: %s%s", prefix,
|
||||
c->extension_images[i].ignore_enoent ? "-": "",
|
||||
c->extension_images[i].source);
|
||||
@ -6395,8 +6386,8 @@ void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix) {
|
||||
|
||||
prefix = strempty(prefix);
|
||||
|
||||
LIST_FOREACH(command, c, c)
|
||||
exec_command_dump(c, f, prefix);
|
||||
LIST_FOREACH(command, i, c)
|
||||
exec_command_dump(i, f, prefix);
|
||||
}
|
||||
|
||||
void exec_command_append_list(ExecCommand **l, ExecCommand *e) {
|
||||
|
@ -4328,7 +4328,7 @@ int config_parse_io_limit(
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_free_ char *path = NULL, *resolved = NULL;
|
||||
CGroupIODeviceLimit *l = NULL, *t;
|
||||
CGroupIODeviceLimit *l = NULL;
|
||||
CGroupContext *c = data;
|
||||
CGroupIOLimitType type;
|
||||
const char *p = rvalue;
|
||||
@ -4343,8 +4343,8 @@ int config_parse_io_limit(
|
||||
assert(type >= 0);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
LIST_FOREACH(device_limits, l, c->io_device_limits)
|
||||
l->limits[type] = cgroup_io_limit_defaults[type];
|
||||
LIST_FOREACH(device_limits, t, c->io_device_limits)
|
||||
t->limits[type] = cgroup_io_limit_defaults[type];
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -4378,12 +4378,11 @@ int config_parse_io_limit(
|
||||
}
|
||||
}
|
||||
|
||||
LIST_FOREACH(device_limits, t, c->io_device_limits) {
|
||||
LIST_FOREACH(device_limits, t, c->io_device_limits)
|
||||
if (path_equal(resolved, t->path)) {
|
||||
l = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!l) {
|
||||
CGroupIOLimitType ttype;
|
||||
@ -4486,7 +4485,7 @@ int config_parse_blockio_bandwidth(
|
||||
void *userdata) {
|
||||
|
||||
_cleanup_free_ char *path = NULL, *resolved = NULL;
|
||||
CGroupBlockIODeviceBandwidth *b = NULL, *t;
|
||||
CGroupBlockIODeviceBandwidth *b = NULL;
|
||||
CGroupContext *c = data;
|
||||
const char *p = rvalue;
|
||||
uint64_t bytes;
|
||||
@ -4500,9 +4499,9 @@ int config_parse_blockio_bandwidth(
|
||||
read = streq("BlockIOReadBandwidth", lvalue);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
LIST_FOREACH(device_bandwidths, b, c->blockio_device_bandwidths) {
|
||||
b->rbps = CGROUP_LIMIT_MAX;
|
||||
b->wbps = CGROUP_LIMIT_MAX;
|
||||
LIST_FOREACH(device_bandwidths, t, c->blockio_device_bandwidths) {
|
||||
t->rbps = CGROUP_LIMIT_MAX;
|
||||
t->wbps = CGROUP_LIMIT_MAX;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -4533,14 +4532,13 @@ int config_parse_blockio_bandwidth(
|
||||
return 0;
|
||||
}
|
||||
|
||||
LIST_FOREACH(device_bandwidths, t, c->blockio_device_bandwidths) {
|
||||
LIST_FOREACH(device_bandwidths, t, c->blockio_device_bandwidths)
|
||||
if (path_equal(resolved, t->path)) {
|
||||
b = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!t) {
|
||||
if (!b) {
|
||||
b = new0(CGroupBlockIODeviceBandwidth, 1);
|
||||
if (!b)
|
||||
return log_oom();
|
||||
|
@ -1222,7 +1222,6 @@ static void unit_gc_sweep(Unit *u, unsigned gc_marker) {
|
||||
is_bad = false;
|
||||
}
|
||||
|
||||
const UnitRef *ref;
|
||||
LIST_FOREACH(refs_by_target, ref, u->refs_by_target) {
|
||||
unit_gc_sweep(ref->source, gc_marker);
|
||||
|
||||
|
@ -1957,7 +1957,6 @@ static int drain_libmount(Manager *m) {
|
||||
static int mount_process_proc_self_mountinfo(Manager *m) {
|
||||
_cleanup_set_free_free_ Set *around = NULL, *gone = NULL;
|
||||
const char *what;
|
||||
Unit *u;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
@ -2562,7 +2562,6 @@ MountImage* mount_image_free_many(MountImage *m, size_t *n) {
|
||||
int mount_image_add(MountImage **m, size_t *n, const MountImage *item) {
|
||||
_cleanup_free_ char *s = NULL, *d = NULL;
|
||||
_cleanup_(mount_options_free_allp) MountOptions *options = NULL;
|
||||
MountOptions *i;
|
||||
MountImage *c;
|
||||
|
||||
assert(m);
|
||||
|
@ -292,7 +292,6 @@ static void path_done(Unit *u) {
|
||||
}
|
||||
|
||||
static int path_add_mount_dependencies(Path *p) {
|
||||
PathSpec *s;
|
||||
int r;
|
||||
|
||||
assert(p);
|
||||
@ -401,7 +400,6 @@ static int path_load(Unit *u) {
|
||||
static void path_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
Path *p = PATH(u);
|
||||
Unit *trigger;
|
||||
PathSpec *s;
|
||||
|
||||
assert(p);
|
||||
assert(f);
|
||||
@ -429,8 +427,6 @@ static void path_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
}
|
||||
|
||||
static void path_unwatch(Path *p) {
|
||||
PathSpec *s;
|
||||
|
||||
assert(p);
|
||||
|
||||
LIST_FOREACH(spec, s, p->specs)
|
||||
@ -439,7 +435,6 @@ static void path_unwatch(Path *p) {
|
||||
|
||||
static int path_watch(Path *p) {
|
||||
int r;
|
||||
PathSpec *s;
|
||||
|
||||
assert(p);
|
||||
|
||||
@ -539,8 +534,6 @@ fail:
|
||||
}
|
||||
|
||||
static bool path_check_good(Path *p, bool initial, bool from_trigger_notify) {
|
||||
PathSpec *s;
|
||||
|
||||
assert(p);
|
||||
|
||||
LIST_FOREACH(spec, s, p->specs)
|
||||
@ -591,8 +584,6 @@ fail:
|
||||
}
|
||||
|
||||
static void path_mkdir(Path *p) {
|
||||
PathSpec *s;
|
||||
|
||||
assert(p);
|
||||
|
||||
if (!p->make_directory)
|
||||
@ -637,7 +628,6 @@ static int path_stop(Unit *u) {
|
||||
|
||||
static int path_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
Path *p = PATH(u);
|
||||
PathSpec *s;
|
||||
|
||||
assert(u);
|
||||
assert(f);
|
||||
@ -700,7 +690,6 @@ static int path_deserialize_item(Unit *u, const char *key, const char *value, FD
|
||||
_cleanup_free_ char *unescaped = NULL;
|
||||
ssize_t l;
|
||||
PathType type;
|
||||
PathSpec *s;
|
||||
|
||||
type = path_type_from_string(type_str);
|
||||
if (type < 0) {
|
||||
@ -742,7 +731,7 @@ _pure_ static const char *path_sub_state_to_string(Unit *u) {
|
||||
}
|
||||
|
||||
static int path_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
|
||||
PathSpec *s = userdata;
|
||||
PathSpec *s = userdata, *found = NULL;
|
||||
Path *p;
|
||||
int changed;
|
||||
|
||||
@ -755,18 +744,18 @@ static int path_dispatch_io(sd_event_source *source, int fd, uint32_t revents, v
|
||||
if (!IN_SET(p->state, PATH_WAITING, PATH_RUNNING))
|
||||
return 0;
|
||||
|
||||
/* log_debug("inotify wakeup on %s.", UNIT(p)->id); */
|
||||
|
||||
LIST_FOREACH(spec, s, p->specs)
|
||||
if (path_spec_owns_inotify_fd(s, fd))
|
||||
LIST_FOREACH(spec, i, p->specs)
|
||||
if (path_spec_owns_inotify_fd(i, fd)) {
|
||||
found = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!s) {
|
||||
if (!found) {
|
||||
log_error("Got event on unknown fd.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
changed = path_spec_fd_event(s, revents);
|
||||
changed = path_spec_fd_event(found, revents);
|
||||
if (changed < 0)
|
||||
goto fail;
|
||||
|
||||
|
@ -434,8 +434,8 @@ static int service_add_fd_store(Service *s, int fd, const char *name, bool do_po
|
||||
* Use this errno rather than E[NM]FILE to distinguish from
|
||||
* the case where systemd itself hits the file limit. */
|
||||
|
||||
LIST_FOREACH(fd_store, fs, s->fd_store) {
|
||||
r = same_fd(fs->fd, fd);
|
||||
LIST_FOREACH(fd_store, i, s->fd_store) {
|
||||
r = same_fd(i->fd, fd);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r > 0) {
|
||||
@ -504,8 +504,6 @@ static int service_add_fd_store_set(Service *s, FDSet *fds, const char *name, bo
|
||||
}
|
||||
|
||||
static void service_remove_fd_store(Service *s, const char *name) {
|
||||
ServiceFDStore *fs, *n;
|
||||
|
||||
assert(s);
|
||||
assert(name);
|
||||
|
||||
@ -567,9 +565,7 @@ static int service_verify(Service *s) {
|
||||
assert(s);
|
||||
assert(UNIT(s)->load_state == UNIT_LOADED);
|
||||
|
||||
for (ServiceExecCommand c = 0; c < _SERVICE_EXEC_COMMAND_MAX; c++) {
|
||||
ExecCommand *command;
|
||||
|
||||
for (ServiceExecCommand c = 0; c < _SERVICE_EXEC_COMMAND_MAX; c++)
|
||||
LIST_FOREACH(command, command, s->exec_command[c]) {
|
||||
if (!path_is_absolute(command->path) && !filename_is_valid(command->path))
|
||||
return log_unit_error_errno(UNIT(s), SYNTHETIC_ERRNO(ENOEXEC),
|
||||
@ -581,7 +577,6 @@ static int service_verify(Service *s) {
|
||||
"Service has an empty argv in %s=. Refusing.",
|
||||
service_exec_command_to_string(c));
|
||||
}
|
||||
}
|
||||
|
||||
if (!s->exec_command[SERVICE_EXEC_START] && !s->exec_command[SERVICE_EXEC_STOP] &&
|
||||
UNIT(s)->success_action == EMERGENCY_ACTION_NONE)
|
||||
@ -1334,7 +1329,6 @@ static int service_collect_fds(
|
||||
}
|
||||
|
||||
if (s->n_fd_store > 0) {
|
||||
ServiceFDStore *fs;
|
||||
size_t n_fds;
|
||||
char **nl;
|
||||
int *t;
|
||||
@ -2712,7 +2706,6 @@ static int service_serialize_exec_command(Unit *u, FILE *f, ExecCommand *command
|
||||
|
||||
static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
Service *s = SERVICE(u);
|
||||
ServiceFDStore *fs;
|
||||
int r;
|
||||
|
||||
assert(u);
|
||||
|
@ -208,8 +208,6 @@ static int socket_arm_timer(Socket *s, usec_t usec) {
|
||||
}
|
||||
|
||||
static bool have_non_accept_socket(Socket *s) {
|
||||
SocketPort *p;
|
||||
|
||||
assert(s);
|
||||
|
||||
if (!s->accept)
|
||||
@ -228,7 +226,6 @@ static bool have_non_accept_socket(Socket *s) {
|
||||
}
|
||||
|
||||
static int socket_add_mount_dependencies(Socket *s) {
|
||||
SocketPort *p;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
@ -368,7 +365,6 @@ static int socket_add_extras(Socket *s) {
|
||||
|
||||
static const char *socket_find_symlink_target(Socket *s) {
|
||||
const char *found = NULL;
|
||||
SocketPort *p;
|
||||
|
||||
LIST_FOREACH(port, p, s->ports) {
|
||||
const char *f = NULL;
|
||||
@ -565,7 +561,6 @@ _const_ static const char* listen_lookup(int family, int type) {
|
||||
|
||||
static void socket_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
Socket *s = SOCKET(u);
|
||||
SocketPort *p;
|
||||
const char *prefix2, *str;
|
||||
|
||||
assert(s);
|
||||
@ -923,7 +918,6 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) {
|
||||
}
|
||||
|
||||
static void socket_close_fds(Socket *s) {
|
||||
SocketPort *p;
|
||||
char **i;
|
||||
|
||||
assert(s);
|
||||
@ -1624,7 +1618,6 @@ static int socket_open_fds(Socket *orig_s) {
|
||||
_cleanup_(socket_close_fdsp) Socket *s = orig_s;
|
||||
_cleanup_(mac_selinux_freep) char *label = NULL;
|
||||
bool know_label = false;
|
||||
SocketPort *p;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
@ -1734,7 +1727,6 @@ static int socket_open_fds(Socket *orig_s) {
|
||||
}
|
||||
|
||||
static void socket_unwatch_fds(Socket *s) {
|
||||
SocketPort *p;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
@ -1753,7 +1745,6 @@ static void socket_unwatch_fds(Socket *s) {
|
||||
}
|
||||
|
||||
static int socket_watch_fds(Socket *s) {
|
||||
SocketPort *p;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
@ -1791,7 +1782,6 @@ enum {
|
||||
|
||||
static int socket_check_open(Socket *s) {
|
||||
bool have_open = false, have_closed = false;
|
||||
SocketPort *p;
|
||||
|
||||
assert(s);
|
||||
|
||||
@ -1995,7 +1985,6 @@ static int socket_chown(Socket *s, pid_t *_pid) {
|
||||
if (r == 0) {
|
||||
uid_t uid = UID_INVALID;
|
||||
gid_t gid = GID_INVALID;
|
||||
SocketPort *p;
|
||||
|
||||
/* Child */
|
||||
|
||||
@ -2294,7 +2283,7 @@ fail:
|
||||
}
|
||||
|
||||
static void flush_ports(Socket *s) {
|
||||
SocketPort *p;
|
||||
assert(s);
|
||||
|
||||
/* Flush all incoming traffic, regardless if actual bytes or new connections, so that this socket isn't busy
|
||||
* anymore */
|
||||
@ -2563,7 +2552,6 @@ static int socket_stop(Unit *u) {
|
||||
|
||||
static int socket_serialize(Unit *u, FILE *f, FDSet *fds) {
|
||||
Socket *s = SOCKET(u);
|
||||
SocketPort *p;
|
||||
int r;
|
||||
|
||||
assert(u);
|
||||
@ -2674,7 +2662,6 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
|
||||
}
|
||||
} else if (streq(key, "fifo")) {
|
||||
int fd, skip = 0;
|
||||
SocketPort *p;
|
||||
|
||||
if (sscanf(value, "%i %n", &fd, &skip) < 1 || fd < 0 || !fdset_contains(fds, fd))
|
||||
log_unit_debug(u, "Failed to parse fifo value: %s", value);
|
||||
@ -2695,7 +2682,6 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
|
||||
|
||||
} else if (streq(key, "special")) {
|
||||
int fd, skip = 0;
|
||||
SocketPort *p;
|
||||
|
||||
if (sscanf(value, "%i %n", &fd, &skip) < 1 || fd < 0 || !fdset_contains(fds, fd))
|
||||
log_unit_debug(u, "Failed to parse special value: %s", value);
|
||||
@ -2716,7 +2702,6 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
|
||||
|
||||
} else if (streq(key, "mqueue")) {
|
||||
int fd, skip = 0;
|
||||
SocketPort *p;
|
||||
|
||||
if (sscanf(value, "%i %n", &fd, &skip) < 1 || fd < 0 || !fdset_contains(fds, fd))
|
||||
log_unit_debug(u, "Failed to parse mqueue value: %s", value);
|
||||
@ -2737,7 +2722,6 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
|
||||
|
||||
} else if (streq(key, "socket")) {
|
||||
int fd, type, skip = 0;
|
||||
SocketPort *p;
|
||||
|
||||
if (sscanf(value, "%i %i %n", &fd, &type, &skip) < 2 || fd < 0 || type < 0 || !fdset_contains(fds, fd))
|
||||
log_unit_debug(u, "Failed to parse socket value: %s", value);
|
||||
@ -2758,7 +2742,6 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
|
||||
|
||||
} else if (streq(key, "netlink")) {
|
||||
int fd, skip = 0;
|
||||
SocketPort *p;
|
||||
|
||||
if (sscanf(value, "%i %n", &fd, &skip) < 1 || fd < 0 || !fdset_contains(fds, fd))
|
||||
log_unit_debug(u, "Failed to parse socket value: %s", value);
|
||||
@ -2778,7 +2761,6 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
|
||||
|
||||
} else if (streq(key, "ffs")) {
|
||||
int fd, skip = 0;
|
||||
SocketPort *p;
|
||||
|
||||
if (sscanf(value, "%i %n", &fd, &skip) < 1 || fd < 0 || !fdset_contains(fds, fd))
|
||||
log_unit_debug(u, "Failed to parse ffs value: %s", value);
|
||||
@ -2805,7 +2787,6 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
|
||||
|
||||
static void socket_distribute_fds(Unit *u, FDSet *fds) {
|
||||
Socket *s = SOCKET(u);
|
||||
SocketPort *p;
|
||||
|
||||
assert(u);
|
||||
|
||||
@ -3227,7 +3208,6 @@ static int socket_dispatch_timer(sd_event_source *source, usec_t usec, void *use
|
||||
|
||||
int socket_collect_fds(Socket *s, int **fds) {
|
||||
size_t k = 0, n = 0;
|
||||
SocketPort *p;
|
||||
int *rfds;
|
||||
|
||||
assert(s);
|
||||
|
@ -537,7 +537,6 @@ static void swap_process_new(Manager *m, const char *device, int prio, bool set_
|
||||
|
||||
static void swap_set_state(Swap *s, SwapState state) {
|
||||
SwapState old_state;
|
||||
Swap *other;
|
||||
|
||||
assert(s);
|
||||
|
||||
@ -745,8 +744,6 @@ static void swap_enter_dead_or_active(Swap *s, SwapResult f) {
|
||||
assert(s);
|
||||
|
||||
if (s->from_proc_swaps) {
|
||||
Swap *other;
|
||||
|
||||
swap_enter_active(s, f);
|
||||
|
||||
LIST_FOREACH_OTHERS(same_devnode, other, s)
|
||||
@ -902,7 +899,7 @@ static void swap_cycle_clear(Swap *s) {
|
||||
}
|
||||
|
||||
static int swap_start(Unit *u) {
|
||||
Swap *s = SWAP(u), *other;
|
||||
Swap *s = SWAP(u);
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
@ -1207,7 +1204,6 @@ static int swap_load_proc_swaps(Manager *m, bool set_flags) {
|
||||
}
|
||||
|
||||
static int swap_process_proc_swaps(Manager *m) {
|
||||
Unit *u;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
@ -1300,7 +1296,7 @@ static int swap_dispatch_io(sd_event_source *source, int fd, uint32_t revents, v
|
||||
|
||||
static Unit *swap_following(Unit *u) {
|
||||
Swap *s = SWAP(u);
|
||||
Swap *other, *first = NULL;
|
||||
Swap *first = NULL;
|
||||
|
||||
assert(s);
|
||||
|
||||
@ -1336,7 +1332,7 @@ static Unit *swap_following(Unit *u) {
|
||||
}
|
||||
|
||||
static int swap_following_set(Unit *u, Set **_set) {
|
||||
Swap *s = SWAP(u), *other;
|
||||
Swap *s = SWAP(u);
|
||||
_cleanup_set_free_ Set *set = NULL;
|
||||
int r;
|
||||
|
||||
|
@ -83,7 +83,6 @@ static int timer_verify(Timer *t) {
|
||||
|
||||
static int timer_add_default_dependencies(Timer *t) {
|
||||
int r;
|
||||
TimerValue *v;
|
||||
|
||||
assert(t);
|
||||
|
||||
@ -236,7 +235,6 @@ static int timer_load(Unit *u) {
|
||||
static void timer_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
Timer *t = TIMER(u);
|
||||
Unit *trigger;
|
||||
TimerValue *v;
|
||||
|
||||
trigger = UNIT_TRIGGER(u);
|
||||
|
||||
@ -375,7 +373,6 @@ static void timer_enter_waiting(Timer *t, bool time_change) {
|
||||
bool found_monotonic = false, found_realtime = false;
|
||||
bool leave_around = false;
|
||||
triple_timestamp ts;
|
||||
TimerValue *v;
|
||||
Unit *trigger;
|
||||
int r;
|
||||
|
||||
@ -617,7 +614,6 @@ fail:
|
||||
|
||||
static int timer_start(Unit *u) {
|
||||
Timer *t = TIMER(u);
|
||||
TimerValue *v;
|
||||
int r;
|
||||
|
||||
assert(t);
|
||||
@ -756,7 +752,6 @@ static int timer_dispatch(sd_event_source *s, uint64_t usec, void *userdata) {
|
||||
|
||||
static void timer_trigger_notify(Unit *u, Unit *other) {
|
||||
Timer *t = TIMER(u);
|
||||
TimerValue *v;
|
||||
|
||||
assert(u);
|
||||
assert(other);
|
||||
|
@ -46,7 +46,7 @@ void transaction_abort(Transaction *tr) {
|
||||
}
|
||||
|
||||
static void transaction_find_jobs_that_matter_to_anchor(Job *j, unsigned generation) {
|
||||
JobDependency *l;
|
||||
assert(j);
|
||||
|
||||
/* A recursive sweep through the graph that marks all units
|
||||
* that matter to the anchor job, i.e. are directly or
|
||||
@ -71,7 +71,7 @@ static void transaction_find_jobs_that_matter_to_anchor(Job *j, unsigned generat
|
||||
}
|
||||
|
||||
static void transaction_merge_and_delete_job(Transaction *tr, Job *j, Job *other, JobType t) {
|
||||
JobDependency *l, *last;
|
||||
JobDependency *last;
|
||||
|
||||
assert(j);
|
||||
assert(other);
|
||||
@ -124,8 +124,6 @@ static void transaction_merge_and_delete_job(Transaction *tr, Job *j, Job *other
|
||||
}
|
||||
|
||||
_pure_ static bool job_is_conflicted_by(Job *j) {
|
||||
JobDependency *l;
|
||||
|
||||
assert(j);
|
||||
|
||||
/* Returns true if this job is pulled in by a least one
|
||||
@ -138,10 +136,8 @@ _pure_ static bool job_is_conflicted_by(Job *j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static int delete_one_unmergeable_job(Transaction *tr, Job *j) {
|
||||
Job *k;
|
||||
|
||||
assert(j);
|
||||
static int delete_one_unmergeable_job(Transaction *tr, Job *job) {
|
||||
assert(job);
|
||||
|
||||
/* Tries to delete one item in the linked list
|
||||
* j->transaction_next->transaction_next->... that conflicts
|
||||
@ -150,7 +146,7 @@ static int delete_one_unmergeable_job(Transaction *tr, Job *j) {
|
||||
|
||||
/* We rely here on the fact that if a merged with b does not
|
||||
* merge with c, either a or b merge with c neither */
|
||||
LIST_FOREACH(transaction, j, j)
|
||||
LIST_FOREACH(transaction, j, job)
|
||||
LIST_FOREACH(transaction, k, j->transaction_next) {
|
||||
Job *d;
|
||||
|
||||
@ -226,7 +222,6 @@ static int transaction_merge_jobs(Transaction *tr, sd_bus_error *e) {
|
||||
* task conflict. If so, try to drop one of them. */
|
||||
HASHMAP_FOREACH(j, tr->jobs) {
|
||||
JobType t;
|
||||
Job *k;
|
||||
|
||||
t = j->type;
|
||||
LIST_FOREACH(transaction, k, j->transaction_next) {
|
||||
@ -257,12 +252,12 @@ static int transaction_merge_jobs(Transaction *tr, sd_bus_error *e) {
|
||||
/* Second step, merge the jobs. */
|
||||
HASHMAP_FOREACH(j, tr->jobs) {
|
||||
JobType t = j->type;
|
||||
Job *k;
|
||||
|
||||
/* Merge all transaction jobs for j->unit */
|
||||
LIST_FOREACH(transaction, k, j->transaction_next)
|
||||
assert_se(job_type_merge_and_collapse(&t, k->type, j->unit) == 0);
|
||||
|
||||
Job *k;
|
||||
while ((k = j->transaction_next)) {
|
||||
if (tr->anchor_job == k) {
|
||||
transaction_merge_and_delete_job(tr, k, j, t);
|
||||
@ -293,7 +288,6 @@ static void transaction_drop_redundant(Transaction *tr) {
|
||||
|
||||
HASHMAP_FOREACH(j, tr->jobs) {
|
||||
bool keep = false;
|
||||
Job *k;
|
||||
|
||||
LIST_FOREACH(transaction, k, j)
|
||||
if (tr->anchor_job == k ||
|
||||
@ -314,14 +308,15 @@ static void transaction_drop_redundant(Transaction *tr) {
|
||||
} while (again);
|
||||
}
|
||||
|
||||
_pure_ static bool unit_matters_to_anchor(Unit *u, Job *j) {
|
||||
_pure_ static bool unit_matters_to_anchor(Unit *u, Job *job) {
|
||||
assert(u);
|
||||
assert(!j->transaction_prev);
|
||||
assert(job);
|
||||
assert(!job->transaction_prev);
|
||||
|
||||
/* Checks whether at least one of the jobs for this unit
|
||||
* matters to the anchor. */
|
||||
|
||||
LIST_FOREACH(transaction, j, j)
|
||||
LIST_FOREACH(transaction, j, job)
|
||||
if (j->matters_to_anchor)
|
||||
return true;
|
||||
|
||||
@ -558,7 +553,7 @@ static int transaction_is_destructive(Transaction *tr, JobMode mode, sd_bus_erro
|
||||
}
|
||||
|
||||
static void transaction_minimize_impact(Transaction *tr) {
|
||||
Job *j;
|
||||
Job *head;
|
||||
|
||||
assert(tr);
|
||||
|
||||
@ -566,8 +561,8 @@ static void transaction_minimize_impact(Transaction *tr) {
|
||||
* or that stop a running service. */
|
||||
|
||||
rescan:
|
||||
HASHMAP_FOREACH(j, tr->jobs) {
|
||||
LIST_FOREACH(transaction, j, j) {
|
||||
HASHMAP_FOREACH(head, tr->jobs) {
|
||||
LIST_FOREACH(transaction, j, head) {
|
||||
bool stops_running_service, changes_existing_job;
|
||||
|
||||
/* If it matters, we shouldn't drop it */
|
||||
@ -804,13 +799,13 @@ static Job* transaction_add_one_job(Transaction *tr, JobType type, Unit *unit, b
|
||||
|
||||
f = hashmap_get(tr->jobs, unit);
|
||||
|
||||
LIST_FOREACH(transaction, j, f) {
|
||||
assert(j->unit == unit);
|
||||
LIST_FOREACH(transaction, i, f) {
|
||||
assert(i->unit == unit);
|
||||
|
||||
if (j->type == type) {
|
||||
if (i->type == type) {
|
||||
if (is_new)
|
||||
*is_new = false;
|
||||
return j;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5869,7 +5869,7 @@ int unit_thaw_vtable_common(Unit *u) {
|
||||
}
|
||||
|
||||
Condition *unit_find_failed_condition(Unit *u) {
|
||||
Condition *c, *failed_trigger = NULL;
|
||||
Condition *failed_trigger = NULL;
|
||||
bool has_succeeded_trigger = false;
|
||||
|
||||
if (u->condition_result)
|
||||
|
@ -1334,7 +1334,7 @@ static int get_boots(
|
||||
|
||||
bool skip_once;
|
||||
int r, count = 0;
|
||||
BootId *head = NULL, *tail = NULL, *id;
|
||||
BootId *head = NULL, *tail = NULL;
|
||||
const bool advance_older = boot_id && offset <= 0;
|
||||
sd_id128_t previous_boot_id;
|
||||
|
||||
@ -1449,7 +1449,7 @@ finish:
|
||||
|
||||
static int list_boots(sd_journal *j) {
|
||||
_cleanup_(table_unrefp) Table *table = NULL;
|
||||
BootId *id, *all_ids;
|
||||
BootId *all_ids;
|
||||
int count, i, r;
|
||||
|
||||
assert(j);
|
||||
|
@ -185,10 +185,10 @@ static unsigned burst_modulate(unsigned burst, uint64_t available) {
|
||||
}
|
||||
|
||||
int journal_ratelimit_test(JournalRateLimit *r, const char *id, usec_t rl_interval, unsigned rl_burst, int priority, uint64_t available) {
|
||||
uint64_t h;
|
||||
JournalRateLimitGroup *g;
|
||||
JournalRateLimitGroup *g, *found = NULL;
|
||||
JournalRateLimitPool *p;
|
||||
unsigned burst;
|
||||
uint64_t h;
|
||||
usec_t ts;
|
||||
|
||||
assert(id);
|
||||
@ -208,23 +208,25 @@ int journal_ratelimit_test(JournalRateLimit *r, const char *id, usec_t rl_interv
|
||||
h = siphash24_string(id, r->hash_key);
|
||||
g = r->buckets[h % BUCKETS_MAX];
|
||||
|
||||
LIST_FOREACH(bucket, g, g)
|
||||
if (streq(g->id, id))
|
||||
LIST_FOREACH(bucket, i, g)
|
||||
if (streq(i->id, id)) {
|
||||
found = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!g) {
|
||||
g = journal_ratelimit_group_new(r, id, rl_interval, ts);
|
||||
if (!g)
|
||||
if (!found) {
|
||||
found = journal_ratelimit_group_new(r, id, rl_interval, ts);
|
||||
if (!found)
|
||||
return -ENOMEM;
|
||||
} else
|
||||
g->interval = rl_interval;
|
||||
found->interval = rl_interval;
|
||||
|
||||
if (rl_interval == 0 || rl_burst == 0)
|
||||
return 1;
|
||||
|
||||
burst = burst_modulate(rl_burst, available);
|
||||
|
||||
p = &g->pools[priority_map[priority]];
|
||||
p = &found->pools[priority_map[priority]];
|
||||
|
||||
if (p->begin <= 0) {
|
||||
p->suppressed = 0;
|
||||
|
@ -328,7 +328,6 @@ static int option_append_pd_prefix(uint8_t **buf, size_t *buflen, const struct i
|
||||
|
||||
int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, const DHCP6IA *ia) {
|
||||
struct ia_header header;
|
||||
const DHCP6Address *addr;
|
||||
size_t ia_buflen;
|
||||
uint8_t *ia_hdr;
|
||||
uint16_t len;
|
||||
|
@ -916,13 +916,15 @@ int dhcp_lease_parse_search_domains(const uint8_t *option, size_t len, char ***d
|
||||
}
|
||||
|
||||
int dhcp_lease_insert_private_option(sd_dhcp_lease *lease, uint8_t tag, const void *data, uint8_t len) {
|
||||
struct sd_dhcp_raw_option *cur, *option;
|
||||
struct sd_dhcp_raw_option *option, *before = NULL;
|
||||
|
||||
assert(lease);
|
||||
|
||||
LIST_FOREACH(options, cur, lease->private_options) {
|
||||
if (tag < cur->tag)
|
||||
if (tag < cur->tag) {
|
||||
before = cur;
|
||||
break;
|
||||
}
|
||||
if (tag == cur->tag) {
|
||||
log_debug("Ignoring duplicate option, tagged %i.", tag);
|
||||
return 0;
|
||||
@ -941,7 +943,7 @@ int dhcp_lease_insert_private_option(sd_dhcp_lease *lease, uint8_t tag, const vo
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
LIST_INSERT_BEFORE(options, lease->private_options, cur, option);
|
||||
LIST_INSERT_BEFORE(options, lease->private_options, before, option);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -961,7 +963,6 @@ int dhcp_lease_new(sd_dhcp_lease **ret) {
|
||||
int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) {
|
||||
_cleanup_(unlink_and_freep) char *temp_path = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
struct sd_dhcp_raw_option *option;
|
||||
struct in_addr address;
|
||||
const struct in_addr *addresses;
|
||||
const void *client_id, *data;
|
||||
|
@ -41,7 +41,6 @@ static usec_t sec2usec(uint32_t sec) {
|
||||
|
||||
static void dhcp6_lease_set_lifetime(sd_dhcp6_lease *lease) {
|
||||
uint32_t t1 = UINT32_MAX, t2 = UINT32_MAX, min_valid_lt = UINT32_MAX;
|
||||
DHCP6Address *a;
|
||||
|
||||
assert(lease);
|
||||
assert(lease->ia_na || lease->ia_pd);
|
||||
@ -107,8 +106,6 @@ int sd_dhcp6_lease_get_server_address(sd_dhcp6_lease *lease, struct in6_addr *re
|
||||
}
|
||||
|
||||
void dhcp6_ia_clear_addresses(DHCP6IA *ia) {
|
||||
DHCP6Address *a, *n;
|
||||
|
||||
assert(ia);
|
||||
|
||||
LIST_FOREACH_SAFE(addresses, a, n, ia->addresses)
|
||||
|
@ -148,8 +148,6 @@ static be32_t usec_to_be32_sec(usec_t usec) {
|
||||
}
|
||||
|
||||
static int radv_send(sd_radv *ra, const struct in6_addr *dst, usec_t lifetime_usec) {
|
||||
sd_radv_route_prefix *rt;
|
||||
sd_radv_prefix *p;
|
||||
struct sockaddr_in6 dst_addr = {
|
||||
.sin6_family = AF_INET6,
|
||||
.sin6_addr = IN6ADDR_ALL_NODES_MULTICAST_INIT,
|
||||
@ -578,7 +576,7 @@ int sd_radv_set_preference(sd_radv *ra, unsigned preference) {
|
||||
|
||||
int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p) {
|
||||
_cleanup_free_ char *addr_p = NULL;
|
||||
sd_radv_prefix *cur, *found = NULL;
|
||||
sd_radv_prefix *found = NULL;
|
||||
int r;
|
||||
|
||||
assert_return(ra, -EINVAL);
|
||||
@ -661,8 +659,6 @@ void sd_radv_remove_prefix(
|
||||
const struct in6_addr *prefix,
|
||||
unsigned char prefixlen) {
|
||||
|
||||
sd_radv_prefix *cur;
|
||||
|
||||
if (!ra)
|
||||
return;
|
||||
|
||||
@ -685,7 +681,7 @@ void sd_radv_remove_prefix(
|
||||
|
||||
int sd_radv_add_route_prefix(sd_radv *ra, sd_radv_route_prefix *p) {
|
||||
_cleanup_free_ char *addr_p = NULL;
|
||||
sd_radv_route_prefix *cur, *found = NULL;
|
||||
sd_radv_route_prefix *found = NULL;
|
||||
int r;
|
||||
|
||||
assert_return(ra, -EINVAL);
|
||||
|
@ -101,7 +101,6 @@ static int add_enumerated_to_set(
|
||||
OrderedSet *s,
|
||||
sd_bus_error *error) {
|
||||
|
||||
struct node_enumerator *c;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -173,7 +172,6 @@ static int add_subtree_to_set(
|
||||
OrderedSet *s,
|
||||
sd_bus_error *error) {
|
||||
|
||||
struct node *i;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -251,7 +249,6 @@ static int node_callbacks_run(
|
||||
bool require_fallback,
|
||||
bool *found_object) {
|
||||
|
||||
struct node_callback *c;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -807,7 +804,6 @@ static int property_get_all_callbacks_run(
|
||||
bool *found_object) {
|
||||
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
|
||||
struct node_vtable *c;
|
||||
bool found_interface;
|
||||
int r;
|
||||
|
||||
@ -887,8 +883,6 @@ static int bus_node_exists(
|
||||
const char *path,
|
||||
bool require_fallback) {
|
||||
|
||||
struct node_vtable *c;
|
||||
struct node_callback *k;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
@ -936,7 +930,6 @@ int introspect_path(
|
||||
|
||||
_cleanup_ordered_set_free_ OrderedSet *s = NULL;
|
||||
_cleanup_(introspect_free) struct introspect intro = {};
|
||||
struct node_vtable *c;
|
||||
bool empty;
|
||||
int r;
|
||||
|
||||
@ -1057,7 +1050,6 @@ static int object_manager_serialize_path(
|
||||
|
||||
const char *previous_interface = NULL;
|
||||
bool found_something = false;
|
||||
struct node_vtable *i;
|
||||
struct node *n;
|
||||
int r;
|
||||
|
||||
@ -1787,7 +1779,7 @@ static int add_object_vtable_internal(
|
||||
void *userdata) {
|
||||
|
||||
sd_bus_slot *s = NULL;
|
||||
struct node_vtable *i, *existing = NULL;
|
||||
struct node_vtable *existing = NULL;
|
||||
const sd_bus_vtable *v;
|
||||
struct node *n;
|
||||
int r;
|
||||
@ -2068,7 +2060,6 @@ static int emit_properties_changed_on_interface(
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
|
||||
bool has_invalidating = false, has_changing = false;
|
||||
struct vtable_member key = {};
|
||||
struct node_vtable *c;
|
||||
struct node *n;
|
||||
char **property;
|
||||
void *u = NULL;
|
||||
@ -2355,7 +2346,6 @@ static int object_added_append_all_prefix(
|
||||
bool require_fallback) {
|
||||
|
||||
const char *previous_interface = NULL;
|
||||
struct node_vtable *c;
|
||||
struct node *n;
|
||||
int r;
|
||||
|
||||
@ -2575,7 +2565,6 @@ static int object_removed_append_all_prefix(
|
||||
bool require_fallback) {
|
||||
|
||||
const char *previous_interface = NULL;
|
||||
struct node_vtable *c;
|
||||
struct node *n;
|
||||
int r;
|
||||
|
||||
@ -2753,7 +2742,6 @@ static int interfaces_added_append_one_prefix(
|
||||
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
bool found_interface = false;
|
||||
struct node_vtable *c;
|
||||
struct node *n;
|
||||
void *u = NULL;
|
||||
int r;
|
||||
|
@ -2783,7 +2783,6 @@ static int process_reply(sd_bus *bus, sd_bus_message *m) {
|
||||
|
||||
static int process_filter(sd_bus *bus, sd_bus_message *m) {
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error_buffer = SD_BUS_ERROR_NULL;
|
||||
struct filter_callback *l;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
|
@ -1920,7 +1920,6 @@ static int event_make_inode_data(
|
||||
static uint32_t inode_data_determine_mask(struct inode_data *d) {
|
||||
bool excl_unlink = true;
|
||||
uint32_t combined = 0;
|
||||
sd_event_source *s;
|
||||
|
||||
assert(d);
|
||||
|
||||
@ -3458,9 +3457,7 @@ static int event_inotify_data_process(sd_event *e, struct inotify_data *d) {
|
||||
/* The queue overran, let's pass this event to all event sources connected to this inotify
|
||||
* object */
|
||||
|
||||
HASHMAP_FOREACH(inode_data, d->inodes) {
|
||||
sd_event_source *s;
|
||||
|
||||
HASHMAP_FOREACH(inode_data, d->inodes)
|
||||
LIST_FOREACH(inotify.by_inode_data, s, inode_data->event_sources) {
|
||||
|
||||
if (event_source_is_offline(s))
|
||||
@ -3470,10 +3467,8 @@ static int event_inotify_data_process(sd_event *e, struct inotify_data *d) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
struct inode_data *inode_data;
|
||||
sd_event_source *s;
|
||||
|
||||
/* Find the inode object for this watch descriptor. If IN_IGNORED is set we also remove it from
|
||||
* our watch descriptor table. */
|
||||
@ -3521,7 +3516,6 @@ static int event_inotify_data_process(sd_event *e, struct inotify_data *d) {
|
||||
}
|
||||
|
||||
static int process_inotify(sd_event *e) {
|
||||
struct inotify_data *d;
|
||||
int r, done = 0;
|
||||
|
||||
assert(e);
|
||||
|
@ -86,7 +86,6 @@ MMapCache* mmap_cache_new(void) {
|
||||
}
|
||||
|
||||
static void window_unlink(Window *w) {
|
||||
Context *c;
|
||||
|
||||
assert(w);
|
||||
|
||||
@ -306,7 +305,7 @@ static int find_mmap(
|
||||
size_t size,
|
||||
void **ret) {
|
||||
|
||||
Window *w;
|
||||
Window *found = NULL;
|
||||
|
||||
assert(f);
|
||||
assert(f->cache);
|
||||
@ -318,16 +317,18 @@ static int find_mmap(
|
||||
return -EIO;
|
||||
|
||||
LIST_FOREACH(by_fd, w, f->windows)
|
||||
if (window_matches(w, offset, size))
|
||||
if (window_matches(w, offset, size)) {
|
||||
found = w;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!w)
|
||||
if (!found)
|
||||
return 0;
|
||||
|
||||
context_attach_window(f->cache, c, w);
|
||||
w->keep_always = w->keep_always || keep_always;
|
||||
context_attach_window(f->cache, c, found);
|
||||
found->keep_always = found->keep_always || keep_always;
|
||||
|
||||
*ret = (uint8_t*) w->ptr + (offset - w->offset);
|
||||
*ret = (uint8_t*) found->ptr + (offset - found->offset);
|
||||
f->cache->n_window_list_hit++;
|
||||
|
||||
return 1;
|
||||
@ -494,8 +495,6 @@ static void mmap_cache_process_sigbus(MMapCache *m) {
|
||||
|
||||
ours = false;
|
||||
HASHMAP_FOREACH(f, m->fds) {
|
||||
Window *w;
|
||||
|
||||
LIST_FOREACH(by_fd, w, f->windows) {
|
||||
if ((uint8_t*) addr >= (uint8_t*) w->ptr &&
|
||||
(uint8_t*) addr < (uint8_t*) w->ptr + w->size) {
|
||||
@ -523,8 +522,6 @@ static void mmap_cache_process_sigbus(MMapCache *m) {
|
||||
return;
|
||||
|
||||
HASHMAP_FOREACH(f, m->fds) {
|
||||
Window *w;
|
||||
|
||||
if (!f->sigbus)
|
||||
continue;
|
||||
|
||||
|
@ -233,7 +233,7 @@ static Match *match_free_if_empty(Match *m) {
|
||||
}
|
||||
|
||||
_public_ int sd_journal_add_match(sd_journal *j, const void *data, size_t size) {
|
||||
Match *l3, *l4, *add_here = NULL, *m = NULL;
|
||||
Match *add_here = NULL, *m = NULL;
|
||||
uint64_t hash;
|
||||
|
||||
assert_return(j, -EINVAL);
|
||||
@ -372,7 +372,6 @@ _public_ int sd_journal_add_disjunction(sd_journal *j) {
|
||||
|
||||
static char *match_make_string(Match *m) {
|
||||
char *p = NULL, *r;
|
||||
Match *i;
|
||||
bool enclose = false;
|
||||
|
||||
if (!m)
|
||||
@ -518,7 +517,6 @@ static int next_for_match(
|
||||
return journal_file_move_to_entry_by_offset_for_data(f, d, after_offset, direction, ret, offset);
|
||||
|
||||
} else if (m->type == MATCH_OR_TERM) {
|
||||
Match *i;
|
||||
|
||||
/* Find the earliest match beyond after_offset */
|
||||
|
||||
@ -538,7 +536,7 @@ static int next_for_match(
|
||||
return 0;
|
||||
|
||||
} else if (m->type == MATCH_AND_TERM) {
|
||||
Match *i, *last_moved;
|
||||
Match *last_moved;
|
||||
|
||||
/* Always jump to the next matching entry and repeat
|
||||
* this until we find an offset that matches for all
|
||||
@ -636,7 +634,6 @@ static int find_location_for_match(
|
||||
} else if (m->type == MATCH_OR_TERM) {
|
||||
uint64_t np = 0;
|
||||
Object *n;
|
||||
Match *i;
|
||||
|
||||
/* Find the earliest match */
|
||||
|
||||
@ -667,7 +664,6 @@ static int find_location_for_match(
|
||||
return 1;
|
||||
|
||||
} else {
|
||||
Match *i;
|
||||
uint64_t np = 0;
|
||||
|
||||
assert(m->type == MATCH_AND_TERM);
|
||||
|
@ -424,7 +424,6 @@ static int process_reply(sd_netlink *nl, sd_netlink_message *m) {
|
||||
}
|
||||
|
||||
static int process_match(sd_netlink *nl, sd_netlink_message *m) {
|
||||
struct match_callback *c;
|
||||
uint16_t type;
|
||||
uint8_t cmd;
|
||||
int r;
|
||||
|
@ -110,8 +110,6 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
|
||||
}
|
||||
|
||||
void udev_list_cleanup(struct udev_list *list) {
|
||||
struct udev_list_entry *i, *n;
|
||||
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
|
@ -3813,8 +3813,8 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err
|
||||
if (streq_ptr(path, user->service_job)) {
|
||||
user->service_job = mfree(user->service_job);
|
||||
|
||||
LIST_FOREACH(sessions_by_user, session, user->sessions)
|
||||
(void) session_jobs_reply(session, id, unit, NULL /* don't propagate user service failures to the client */);
|
||||
LIST_FOREACH(sessions_by_user, s, user->sessions)
|
||||
(void) session_jobs_reply(s, id, unit, NULL /* don't propagate user service failures to the client */);
|
||||
|
||||
user_save(user);
|
||||
}
|
||||
|
@ -67,7 +67,6 @@ void device_free(Device *d) {
|
||||
}
|
||||
|
||||
void device_attach(Device *d, Seat *s) {
|
||||
Device *i;
|
||||
bool had_master;
|
||||
|
||||
assert(d);
|
||||
|
@ -56,7 +56,6 @@ static int property_get_sessions(
|
||||
sd_bus_error *error) {
|
||||
|
||||
Seat *s = userdata;
|
||||
Session *session;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
|
@ -122,8 +122,6 @@ int seat_save(Seat *s) {
|
||||
}
|
||||
|
||||
if (s->sessions) {
|
||||
Session *i;
|
||||
|
||||
fputs("SESSIONS=", f);
|
||||
LIST_FOREACH(sessions_by_seat, i, s->sessions) {
|
||||
fprintf(f,
|
||||
@ -349,7 +347,7 @@ int seat_switch_to_previous(Seat *s) {
|
||||
}
|
||||
|
||||
int seat_active_vt_changed(Seat *s, unsigned vtnr) {
|
||||
Session *i, *new_active = NULL;
|
||||
Session *new_active = NULL;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
@ -368,7 +366,7 @@ int seat_active_vt_changed(Seat *s, unsigned vtnr) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!new_active) {
|
||||
if (!new_active)
|
||||
/* no running one? then we can't decide which one is the
|
||||
* active one, let the first one win */
|
||||
LIST_FOREACH(sessions_by_seat, i, s->sessions)
|
||||
@ -376,7 +374,6 @@ int seat_active_vt_changed(Seat *s, unsigned vtnr) {
|
||||
new_active = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
r = seat_set_active(s, new_active);
|
||||
manager_spawn_autovt(s->manager, vtnr);
|
||||
@ -467,7 +464,6 @@ int seat_stop(Seat *s, bool force) {
|
||||
}
|
||||
|
||||
int seat_stop_sessions(Seat *s, bool force) {
|
||||
Session *session;
|
||||
int r = 0, k;
|
||||
|
||||
assert(s);
|
||||
@ -482,7 +478,6 @@ int seat_stop_sessions(Seat *s, bool force) {
|
||||
}
|
||||
|
||||
void seat_evict_position(Seat *s, Session *session) {
|
||||
Session *iter;
|
||||
unsigned pos = session->position;
|
||||
|
||||
session->position = 0;
|
||||
@ -496,12 +491,11 @@ void seat_evict_position(Seat *s, Session *session) {
|
||||
/* There might be another session claiming the same
|
||||
* position (eg., during gdm->session transition), so let's look
|
||||
* for it and set it on the free slot. */
|
||||
LIST_FOREACH(sessions_by_seat, iter, s->sessions) {
|
||||
LIST_FOREACH(sessions_by_seat, iter, s->sessions)
|
||||
if (iter->position == pos && session_get_state(iter) != SESSION_CLOSING) {
|
||||
s->positions[pos] = iter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -599,7 +593,6 @@ bool seat_can_graphical(Seat *s) {
|
||||
}
|
||||
|
||||
int seat_get_idle_hint(Seat *s, dual_timestamp *t) {
|
||||
Session *session;
|
||||
bool idle_hint = true;
|
||||
dual_timestamp ts = DUAL_TIMESTAMP_NULL;
|
||||
|
||||
|
@ -106,7 +106,6 @@ static int property_get_sessions(
|
||||
sd_bus_error *error) {
|
||||
|
||||
User *u = userdata;
|
||||
Session *session;
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
|
@ -189,7 +189,6 @@ static int user_save_internal(User *u) {
|
||||
u->last_session_timestamp);
|
||||
|
||||
if (u->sessions) {
|
||||
Session *i;
|
||||
bool first;
|
||||
|
||||
fputs("SESSIONS=", f);
|
||||
@ -499,8 +498,8 @@ static void user_stop_service(User *u, bool force) {
|
||||
}
|
||||
|
||||
int user_stop(User *u, bool force) {
|
||||
Session *s;
|
||||
int r = 0;
|
||||
|
||||
assert(u);
|
||||
|
||||
/* This is called whenever we begin with tearing down a user record. It's called in two cases: explicit API
|
||||
@ -534,7 +533,6 @@ int user_stop(User *u, bool force) {
|
||||
}
|
||||
|
||||
int user_finalize(User *u) {
|
||||
Session *s;
|
||||
int r = 0, k;
|
||||
|
||||
assert(u);
|
||||
@ -575,7 +573,6 @@ int user_finalize(User *u) {
|
||||
}
|
||||
|
||||
int user_get_idle_hint(User *u, dual_timestamp *t) {
|
||||
Session *s;
|
||||
bool idle_hint = true;
|
||||
dual_timestamp ts = DUAL_TIMESTAMP_NULL;
|
||||
|
||||
@ -721,8 +718,6 @@ void user_add_to_gc_queue(User *u) {
|
||||
}
|
||||
|
||||
UserState user_get_state(User *u) {
|
||||
Session *i;
|
||||
|
||||
assert(u);
|
||||
|
||||
if (u->stopping)
|
||||
@ -805,8 +800,6 @@ static int elect_display_compare(Session *s1, Session *s2) {
|
||||
}
|
||||
|
||||
void user_elect_display(User *u) {
|
||||
Session *s;
|
||||
|
||||
assert(u);
|
||||
|
||||
/* This elects a primary session for each user, which we call the "display". We try to keep the assignment
|
||||
|
@ -685,7 +685,7 @@ static int manager_connect_bus(Manager *m) {
|
||||
|
||||
static int manager_vt_switch(sd_event_source *src, const struct signalfd_siginfo *si, void *data) {
|
||||
Manager *m = data;
|
||||
Session *active, *iter;
|
||||
Session *active;
|
||||
|
||||
/*
|
||||
* We got a VT-switch signal and we have to acknowledge it immediately.
|
||||
@ -732,16 +732,14 @@ static int manager_vt_switch(sd_event_source *src, const struct signalfd_siginfo
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (active->vtfd >= 0) {
|
||||
if (active->vtfd >= 0)
|
||||
session_leave_vt(active);
|
||||
} else {
|
||||
LIST_FOREACH(sessions_by_seat, iter, m->seat0->sessions) {
|
||||
else
|
||||
LIST_FOREACH(sessions_by_seat, iter, m->seat0->sessions)
|
||||
if (iter->vtnr == active->vtnr && iter->vtfd >= 0) {
|
||||
session_leave_vt(iter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1033,7 +1033,6 @@ int parse_cmdline_item(const char *key, const char *value, void *data) {
|
||||
|
||||
int context_merge_networks(Context *context) {
|
||||
Network *all, *network;
|
||||
Route *route;
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
@ -1129,8 +1128,6 @@ static int route_dump(Route *route, FILE *f) {
|
||||
}
|
||||
|
||||
void network_dump(Network *network, FILE *f) {
|
||||
Address *address;
|
||||
Route *route;
|
||||
const char *dhcp;
|
||||
char **dns;
|
||||
|
||||
|
@ -147,7 +147,7 @@ cancel:
|
||||
}
|
||||
|
||||
static int wireguard_set_peer_one(NetDev *netdev, sd_netlink_message *message, const WireguardPeer *peer, uint16_t index, WireguardIPmask **mask_start) {
|
||||
WireguardIPmask *mask, *start;
|
||||
WireguardIPmask *start, *last = NULL;
|
||||
uint16_t j = 0;
|
||||
int r;
|
||||
|
||||
@ -196,8 +196,10 @@ static int wireguard_set_peer_one(NetDev *netdev, sd_netlink_message *message, c
|
||||
r = wireguard_set_ipmask_one(netdev, message, mask, ++j);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
if (r == 0) {
|
||||
last = mask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
r = sd_netlink_message_close_container(message);
|
||||
@ -208,8 +210,8 @@ static int wireguard_set_peer_one(NetDev *netdev, sd_netlink_message *message, c
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Could not add wireguard peer: %m");
|
||||
|
||||
*mask_start = mask; /* Start next cycle from this mask. */
|
||||
return !mask;
|
||||
*mask_start = last; /* Start next cycle from this mask. */
|
||||
return !last;
|
||||
|
||||
cancel:
|
||||
r = sd_netlink_message_cancel_array(message);
|
||||
@ -222,7 +224,7 @@ cancel:
|
||||
static int wireguard_set_interface(NetDev *netdev) {
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
|
||||
WireguardIPmask *mask_start = NULL;
|
||||
WireguardPeer *peer, *peer_start;
|
||||
WireguardPeer *peer_start;
|
||||
bool sent_once = false;
|
||||
uint32_t serial;
|
||||
Wireguard *w;
|
||||
@ -267,14 +269,17 @@ static int wireguard_set_interface(NetDev *netdev) {
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Could not append wireguard peer attributes: %m");
|
||||
|
||||
WireguardPeer *peer_last = NULL;
|
||||
LIST_FOREACH(peers, peer, peer_start) {
|
||||
r = wireguard_set_peer_one(netdev, message, peer, ++i, &mask_start);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
if (r == 0) {
|
||||
peer_last = peer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
peer_start = peer; /* Start next cycle from this peer. */
|
||||
peer_start = peer_last; /* Start next cycle from this peer. */
|
||||
|
||||
r = sd_netlink_message_close_container(message);
|
||||
if (r < 0)
|
||||
@ -424,7 +429,6 @@ static int peer_resolve_endpoint(WireguardPeer *peer) {
|
||||
}
|
||||
|
||||
static void wireguard_resolve_endpoints(NetDev *netdev) {
|
||||
WireguardPeer *peer;
|
||||
Wireguard *w;
|
||||
|
||||
assert(netdev);
|
||||
@ -1124,7 +1128,6 @@ static int wireguard_peer_verify(WireguardPeer *peer) {
|
||||
}
|
||||
|
||||
static int wireguard_verify(NetDev *netdev, const char *filename) {
|
||||
WireguardPeer *peer, *peer_next;
|
||||
Wireguard *w;
|
||||
int r;
|
||||
|
||||
@ -1144,8 +1147,6 @@ static int wireguard_verify(NetDev *netdev, const char *filename) {
|
||||
"Ignoring network device.", filename);
|
||||
|
||||
LIST_FOREACH_SAFE(peers, peer, peer_next, w->peers) {
|
||||
WireguardIPmask *ipmask;
|
||||
|
||||
if (wireguard_peer_verify(peer) < 0) {
|
||||
wireguard_peer_free(peer);
|
||||
continue;
|
||||
|
@ -16,11 +16,10 @@
|
||||
#include "util.h"
|
||||
|
||||
int expose_port_parse(ExposePort **l, const char *s) {
|
||||
|
||||
const char *split, *e;
|
||||
uint16_t container_port, host_port;
|
||||
ExposePort *port;
|
||||
int protocol;
|
||||
ExposePort *p;
|
||||
int r;
|
||||
|
||||
assert(l);
|
||||
@ -59,17 +58,17 @@ int expose_port_parse(ExposePort **l, const char *s) {
|
||||
if (p->protocol == protocol && p->host_port == host_port)
|
||||
return -EEXIST;
|
||||
|
||||
p = new(ExposePort, 1);
|
||||
if (!p)
|
||||
port = new(ExposePort, 1);
|
||||
if (!port)
|
||||
return -ENOMEM;
|
||||
|
||||
*p = (ExposePort) {
|
||||
*port = (ExposePort) {
|
||||
.protocol = protocol,
|
||||
.host_port = host_port,
|
||||
.container_port = container_port,
|
||||
};
|
||||
|
||||
LIST_PREPEND(ports, *l, p);
|
||||
LIST_PREPEND(ports, *l, port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -84,7 +83,6 @@ void expose_port_free_all(ExposePort *p) {
|
||||
}
|
||||
|
||||
int expose_port_flush(FirewallContext **fw_ctx, ExposePort* l, int af, union in_addr_union *exposed) {
|
||||
ExposePort *p;
|
||||
int r;
|
||||
|
||||
assert(exposed);
|
||||
@ -117,7 +115,6 @@ int expose_port_flush(FirewallContext **fw_ctx, ExposePort* l, int af, union in_
|
||||
int expose_port_execute(sd_netlink *rtnl, FirewallContext **fw_ctx, ExposePort *l, int af, union in_addr_union *exposed) {
|
||||
_cleanup_free_ struct local_address *addresses = NULL;
|
||||
union in_addr_union new_exposed;
|
||||
ExposePort *p;
|
||||
bool add;
|
||||
int r;
|
||||
|
||||
|
@ -373,7 +373,6 @@ static int context_add_free_area(
|
||||
|
||||
static bool context_drop_one_priority(Context *context) {
|
||||
int32_t priority = 0;
|
||||
Partition *p;
|
||||
bool exists = false;
|
||||
|
||||
LIST_FOREACH(partitions, p, context->partitions) {
|
||||
@ -561,8 +560,6 @@ static uint64_t charge_weight(uint64_t total, uint64_t amount) {
|
||||
}
|
||||
|
||||
static bool context_allocate_partitions(Context *context, uint64_t *ret_largest_free_area) {
|
||||
Partition *p;
|
||||
|
||||
assert(context);
|
||||
|
||||
/* Sort free areas by size, putting smallest first */
|
||||
@ -613,7 +610,6 @@ static bool context_allocate_partitions(Context *context, uint64_t *ret_largest_
|
||||
|
||||
static int context_sum_weights(Context *context, FreeArea *a, uint64_t *ret) {
|
||||
uint64_t weight_sum = 0;
|
||||
Partition *p;
|
||||
|
||||
assert(context);
|
||||
assert(a);
|
||||
@ -677,7 +673,6 @@ static int context_grow_partitions_phase(
|
||||
uint64_t *span,
|
||||
uint64_t *weight_sum) {
|
||||
|
||||
Partition *p;
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
@ -832,9 +827,7 @@ static int context_grow_partitions_on_free_area(Context *context, FreeArea *a) {
|
||||
|
||||
/* What? Even still some space left (maybe because there was no preceding partition, or it had a
|
||||
* size limit), then let's donate it to whoever wants it. */
|
||||
if (span > 0) {
|
||||
Partition *p;
|
||||
|
||||
if (span > 0)
|
||||
LIST_FOREACH(partitions, p, context->partitions) {
|
||||
uint64_t m, xsz;
|
||||
|
||||
@ -857,7 +850,6 @@ static int context_grow_partitions_on_free_area(Context *context, FreeArea *a) {
|
||||
if (span == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Yuck, still no one? Then make it padding */
|
||||
if (span > 0 && a->after) {
|
||||
@ -869,7 +861,6 @@ static int context_grow_partitions_on_free_area(Context *context, FreeArea *a) {
|
||||
}
|
||||
|
||||
static int context_grow_partitions(Context *context) {
|
||||
Partition *p;
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
@ -903,7 +894,6 @@ static int context_grow_partitions(Context *context) {
|
||||
|
||||
static void context_place_partitions(Context *context) {
|
||||
uint64_t partno = 0;
|
||||
Partition *p;
|
||||
|
||||
assert(context);
|
||||
|
||||
@ -1729,7 +1719,7 @@ static int context_load_partition_table(
|
||||
n_partitions = fdisk_table_get_nents(t);
|
||||
for (size_t i = 0; i < n_partitions; i++) {
|
||||
_cleanup_free_ char *label_copy = NULL;
|
||||
Partition *pp, *last = NULL;
|
||||
Partition *last = NULL;
|
||||
struct fdisk_partition *p;
|
||||
struct fdisk_parttype *pt;
|
||||
const char *pts, *ids, *label;
|
||||
@ -1910,8 +1900,6 @@ add_initial_free_area:
|
||||
}
|
||||
|
||||
static void context_unload_partition_table(Context *context) {
|
||||
Partition *p, *next;
|
||||
|
||||
assert(context);
|
||||
|
||||
LIST_FOREACH_SAFE(partitions, p, next, context->partitions) {
|
||||
@ -1999,7 +1987,6 @@ static const char *partition_label(const Partition *p) {
|
||||
static int context_dump_partitions(Context *context, const char *node) {
|
||||
_cleanup_(table_unrefp) Table *t = NULL;
|
||||
uint64_t sum_padding = 0, sum_size = 0;
|
||||
Partition *p;
|
||||
int r;
|
||||
|
||||
if ((arg_json_format_flags & JSON_FORMAT_OFF) && context->n_partitions == 0) {
|
||||
@ -2189,7 +2176,7 @@ done:
|
||||
static int context_dump_partition_bar(Context *context, const char *node) {
|
||||
_cleanup_free_ Partition **bar = NULL;
|
||||
_cleanup_free_ size_t *start_array = NULL;
|
||||
Partition *p, *last = NULL;
|
||||
Partition *last = NULL;
|
||||
bool z = false;
|
||||
size_t c, j = 0;
|
||||
|
||||
@ -2300,7 +2287,7 @@ static int context_dump_partition_bar(Context *context, const char *node) {
|
||||
}
|
||||
|
||||
static bool context_changed(const Context *context) {
|
||||
Partition *p;
|
||||
assert(context);
|
||||
|
||||
LIST_FOREACH(partitions, p, context->partitions) {
|
||||
if (p->dropped)
|
||||
@ -2470,7 +2457,6 @@ static int context_discard_partition(Context *context, Partition *p) {
|
||||
|
||||
static int context_discard_gap_after(Context *context, Partition *p) {
|
||||
uint64_t gap, next = UINT64_MAX;
|
||||
Partition *q;
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
@ -2528,7 +2514,6 @@ static int context_discard_gap_after(Context *context, Partition *p) {
|
||||
}
|
||||
|
||||
static int context_wipe_and_discard(Context *context, bool from_scratch) {
|
||||
Partition *p;
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
@ -2746,7 +2731,6 @@ static int deactivate_luks(struct crypt_device *cd, const char *node) {
|
||||
}
|
||||
|
||||
static int context_copy_blocks(Context *context) {
|
||||
Partition *p;
|
||||
int whole_fd = -1, r;
|
||||
|
||||
assert(context);
|
||||
@ -2996,7 +2980,6 @@ static int partition_populate(Partition *p, const char *node) {
|
||||
}
|
||||
|
||||
static int context_mkfs(Context *context) {
|
||||
Partition *p;
|
||||
int fd = -1, r;
|
||||
|
||||
assert(context);
|
||||
@ -3114,7 +3097,6 @@ static int partition_acquire_uuid(Context *context, Partition *p, sd_id128_t *re
|
||||
} result;
|
||||
|
||||
uint64_t k = 0;
|
||||
Partition *q;
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
@ -3198,7 +3180,6 @@ static int partition_acquire_label(Context *context, Partition *p, char **ret) {
|
||||
for (;;) {
|
||||
const char *ll = label ?: prefix;
|
||||
bool retry = false;
|
||||
Partition *q;
|
||||
|
||||
LIST_FOREACH(partitions, q, context->partitions) {
|
||||
if (p == q)
|
||||
@ -3230,7 +3211,6 @@ static int partition_acquire_label(Context *context, Partition *p, char **ret) {
|
||||
}
|
||||
|
||||
static int context_acquire_partition_uuids_and_labels(Context *context) {
|
||||
Partition *p;
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
@ -3337,7 +3317,6 @@ static uint64_t partition_merge_flags(Partition *p) {
|
||||
}
|
||||
|
||||
static int context_mangle_partitions(Context *context) {
|
||||
Partition *p;
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
@ -3604,7 +3583,6 @@ static int context_read_seed(Context *context, const char *root) {
|
||||
}
|
||||
|
||||
static int context_factory_reset(Context *context, bool from_scratch) {
|
||||
Partition *p;
|
||||
size_t n = 0;
|
||||
int r;
|
||||
|
||||
@ -3653,8 +3631,6 @@ static int context_factory_reset(Context *context, bool from_scratch) {
|
||||
}
|
||||
|
||||
static int context_can_factory_reset(Context *context) {
|
||||
Partition *p;
|
||||
|
||||
assert(context);
|
||||
|
||||
LIST_FOREACH(partitions, p, context->partitions)
|
||||
@ -3969,7 +3945,6 @@ static int context_open_copy_block_paths(
|
||||
const char *root,
|
||||
dev_t restrict_devno) {
|
||||
|
||||
Partition *p;
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
@ -4797,7 +4772,6 @@ done:
|
||||
|
||||
static int determine_auto_size(Context *c) {
|
||||
uint64_t sum;
|
||||
Partition *p;
|
||||
|
||||
assert(c);
|
||||
|
||||
|
@ -863,7 +863,6 @@ static int bus_method_resolve_record(sd_bus_message *message, void *userdata, sd
|
||||
static int append_srv(DnsQuery *q, sd_bus_message *reply, DnsResourceRecord *rr) {
|
||||
_cleanup_(dns_resource_record_unrefp) DnsResourceRecord *canonical = NULL;
|
||||
_cleanup_free_ char *normalized = NULL;
|
||||
DnsQuery *aux;
|
||||
int r;
|
||||
|
||||
assert(q);
|
||||
@ -994,7 +993,6 @@ static int append_srv(DnsQuery *q, sd_bus_message *reply, DnsResourceRecord *rr)
|
||||
}
|
||||
|
||||
static int append_txt(sd_bus_message *reply, DnsResourceRecord *rr) {
|
||||
DnsTxtItem *i;
|
||||
int r;
|
||||
|
||||
assert(reply);
|
||||
@ -1025,7 +1023,6 @@ static void resolve_service_all_complete(DnsQuery *query) {
|
||||
DnsQuestion *question;
|
||||
DnsResourceRecord *rr;
|
||||
unsigned added = 0;
|
||||
DnsQuery *aux;
|
||||
int r;
|
||||
|
||||
assert(q);
|
||||
@ -1448,7 +1445,6 @@ static int bus_property_get_dns_servers_internal(
|
||||
bool extended) {
|
||||
|
||||
Manager *m = userdata;
|
||||
DnsServer *s;
|
||||
Link *l;
|
||||
int r;
|
||||
|
||||
@ -1507,7 +1503,7 @@ static int bus_property_get_fallback_dns_servers_internal(
|
||||
sd_bus_error *error,
|
||||
bool extended) {
|
||||
|
||||
DnsServer *s, **f = userdata;
|
||||
DnsServer **f = userdata;
|
||||
int r;
|
||||
|
||||
assert(reply);
|
||||
@ -1600,7 +1596,6 @@ static int bus_property_get_domains(
|
||||
sd_bus_error *error) {
|
||||
|
||||
Manager *m = userdata;
|
||||
DnsSearchDomain *d;
|
||||
Link *l;
|
||||
int r;
|
||||
|
||||
@ -1658,7 +1653,6 @@ static int bus_property_get_cache_statistics(
|
||||
|
||||
uint64_t size = 0, hit = 0, miss = 0;
|
||||
Manager *m = userdata;
|
||||
DnsScope *s;
|
||||
|
||||
assert(reply);
|
||||
assert(m);
|
||||
@ -1751,7 +1745,6 @@ static int bus_property_get_resolv_conf_mode(
|
||||
|
||||
static int bus_method_reset_statistics(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
Manager *m = userdata;
|
||||
DnsScope *s;
|
||||
|
||||
assert(message);
|
||||
assert(m);
|
||||
|
@ -117,7 +117,7 @@ static void dns_cache_item_unlink_and_free(DnsCache *c, DnsCacheItem *i) {
|
||||
}
|
||||
|
||||
static bool dns_cache_remove_by_rr(DnsCache *c, DnsResourceRecord *rr) {
|
||||
DnsCacheItem *first, *i;
|
||||
DnsCacheItem *first;
|
||||
int r;
|
||||
|
||||
first = hashmap_get(c->by_key, rr->key);
|
||||
@ -135,7 +135,7 @@ static bool dns_cache_remove_by_rr(DnsCache *c, DnsResourceRecord *rr) {
|
||||
}
|
||||
|
||||
static bool dns_cache_remove_by_key(DnsCache *c, DnsResourceKey *key) {
|
||||
DnsCacheItem *first, *i, *n;
|
||||
DnsCacheItem *first;
|
||||
|
||||
assert(c);
|
||||
assert(key);
|
||||
@ -301,12 +301,10 @@ static int dns_cache_link_item(DnsCache *c, DnsCacheItem *i) {
|
||||
}
|
||||
|
||||
static DnsCacheItem* dns_cache_get(DnsCache *c, DnsResourceRecord *rr) {
|
||||
DnsCacheItem *i;
|
||||
|
||||
assert(c);
|
||||
assert(rr);
|
||||
|
||||
LIST_FOREACH(by_key, i, hashmap_get(c->by_key, rr->key))
|
||||
LIST_FOREACH(by_key, i, (DnsCacheItem*) hashmap_get(c->by_key, rr->key))
|
||||
if (i->rr && dns_resource_record_equal(i->rr, rr) > 0)
|
||||
return i;
|
||||
|
||||
@ -987,7 +985,7 @@ int dns_cache_lookup(
|
||||
unsigned n = 0;
|
||||
int r;
|
||||
bool nxdomain = false;
|
||||
DnsCacheItem *j, *first, *nsec = NULL;
|
||||
DnsCacheItem *first, *nsec = NULL;
|
||||
bool have_authenticated = false, have_non_authenticated = false, have_confidential = false, have_non_confidential = false;
|
||||
usec_t current = 0;
|
||||
int found_rcode = -1;
|
||||
@ -1223,7 +1221,7 @@ miss:
|
||||
}
|
||||
|
||||
int dns_cache_check_conflicts(DnsCache *cache, DnsResourceRecord *rr, int owner_family, const union in_addr_union *owner_address) {
|
||||
DnsCacheItem *i, *first;
|
||||
DnsCacheItem *first;
|
||||
bool same_owner = true;
|
||||
|
||||
assert(cache);
|
||||
@ -1266,9 +1264,7 @@ int dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p) {
|
||||
assert(cache);
|
||||
assert(p);
|
||||
|
||||
HASHMAP_FOREACH(i, cache->by_key) {
|
||||
DnsCacheItem *j;
|
||||
|
||||
HASHMAP_FOREACH(i, cache->by_key)
|
||||
LIST_FOREACH(by_key, j, i) {
|
||||
if (!j->rr)
|
||||
continue;
|
||||
@ -1299,7 +1295,6 @@ int dns_cache_export_shared_to_packet(DnsCache *cache, DnsPacket *p) {
|
||||
|
||||
ancount++;
|
||||
}
|
||||
}
|
||||
|
||||
DNS_PACKET_HEADER(p)->ancount = htobe16(ancount);
|
||||
|
||||
@ -1315,9 +1310,7 @@ void dns_cache_dump(DnsCache *cache, FILE *f) {
|
||||
if (!f)
|
||||
f = stdout;
|
||||
|
||||
HASHMAP_FOREACH(i, cache->by_key) {
|
||||
DnsCacheItem *j;
|
||||
|
||||
HASHMAP_FOREACH(i, cache->by_key)
|
||||
LIST_FOREACH(by_key, j, i) {
|
||||
|
||||
fputc('\t', f);
|
||||
@ -1341,7 +1334,6 @@ void dns_cache_dump(DnsCache *cache, FILE *f) {
|
||||
fputc('\n', f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool dns_cache_is_empty(DnsCache *cache) {
|
||||
|
@ -941,15 +941,12 @@ int dns_packet_append_rr(DnsPacket *p, const DnsResourceRecord *rr, const DnsAns
|
||||
r = dns_packet_append_raw_string(p, NULL, 0, NULL);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
} else {
|
||||
DnsTxtItem *i;
|
||||
|
||||
} else
|
||||
LIST_FOREACH(items, i, rr->txt.items) {
|
||||
r = dns_packet_append_raw_string(p, i->data, i->length, NULL);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
r = 0;
|
||||
break;
|
||||
|
@ -345,8 +345,6 @@ fail:
|
||||
}
|
||||
|
||||
static void dns_query_stop(DnsQuery *q) {
|
||||
DnsQueryCandidate *c;
|
||||
|
||||
assert(q);
|
||||
|
||||
event_source_disable(q->timeout_event_source);
|
||||
@ -718,8 +716,7 @@ static int dns_query_try_etc_hosts(DnsQuery *q) {
|
||||
|
||||
int dns_query_go(DnsQuery *q) {
|
||||
DnsScopeMatch found = DNS_SCOPE_NO;
|
||||
DnsScope *s, *first = NULL;
|
||||
DnsQueryCandidate *c;
|
||||
DnsScope *first = NULL;
|
||||
int r;
|
||||
|
||||
assert(q);
|
||||
@ -938,8 +935,7 @@ fail:
|
||||
}
|
||||
|
||||
void dns_query_ready(DnsQuery *q) {
|
||||
|
||||
DnsQueryCandidate *bad = NULL, *c;
|
||||
DnsQueryCandidate *bad = NULL;
|
||||
bool pending = false;
|
||||
|
||||
assert(q);
|
||||
|
@ -784,7 +784,6 @@ static char *format_types(Bitmap *types) {
|
||||
}
|
||||
|
||||
static char *format_txt(DnsTxtItem *first) {
|
||||
DnsTxtItem *i;
|
||||
size_t c = 1;
|
||||
char *p, *s;
|
||||
|
||||
@ -1358,8 +1357,6 @@ void dns_resource_record_hash_func(const DnsResourceRecord *rr, struct siphash *
|
||||
|
||||
case DNS_TYPE_TXT:
|
||||
case DNS_TYPE_SPF: {
|
||||
DnsTxtItem *j;
|
||||
|
||||
LIST_FOREACH(items, j, rr->txt.items) {
|
||||
siphash24_compress_safe(j->data, j->length, state);
|
||||
|
||||
@ -1813,7 +1810,7 @@ bool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b) {
|
||||
}
|
||||
|
||||
DnsTxtItem *dns_txt_item_copy(DnsTxtItem *first) {
|
||||
DnsTxtItem *i, *copy = NULL, *end = NULL;
|
||||
DnsTxtItem *copy = NULL, *end = NULL;
|
||||
|
||||
LIST_FOREACH(items, i, first) {
|
||||
DnsTxtItem *j;
|
||||
|
@ -529,7 +529,6 @@ static DnsScopeMatch match_subnet_reverse_lookups(
|
||||
bool exclude_own) {
|
||||
|
||||
union in_addr_union ia;
|
||||
LinkAddress *a;
|
||||
int f, r;
|
||||
|
||||
assert(s);
|
||||
@ -587,7 +586,6 @@ DnsScopeMatch dns_scope_good_domain(
|
||||
DnsQuery *q) {
|
||||
|
||||
DnsQuestion *question;
|
||||
DnsSearchDomain *d;
|
||||
const char *domain;
|
||||
uint64_t flags;
|
||||
int ifindex;
|
||||
@ -1082,7 +1080,7 @@ DnsTransaction *dns_scope_find_transaction(
|
||||
DnsResourceKey *key,
|
||||
uint64_t query_flags) {
|
||||
|
||||
DnsTransaction *first, *t;
|
||||
DnsTransaction *first;
|
||||
|
||||
assert(scope);
|
||||
assert(key);
|
||||
@ -1398,8 +1396,7 @@ int dns_scope_announce(DnsScope *scope, bool goodbye) {
|
||||
_cleanup_(dns_answer_unrefp) DnsAnswer *answer = NULL;
|
||||
_cleanup_(dns_packet_unrefp) DnsPacket *p = NULL;
|
||||
_cleanup_set_free_ Set *types = NULL;
|
||||
DnsTransaction *t;
|
||||
DnsZoneItem *z, *i;
|
||||
DnsZoneItem *z;
|
||||
unsigned size = 0;
|
||||
char *service_type;
|
||||
int r;
|
||||
@ -1527,7 +1524,6 @@ int dns_scope_announce(DnsScope *scope, bool goodbye) {
|
||||
|
||||
int dns_scope_add_dnssd_services(DnsScope *scope) {
|
||||
DnssdService *service;
|
||||
DnssdTxtData *txt_data;
|
||||
int r;
|
||||
|
||||
assert(scope);
|
||||
@ -1561,7 +1557,6 @@ int dns_scope_add_dnssd_services(DnsScope *scope) {
|
||||
int dns_scope_remove_dnssd_services(DnsScope *scope) {
|
||||
_cleanup_(dns_resource_key_unrefp) DnsResourceKey *key = NULL;
|
||||
DnssdService *service;
|
||||
DnssdTxtData *txt_data;
|
||||
int r;
|
||||
|
||||
assert(scope);
|
||||
@ -1586,7 +1581,7 @@ int dns_scope_remove_dnssd_services(DnsScope *scope) {
|
||||
}
|
||||
|
||||
static bool dns_scope_has_route_only_domains(DnsScope *scope) {
|
||||
DnsSearchDomain *domain, *first;
|
||||
DnsSearchDomain *first;
|
||||
bool route_only = false;
|
||||
|
||||
assert(scope);
|
||||
|
@ -178,7 +178,6 @@ void dns_search_domain_mark_all(DnsSearchDomain *first) {
|
||||
}
|
||||
|
||||
int dns_search_domain_find(DnsSearchDomain *first, const char *name, DnsSearchDomain **ret) {
|
||||
DnsSearchDomain *d;
|
||||
int r;
|
||||
|
||||
assert(name);
|
||||
|
@ -815,8 +815,6 @@ void dns_server_mark_all(DnsServer *server) {
|
||||
}
|
||||
|
||||
DnsServer *dns_server_find(DnsServer *first, int family, const union in_addr_union *in_addr, uint16_t port, int ifindex, const char *name) {
|
||||
DnsServer *s;
|
||||
|
||||
LIST_FOREACH(servers, s, first)
|
||||
if (s->family == family &&
|
||||
in_addr_equal(family, &s->address, in_addr) > 0 &&
|
||||
@ -992,8 +990,6 @@ void dns_server_reset_features(DnsServer *s) {
|
||||
}
|
||||
|
||||
void dns_server_reset_features_all(DnsServer *s) {
|
||||
DnsServer *i;
|
||||
|
||||
LIST_FOREACH(servers, i, s)
|
||||
dns_server_reset_features(i);
|
||||
}
|
||||
|
@ -634,12 +634,9 @@ static int on_stream_complete(DnsStream *s, int error) {
|
||||
}
|
||||
}
|
||||
|
||||
if (error != 0) {
|
||||
DnsTransaction *t, *n;
|
||||
|
||||
if (error != 0)
|
||||
LIST_FOREACH_SAFE(transactions_by_stream, t, n, s->transactions)
|
||||
on_transaction_stream_error(t, error);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1762,7 +1759,6 @@ static int dns_transaction_prepare(DnsTransaction *t, usec_t ts) {
|
||||
static int dns_transaction_make_packet_mdns(DnsTransaction *t) {
|
||||
_cleanup_(dns_packet_unrefp) DnsPacket *p = NULL;
|
||||
bool add_known_answers = false;
|
||||
DnsTransaction *other;
|
||||
DnsResourceKey *tkey;
|
||||
_cleanup_set_free_ Set *keys = NULL;
|
||||
unsigned qdcount;
|
||||
|
@ -78,12 +78,10 @@ void dns_zone_flush(DnsZone *z) {
|
||||
}
|
||||
|
||||
DnsZoneItem* dns_zone_get(DnsZone *z, DnsResourceRecord *rr) {
|
||||
DnsZoneItem *i;
|
||||
|
||||
assert(z);
|
||||
assert(rr);
|
||||
|
||||
LIST_FOREACH(by_key, i, hashmap_get(z->by_key, rr->key))
|
||||
LIST_FOREACH(by_key, i, (DnsZoneItem*) hashmap_get(z->by_key, rr->key))
|
||||
if (dns_resource_record_equal(i->rr, rr) > 0)
|
||||
return i;
|
||||
|
||||
@ -250,21 +248,15 @@ int dns_zone_put(DnsZone *z, DnsScope *s, DnsResourceRecord *rr, bool probe) {
|
||||
return r;
|
||||
|
||||
if (probe) {
|
||||
DnsZoneItem *first, *j;
|
||||
bool established = false;
|
||||
|
||||
/* Check if there's already an RR with the same name
|
||||
* established. If so, it has been probed already, and
|
||||
* we don't need to probe again. */
|
||||
|
||||
LIST_FIND_HEAD(by_name, i, first);
|
||||
LIST_FOREACH(by_name, j, first) {
|
||||
if (i == j)
|
||||
continue;
|
||||
|
||||
LIST_FOREACH_OTHERS(by_name, j, i)
|
||||
if (j->state == DNS_ZONE_ITEM_ESTABLISHED)
|
||||
established = true;
|
||||
}
|
||||
|
||||
if (established)
|
||||
i->state = DNS_ZONE_ITEM_ESTABLISHED;
|
||||
@ -306,7 +298,7 @@ static int dns_zone_add_authenticated_answer(DnsAnswer *a, DnsZoneItem *i, int i
|
||||
int dns_zone_lookup(DnsZone *z, DnsResourceKey *key, int ifindex, DnsAnswer **ret_answer, DnsAnswer **ret_soa, bool *ret_tentative) {
|
||||
_cleanup_(dns_answer_unrefp) DnsAnswer *answer = NULL, *soa = NULL;
|
||||
unsigned n_answer = 0;
|
||||
DnsZoneItem *j, *first;
|
||||
DnsZoneItem *first;
|
||||
bool tentative = true, need_soa = false;
|
||||
int r;
|
||||
|
||||
@ -576,7 +568,7 @@ static int dns_zone_item_verify(DnsZoneItem *i) {
|
||||
}
|
||||
|
||||
int dns_zone_check_conflicts(DnsZone *zone, DnsResourceRecord *rr) {
|
||||
DnsZoneItem *i, *first;
|
||||
DnsZoneItem *first;
|
||||
int c = 0;
|
||||
|
||||
assert(zone);
|
||||
@ -614,7 +606,7 @@ int dns_zone_check_conflicts(DnsZone *zone, DnsResourceRecord *rr) {
|
||||
}
|
||||
|
||||
int dns_zone_verify_conflicts(DnsZone *zone, DnsResourceKey *key) {
|
||||
DnsZoneItem *i, *first;
|
||||
DnsZoneItem *first;
|
||||
int c = 0;
|
||||
|
||||
assert(zone);
|
||||
@ -639,12 +631,9 @@ void dns_zone_verify_all(DnsZone *zone) {
|
||||
|
||||
assert(zone);
|
||||
|
||||
HASHMAP_FOREACH(i, zone->by_key) {
|
||||
DnsZoneItem *j;
|
||||
|
||||
HASHMAP_FOREACH(i, zone->by_key)
|
||||
LIST_FOREACH(by_key, j, i)
|
||||
dns_zone_item_verify(j);
|
||||
}
|
||||
}
|
||||
|
||||
void dns_zone_dump(DnsZone *zone, FILE *f) {
|
||||
@ -656,9 +645,7 @@ void dns_zone_dump(DnsZone *zone, FILE *f) {
|
||||
if (!f)
|
||||
f = stdout;
|
||||
|
||||
HASHMAP_FOREACH(i, zone->by_key) {
|
||||
DnsZoneItem *j;
|
||||
|
||||
HASHMAP_FOREACH(i, zone->by_key)
|
||||
LIST_FOREACH(by_key, j, i) {
|
||||
const char *t;
|
||||
|
||||
@ -672,7 +659,6 @@ void dns_zone_dump(DnsZone *zone, FILE *f) {
|
||||
fputs(t, f);
|
||||
fputc('\n', f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool dns_zone_is_empty(DnsZone *zone) {
|
||||
@ -683,7 +669,7 @@ bool dns_zone_is_empty(DnsZone *zone) {
|
||||
}
|
||||
|
||||
bool dns_zone_contains_name(DnsZone *z, const char *name) {
|
||||
DnsZoneItem *i, *first;
|
||||
DnsZoneItem *first;
|
||||
|
||||
first = hashmap_get(z->by_name, name);
|
||||
if (!first)
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
int bus_dnssd_method_unregister(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||
DnssdService *s = userdata;
|
||||
DnssdTxtData *txt_data;
|
||||
Manager *m;
|
||||
Link *l;
|
||||
int r;
|
||||
|
@ -211,7 +211,6 @@ int dnssd_update_rrs(DnssdService *s) {
|
||||
_cleanup_free_ char *n = NULL;
|
||||
_cleanup_free_ char *service_name = NULL;
|
||||
_cleanup_free_ char *full_name = NULL;
|
||||
DnssdTxtData *txt_data;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
|
@ -51,7 +51,6 @@ static int property_get_dns_internal(
|
||||
bool extended) {
|
||||
|
||||
Link *l = userdata;
|
||||
DnsServer *s;
|
||||
int r;
|
||||
|
||||
assert(reply);
|
||||
@ -144,7 +143,6 @@ static int property_get_domains(
|
||||
sd_bus_error *error) {
|
||||
|
||||
Link *l = userdata;
|
||||
DnsSearchDomain *d;
|
||||
int r;
|
||||
|
||||
assert(reply);
|
||||
|
@ -186,7 +186,6 @@ void link_allocate_scopes(Link *l) {
|
||||
}
|
||||
|
||||
void link_add_rrs(Link *l, bool force_remove) {
|
||||
LinkAddress *a;
|
||||
int r;
|
||||
|
||||
LIST_FOREACH(addresses, a, l->addresses)
|
||||
@ -682,8 +681,6 @@ int link_update(Link *l) {
|
||||
}
|
||||
|
||||
bool link_relevant(Link *l, int family, bool local_multicast) {
|
||||
LinkAddress *a;
|
||||
|
||||
assert(l);
|
||||
|
||||
/* A link is relevant for local multicast traffic if it isn't a loopback device, has a link
|
||||
@ -717,8 +714,6 @@ bool link_relevant(Link *l, int family, bool local_multicast) {
|
||||
}
|
||||
|
||||
LinkAddress *link_find_address(Link *l, int family, const union in_addr_union *in_addr) {
|
||||
LinkAddress *a;
|
||||
|
||||
assert(l);
|
||||
|
||||
if (!IN_SET(family, AF_INET, AF_INET6))
|
||||
@ -1223,8 +1218,6 @@ int link_save_user(Link *l) {
|
||||
fprintf(f, "DEFAULT_ROUTE=%s\n", yes_no(l->default_route));
|
||||
|
||||
if (l->dns_servers) {
|
||||
DnsServer *server;
|
||||
|
||||
fputs("SERVERS=", f);
|
||||
LIST_FOREACH(servers, server, l->dns_servers) {
|
||||
|
||||
@ -1243,8 +1236,6 @@ int link_save_user(Link *l) {
|
||||
}
|
||||
|
||||
if (l->search_domains) {
|
||||
DnsSearchDomain *domain;
|
||||
|
||||
fputs("DOMAINS=", f);
|
||||
LIST_FOREACH(domains, domain, l->search_domains) {
|
||||
|
||||
|
@ -514,9 +514,7 @@ static int manager_sigusr1(sd_event_source *s, const struct signalfd_siginfo *si
|
||||
_cleanup_free_ char *buffer = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
Manager *m = userdata;
|
||||
DnsServer *server;
|
||||
size_t size = 0;
|
||||
DnsScope *scope;
|
||||
Link *l;
|
||||
|
||||
assert(s);
|
||||
@ -1316,8 +1314,6 @@ DnsScope* manager_find_scope(Manager *m, DnsPacket *p) {
|
||||
}
|
||||
|
||||
void manager_verify_all(Manager *m) {
|
||||
DnsScope *s;
|
||||
|
||||
assert(m);
|
||||
|
||||
LIST_FOREACH(scopes, s, m->dns_scopes)
|
||||
@ -1349,7 +1345,6 @@ int manager_is_own_hostname(Manager *m, const char *name) {
|
||||
}
|
||||
|
||||
int manager_compile_dns_servers(Manager *m, OrderedSet **dns) {
|
||||
DnsServer *s;
|
||||
Link *l;
|
||||
int r;
|
||||
|
||||
@ -1400,7 +1395,6 @@ int manager_compile_dns_servers(Manager *m, OrderedSet **dns) {
|
||||
* > 0 or true: return only domains which are for routing only
|
||||
*/
|
||||
int manager_compile_search_domains(Manager *m, OrderedSet **domains, int filter_route) {
|
||||
DnsSearchDomain *d;
|
||||
Link *l;
|
||||
int r;
|
||||
|
||||
@ -1512,8 +1506,6 @@ bool manager_routable(Manager *m) {
|
||||
}
|
||||
|
||||
void manager_flush_caches(Manager *m, int log_level) {
|
||||
DnsScope *scope;
|
||||
|
||||
assert(m);
|
||||
|
||||
LIST_FOREACH(scopes, scope, m->dns_scopes)
|
||||
|
@ -203,7 +203,6 @@ static bool mdns_should_reply_using_unicast(DnsPacket *p) {
|
||||
}
|
||||
|
||||
static bool sender_on_local_subnet(DnsScope *s, DnsPacket *p) {
|
||||
LinkAddress *a;
|
||||
int r;
|
||||
|
||||
/* Check whether the sender is on a local subnet. */
|
||||
@ -359,7 +358,6 @@ static int on_mdns_packet(sd_event_source *s, int fd, uint32_t revents, void *us
|
||||
|
||||
if (dns_packet_validate_reply(p) > 0) {
|
||||
DnsResourceRecord *rr;
|
||||
DnsTransaction *t;
|
||||
|
||||
log_debug("Got mDNS reply packet");
|
||||
|
||||
|
@ -188,17 +188,14 @@ static int load_state(Context *c, const struct rfkill_event *event) {
|
||||
}
|
||||
|
||||
static void save_state_queue_remove(Context *c, int idx, const char *state_file) {
|
||||
struct write_queue_item *item, *tmp;
|
||||
|
||||
assert(c);
|
||||
|
||||
LIST_FOREACH_SAFE(queue, item, tmp, c->write_queue) {
|
||||
LIST_FOREACH_SAFE(queue, item, tmp, c->write_queue)
|
||||
if ((state_file && streq(item->file, state_file)) || idx == item->rfkill_idx) {
|
||||
log_debug("Canceled previous save state of '%s' to %s.", one_zero(item->state), item->file);
|
||||
LIST_REMOVE(queue, c->write_queue, item);
|
||||
write_queue_item_free(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int save_state_queue(Context *c, const struct rfkill_event *event) {
|
||||
|
@ -199,7 +199,7 @@ static int dump_processes(
|
||||
}
|
||||
|
||||
if (cg->children) {
|
||||
struct CGroupInfo **children, *child;
|
||||
struct CGroupInfo **children;
|
||||
size_t n = 0, i;
|
||||
|
||||
/* Order subcgroups by their name */
|
||||
@ -217,9 +217,7 @@ static int dump_processes(
|
||||
const char *name, *special;
|
||||
bool more;
|
||||
|
||||
child = children[i];
|
||||
|
||||
name = strrchr(child->cgroup_path, '/');
|
||||
name = strrchr(children[i]->cgroup_path, '/');
|
||||
if (!name)
|
||||
return -EINVAL;
|
||||
name++;
|
||||
@ -238,7 +236,7 @@ static int dump_processes(
|
||||
if (!pp)
|
||||
return -ENOMEM;
|
||||
|
||||
r = dump_processes(cgroups, child->cgroup_path, pp, n_columns, flags);
|
||||
r = dump_processes(cgroups, children[i]->cgroup_path, pp, n_columns, flags);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
@ -89,8 +89,6 @@ Condition* condition_free(Condition *c) {
|
||||
}
|
||||
|
||||
Condition* condition_free_list_type(Condition *head, ConditionType type) {
|
||||
Condition *c, *n;
|
||||
|
||||
LIST_FOREACH_SAFE(conditions, c, n, head)
|
||||
if (type < 0 || c->type == type) {
|
||||
LIST_REMOVE(conditions, head, c);
|
||||
@ -1171,7 +1169,6 @@ bool condition_test_list(
|
||||
condition_test_logger_t logger,
|
||||
void *userdata) {
|
||||
|
||||
Condition *c;
|
||||
int triggered = -1;
|
||||
|
||||
assert(!!logger == !!to_string);
|
||||
@ -1234,8 +1231,6 @@ void condition_dump(Condition *c, FILE *f, const char *prefix, condition_to_stri
|
||||
}
|
||||
|
||||
void condition_dump_list(Condition *first, FILE *f, const char *prefix, condition_to_string_t to_string) {
|
||||
Condition *c;
|
||||
|
||||
LIST_FOREACH(conditions, c, first)
|
||||
condition_dump(c, f, prefix, to_string);
|
||||
}
|
||||
|
@ -3333,8 +3333,6 @@ MountOptions* mount_options_free_all(MountOptions *options) {
|
||||
}
|
||||
|
||||
const char* mount_options_from_designator(const MountOptions *options, PartitionDesignator designator) {
|
||||
const MountOptions *m;
|
||||
|
||||
LIST_FOREACH(mount_options, m, options)
|
||||
if (designator == m->partition_designator && !isempty(m->options))
|
||||
return m->options;
|
||||
|
@ -2347,7 +2347,6 @@ int varlink_server_shutdown(VarlinkServer *s) {
|
||||
}
|
||||
|
||||
int varlink_server_attach_event(VarlinkServer *s, sd_event *e, int64_t priority) {
|
||||
VarlinkServerSocket *ss;
|
||||
int r;
|
||||
|
||||
assert_return(s, -EINVAL);
|
||||
@ -2382,8 +2381,6 @@ fail:
|
||||
}
|
||||
|
||||
int varlink_server_detach_event(VarlinkServer *s) {
|
||||
VarlinkServerSocket *ss;
|
||||
|
||||
assert_return(s, -EINVAL);
|
||||
|
||||
LIST_FOREACH(sockets, ss, s->sockets)
|
||||
|
@ -12,7 +12,6 @@
|
||||
static void test_mount_points_list_one(const char *fname) {
|
||||
_cleanup_(mount_points_list_free) LIST_HEAD(MountPoint, mp_list_head);
|
||||
_cleanup_free_ char *testdata_fname = NULL;
|
||||
MountPoint *m;
|
||||
|
||||
log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/self/mountinfo");
|
||||
|
||||
@ -43,7 +42,6 @@ TEST(mount_points_list) {
|
||||
static void test_swap_list_one(const char *fname) {
|
||||
_cleanup_(mount_points_list_free) LIST_HEAD(MountPoint, mp_list_head);
|
||||
_cleanup_free_ char *testdata_fname = NULL;
|
||||
MountPoint *m;
|
||||
int r;
|
||||
|
||||
log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/swaps");
|
||||
|
@ -589,7 +589,6 @@ static int umount_with_timeout(MountPoint *m, int umount_log_level) {
|
||||
/* This includes remounting readonly, which changes the kernel mount options. Therefore the list passed to
|
||||
* this function is invalidated, and should not be reused. */
|
||||
static int mount_points_list_umount(MountPoint **head, bool *changed, int umount_log_level) {
|
||||
MountPoint *m;
|
||||
int n_failed = 0;
|
||||
|
||||
assert(head);
|
||||
@ -635,7 +634,6 @@ static int mount_points_list_umount(MountPoint **head, bool *changed, int umount
|
||||
}
|
||||
|
||||
static int swap_points_list_off(MountPoint **head, bool *changed) {
|
||||
MountPoint *m, *n;
|
||||
int n_failed = 0;
|
||||
|
||||
assert(head);
|
||||
@ -657,7 +655,6 @@ static int swap_points_list_off(MountPoint **head, bool *changed) {
|
||||
}
|
||||
|
||||
static int loopback_points_list_detach(MountPoint **head, bool *changed, int umount_log_level) {
|
||||
MountPoint *m, *n;
|
||||
int n_failed = 0, r;
|
||||
dev_t rootdev = 0;
|
||||
|
||||
@ -689,7 +686,6 @@ static int loopback_points_list_detach(MountPoint **head, bool *changed, int umo
|
||||
}
|
||||
|
||||
static int dm_points_list_detach(MountPoint **head, bool *changed, int umount_log_level) {
|
||||
MountPoint *m, *n;
|
||||
int n_failed = 0, r;
|
||||
dev_t rootdev = 0;
|
||||
|
||||
@ -720,7 +716,6 @@ static int dm_points_list_detach(MountPoint **head, bool *changed, int umount_lo
|
||||
}
|
||||
|
||||
static int md_points_list_detach(MountPoint **head, bool *changed, int umount_log_level) {
|
||||
MountPoint *m, *n;
|
||||
int n_failed = 0, r;
|
||||
dev_t rootdev = 0;
|
||||
|
||||
|
@ -305,7 +305,6 @@ static void print_status_info(
|
||||
|
||||
const char *active_on, *active_off, *on, *off, *ss, *fs;
|
||||
_cleanup_free_ char *formatted_path = NULL;
|
||||
ExecStatusInfo *p;
|
||||
usec_t timestamp;
|
||||
const char *path;
|
||||
char **t, **t2;
|
||||
@ -488,7 +487,6 @@ static void print_status_info(
|
||||
}
|
||||
|
||||
if (!i->condition_result && i->condition_timestamp > 0) {
|
||||
UnitCondition *c;
|
||||
int n = 0;
|
||||
|
||||
printf(" Condition: start %scondition failed%s at %s; %s\n",
|
||||
|
@ -11,7 +11,6 @@ int main(int argc, const char *argv[]) {
|
||||
LIST_HEAD(list_item, head);
|
||||
LIST_HEAD(list_item, head2);
|
||||
list_item items[4];
|
||||
list_item *cursor;
|
||||
|
||||
LIST_HEAD_INIT(head);
|
||||
LIST_HEAD_INIT(head2);
|
||||
@ -57,6 +56,7 @@ int main(int argc, const char *argv[]) {
|
||||
assert_se(items[2].item_prev == &items[3]);
|
||||
assert_se(items[3].item_prev == NULL);
|
||||
|
||||
list_item *cursor;
|
||||
LIST_FIND_HEAD(item, &items[0], cursor);
|
||||
assert_se(cursor == &items[3]);
|
||||
|
||||
|
@ -34,7 +34,6 @@ static int test_socket_bind(
|
||||
char **deny_rules) {
|
||||
_cleanup_free_ char *exec_start = NULL;
|
||||
_cleanup_(unit_freep) Unit *u = NULL;
|
||||
CGroupSocketBindItem *bi;
|
||||
CGroupContext *cc = NULL;
|
||||
char **rule;
|
||||
int cld_code, r;
|
||||
|
@ -133,7 +133,6 @@ static void context_clear(Context *c) {
|
||||
|
||||
static int context_add_ntp_service(Context *c, const char *s, const char *source) {
|
||||
_cleanup_(unit_status_info_freep) UnitStatusInfo *unit = NULL;
|
||||
UnitStatusInfo *u;
|
||||
|
||||
assert(c);
|
||||
assert(s);
|
||||
@ -251,7 +250,6 @@ static int context_parse_ntp_services(Context *c) {
|
||||
}
|
||||
|
||||
static int context_ntp_service_is_active(Context *c) {
|
||||
UnitStatusInfo *info;
|
||||
int count = 0;
|
||||
|
||||
assert(c);
|
||||
@ -265,7 +263,6 @@ static int context_ntp_service_is_active(Context *c) {
|
||||
}
|
||||
|
||||
static int context_ntp_service_exists(Context *c) {
|
||||
UnitStatusInfo *info;
|
||||
int count = 0;
|
||||
|
||||
assert(c);
|
||||
@ -410,7 +407,6 @@ static int context_update_ntp_status(Context *c, sd_bus *bus, sd_bus_message *m)
|
||||
{ "UnitFileState", "s", NULL, offsetof(UnitStatusInfo, unit_file_state) },
|
||||
{}
|
||||
};
|
||||
UnitStatusInfo *u;
|
||||
int r;
|
||||
|
||||
assert(c);
|
||||
@ -453,7 +449,6 @@ static int context_update_ntp_status(Context *c, sd_bus *bus, sd_bus_message *m)
|
||||
|
||||
static int match_job_removed(sd_bus_message *m, void *userdata, sd_bus_error *error) {
|
||||
Context *c = userdata;
|
||||
UnitStatusInfo *u;
|
||||
const char *path;
|
||||
unsigned n = 0;
|
||||
int r;
|
||||
@ -925,7 +920,6 @@ static int method_set_ntp(sd_bus_message *m, void *userdata, sd_bus_error *error
|
||||
_cleanup_(sd_bus_slot_unrefp) sd_bus_slot *slot = NULL;
|
||||
sd_bus *bus = sd_bus_message_get_bus(m);
|
||||
Context *c = userdata;
|
||||
UnitStatusInfo *u;
|
||||
const UnitStatusInfo *selected = NULL;
|
||||
int enable, interactive, q, r;
|
||||
|
||||
|
@ -23,7 +23,7 @@ static int property_get_servers(
|
||||
void *userdata,
|
||||
sd_bus_error *error) {
|
||||
|
||||
ServerName *p, **s = userdata;
|
||||
ServerName **s = userdata;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
|
@ -24,7 +24,6 @@ int manager_parse_server_string(Manager *m, ServerType type, const char *string)
|
||||
for (;;) {
|
||||
_cleanup_free_ char *word = NULL;
|
||||
bool found = false;
|
||||
ServerName *n;
|
||||
|
||||
r = extract_first_word(&string, &word, NULL, 0);
|
||||
if (r < 0)
|
||||
|
@ -960,7 +960,6 @@ Manager* manager_free(Manager *m) {
|
||||
|
||||
static int manager_network_read_link_servers(Manager *m) {
|
||||
_cleanup_strv_free_ char **ntp = NULL;
|
||||
ServerName *n, *nx;
|
||||
char **i;
|
||||
bool changed = false;
|
||||
int r;
|
||||
|
@ -69,8 +69,6 @@ static LinkConfig* link_config_free(LinkConfig *config) {
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(LinkConfig*, link_config_free);
|
||||
|
||||
static void link_configs_free(LinkConfigContext *ctx) {
|
||||
LinkConfig *config, *config_next;
|
||||
|
||||
if (!ctx)
|
||||
return;
|
||||
|
||||
@ -423,7 +421,6 @@ int link_new(LinkConfigContext *ctx, sd_netlink **rtnl, sd_device *device, Link
|
||||
}
|
||||
|
||||
int link_get_config(LinkConfigContext *ctx, Link *link) {
|
||||
LinkConfig *config;
|
||||
int r;
|
||||
|
||||
assert(ctx);
|
||||
|
@ -268,8 +268,6 @@ static void udev_rule_token_free(UdevRuleToken *token) {
|
||||
}
|
||||
|
||||
static void udev_rule_line_clear_tokens(UdevRuleLine *rule_line) {
|
||||
UdevRuleToken *i, *next;
|
||||
|
||||
assert(rule_line);
|
||||
|
||||
LIST_FOREACH_SAFE(tokens, i, next, rule_line->tokens)
|
||||
@ -298,8 +296,6 @@ static UdevRuleLine* udev_rule_line_free(UdevRuleLine *rule_line) {
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(UdevRuleLine*, udev_rule_line_free);
|
||||
|
||||
static void udev_rule_file_free(UdevRuleFile *rule_file) {
|
||||
UdevRuleLine *i, *next;
|
||||
|
||||
if (!rule_file)
|
||||
return;
|
||||
|
||||
@ -311,8 +307,6 @@ static void udev_rule_file_free(UdevRuleFile *rule_file) {
|
||||
}
|
||||
|
||||
UdevRules *udev_rules_free(UdevRules *rules) {
|
||||
UdevRuleFile *i, *next;
|
||||
|
||||
if (!rules)
|
||||
return NULL;
|
||||
|
||||
@ -1070,7 +1064,7 @@ static void sort_tokens(UdevRuleLine *rule_line) {
|
||||
rule_line->current_token = NULL;
|
||||
|
||||
while (!LIST_IS_EMPTY(head_old)) {
|
||||
UdevRuleToken *t, *min_token = NULL;
|
||||
UdevRuleToken *min_token = NULL;
|
||||
|
||||
LIST_FOREACH(tokens, t, head_old)
|
||||
if (!min_token || min_token->type > t->type)
|
||||
@ -1146,8 +1140,6 @@ static int rule_add_line(UdevRules *rules, const char *line_str, unsigned line_n
|
||||
}
|
||||
|
||||
static void rule_resolve_goto(UdevRuleFile *rule_file) {
|
||||
UdevRuleLine *line, *line_next, *i;
|
||||
|
||||
assert(rule_file);
|
||||
|
||||
/* link GOTOs to LABEL rules in this file to be able to fast-forward */
|
||||
@ -2438,9 +2430,12 @@ static int udev_rule_apply_parent_token_to_event(
|
||||
head = rules->current_file->current_line->current_token;
|
||||
event->dev_parent = event->dev;
|
||||
for (;;) {
|
||||
LIST_FOREACH(tokens, line->current_token, head) {
|
||||
if (!token_is_for_parents(line->current_token))
|
||||
line->current_token = NULL;
|
||||
LIST_FOREACH(tokens, token, head) {
|
||||
if (!token_is_for_parents(token))
|
||||
return true; /* All parent tokens match. */
|
||||
|
||||
line->current_token = token;
|
||||
r = udev_rule_apply_token_to_event(rules, event->dev_parent, event, 0, timeout_signal, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -2468,7 +2463,6 @@ static int udev_rule_apply_line_to_event(
|
||||
|
||||
UdevRuleLine *line = rules->current_file->current_line;
|
||||
UdevRuleLineType mask = LINE_HAS_GOTO | LINE_UPDATE_SOMETHING;
|
||||
UdevRuleToken *token, *next_token;
|
||||
bool parents_done = false;
|
||||
sd_device_action_t action;
|
||||
int r;
|
||||
@ -2525,8 +2519,6 @@ int udev_rules_apply_to_event(
|
||||
int timeout_signal,
|
||||
Hashmap *properties_list) {
|
||||
|
||||
UdevRuleFile *file;
|
||||
UdevRuleLine *next_line;
|
||||
int r;
|
||||
|
||||
assert(rules);
|
||||
@ -2534,7 +2526,8 @@ int udev_rules_apply_to_event(
|
||||
|
||||
LIST_FOREACH(rule_files, file, rules->rule_files) {
|
||||
rules->current_file = file;
|
||||
LIST_FOREACH_SAFE(rule_lines, file->current_line, next_line, file->rule_lines) {
|
||||
LIST_FOREACH_SAFE(rule_lines, line, next_line, file->rule_lines) {
|
||||
file->current_line = line;
|
||||
r = udev_rule_apply_line_to_event(rules, event, timeout_usec, timeout_signal, properties_list, &next_line);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@ -2612,7 +2605,6 @@ static int apply_static_dev_perms(const char *devnode, uid_t uid, gid_t gid, mod
|
||||
}
|
||||
|
||||
static int udev_rule_line_apply_static_dev_perms(UdevRuleLine *rule_line) {
|
||||
UdevRuleToken *token;
|
||||
_cleanup_strv_free_ char **tags = NULL;
|
||||
uid_t uid = UID_INVALID;
|
||||
gid_t gid = GID_INVALID;
|
||||
@ -2645,8 +2637,6 @@ static int udev_rule_line_apply_static_dev_perms(UdevRuleLine *rule_line) {
|
||||
}
|
||||
|
||||
int udev_rules_apply_static_dev_perms(UdevRules *rules) {
|
||||
UdevRuleFile *file;
|
||||
UdevRuleLine *line;
|
||||
int r;
|
||||
|
||||
assert(rules);
|
||||
|
@ -181,8 +181,6 @@ static Event *event_free(Event *event) {
|
||||
}
|
||||
|
||||
static void event_queue_cleanup(Manager *manager, EventState match_state) {
|
||||
Event *event, *tmp;
|
||||
|
||||
LIST_FOREACH_SAFE(event, event, tmp, manager->events) {
|
||||
if (match_state != EVENT_UNDEF && match_state != event->state)
|
||||
continue;
|
||||
@ -781,7 +779,7 @@ static int event_run(Event *event) {
|
||||
static int event_is_blocked(Event *event) {
|
||||
const char *subsystem, *devpath, *devpath_old = NULL;
|
||||
dev_t devnum = makedev(0, 0);
|
||||
Event *loop_event;
|
||||
Event *loop_event = NULL;
|
||||
size_t devpath_len;
|
||||
int r, ifindex = 0;
|
||||
bool is_block;
|
||||
@ -796,7 +794,9 @@ static int event_is_blocked(Event *event) {
|
||||
/* we have checked previously and no blocker found */
|
||||
return false;
|
||||
|
||||
LIST_FOREACH(event, loop_event, event->manager->events) {
|
||||
LIST_FOREACH(event, e, event->manager->events) {
|
||||
loop_event = e;
|
||||
|
||||
/* we already found a later event, earlier cannot block us, no need to check again */
|
||||
if (loop_event->seqnum < event->blocker_seqnum)
|
||||
continue;
|
||||
@ -842,10 +842,12 @@ static int event_is_blocked(Event *event) {
|
||||
return r;
|
||||
|
||||
/* check if queue contains events we depend on */
|
||||
LIST_FOREACH(event, loop_event, loop_event) {
|
||||
LIST_FOREACH(event, e, loop_event) {
|
||||
size_t loop_devpath_len, common;
|
||||
const char *loop_devpath;
|
||||
|
||||
loop_event = e;
|
||||
|
||||
/* found ourself, no later event can block us */
|
||||
if (loop_event->seqnum >= event->seqnum)
|
||||
goto no_blocker;
|
||||
@ -915,7 +917,6 @@ no_blocker:
|
||||
}
|
||||
|
||||
static int event_queue_start(Manager *manager) {
|
||||
Event *event, *event_next;
|
||||
usec_t usec;
|
||||
int r;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user