Lines Matching refs:slot

18         sd_bus_slot *slot;  in bus_slot_allocate()  local
22 slot = malloc0(offsetof(sd_bus_slot, reply_callback) + extra); in bus_slot_allocate()
23 if (!slot) in bus_slot_allocate()
26 slot->n_ref = 1; in bus_slot_allocate()
27 slot->type = type; in bus_slot_allocate()
28 slot->bus = bus; in bus_slot_allocate()
29 slot->floating = floating; in bus_slot_allocate()
30 slot->userdata = userdata; in bus_slot_allocate()
35 LIST_PREPEND(slots, bus->slots, slot); in bus_slot_allocate()
37 return slot; in bus_slot_allocate()
40 void bus_slot_disconnect(sd_bus_slot *slot, bool unref) { in bus_slot_disconnect() argument
43 assert(slot); in bus_slot_disconnect()
45 if (!slot->bus) in bus_slot_disconnect()
48 switch (slot->type) { in bus_slot_disconnect()
52 if (slot->reply_callback.cookie != 0) in bus_slot_disconnect()
53 … ordered_hashmap_remove(slot->bus->reply_callbacks, &slot->reply_callback.cookie); in bus_slot_disconnect()
55 if (slot->reply_callback.timeout_usec != 0) in bus_slot_disconnect()
56 …prioq_remove(slot->bus->reply_callbacks_prioq, &slot->reply_callback, &slot->reply_callback.prioq_… in bus_slot_disconnect()
61 slot->bus->filter_callbacks_modified = true; in bus_slot_disconnect()
62 LIST_REMOVE(callbacks, slot->bus->filter_callbacks, &slot->filter_callback); in bus_slot_disconnect()
67 if (slot->match_added) in bus_slot_disconnect()
68 … (void) bus_remove_match_internal(slot->bus, slot->match_callback.match_string); in bus_slot_disconnect()
70 if (slot->match_callback.install_slot) { in bus_slot_disconnect()
71 bus_slot_disconnect(slot->match_callback.install_slot, true); in bus_slot_disconnect()
72slot->match_callback.install_slot = sd_bus_slot_unref(slot->match_callback.install_slot); in bus_slot_disconnect()
75 slot->bus->match_callbacks_modified = true; in bus_slot_disconnect()
76 bus_match_remove(&slot->bus->match_callbacks, &slot->match_callback); in bus_slot_disconnect()
78 slot->match_callback.match_string = mfree(slot->match_callback.match_string); in bus_slot_disconnect()
84 if (slot->node_callback.node) { in bus_slot_disconnect()
85 … LIST_REMOVE(callbacks, slot->node_callback.node->callbacks, &slot->node_callback); in bus_slot_disconnect()
86 slot->bus->nodes_modified = true; in bus_slot_disconnect()
88 bus_node_gc(slot->bus, slot->node_callback.node); in bus_slot_disconnect()
95 if (slot->node_enumerator.node) { in bus_slot_disconnect()
96 … LIST_REMOVE(enumerators, slot->node_enumerator.node->enumerators, &slot->node_enumerator); in bus_slot_disconnect()
97 slot->bus->nodes_modified = true; in bus_slot_disconnect()
99 bus_node_gc(slot->bus, slot->node_enumerator.node); in bus_slot_disconnect()
106 if (slot->node_object_manager.node) { in bus_slot_disconnect()
107 …LIST_REMOVE(object_managers, slot->node_object_manager.node->object_managers, &slot->node_object_m… in bus_slot_disconnect()
108 slot->bus->nodes_modified = true; in bus_slot_disconnect()
110 bus_node_gc(slot->bus, slot->node_object_manager.node); in bus_slot_disconnect()
117 … if (slot->node_vtable.node && slot->node_vtable.interface && slot->node_vtable.vtable) { in bus_slot_disconnect()
120 …for (v = slot->node_vtable.vtable; v->type != _SD_BUS_VTABLE_END; v = bus_vtable_next(slot->node_v… in bus_slot_disconnect()
128 key.path = slot->node_vtable.node->path; in bus_slot_disconnect()
129 key.interface = slot->node_vtable.interface; in bus_slot_disconnect()
132 x = hashmap_remove(slot->bus->vtable_methods, &key); in bus_slot_disconnect()
140 key.path = slot->node_vtable.node->path; in bus_slot_disconnect()
141 key.interface = slot->node_vtable.interface; in bus_slot_disconnect()
144 x = hashmap_remove(slot->bus->vtable_properties, &key); in bus_slot_disconnect()
152 slot->node_vtable.interface = mfree(slot->node_vtable.interface); in bus_slot_disconnect()
154 if (slot->node_vtable.node) { in bus_slot_disconnect()
155 LIST_REMOVE(vtables, slot->node_vtable.node->vtables, &slot->node_vtable); in bus_slot_disconnect()
156 slot->bus->nodes_modified = true; in bus_slot_disconnect()
158 bus_node_gc(slot->bus, slot->node_vtable.node); in bus_slot_disconnect()
167 bus = slot->bus; in bus_slot_disconnect()
169 slot->type = _BUS_SLOT_INVALID; in bus_slot_disconnect()
170 slot->bus = NULL; in bus_slot_disconnect()
171 LIST_REMOVE(slots, bus->slots, slot); in bus_slot_disconnect()
173 if (!slot->floating) in bus_slot_disconnect()
176 sd_bus_slot_unref(slot); in bus_slot_disconnect()
179 static sd_bus_slot* bus_slot_free(sd_bus_slot *slot) { in bus_slot_free() argument
180 assert(slot); in bus_slot_free()
182 bus_slot_disconnect(slot, false); in bus_slot_free()
184 if (slot->destroy_callback) in bus_slot_free()
185 slot->destroy_callback(slot->userdata); in bus_slot_free()
187 free(slot->description); in bus_slot_free()
188 return mfree(slot); in bus_slot_free()
193 _public_ sd_bus* sd_bus_slot_get_bus(sd_bus_slot *slot) { in sd_bus_slot_get_bus() argument
194 assert_return(slot, NULL); in sd_bus_slot_get_bus()
196 return slot->bus; in sd_bus_slot_get_bus()
199 _public_ void *sd_bus_slot_get_userdata(sd_bus_slot *slot) { in sd_bus_slot_get_userdata() argument
200 assert_return(slot, NULL); in sd_bus_slot_get_userdata()
202 return slot->userdata; in sd_bus_slot_get_userdata()
205 _public_ void *sd_bus_slot_set_userdata(sd_bus_slot *slot, void *userdata) { in sd_bus_slot_set_userdata() argument
208 assert_return(slot, NULL); in sd_bus_slot_set_userdata()
210 ret = slot->userdata; in sd_bus_slot_set_userdata()
211 slot->userdata = userdata; in sd_bus_slot_set_userdata()
216 _public_ int sd_bus_slot_set_destroy_callback(sd_bus_slot *slot, sd_bus_destroy_t callback) { in sd_bus_slot_set_destroy_callback() argument
217 assert_return(slot, -EINVAL); in sd_bus_slot_set_destroy_callback()
219 slot->destroy_callback = callback; in sd_bus_slot_set_destroy_callback()
223 _public_ int sd_bus_slot_get_destroy_callback(sd_bus_slot *slot, sd_bus_destroy_t *callback) { in sd_bus_slot_get_destroy_callback() argument
224 assert_return(slot, -EINVAL); in sd_bus_slot_get_destroy_callback()
227 *callback = slot->destroy_callback; in sd_bus_slot_get_destroy_callback()
229 return !!slot->destroy_callback; in sd_bus_slot_get_destroy_callback()
232 _public_ sd_bus_message *sd_bus_slot_get_current_message(sd_bus_slot *slot) { in sd_bus_slot_get_current_message() argument
233 assert_return(slot, NULL); in sd_bus_slot_get_current_message()
234 assert_return(slot->type >= 0, NULL); in sd_bus_slot_get_current_message()
236 if (slot->bus->current_slot != slot) in sd_bus_slot_get_current_message()
239 return slot->bus->current_message; in sd_bus_slot_get_current_message()
242 _public_ sd_bus_message_handler_t sd_bus_slot_get_current_handler(sd_bus_slot *slot) { in sd_bus_slot_get_current_handler() argument
243 assert_return(slot, NULL); in sd_bus_slot_get_current_handler()
244 assert_return(slot->type >= 0, NULL); in sd_bus_slot_get_current_handler()
246 if (slot->bus->current_slot != slot) in sd_bus_slot_get_current_handler()
249 return slot->bus->current_handler; in sd_bus_slot_get_current_handler()
252 _public_ void* sd_bus_slot_get_current_userdata(sd_bus_slot *slot) { in sd_bus_slot_get_current_userdata() argument
253 assert_return(slot, NULL); in sd_bus_slot_get_current_userdata()
254 assert_return(slot->type >= 0, NULL); in sd_bus_slot_get_current_userdata()
256 if (slot->bus->current_slot != slot) in sd_bus_slot_get_current_userdata()
259 return slot->bus->current_userdata; in sd_bus_slot_get_current_userdata()
262 _public_ int sd_bus_slot_get_floating(sd_bus_slot *slot) { in sd_bus_slot_get_floating() argument
263 assert_return(slot, -EINVAL); in sd_bus_slot_get_floating()
265 return slot->floating; in sd_bus_slot_get_floating()
268 _public_ int sd_bus_slot_set_floating(sd_bus_slot *slot, int b) { in sd_bus_slot_set_floating() argument
269 assert_return(slot, -EINVAL); in sd_bus_slot_set_floating()
271 if (slot->floating == !!b) in sd_bus_slot_set_floating()
274 if (!slot->bus) /* already disconnected slots can't be reconnected */ in sd_bus_slot_set_floating()
277 slot->floating = b; in sd_bus_slot_set_floating()
283 sd_bus_slot_ref(slot); in sd_bus_slot_set_floating()
284 sd_bus_unref(slot->bus); in sd_bus_slot_set_floating()
286 sd_bus_ref(slot->bus); in sd_bus_slot_set_floating()
287 sd_bus_slot_unref(slot); in sd_bus_slot_set_floating()
293 _public_ int sd_bus_slot_set_description(sd_bus_slot *slot, const char *description) { in sd_bus_slot_set_description() argument
294 assert_return(slot, -EINVAL); in sd_bus_slot_set_description()
296 return free_and_strdup(&slot->description, description); in sd_bus_slot_set_description()
299 _public_ int sd_bus_slot_get_description(sd_bus_slot *slot, const char **description) { in sd_bus_slot_get_description() argument
300 assert_return(slot, -EINVAL); in sd_bus_slot_get_description()
303 if (slot->description) in sd_bus_slot_get_description()
304 *description = slot->description; in sd_bus_slot_get_description()
305 else if (slot->type == BUS_MATCH_CALLBACK) in sd_bus_slot_get_description()
306 *description = slot->match_callback.match_string; in sd_bus_slot_get_description()