Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the implementation principle of qemu queue?

Shulou Source: shulou.com Published: 2022-06-01 19:16:19 10月03日 Update

Today, I will talk to you about the implementation principle of qemu queue, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

# define QLIST_HEAD (name, type)\

Struct name {\

Struct type * lh_first; / * first element * /\

}

# define QLIST_HEAD_INITIALIZER (head)\

{NULL}

# define QLIST_ENTRY (type)\

Struct {\

Struct type * le_next; / * next element * /\

Struct type * * le_prev; / * address of previous next element * /\

}

/ *

* List functions.

, /

# define QLIST_INIT (head) do {\

(head)-> lh_first = NULL;\

} while (/ * CONSTCOND*/0)

# define QLIST_INSERT_AFTER (listelm, elm, field) do {\

If (elm)-> field.le_next = (listelm)-> field.le_next)! = NULL)\

(listelm)-> field.le_next- > field.le_prev =\

& (elm)-> field.le_next;\

(listelm)-> field.le_next = (elm);\

(elm)-> field.le_prev = & (listelm)-> field.le_next;\

} while (/ * CONSTCOND*/0)

# define QLIST_INSERT_BEFORE (listelm, elm, field) do {\

(elm)-> field.le_prev = (listelm)-> field.le_prev;\

(elm)-> field.le_next = (listelm);\

* (listelm)-> field.le_prev = (elm);\

(listelm)-> field.le_prev = & (elm)-> field.le_next;\

} while (/ * CONSTCOND*/0)

# define QLIST_INSERT_HEAD (head, elm, field) do {\

If (elm)-> field.le_next = (head)-> lh_first)! = NULL)\

(head)-> lh_first- > field.le_prev = & (elm)-> field.le_next;\

(head)-> lh_first = (elm);\

(elm)-> field.le_prev = & (head)-> lh_first;\

} while (/ * CONSTCOND*/0)

Node- > next points to the next node

Node- > prev is the entry that points to the previous node, so * (node- > prev) is the address of the Nextfield of the previous node.

That is to say (* node- > prev)-> next = = node

After reading the above, do you have any further understanding of how qemu queues are implemented? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Content that is nodes principles queues directions that is addresses more knowledge articles industry information information channels channels enter one support related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux macOS Huawei Docker Microsoft