[CRIU] [PATCH] Revert "Fix building with 4.18"

Adrian Reber adrian at lisas.de
Tue Sep 11 17:09:55 MSK 2018


From: Adrian Reber <areber at redhat.com>

During the 4.18 development period a header change was introduced which
broke compilation of CRIU. The fix for CRIU was to pull in those headers
to avoid breakage. With the final 4.18 release this has been fixed and
the patch can be reverted. This happens with this commit.

This reverts commit e68c3c8a664b5221d6f20f8226052ff72b7723ec.

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 criu/cr-check.c          |  2 +-
 criu/include/aio.h       | 73 +--------------------------------------
 criu/pie/restorer.c      |  1 +
 test/zdtm/static/aio01.c | 74 ++--------------------------------------
 4 files changed, 5 insertions(+), 145 deletions(-)

diff --git a/criu/cr-check.c b/criu/cr-check.c
index 1c12ec256..3cdc45315 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -22,6 +22,7 @@
 #include <sys/prctl.h>
 #include <sched.h>
 #include <sys/mount.h>
+#include <linux/aio_abi.h>
 
 #include "../soccr/soccr.h"
 
@@ -50,7 +51,6 @@
 #include "net.h"
 #include "restorer.h"
 #include "uffd.h"
-#include "aio.h"
 
 static char *feature_name(int (*func)());
 
diff --git a/criu/include/aio.h b/criu/include/aio.h
index a749c47fa..9a58089b6 100644
--- a/criu/include/aio.h
+++ b/criu/include/aio.h
@@ -1,6 +1,7 @@
 #ifndef __CR_AIO_H__
 #define __CR_AIO_H__
 
+#include <linux/aio_abi.h>
 #include "images/mm.pb-c.h"
 unsigned int aio_estimate_nr_reqs(unsigned int size);
 int dump_aio_ring(MmEntry *mme, struct vma_area *vma);
@@ -11,78 +12,6 @@ unsigned long aio_rings_args_size(struct vm_area_list *);
 struct task_restore_args;
 int prepare_aios(struct pstree_item *t, struct task_restore_args *ta);
 
