From 362bf390474ae5fd4a5789db0a6a2644a8bc1c65 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 7 Apr 2022 15:18:48 -0400 Subject: [PATCH] refactor: sandbox struct in req queue --- runtime/include/global_request_scheduler.h | 2 +- runtime/src/global_request_scheduler.c | 2 +- runtime/src/global_request_scheduler_minheap.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runtime/include/global_request_scheduler.h b/runtime/include/global_request_scheduler.h index 8e363eb..437fccd 100644 --- a/runtime/include/global_request_scheduler.h +++ b/runtime/include/global_request_scheduler.h @@ -5,7 +5,7 @@ #include "sandbox_types.h" /* Returns pointer back if successful, null otherwise */ -typedef struct sandbox *(*global_request_scheduler_add_fn_t)(void *); +typedef struct sandbox *(*global_request_scheduler_add_fn_t)(struct sandbox *); typedef int (*global_request_scheduler_remove_fn_t)(struct sandbox **); typedef int (*global_request_scheduler_remove_if_earlier_fn_t)(struct sandbox **, uint64_t); typedef uint64_t (*global_request_scheduler_peek_fn_t)(void); diff --git a/runtime/src/global_request_scheduler.c b/runtime/src/global_request_scheduler.c index 459eef9..4362100 100644 --- a/runtime/src/global_request_scheduler.c +++ b/runtime/src/global_request_scheduler.c @@ -5,7 +5,7 @@ /* Default uninitialized implementations of the polymorphic interface */ noreturn static struct sandbox * -uninitialized_add(void *arg) +uninitialized_add(struct sandbox *arg) { panic("Global Request Scheduler Add was called before initialization\n"); } diff --git a/runtime/src/global_request_scheduler_minheap.c b/runtime/src/global_request_scheduler_minheap.c index 3d8facf..510cb15 100644 --- a/runtime/src/global_request_scheduler_minheap.c +++ b/runtime/src/global_request_scheduler_minheap.c @@ -15,16 +15,16 @@ static struct priority_queue *global_request_scheduler_minheap; * @returns pointer to request if added. Panics runtime otherwise */ static struct sandbox * -global_request_scheduler_minheap_add(void *sandbox_raw) +global_request_scheduler_minheap_add(struct sandbox *sandbox) { - assert(sandbox_raw); + assert(sandbox); assert(global_request_scheduler_minheap); if (unlikely(!listener_thread_is_running())) panic("%s is only callable by the listener thread\n", __func__); - int return_code = priority_queue_enqueue(global_request_scheduler_minheap, sandbox_raw); + int return_code = priority_queue_enqueue(global_request_scheduler_minheap, sandbox); /* TODO: Propagate -1 to caller. Issue #91 */ if (return_code == -ENOSPC) panic("Request Queue is full\n"); - return (struct sandbox *)sandbox_raw; + return sandbox; } /**