[CRIU] [PATCH v6 1/5] aio: Make struct aio_ring visible for everybody

Kirill Tkhai ktkhai at virtuozzo.com
Wed Mar 23 08:00:15 PDT 2016


Move the declaration from .c to header file.
Also rename parasite_check_aios() since we
have one more function with the same name.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/aio.c          |    2 +-
 criu/cr-dump.c      |    2 +-
 criu/include/aio.h  |   19 ++++++++++++++++++-
 criu/pie/parasite.c |   17 +----------------
 4 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/criu/aio.c b/criu/aio.c
index 4c1f19b..5ccf51a 100644
--- a/criu/aio.c
+++ b/criu/aio.c
@@ -70,7 +70,7 @@ unsigned long aio_rings_args_size(struct vm_area_list *vmas)
 		vmas->nr_aios * sizeof(struct parasite_aio);
 }
 
-int parasite_check_aios(struct parasite_ctl *ctl, struct vm_area_list *vmas)
+int parasite_collect_aios(struct parasite_ctl *ctl, struct vm_area_list *vmas)
 {
 	struct vma_area *vma;
 	struct parasite_check_aios_args *aa;
diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 75592ca..6d3ccd1 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1263,7 +1263,7 @@ static int dump_one_task(struct pstree_item *item)
 		goto err_cure_imgset;
 	}
 
-	ret = parasite_check_aios(parasite_ctl, &vmas); /* FIXME -- merge with above */
+	ret = parasite_collect_aios(parasite_ctl, &vmas); /* FIXME -- merge with above */
 	if (ret) {
 		pr_err("Failed to check aio rings (pid: %d)\n", pid);
 		goto err_cure_imgset;
diff --git a/criu/include/aio.h b/criu/include/aio.h
index af6d687..1e08775 100644
--- a/criu/include/aio.h
+++ b/criu/include/aio.h
@@ -1,12 +1,29 @@
 #ifndef __CR_AIO_H__
 #define __CR_AIO_H__
+
+#include <linux/aio_abi.h>
 #include "images/mm.pb-c.h"
 int dump_aio_ring(MmEntry *mme, struct vma_area *vma);
 void free_aios(MmEntry *mme);
 struct parasite_ctl;
-int parasite_check_aios(struct parasite_ctl *, struct vm_area_list *);
+int parasite_collect_aios(struct parasite_ctl *, struct vm_area_list *);
 unsigned long aio_rings_args_size(struct vm_area_list *);
 
+struct aio_ring {
+	unsigned        id;     /* kernel internal index number */
+	unsigned        nr;     /* number of io_events */
+	unsigned        head;   /* Written to by userland or under ring_lock
+				 * mutex by aio_read_events_ring(). */
+	unsigned        tail;
+
+	unsigned        magic;
+	unsigned        compat_features;
+	unsigned        incompat_features;
+	unsigned        header_length;  /* size of aio_ring */
+
+	struct io_event         io_events[0];
+};
+
 struct rst_aio_ring {
 	unsigned long addr;
 	unsigned long len;
diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c
index d47f825..1df3e71 100644
--- a/criu/pie/parasite.c
+++ b/criu/pie/parasite.c
@@ -16,6 +16,7 @@
 #include "parasite-vdso.h"
 #include "log.h"
 #include "tty.h"
+#include "aio.h"
 
 #include <string.h>
 
@@ -384,22 +385,6 @@ static inline int tty_ioctl(int fd, int cmd, int *arg)
 #define AIO_RING_COMPAT_FEATURES	1
 #define AIO_RING_INCOMPAT_FEATURES	0
 
-struct aio_ring {
-	unsigned        id;     /* kernel internal index number */
-	unsigned        nr;     /* number of io_events */
-	unsigned        head;   /* Written to by userland or under ring_lock
-				 * mutex by aio_read_events_ring(). */
-	unsigned        tail;
-
-	unsigned        magic;
-	unsigned        compat_features;
-	unsigned        incompat_features;
-	unsigned        header_length;  /* size of aio_ring */
-
-
-	/* struct io_event         io_events[0]; */
-};
-
 static int sane_ring(struct aio_ring *ring)
 {
 	return ring->magic == AIO_RING_MAGIC &&



More information about the CRIU mailing list