• Home
  • Raw
  • Download

Lines Matching refs:t

28 static void transport_unref(atransport *t);
71 kick_transport(atransport* t) in kick_transport() argument
73 if (t && !t->kicked) in kick_transport()
78 kicked = t->kicked; in kick_transport()
80 t->kicked = 1; in kick_transport()
84 t->kick(t); in kick_transport()
89 run_transport_disconnects(atransport* t) in run_transport_disconnects() argument
91 adisconnect* dis = t->disconnects.next; in run_transport_disconnects()
93 D("%s: run_transport_disconnects\n", t->serial); in run_transport_disconnects()
94 while (dis != &t->disconnects) { in run_transport_disconnects()
96 dis->func( dis->opaque, t ); in run_transport_disconnects()
205 atransport *t = _t; in transport_socket_events() local
209 if(read_packet(fd, t->serial, &p)){ in transport_socket_events()
210 D("%s: failed to read packet from transport socket on fd %d\n", t->serial, fd); in transport_socket_events()
217 void send_packet(apacket *p, atransport *t) in send_packet() argument
235 if (t == NULL) { in send_packet()
242 if(write_packet(t->transport_socket, t->serial, &p)){ in send_packet()
262 atransport *t = _t; in output_thread() local
266 t->serial, t->fd, t->sync_token + 1); in output_thread()
270 p->msg.arg1 = ++(t->sync_token); in output_thread()
272 if(write_packet(t->fd, t->serial, &p)) { in output_thread()
274 D("%s: failed to write SYNC packet\n", t->serial); in output_thread()
278 D("%s: data pump started\n", t->serial); in output_thread()
282 if(t->read_from_remote(p, t) == 0){ in output_thread()
284 t->serial); in output_thread()
285 if(write_packet(t->fd, t->serial, &p)){ in output_thread()
287 D("%s: failed to write apacket to transport\n", t->serial); in output_thread()
291 D("%s: remote read failed for transport\n", t->serial); in output_thread()
297 D("%s: SYNC offline for transport\n", t->serial); in output_thread()
303 if(write_packet(t->fd, t->serial, &p)) { in output_thread()
305 D("%s: failed to write SYNC apacket to transport", t->serial); in output_thread()
309 D("%s: transport output thread is exiting\n", t->serial); in output_thread()
310 kick_transport(t); in output_thread()
311 transport_unref(t); in output_thread()
317 atransport *t = _t; in input_thread() local
322 t->serial, t->fd); in input_thread()
325 if(read_packet(t->fd, t->serial, &p)) { in input_thread()
327 t->serial, t->fd ); in input_thread()
332 D("%s: transport SYNC offline\n", t->serial); in input_thread()
336 if(p->msg.arg1 == t->sync_token) { in input_thread()
337 D("%s: transport SYNC online\n", t->serial); in input_thread()
341 t->serial, p->msg.arg1, t->sync_token); in input_thread()
346 D("%s: transport got packet, sending to remote\n", t->serial); in input_thread()
347 t->write_to_remote(p, t); in input_thread()
349 D("%s: transport ignoring packet while offline\n", t->serial); in input_thread()
358 close_all_sockets(t); in input_thread()
360 D("%s: transport input thread is exiting, fd %d\n", t->serial, t->fd); in input_thread()
361 kick_transport(t); in input_thread()
362 transport_unref(t); in input_thread()
577 atransport *t; in transport_registration_func() local
587 t = m.transport; in transport_registration_func()
590 D("transport: %s removing and free'ing %d\n", t->serial, t->transport_socket); in transport_registration_func()
595 fdevent_remove(&(t->transport_fde)); in transport_registration_func()
596 adb_close(t->fd); in transport_registration_func()
599 t->next->prev = t->prev; in transport_registration_func()
600 t->prev->next = t->next; in transport_registration_func()
603 run_transport_disconnects(t); in transport_registration_func()
605 if (t->product) in transport_registration_func()
606 free(t->product); in transport_registration_func()
607 if (t->serial) in transport_registration_func()
608 free(t->serial); in transport_registration_func()
609 if (t->model) in transport_registration_func()
610 free(t->model); in transport_registration_func()
611 if (t->device) in transport_registration_func()
612 free(t->device); in transport_registration_func()
613 if (t->devpath) in transport_registration_func()
614 free(t->devpath); in transport_registration_func()
616 memset(t,0xee,sizeof(atransport)); in transport_registration_func()
617 free(t); in transport_registration_func()
624 if (t->connection_state != CS_NOPERM) { in transport_registration_func()
626 t->ref_count = 2; in transport_registration_func()
632 D("transport: %s (%d,%d) starting\n", t->serial, s[0], s[1]); in transport_registration_func()
634 t->transport_socket = s[0]; in transport_registration_func()
635 t->fd = s[1]; in transport_registration_func()
637 fdevent_install(&(t->transport_fde), in transport_registration_func()
638 t->transport_socket, in transport_registration_func()
640 t); in transport_registration_func()
642 fdevent_set(&(t->transport_fde), FDE_READ); in transport_registration_func()
644 if(adb_thread_create(&input_thread_ptr, input_thread, t)){ in transport_registration_func()
648 if(adb_thread_create(&output_thread_ptr, output_thread, t)){ in transport_registration_func()
655 t->next->prev = t->prev; in transport_registration_func()
656 t->prev->next = t->next; in transport_registration_func()
658 t->next = &transport_list; in transport_registration_func()
659 t->prev = transport_list.prev; in transport_registration_func()
660 t->next->prev = t; in transport_registration_func()
661 t->prev->next = t; in transport_registration_func()
664 t->disconnects.next = t->disconnects.prev = &t->disconnects; in transport_registration_func()
712 static void transport_unref_locked(atransport *t) in transport_unref_locked() argument
714 t->ref_count--; in transport_unref_locked()
715 if (t->ref_count == 0) { in transport_unref_locked()
716 D("transport: %s unref (kicking and closing)\n", t->serial); in transport_unref_locked()
717 if (!t->kicked) { in transport_unref_locked()
718 t->kicked = 1; in transport_unref_locked()
719 t->kick(t); in transport_unref_locked()
721 t->close(t); in transport_unref_locked()
722 remove_transport(t); in transport_unref_locked()
724 D("transport: %s unref (count=%d)\n", t->serial, t->ref_count); in transport_unref_locked()
728 static void transport_unref(atransport *t) in transport_unref() argument
730 if (t) { in transport_unref()
732 transport_unref_locked(t); in transport_unref()
737 void add_transport_disconnect(atransport* t, adisconnect* dis) in add_transport_disconnect() argument
740 dis->next = &t->disconnects; in add_transport_disconnect()
747 void remove_transport_disconnect(atransport* t, adisconnect* dis) in remove_transport_disconnect() argument
796 atransport *t; in acquire_one_transport() local
805 for (t = transport_list.next; t != &transport_list; t = t->next) { in acquire_one_transport()
806 if (t->connection_state == CS_NOPERM) { in acquire_one_transport()
814 if ((t->serial && !strcmp(serial, t->serial)) || in acquire_one_transport()
815 (t->devpath && !strcmp(serial, t->devpath)) || in acquire_one_transport()
816 qual_match(serial, "product:", t->product, 0) || in acquire_one_transport()
817 qual_match(serial, "model:", t->model, 1) || in acquire_one_transport()
818 qual_match(serial, "device:", t->device, 0)) { in acquire_one_transport()
826 result = t; in acquire_one_transport()
829 if (ttype == kTransportUsb && t->type == kTransportUsb) { in acquire_one_transport()
837 result = t; in acquire_one_transport()
838 } else if (ttype == kTransportLocal && t->type == kTransportLocal) { in acquire_one_transport()
846 result = t; in acquire_one_transport()
855 result = t; in acquire_one_transport()
895 static const char *statename(atransport *t) in statename() argument
897 switch(t->connection_state){ in statename()
933 static size_t format_transport(atransport *t, char *buf, size_t bufsize, in format_transport() argument
936 const char* serial = t->serial; in format_transport()
941 return snprintf(buf, bufsize, "%s\t%s\n", serial, statename(t)); in format_transport()
945 len = snprintf(buf, remaining, "%-22s %s", serial, statename(t)); in format_transport()
949 add_qual(&buf, &remaining, " ", t->devpath, 0); in format_transport()
950 add_qual(&buf, &remaining, " product:", t->product, 0); in format_transport()
951 add_qual(&buf, &remaining, " model:", t->model, 1); in format_transport()
952 add_qual(&buf, &remaining, " device:", t->device, 0); in format_transport()
966 atransport *t; in list_transports() local
970 for(t = transport_list.next; t != &transport_list; t = t->next) { in list_transports()
971 len = format_transport(t, p, end - p, long_listing); in list_transports()
987 atransport *t; in close_usb_devices() local
990 for(t = transport_list.next; t != &transport_list; t = t->next) { in close_usb_devices()
991 if ( !t->kicked ) { in close_usb_devices()
992 t->kicked = 1; in close_usb_devices()
993 t->kick(t); in close_usb_devices()
1002 atransport *t = calloc(1, sizeof(atransport)); in register_socket_transport() local
1007 snprintf(buff, sizeof buff, "T-%p", t); in register_socket_transport()
1011 if (init_socket_transport(t, s, port, local) < 0) { in register_socket_transport()
1012 free(t); in register_socket_transport()
1020 free(t); in register_socket_transport()
1028 free(t); in register_socket_transport()
1033 t->next = &pending_list; in register_socket_transport()
1034 t->prev = pending_list.prev; in register_socket_transport()
1035 t->next->prev = t; in register_socket_transport()
1036 t->prev->next = t; in register_socket_transport()
1037 t->serial = strdup(serial); in register_socket_transport()
1040 register_transport(t); in register_socket_transport()
1047 atransport *t; in find_transport() local
1050 for(t = transport_list.next; t != &transport_list; t = t->next) { in find_transport()
1051 if (t->serial && !strcmp(serial, t->serial)) { in find_transport()
1057 if (t != &transport_list) in find_transport()
1058 return t; in find_transport()
1063 void unregister_transport(atransport *t) in unregister_transport() argument
1066 t->next->prev = t->prev; in unregister_transport()
1067 t->prev->next = t->next; in unregister_transport()
1070 kick_transport(t); in unregister_transport()
1071 transport_unref(t); in unregister_transport()
1077 atransport *t, *next; in unregister_all_tcp_transports() local
1079 for (t = transport_list.next; t != &transport_list; t = next) { in unregister_all_tcp_transports()
1080 next = t->next; in unregister_all_tcp_transports()
1081 if (t->type == kTransportLocal && t->adb_port == 0) { in unregister_all_tcp_transports()
1082 t->next->prev = t->prev; in unregister_all_tcp_transports()
1083 t->prev->next = next; in unregister_all_tcp_transports()
1085 if (!t->kicked) in unregister_all_tcp_transports()
1087 t->kicked = 1; in unregister_all_tcp_transports()
1088 t->kick(t); in unregister_all_tcp_transports()
1090 transport_unref_locked(t); in unregister_all_tcp_transports()
1101 atransport *t = calloc(1, sizeof(atransport)); in register_usb_transport() local
1102 D("transport: %p init'ing for usb_handle %p (sn='%s')\n", t, usb, in register_usb_transport()
1104 init_usb_transport(t, usb, (writeable ? CS_OFFLINE : CS_NOPERM)); in register_usb_transport()
1106 t->serial = strdup(serial); in register_usb_transport()
1109 t->devpath = strdup(devpath); in register_usb_transport()
1113 t->next = &pending_list; in register_usb_transport()
1114 t->prev = pending_list.prev; in register_usb_transport()
1115 t->next->prev = t; in register_usb_transport()
1116 t->prev->next = t; in register_usb_transport()
1119 register_transport(t); in register_usb_transport()
1125 atransport *t; in unregister_usb_transport() local
1127 for(t = transport_list.next; t != &transport_list; t = t->next) { in unregister_usb_transport()
1128 if (t->usb == usb && t->connection_state == CS_NOPERM) { in unregister_usb_transport()
1129 t->next->prev = t->prev; in unregister_usb_transport()
1130 t->prev->next = t->next; in unregister_usb_transport()