Lines Matching refs:node

265 	struct binder_node *node;  member
871 struct binder_node *node; in binder_get_node() local
874 node = rb_entry(n, struct binder_node, rb_node); in binder_get_node()
876 if (ptr < node->ptr) in binder_get_node()
878 else if (ptr > node->ptr) in binder_get_node()
881 return node; in binder_get_node()
892 struct binder_node *node; in binder_new_node() local
896 node = rb_entry(parent, struct binder_node, rb_node); in binder_new_node()
898 if (ptr < node->ptr) in binder_new_node()
900 else if (ptr > node->ptr) in binder_new_node()
906 node = kzalloc(sizeof(*node), GFP_KERNEL); in binder_new_node()
907 if (node == NULL) in binder_new_node()
910 rb_link_node(&node->rb_node, parent, p); in binder_new_node()
911 rb_insert_color(&node->rb_node, &proc->nodes); in binder_new_node()
912 node->debug_id = ++binder_last_id; in binder_new_node()
913 node->proc = proc; in binder_new_node()
914 node->ptr = ptr; in binder_new_node()
915 node->cookie = cookie; in binder_new_node()
916 node->work.type = BINDER_WORK_NODE; in binder_new_node()
917 INIT_LIST_HEAD(&node->work.entry); in binder_new_node()
918 INIT_LIST_HEAD(&node->async_todo); in binder_new_node()
921 proc->pid, current->pid, node->debug_id, in binder_new_node()
922 (u64)node->ptr, (u64)node->cookie); in binder_new_node()
923 return node; in binder_new_node()
926 static int binder_inc_node(struct binder_node *node, int strong, int internal, in binder_inc_node() argument
932 node->internal_strong_refs == 0 && in binder_inc_node()
933 !(node == binder_context_mgr_node && in binder_inc_node()
934 node->has_strong_ref)) { in binder_inc_node()
936 node->debug_id); in binder_inc_node()
939 node->internal_strong_refs++; in binder_inc_node()
941 node->local_strong_refs++; in binder_inc_node()
942 if (!node->has_strong_ref && target_list) { in binder_inc_node()
943 list_del_init(&node->work.entry); in binder_inc_node()
944 list_add_tail(&node->work.entry, target_list); in binder_inc_node()
948 node->local_weak_refs++; in binder_inc_node()
949 if (!node->has_weak_ref && list_empty(&node->work.entry)) { in binder_inc_node()
952 node->debug_id); in binder_inc_node()
955 list_add_tail(&node->work.entry, target_list); in binder_inc_node()
961 static int binder_dec_node(struct binder_node *node, int strong, int internal) in binder_dec_node() argument
965 node->internal_strong_refs--; in binder_dec_node()
967 node->local_strong_refs--; in binder_dec_node()
968 if (node->local_strong_refs || node->internal_strong_refs) in binder_dec_node()
972 node->local_weak_refs--; in binder_dec_node()
973 if (node->local_weak_refs || !hlist_empty(&node->refs)) in binder_dec_node()
976 if (node->proc && (node->has_strong_ref || node->has_weak_ref)) { in binder_dec_node()
977 if (list_empty(&node->work.entry)) { in binder_dec_node()
978 list_add_tail(&node->work.entry, &node->proc->todo); in binder_dec_node()
979 wake_up_interruptible(&node->proc->wait); in binder_dec_node()
982 if (hlist_empty(&node->refs) && !node->local_strong_refs && in binder_dec_node()
983 !node->local_weak_refs) { in binder_dec_node()
984 list_del_init(&node->work.entry); in binder_dec_node()
985 if (node->proc) { in binder_dec_node()
986 rb_erase(&node->rb_node, &node->proc->nodes); in binder_dec_node()
989 node->debug_id); in binder_dec_node()
991 hlist_del(&node->dead_node); in binder_dec_node()
994 node->debug_id); in binder_dec_node()
996 kfree(node); in binder_dec_node()
1025 struct binder_node *node) in binder_get_ref_for_node() argument
1036 if (node < ref->node) in binder_get_ref_for_node()
1038 else if (node > ref->node) in binder_get_ref_for_node()
1049 new_ref->node = node; in binder_get_ref_for_node()
1053 new_ref->desc = (node == binder_context_mgr_node) ? 0 : 1; in binder_get_ref_for_node()
1075 if (node) { in binder_get_ref_for_node()
1076 hlist_add_head(&new_ref->node_entry, &node->refs); in binder_get_ref_for_node()
1081 node->debug_id); in binder_get_ref_for_node()
1095 ref->node->debug_id); in binder_delete_ref()
1100 binder_dec_node(ref->node, 1, 1); in binder_delete_ref()
1102 binder_dec_node(ref->node, 0, 1); in binder_delete_ref()
1122 ret = binder_inc_node(ref->node, 1, 1, target_list); in binder_inc_ref()
1129 ret = binder_inc_node(ref->node, 0, 1, target_list); in binder_inc_ref()
1152 ret = binder_dec_node(ref->node, strong, 1); in binder_dec_ref()
1275 struct binder_node *node = binder_get_node(proc, fp->binder); in binder_transaction_buffer_release() local
1277 if (node == NULL) { in binder_transaction_buffer_release()
1284 node->debug_id, (u64)node->ptr); in binder_transaction_buffer_release()
1285 binder_dec_node(node, fp->type == BINDER_TYPE_BINDER, 0); in binder_transaction_buffer_release()
1298 ref->debug_id, ref->desc, ref->node->debug_id); in binder_transaction_buffer_release()
1390 target_node = ref->node; in binder_transaction()
1541 struct binder_node *node = binder_get_node(proc, fp->binder); in binder_transaction() local
1543 if (node == NULL) { in binder_transaction()
1544 node = binder_new_node(proc, fp->binder, fp->cookie); in binder_transaction()
1545 if (node == NULL) { in binder_transaction()
1549 node->min_priority = fp->flags & FLAT_BINDER_FLAG_PRIORITY_MASK; in binder_transaction()
1550 node->accept_fds = !!(fp->flags & FLAT_BINDER_FLAG_ACCEPTS_FDS); in binder_transaction()
1552 if (fp->cookie != node->cookie) { in binder_transaction()
1555 (u64)fp->binder, node->debug_id, in binder_transaction()
1556 (u64)fp->cookie, (u64)node->cookie); in binder_transaction()
1565 ref = binder_get_ref_for_node(target_proc, node); in binder_transaction()
1578 trace_binder_transaction_node_to_ref(t, node, ref); in binder_transaction()
1581 node->debug_id, (u64)node->ptr, in binder_transaction()
1600 if (ref->node->proc == target_proc) { in binder_transaction()
1605 fp->binder = ref->node->ptr; in binder_transaction()
1606 fp->cookie = ref->node->cookie; in binder_transaction()
1607 binder_inc_node(ref->node, fp->type == BINDER_TYPE_BINDER, 0, NULL); in binder_transaction()
1611 ref->debug_id, ref->desc, ref->node->debug_id, in binder_transaction()
1612 (u64)ref->node->ptr); in binder_transaction()
1616 new_ref = binder_get_ref_for_node(target_proc, ref->node); in binder_transaction()
1628 new_ref->desc, ref->node->debug_id); in binder_transaction()
1825 ref->desc, ref->strong, ref->weak, ref->node->debug_id); in binder_thread_write()
1832 struct binder_node *node; in binder_thread_write() local
1840 node = binder_get_node(proc, node_ptr); in binder_thread_write()
1841 if (node == NULL) { in binder_thread_write()
1850 if (cookie != node->cookie) { in binder_thread_write()
1855 (u64)node_ptr, node->debug_id, in binder_thread_write()
1856 (u64)cookie, (u64)node->cookie); in binder_thread_write()
1860 if (node->pending_strong_ref == 0) { in binder_thread_write()
1863 node->debug_id); in binder_thread_write()
1866 node->pending_strong_ref = 0; in binder_thread_write()
1868 if (node->pending_weak_ref == 0) { in binder_thread_write()
1871 node->debug_id); in binder_thread_write()
1874 node->pending_weak_ref = 0; in binder_thread_write()
1876 binder_dec_node(node, cmd == BC_ACQUIRE_DONE, 0); in binder_thread_write()
1881 node->debug_id, node->local_strong_refs, node->local_weak_refs); in binder_thread_write()
2011 ref->strong, ref->weak, ref->node->debug_id); in binder_thread_write()
2031 if (ref->node->proc == NULL) { in binder_thread_write()
2266 struct binder_node *node = container_of(w, struct binder_node, work); in binder_thread_read() local
2269 int strong = node->internal_strong_refs || node->local_strong_refs; in binder_thread_read()
2270 int weak = !hlist_empty(&node->refs) || node->local_weak_refs || strong; in binder_thread_read()
2272 if (weak && !node->has_weak_ref) { in binder_thread_read()
2275 node->has_weak_ref = 1; in binder_thread_read()
2276 node->pending_weak_ref = 1; in binder_thread_read()
2277 node->local_weak_refs++; in binder_thread_read()
2278 } else if (strong && !node->has_strong_ref) { in binder_thread_read()
2281 node->has_strong_ref = 1; in binder_thread_read()
2282 node->pending_strong_ref = 1; in binder_thread_read()
2283 node->local_strong_refs++; in binder_thread_read()
2284 } else if (!strong && node->has_strong_ref) { in binder_thread_read()
2287 node->has_strong_ref = 0; in binder_thread_read()
2288 } else if (!weak && node->has_weak_ref) { in binder_thread_read()
2291 node->has_weak_ref = 0; in binder_thread_read()
2297 if (put_user(node->ptr, in binder_thread_read()
2301 if (put_user(node->cookie, in binder_thread_read()
2310 node->debug_id, in binder_thread_read()
2311 (u64)node->ptr, (u64)node->cookie); in binder_thread_read()
2318 node->debug_id, in binder_thread_read()
2319 (u64)node->ptr, in binder_thread_read()
2320 (u64)node->cookie); in binder_thread_read()
2321 rb_erase(&node->rb_node, &proc->nodes); in binder_thread_read()
2322 kfree(node); in binder_thread_read()
2328 node->debug_id, in binder_thread_read()
2329 (u64)node->ptr, in binder_thread_read()
2330 (u64)node->cookie); in binder_thread_read()
3019 static int binder_node_release(struct binder_node *node, int refs) in binder_node_release() argument
3024 list_del_init(&node->work.entry); in binder_node_release()
3025 binder_release_work(&node->async_todo); in binder_node_release()
3027 if (hlist_empty(&node->refs)) { in binder_node_release()
3028 kfree(node); in binder_node_release()
3034 node->proc = NULL; in binder_node_release()
3035 node->local_strong_refs = 0; in binder_node_release()
3036 node->local_weak_refs = 0; in binder_node_release()
3037 hlist_add_head(&node->dead_node, &binder_dead_nodes); in binder_node_release()
3039 hlist_for_each_entry(ref, &node->refs, node_entry) { in binder_node_release()
3058 node->debug_id, refs, death); in binder_node_release()
3095 struct binder_node *node; in binder_deferred_release() local
3097 node = rb_entry(n, struct binder_node, rb_node); in binder_deferred_release()
3099 rb_erase(&node->rb_node, &proc->nodes); in binder_deferred_release()
3100 incoming_refs = binder_node_release(node, incoming_refs); in binder_deferred_release()
3259 struct binder_node *node; in print_binder_work() local
3271 node = container_of(w, struct binder_node, work); in print_binder_work()
3273 prefix, node->debug_id, in print_binder_work()
3274 (u64)node->ptr, (u64)node->cookie); in print_binder_work()
3324 static void print_binder_node(struct seq_file *m, struct binder_node *node) in print_binder_node() argument
3331 hlist_for_each_entry(ref, &node->refs, node_entry) in print_binder_node()
3335 node->debug_id, (u64)node->ptr, (u64)node->cookie, in print_binder_node()
3336 node->has_strong_ref, node->has_weak_ref, in print_binder_node()
3337 node->local_strong_refs, node->local_weak_refs, in print_binder_node()
3338 node->internal_strong_refs, count); in print_binder_node()
3341 hlist_for_each_entry(ref, &node->refs, node_entry) in print_binder_node()
3345 list_for_each_entry(w, &node->async_todo, entry) in print_binder_node()
3353 ref->debug_id, ref->desc, ref->node->proc ? "" : "dead ", in print_binder_ref()
3354 ref->node->debug_id, ref->strong, ref->weak, ref->death); in print_binder_ref()
3372 struct binder_node *node = rb_entry(n, struct binder_node, in print_binder_proc() local
3374 if (print_all || node->has_async_transaction) in print_binder_proc()
3375 print_binder_node(m, node); in print_binder_proc()
3539 struct binder_node *node; in binder_state_show() local
3549 hlist_for_each_entry(node, &binder_dead_nodes, dead_node) in binder_state_show()
3550 print_binder_node(m, node); in binder_state_show()