-/* copied from linux/fs.h */
-typedef int __bitwise __kernel_rwf_t;
-
-/* copied from linux/aio_abi.h */
-#ifndef COMPEL_SYSCALL_TYPES_H__
-/* The ifndef is needed to avoid a clang compiler error */
-typedef __kernel_ulong_t aio_context_t;
-#endif
-
-enum {
-	IOCB_CMD_PREAD = 0,
-	IOCB_CMD_PWRITE = 1,
-	IOCB_CMD_FSYNC = 2,
-	IOCB_CMD_FDSYNC = 3,
-	/* These two are experimental.
-	 * IOCB_CMD_PREADX = 4,
-	 * IOCB_CMD_POLL = 5,
-	 */
-	IOCB_CMD_NOOP = 6,
-	IOCB_CMD_PREADV = 7,
-	IOCB_CMD_PWRITEV = 8,
-};
-/* read() from /dev/aio returns these structures. */
-struct io_event {
-	__u64		data;		/* the data field from the iocb */
-	__u64		obj;		/* what iocb this event came from */
-	__s64		res;		/* result code for this event */
-	__s64		res2;		/* secondary result */
-};
-
-/*
- * we always use a 64bit off_t when communicating
- * with userland.  its up to libraries to do the
- * proper padding and aio_error abstraction
- */
-
-struct iocb {
-	/* these are internal to the kernel/libc. */
-	__u64	aio_data;	/* data to be returned in event's data */
-
-#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
-	__u32	aio_key;	/* the kernel sets aio_key to the req # */
-	__kernel_rwf_t aio_rw_flags;	/* RWF_* flags */
-#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
-	__kernel_rwf_t aio_rw_flags;	/* RWF_* flags */
-	__u32	aio_key;	/* the kernel sets aio_key to the req # */
-#else
-#error edit for your odd byteorder.
-#endif
-
-	/* common fields */
-	__u16	aio_lio_opcode;	/* see IOCB_CMD_ above */
-	__s16	aio_reqprio;
-	__u32	aio_fildes;
-
-	__u64	aio_buf;
-	__u64	aio_nbytes;
-	__s64	aio_offset;
-
-	/* extra parameters */
-	__u64	aio_reserved2;	/* TODO: use this for a (struct sigevent *) */
-
-	/* flags for the "struct iocb" */
-	__u32	aio_flags;
-
-	/*
-	 * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an
-	 * eventfd to signal AIO readiness to
-	 */
-	__u32	aio_resfd;
-}; /* 64 bytes */
-
 struct aio_ring {
 	unsigned        id;     /* kernel internal index number */
 	unsigned        nr;     /* number of io_events */
diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index 1c982d8d6..186cbae40 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -3,6 +3,7 @@
 
 #include <linux/securebits.h>
 #include <linux/capability.h>
+#include <linux/aio_abi.h>
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/file.h>
diff --git a/test/zdtm/static/aio01.c b/test/zdtm/static/aio01.c
index 1aa37eb83..fda7572a1 100644
--- a/test/zdtm/static/aio01.c
+++ b/test/zdtm/static/aio01.c
@@ -1,5 +1,6 @@
-#include <linux/types.h>
+#include <linux/aio_abi.h>
 #include <sys/syscall.h>
+#include <sys/types.h>
 #include <sys/stat.h>
 #include <string.h>
 #include <stdlib.h>
@@ -12,77 +13,6 @@
 const char *test_doc	= "Check head and tail restore correct";
 const char *test_author	= "Kirill Tkhai <ktkhai at virtuozzo.com>";
 
-/* copied from linux/fs.h */
-typedef int __bitwise __kernel_rwf_t;
-
-/* copied from linux/aio_abi.h */
-#ifndef COMPEL_SYSCALL_TYPES_H__
-typedef __kernel_ulong_t aio_context_t;
-#endif
-
-enum {
-	IOCB_CMD_PREAD = 0,
-	IOCB_CMD_PWRITE = 1,
-	IOCB_CMD_FSYNC = 2,
-	IOCB_CMD_FDSYNC = 3,
-	/* These two are experimental.
-	 * IOCB_CMD_PREADX = 4,
-	 * IOCB_CMD_POLL = 5,
-	 */
-	IOCB_CMD_NOOP = 6,
-	IOCB_CMD_PREADV = 7,
-	IOCB_CMD_PWRITEV = 8,
-};
-/* read() from /dev/aio returns these structures. */
-struct io_event {
-	__u64		data;		/* the data field from the iocb */
-	__u64		obj;		/* what iocb this event came from */
-	__s64		res;		/* result code for this event */
-	__s64		res2;		/* secondary result */
-};
-
-/*
- * we always use a 64bit off_t when communicating
- * with userland.  its up to libraries to do the
- * proper padding and aio_error abstraction
- */
-
-struct iocb {
-	/* these are internal to the kernel/libc. */
-	__u64	aio_data;	/* data to be returned in event's data */
-
-#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
-	__u32	aio_key;	/* the kernel sets aio_key to the req # */
-	__kernel_rwf_t aio_rw_flags;	/* RWF_* flags */
-#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
-	__kernel_rwf_t aio_rw_flags;	/* RWF_* flags */
-	__u32	aio_key;	/* the kernel sets aio_key to the req # */
-#else
-#error edit for your odd byteorder.
-#endif
-
-	/* common fields */
-	__u16	aio_lio_opcode;	/* see IOCB_CMD_ above */
-	__s16	aio_reqprio;
-	__u32	aio_fildes;
-
-	__u64	aio_buf;
-	__u64	aio_nbytes;
-	__s64	aio_offset;
-
-	/* extra parameters */
-	__u64	aio_reserved2;	/* TODO: use this for a (struct sigevent *) */
-
-	/* flags for the "struct iocb" */
-	__u32	aio_flags;
-
-	/*
-	 * if the IOCB_FLAG_RESFD flag of "aio_flags" is set, this is an
-	 * eventfd to signal AIO readiness to
-	 */
-	__u32	aio_resfd;
-}; /* 64 bytes */
-
 struct aio_ring {
 	unsigned	id;     /* kernel internal index number */
 	unsigned	nr;     /* number of io_events */
-- 
2.17.1



More information about the CRIU mailing list