core: rename "clients" field of Job structure to "bus_track"
Let's make semantics of this field more similar to the same functionality in the Unit object, in particular as we add new functionality to it later on.
This commit is contained in:
parent
a2d72e265a
commit
1a465207ab
|
@ -65,7 +65,7 @@ int bus_job_method_cancel(sd_bus_message *message, void *userdata, sd_bus_error
|
|||
return r;
|
||||
|
||||
/* Access is granted to the job owner */
|
||||
if (!sd_bus_track_contains(j->clients, sd_bus_message_get_sender(message))) {
|
||||
if (!sd_bus_track_contains(j->bus_track, sd_bus_message_get_sender(message))) {
|
||||
|
||||
/* And for everybody else consult PolicyKit */
|
||||
r = bus_verify_manage_units_async(j->unit->manager, message, error);
|
||||
|
@ -143,7 +143,7 @@ void bus_job_send_change_signal(Job *j) {
|
|||
j->in_dbus_queue = false;
|
||||
}
|
||||
|
||||
r = bus_foreach_bus(j->manager, j->clients, j->sent_dbus_new_signal ? send_changed_signal : send_new_signal, j);
|
||||
r = bus_foreach_bus(j->manager, j->bus_track, j->sent_dbus_new_signal ? send_changed_signal : send_new_signal, j);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to send job change signal for %u: %m", j->id);
|
||||
|
||||
|
@ -187,7 +187,7 @@ void bus_job_send_removed_signal(Job *j) {
|
|||
if (!j->sent_dbus_new_signal)
|
||||
bus_job_send_change_signal(j);
|
||||
|
||||
r = bus_foreach_bus(j->manager, j->clients, send_removed_signal, j);
|
||||
r = bus_foreach_bus(j->manager, j->bus_track, send_removed_signal, j);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to send job remove signal for %u: %m", j->id);
|
||||
}
|
||||
|
|
|
@ -1224,13 +1224,13 @@ int bus_unit_queue_job(
|
|||
return r;
|
||||
|
||||
if (sd_bus_message_get_bus(message) == u->manager->api_bus) {
|
||||
if (!j->clients) {
|
||||
r = sd_bus_track_new(sd_bus_message_get_bus(message), &j->clients, NULL, NULL);
|
||||
if (!j->bus_track) {
|
||||
r = sd_bus_track_new(sd_bus_message_get_bus(message), &j->bus_track, NULL, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
r = sd_bus_track_add_sender(j->clients, message);
|
||||
r = sd_bus_track_add_sender(j->bus_track, message);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -1054,8 +1054,8 @@ static void destroy_bus(Manager *m, sd_bus **bus) {
|
|||
m->subscribed = sd_bus_track_unref(m->subscribed);
|
||||
|
||||
HASHMAP_FOREACH(j, m->jobs, i)
|
||||
if (j->clients && sd_bus_track_get_bus(j->clients) == *bus)
|
||||
j->clients = sd_bus_track_unref(j->clients);
|
||||
if (j->bus_track && sd_bus_track_get_bus(j->bus_track) == *bus)
|
||||
j->bus_track = sd_bus_track_unref(j->bus_track);
|
||||
|
||||
/* Get rid of queued message on this bus */
|
||||
if (m->queued_message && sd_bus_message_get_bus(m->queued_message) == *bus)
|
||||
|
|
|
@ -92,7 +92,7 @@ void job_free(Job *j) {
|
|||
|
||||
sd_event_source_unref(j->timer_event_source);
|
||||
|
||||
sd_bus_track_unref(j->clients);
|
||||
sd_bus_track_unref(j->bus_track);
|
||||
strv_free(j->deserialized_clients);
|
||||
|
||||
free(j);
|
||||
|
@ -1010,7 +1010,7 @@ int job_serialize(Job *j, FILE *f) {
|
|||
if (j->begin_usec > 0)
|
||||
fprintf(f, "job-begin="USEC_FMT"\n", j->begin_usec);
|
||||
|
||||
bus_track_serialize(j->clients, f, "subscribed");
|
||||
bus_track_serialize(j->bus_track, f, "subscribed");
|
||||
|
||||
/* End marker */
|
||||
fputc('\n', f);
|
||||
|
@ -1121,7 +1121,7 @@ int job_coldplug(Job *j) {
|
|||
|
||||
/* After deserialization is complete and the bus connection
|
||||
* set up again, let's start watching our subscribers again */
|
||||
(void) bus_track_coldplug(j->manager, &j->clients, false, j->deserialized_clients);
|
||||
(void) bus_track_coldplug(j->manager, &j->bus_track, false, j->deserialized_clients);
|
||||
j->deserialized_clients = strv_free(j->deserialized_clients);
|
||||
|
||||
if (j->state == JOB_WAITING)
|
||||
|
|
|
@ -156,7 +156,7 @@ struct Job {
|
|||
*
|
||||
* There can be more than one client, because of job merging.
|
||||
*/
|
||||
sd_bus_track *clients;
|
||||
sd_bus_track *bus_track;
|
||||
char **deserialized_clients;
|
||||
|
||||
JobResult result;
|
||||
|
|
Loading…
Reference in New Issue