Blame SOURCES/kvm-qom-provide-root-container-for-internal-objs.patch

4a2fec
From f105da1e0b15cdded39ad0a96501aace13e3bd6b Mon Sep 17 00:00:00 2001
4a2fec
From: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Date: Fri, 22 Dec 2017 11:08:44 +0100
4a2fec
Subject: [PATCH 26/42] qom: provide root container for internal objs
4a2fec
MIME-Version: 1.0
4a2fec
Content-Type: text/plain; charset=UTF-8
4a2fec
Content-Transfer-Encoding: 8bit
4a2fec
4a2fec
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Message-id: <20171222110900.24813-5-stefanha@redhat.com>
4a2fec
Patchwork-id: 78486
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 04/20] qom: provide root container for internal objs
4a2fec
Bugzilla: 1519721
4a2fec
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
4a2fec
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
4a2fec
From: Peter Xu <peterx@redhat.com>
4a2fec
4a2fec
We have object_get_objects_root() to keep user created objects, however
4a2fec
no place for objects that will be used internally.  Create such a
4a2fec
container for internal objects.
4a2fec
4a2fec
CC: Andreas Färber <afaerber@suse.de>
4a2fec
CC: Markus Armbruster <armbru@redhat.com>
4a2fec
CC: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
Suggested-by: Daniel P. Berrange <berrange@redhat.com>
4a2fec
Signed-off-by: Peter Xu <peterx@redhat.com>
4a2fec
Reviewed-by: Fam Zheng <famz@redhat.com>
4a2fec
Message-id: 20170928025958.1420-2-peterx@redhat.com
4a2fec
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
(cherry picked from commit 7c47c4ead75d0b733ee8f2f51fd1de0644cc1308)
4a2fec
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 include/qom/object.h | 11 +++++++++++
4a2fec
 qom/object.c         | 11 +++++++++++
4a2fec
 2 files changed, 22 insertions(+)
4a2fec
4a2fec
diff --git a/include/qom/object.h b/include/qom/object.h
4a2fec
index 1b82899..dde5086 100644
4a2fec
--- a/include/qom/object.h
4a2fec
+++ b/include/qom/object.h
4a2fec
@@ -1214,6 +1214,17 @@ Object *object_get_root(void);
4a2fec
 Object *object_get_objects_root(void);
4a2fec
 
4a2fec
 /**
4a2fec
+ * object_get_internal_root:
4a2fec
+ *
4a2fec
+ * Get the container object that holds internally used object
4a2fec
+ * instances.  Any object which is put into this container must not be
4a2fec
+ * user visible, and it will not be exposed in the QOM tree.
4a2fec
+ *
4a2fec
+ * Returns: the internal object container
4a2fec
+ */
4a2fec
+Object *object_get_internal_root(void);
4a2fec
+
4a2fec
+/**
4a2fec
  * object_get_canonical_path_component:
4a2fec
  *
4a2fec
  * Returns: The final component in the object's canonical path.  The canonical
4a2fec
diff --git a/qom/object.c b/qom/object.c
4a2fec
index fe6e744..4e4b2f7 100644
4a2fec
--- a/qom/object.c
4a2fec
+++ b/qom/object.c
4a2fec
@@ -1370,6 +1370,17 @@ Object *object_get_objects_root(void)
4a2fec
     return container_get(object_get_root(), "/objects");
4a2fec
 }
4a2fec
 
4a2fec
+Object *object_get_internal_root(void)
4a2fec
+{
4a2fec
+    static Object *internal_root;
4a2fec
+
4a2fec
+    if (!internal_root) {
4a2fec
+        internal_root = object_new("container");
4a2fec
+    }
4a2fec
+
4a2fec
+    return internal_root;
4a2fec
+}
4a2fec
+
4a2fec
 static void object_get_child_property(Object *obj, Visitor *v,
4a2fec
                                       const char *name, void *opaque,
4a2fec
                                       Error **errp)
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec