diff options
Diffstat (limited to 'libcr_ipc/rpc.c')
-rw-r--r-- | libcr_ipc/rpc.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/libcr_ipc/rpc.c b/libcr_ipc/rpc.c index a648fde..6d9422f 100644 --- a/libcr_ipc/rpc.c +++ b/libcr_ipc/rpc.c @@ -10,17 +10,15 @@ #include <libcr_ipc/rpc.h> -#include "_linkedlist.h" - struct cr_rpc_requester { - cr_ipc_sll_node; + lm_sll_node; cid_t cid; void *req_ptr; /* where to read req from */ void *resp_ptr; /* where to write resp to */ }; struct cr_rpc_responder { - cr_ipc_sll_node; + lm_sll_node; /* before enqueued | after dequeued */ /* -------------------+-------------------- */ cid_t cid; /* responder cid | requester cid */ @@ -34,8 +32,8 @@ void _cr_rpc_send_req(struct _cr_rpc *ch, void *req_ptr, size_t req_size, void * if (ch->waiters.front && ch->waiter_typ != _CR_RPC_REQUESTER) { /* fast-path (still blocks) */ struct cr_rpc_responder *responder = - cr_ipc_sll_node_cast(struct cr_rpc_responder, ch->waiters.front); - cr_ipc_sll_pop_from_front(&ch->waiters); + lm_sll_node_cast(struct cr_rpc_responder, ch->waiters.front); + lm_sll_pop_from_front(&ch->waiters); /* Copy the req to the responder's stack. */ memcpy(responder->ptr, req_ptr, req_size); /* Notify the responder that we have done so. */ @@ -50,7 +48,7 @@ void _cr_rpc_send_req(struct _cr_rpc *ch, void *req_ptr, size_t req_size, void * .req_ptr = req_ptr, .resp_ptr = resp_ptr, }; - cr_ipc_sll_push_to_rear(&ch->waiters, &self); + lm_sll_push_to_rear(&ch->waiters, &self); /* Wait for a responder to both copy our req and sed * `*resp_ptr`. */ cr_pause_and_yield(); @@ -65,8 +63,8 @@ void _cr_rpc_recv_req(struct _cr_rpc *ch, void *req_ptr, size_t req_size, void * if (ch->waiters.front && ch->waiter_typ != _CR_RPC_RESPONDER) { /* non-blocking fast-path */ struct cr_rpc_requester *requester = - cr_ipc_sll_node_cast(struct cr_rpc_requester, ch->waiters.front); - cr_ipc_sll_pop_from_front(&ch->waiters); + lm_sll_node_cast(struct cr_rpc_requester, ch->waiters.front); + lm_sll_pop_from_front(&ch->waiters); memcpy(req_ptr, requester->req_ptr, req_size); *ret_requester = requester->cid; @@ -76,7 +74,7 @@ void _cr_rpc_recv_req(struct _cr_rpc *ch, void *req_ptr, size_t req_size, void * .cid = cr_getcid(), .ptr = req_ptr, }; - cr_ipc_sll_push_to_rear(&ch->waiters, &self); + lm_sll_push_to_rear(&ch->waiters, &self); ch->waiter_typ = _CR_RPC_RESPONDER; cr_pause_and_yield(); *ret_requester = self.cid; |