Lines Matching refs:rp
185 read_port_t *rp = calloc(1, sizeof(read_port_t)); in port_open() local
186 if (!rp) in port_open()
189 rp->magic = READPORT_MAGIC; in port_open()
190 wait_queue_init(&rp->wait); in port_open()
191 rp->ctx = ctx; in port_open()
198 free(rp); in port_open()
210 rp->wport = wp; in port_open()
213 list_add_tail(&wp->rp_list, &rp->w_node); in port_open()
214 rp->buf = wp->buf; in port_open()
225 list_add_tail(&wp->rp_list, &rp->w_node); in port_open()
226 rp->buf = buf; in port_open()
242 *port = (void *)rp; in port_open()
244 free(rp); in port_open()
273 read_port_t *rp = (read_port_t *)ports[ix]; in port_group() local
274 if ((rp->magic != READPORT_MAGIC) || rp->gport) { in port_group()
284 rp->gport = pg; in port_group()
285 list_add_tail(&pg->rp_list, &rp->g_node); in port_group()
306 read_port_t *rp = (read_port_t *)port; in port_group_add() local
307 if (rp->magic != READPORT_MAGIC || rp->gport) in port_group_add()
316 rp->gport = pg; in port_group_add()
317 list_add_tail(&pg->rp_list, &rp->g_node); in port_group_add()
321 if (!buf_is_empty(rp->buf)) { in port_group_add()
340 read_port_t *rp = (read_port_t *)port; in port_group_remove() local
341 if (rp->magic != READPORT_MAGIC || rp->gport != pg) in port_group_remove()
349 if (current_rp == rp) { in port_group_remove()
357 list_delete(&rp->g_node); in port_group_remove()
385 read_port_t *rp; in port_write() local
386 list_for_every_entry(&wp->rp_list, rp, read_port_t, w_node) { in port_write()
387 if (buf_write(rp->buf, pk, count) < 0) { in port_write()
394 if (rp->gport) { in port_write()
395 awaken = wait_queue_wake_one(&rp->gport->wait, false, NO_ERROR); in port_write()
398 awaken = wait_queue_wake_one(&rp->wait, false, NO_ERROR); in port_write()
415 static inline status_t read_no_lock(read_port_t *rp, lk_time_t timeout, port_result_t *result) { in read_no_lock() argument
416 status_t status = buf_read(rp->buf, result); in read_no_lock()
417 result->ctx = rp->ctx; in read_no_lock()
426 status_t wr = wait_queue_block(&rp->wait, timeout); in read_no_lock()
430 return read_no_lock(rp, timeout, result); in read_no_lock()
438 read_port_t *rp = (read_port_t *)port; in port_read() local
441 if (rp->magic == READPORT_MAGIC) { in port_read()
443 rc = read_no_lock(rp, timeout, result); in port_read()
444 } else if (rp->magic == PORTGROUP_MAGIC) { in port_read()
450 list_for_every_entry(&pg->rp_list, rp, read_port_t, g_node) { in port_read()
451 rc = read_no_lock(rp, 0, result); in port_read()
489 read_port_t *rp; in port_destroy() local
490 list_for_every_entry(&wp->rp_list, rp, read_port_t, w_node) { in port_destroy()
492 wait_queue_wake_all(&rp->wait, false, ERR_CANCELLED); in port_destroy()
493 if (rp->gport) { in port_destroy()
494 wait_queue_wake_all(&rp->gport->wait, false, ERR_CANCELLED); in port_destroy()
497 rp->wport = NULL; in port_destroy()
513 read_port_t *rp = (read_port_t *) port; in port_close() local
517 if (rp->magic == READPORT_MAGIC) { in port_close()
519 if (rp->wport) { in port_close()
521 list_delete(&rp->w_node); in port_close()
522 if (list_is_empty(&rp->wport->rp_list)) { in port_close()
523 rp->wport->buf = rp->buf; in port_close()
524 rp->buf = NULL; in port_close()
526 buf = rp->buf; in port_close()
529 if (rp->gport) { in port_close()
531 list_delete(&rp->g_node); in port_close()
534 wait_queue_destroy(&rp->wait, true); in port_close()
535 rp->magic = 0; in port_close()
537 } else if (rp->magic == PORTGROUP_MAGIC) { in port_close()
543 rp = NULL; in port_close()
544 list_for_every_entry(&pg->rp_list, rp, read_port_t, g_node) { in port_close()
545 rp->gport = NULL; in port_close()
549 } else if (rp->magic == WRITEPORT_MAGIC_W) { in port_close()