Esempio n. 1
0
static int _object_notify_deleted_children(struct object_instance *parent_pt)
{
	struct list_head *list;
	struct list_head *notify_list;
	int res;
	struct object_instance *obj_pt = NULL;
	struct object_tracker * tracker_pt;

	for (list = parent_pt->child_head.next;
		 list != &parent_pt->child_head; list = list->next) {

		obj_pt = list_entry(list, struct object_instance,
							child_list);
		res = _object_notify_deleted_children(obj_pt);
		if (res)
			return res;

		for (notify_list = obj_pt->track_head.next;
			 notify_list != &obj_pt->track_head;
			 notify_list = notify_list->next) {

			tracker_pt = list_entry (notify_list, struct object_tracker, object_list);

			if ((tracker_pt != NULL) &&
				(tracker_pt->object_destroy_notify_fn != NULL))
				tracker_pt->object_destroy_notify_fn(parent_pt->object_handle,
					obj_pt->object_name,
					obj_pt->object_name_len,
					tracker_pt->data_pt);
		}
	}

	return 0;
}
Esempio n. 2
0
static void object_pre_deletion_notification(hdb_handle_t object_handle,
	hdb_handle_t parent_object_handle,
	const void *name_pt, size_t name_len)
{
	struct list_head * list;
	struct object_instance * obj_pt;
	struct object_tracker * tracker_pt;
	hdb_handle_t obj_handle = object_handle;

	do {
		if (hdb_handle_get (&object_instance_database,
			obj_handle, (void *)&obj_pt) != 0) {
			return;
		}

		for (list = obj_pt->track_head.next;
			list != &obj_pt->track_head; list = list->next) {

			tracker_pt = list_entry (list, struct object_tracker, object_list);

			if (((obj_handle == parent_object_handle) ||
					(tracker_pt->depth == OBJECT_TRACK_DEPTH_RECURSIVE)) &&
				(tracker_pt->object_destroy_notify_fn != NULL)) {
				tracker_pt->object_destroy_notify_fn(
					parent_object_handle,
					name_pt, name_len,
					tracker_pt->data_pt);
			}
		}
		/* notify child object listeners */
		if (obj_handle == object_handle)
			_object_notify_deleted_children(obj_pt);

		obj_handle = obj_pt->parent_handle;
		hdb_handle_put (&object_instance_database, obj_pt->object_handle);
	} while (obj_handle != OBJECT_PARENT_HANDLE);
}