[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH v3 09/22] Add basic lu_save_all() shell



From: David Woodhouse <dwmw@xxxxxxxxxxxx>

---
 xen/common/kexec.c     |  6 +++++
 xen/common/lu/Makefile |  2 +-
 xen/common/lu/save.c   | 56 ++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/lu.h   |  3 +++
 4 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 xen/common/lu/save.c

diff --git a/xen/common/kexec.c b/xen/common/kexec.c
index a78aa4f5b0..658fe3d3d4 100644
--- a/xen/common/kexec.c
+++ b/xen/common/kexec.c
@@ -29,6 +29,7 @@
 #include <public/elfnote.h>
 #include <xsm/xsm.h>
 #include <xen/cpu.h>
+#include <xen/lu.h>
 #ifdef CONFIG_COMPAT
 #include <compat/kexec.h>
 #endif
@@ -407,6 +408,11 @@ static long kexec_reboot(void *_image)
 static long kexec_live_update(void *_image)
 {
     struct kexec_image *image = _image;
+    int ret;
+
+    ret = lu_save_all(image);
+    if (ret)
+        return ret;
 
     kexecing = TRUE;
 
diff --git a/xen/common/lu/Makefile b/xen/common/lu/Makefile
index 68991b3ca4..7b7d975f65 100644
--- a/xen/common/lu/Makefile
+++ b/xen/common/lu/Makefile
@@ -1 +1 @@
-obj-y += stream.o
+obj-y += stream.o save.o
diff --git a/xen/common/lu/save.c b/xen/common/lu/save.c
new file mode 100644
index 0000000000..c43962c44e
--- /dev/null
+++ b/xen/common/lu/save.c
@@ -0,0 +1,56 @@
+
+#include <xen/types.h>
+#include <xen/vmap.h>
+#include <xen/lu.h>
+#include <xen/kimage.h>
+#include <xen/sched.h>
+
+int lu_save_global(struct lu_stream *stream)
+{
+    return 0;
+}
+
+
+int lu_save_domain(struct lu_stream *stream, struct domain *d)
+{
+    return 0;
+}
+
+int lu_save_all(struct kexec_image *image)
+{
+    struct lu_stream stream;
+    struct domain *d;
+    int ret;
+
+    memset(&stream, 0, sizeof(stream));
+
+    ret = lu_save_global(&stream);
+
+    for_each_domain ( d )
+    {
+        if (ret)
+            break;
+
+        ret = lu_save_domain(&stream, d);
+    }
+
+    if (!ret)
+        ret = kimage_add_live_update_data(image,
+                          _mfn(virt_to_mfn(stream.pagelist)),
+                          stream.nr_pages);
+
+    if (ret)
+        lu_stream_free(&stream);
+
+    return ret;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/xen/lu.h b/xen/include/xen/lu.h
index 21ee1825d3..f232a56950 100644
--- a/xen/include/xen/lu.h
+++ b/xen/include/xen/lu.h
@@ -19,6 +19,9 @@ void lu_stream_end_reservation(struct lu_stream *stream, 
size_t size);
 int lu_stream_append(struct lu_stream *stream, const void *data, size_t size);
 void lu_stream_free(struct lu_stream *stream);
 
+struct kexec_image;
+int lu_save_all(struct kexec_image *image);
+
 #endif /* __XEN_LU_H__ */
 
 /*
-- 
2.21.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.