X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_queue.c;h=a4b5144cddd800c3f67a74919449ec8b71e33d36;hb=6fa605075d1944da0a88a389122ea24bbc583329;hp=28d41acc6678a5679a7c6f77c025f26105a99d57;hpb=b7093fd3602ef2c796a1f8a0daded9d6aad0b756;p=palacios.git diff --git a/palacios/src/palacios/vmm_queue.c b/palacios/src/palacios/vmm_queue.c index 28d41ac..a4b5144 100644 --- a/palacios/src/palacios/vmm_queue.c +++ b/palacios/src/palacios/vmm_queue.c @@ -19,6 +19,9 @@ #include + + + void v3_init_queue(struct v3_queue * queue) { queue->num_entries = 0; INIT_LIST_HEAD(&(queue->entries)); @@ -29,7 +32,7 @@ struct v3_queue * v3_create_queue() { 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; } @@ -37,12 +40,23 @@ struct v3_queue * v3_create_queue() { 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 ; }