1 #include <palacios/vmm_queue.h>
5 void init_queue(struct gen_queue * queue) {
6 queue->num_entries = 0;
7 INIT_LIST_HEAD(&(queue->entries));
11 struct gen_queue * create_queue() {
12 struct gen_queue * tmp_queue = V3_Malloc(sizeof(struct gen_queue));
13 init_queue(tmp_queue);
17 void enqueue(struct gen_queue * queue, addr_t entry) {
18 struct queue_entry * q_entry = V3_Malloc(sizeof(struct queue_entry));
20 q_entry->entry = entry;
21 list_add_tail(&(q_entry->entry_list), &(queue->entries));
26 addr_t dequeue(struct gen_queue * queue) {
29 if (!list_empty(&(queue->entries))) {
30 struct list_head * q_entry = queue->entries.next;
31 struct queue_entry * tmp_entry = list_entry(q_entry, struct queue_entry, entry_list);
33 entry_val = tmp_entry->entry;