assert(bus);
assert(path);
assert(c);
- assert(userdata);
u = c->userdata;
if (c->find) {
return r;
}
- *userdata = u;
+ if (userdata)
+ *userdata = u;
+
return 1;
}
assert(bus);
assert(n);
- if (n->child)
- return true;
+ /* Tests if there's anything attached directly to this node
+ * for the specified path */
LIST_FOREACH(callbacks, k, n->callbacks) {
if (require_fallback && !k->is_fallback)
if (require_fallback && !c->is_fallback)
continue;
- return true;
+ if (node_vtable_get_userdata(bus, path, c, NULL) > 0)
+ return true;
}
return !require_fallback && (n->enumerators || n->object_manager);
-
}
static int process_introspect(
empty = set_isempty(s);
LIST_FOREACH(vtables, c, n->vtables) {
- void *u;
-
if (require_fallback && !c->is_fallback)
continue;
- r = node_vtable_get_userdata(bus, m->path, c, &u);
+ r = node_vtable_get_userdata(bus, m->path, c, NULL);
if (r < 0)
return r;
if (r == 0)
static int object_manager_serialize_path(
sd_bus *bus,
sd_bus_message *reply,
+ const char *prefix,
const char *path,
bool require_fallback,
sd_bus_error *error) {
assert(bus);
assert(reply);
+ assert(prefix);
assert(path);
assert(error);
- n = hashmap_get(bus->nodes, path);
+ n = hashmap_get(bus->nodes, prefix);
if (!n)
return 0;
assert(error);
/* First, add all vtables registered for this path */
- r = object_manager_serialize_path(bus, reply, path, false, error);
+ r = object_manager_serialize_path(bus, reply, path, path, false, error);
if (r < 0)
return r;
if (sd_bus_error_is_set(error))
*e = 0;
- r = object_manager_serialize_path(bus, reply, p, true, error);
+ r = object_manager_serialize_path(bus, reply, p, path, true, error);
if (r < 0)
return r;
return 1;
}
-static int object_find_and_run(sd_bus *bus, sd_bus_message *m, const char *p, bool require_fallback, bool *found_object) {
+static int object_find_and_run(
+ sd_bus *bus,
+ sd_bus_message *m,
+ const char *p,
+ bool require_fallback,
+ bool *found_object) {
+
struct node *n;
struct vtable_member vtable_key, *v;
int r;
sd_bus_object_find_t find,
void *userdata) {
- struct node_vtable *c, *i;
+ struct node_vtable *c = NULL, *i;
const sd_bus_vtable *v;
struct node *n;
int r;
struct node_vtable *c;
struct node *n;
char **property;
- void *u;
+ void *u = NULL;
int r;
assert(bus);
if (r < 0)
return r;
- r = v->vtable->property.get(bus, m->path, interface, *property, m, &error, u);
+ r = v->vtable->property.get(bus, m->path, interface, *property, m, &error, vtable_property_convert_userdata(v->vtable, u));
if (r < 0)
return r;