[libvirt] [PATCH 4/5] security_stack: Turn list of nested drivers into a doubly linked list

Michal Privoznik mprivozn at redhat.com
Mon Sep 16 09:12:07 UTC 2019


In near future we will need to walk through the list of internal
drivers in reversed order. The simplest solution is to turn
singly linked list into a doubly linked list.
We will not need to start from the end really, so there's no tail
pointer kept.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/security/security_stack.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/security/security_stack.c b/src/security/security_stack.c
index dd055075cb..51a8b76748 100644
--- a/src/security/security_stack.c
+++ b/src/security/security_stack.c
@@ -35,6 +35,7 @@ typedef virSecurityStackItem *virSecurityStackItemPtr;
 struct _virSecurityStackItem {
     virSecurityManagerPtr securityManager;
     virSecurityStackItemPtr next;
+    virSecurityStackItemPtr prev;
 };
 
 struct _virSecurityStackData {
@@ -56,6 +57,7 @@ virSecurityStackAddNested(virSecurityManagerPtr mgr,
     if (VIR_ALLOC(item) < 0)
         return -1;
     item->securityManager = nested;
+    item->prev = tmp;
     if (tmp)
         tmp->next = item;
     else
-- 
2.21.0




More information about the libvir-list mailing list