#include <palacios/vmm_queue.h>
+
+
+
void v3_init_queue(struct v3_queue * queue) {
queue->num_entries = 0;
INIT_LIST_HEAD(&(queue->entries));
struct v3_queue * tmp_queue = V3_Malloc(sizeof(struct v3_queue));
if (!tmp_queue) {
- PrintError("Cannot allocate a queue\n");
+ PrintError(VM_NONE, VCORE_NONE,"Cannot allocate a queue\n");
return NULL;
}
return tmp_queue;
}
+void v3_deinit_queue(struct v3_queue * queue) {
+ while (v3_dequeue(queue)) {
+ PrintError(VM_NONE, VCORE_NONE,"ERROR: Freeing non-empty queue. PROBABLE MEMORY LEAK DETECTED\n");
+ }
+
+ v3_lock_deinit(&(queue->lock));
+}
+
+
+
+
void v3_enqueue(struct v3_queue * queue, addr_t entry) {
struct v3_queue_entry * q_entry = V3_Malloc(sizeof(struct v3_queue_entry));
unsigned int flags = 0;
if (!q_entry) {
- PrintError("Cannot allocate a queue entry for enqueue\n");
+ PrintError(VM_NONE, VCORE_NONE,"Cannot allocate a queue entry for enqueue\n");
return ;
}