[CRIU] [PATCH 3/5] crtools: move cr_options in a separate header
Andrey Vagin
avagin at openvz.org
Wed Nov 6 05:21:11 PST 2013
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
cr-dump.c | 1 +
cr-restore.c | 1 +
cr-service.c | 1 +
cr-show.c | 2 +-
crtools.c | 1 +
file-lock.c | 2 +-
files-reg.c | 2 +-
image.c | 2 +-
include/cr_options.h | 43 +++++++++++++++++++++++++++++++++++++++++++
include/crtools.h | 35 -----------------------------------
include/parasite-syscall.h | 1 +
include/util-pie.h | 2 ++
ipc_ns.c | 2 +-
log.c | 2 +-
mem.c | 2 +-
mount.c | 2 +-
net.c | 2 +-
page-xfer.c | 3 ++-
pstree.c | 1 +
sk-inet.c | 2 +-
sk-queue.c | 2 ++
sk-tcp.c | 2 +-
sk-unix.c | 2 +-
tty.c | 2 +-
tun.c | 2 +-
util.c | 2 +-
26 files changed, 70 insertions(+), 51 deletions(-)
create mode 100644 include/cr_options.h
diff --git a/cr-dump.c b/cr-dump.c
index 5ced199..ffae7ff 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -37,6 +37,7 @@
#include "kcmp-ids.h"
#include "compiler.h"
#include "crtools.h"
+#include "cr_options.h"
#include "servicefd.h"
#include "syscall.h"
#include "ptrace.h"
diff --git a/cr-restore.c b/cr-restore.c
index ace2b38..aaf65e1 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -29,6 +29,7 @@
#include "asm/types.h"
#include "asm/restorer.h"
+#include "cr_options.h"
#include "servicefd.h"
#include "image.h"
#include "util.h"
diff --git a/cr-service.c b/cr-service.c
index b5ce8cc..9b2c3f1 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -14,6 +14,7 @@
#include <sys/stat.h>
#include "crtools.h"
+#include "cr_options.h"
#include "util-pie.h"
#include "util.h"
#include "log.h"
diff --git a/cr-show.c b/cr-show.c
index edbd67b..9a1982b 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -17,7 +17,7 @@
#include "fdset.h"
#include "namespaces.h"
#include "compiler.h"
-#include "crtools.h"
+#include "cr_options.h"
#include "util.h"
#include "sockets.h"
#include "image.h"
diff --git a/crtools.c b/crtools.c
index 3b2919b..60fd2e8 100644
--- a/crtools.c
+++ b/crtools.c
@@ -20,6 +20,7 @@
#include "compiler.h"
#include "crtools.h"
+#include "cr_options.h"
#include "sockets.h"
#include "syscall.h"
#include "files.h"
diff --git a/file-lock.c b/file-lock.c
index 5ea11cc..de9dc22 100644
--- a/file-lock.c
+++ b/file-lock.c
@@ -6,7 +6,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include "crtools.h"
+#include "cr_options.h"
#include "fdset.h"
#include "image.h"
#include "servicefd.h"
diff --git a/files-reg.c b/files-reg.c
index f14c1f9..f19652b 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -5,7 +5,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include "crtools.h"
+#include "cr_options.h"
#include "fdset.h"
#include "file-ids.h"
#include "mount.h"
diff --git a/image.c b/image.c
index 3a26600..b244cf3 100644
--- a/image.c
+++ b/image.c
@@ -1,6 +1,6 @@
#include <unistd.h>
#include <stdarg.h>
-#include "crtools.h"
+#include "cr_options.h"
#include "fdset.h"
#include "image.h"
#include "eventpoll.h"
diff --git a/include/cr_options.h b/include/cr_options.h
new file mode 100644
index 0000000..9186fe7
--- /dev/null
+++ b/include/cr_options.h
@@ -0,0 +1,43 @@
+#ifndef __CR_OPTIONS_H__
+#define __CR_OPTIONS_H__
+
+#include <stdbool.h>
+
+#include "list.h"
+
+struct script {
+ struct list_head node;
+ char *path;
+};
+
+struct cr_options {
+ int final_state;
+ char *show_dump_file;
+ bool check_ms_kernel;
+ bool show_pages_content;
+ bool restore_detach;
+ bool ext_unix_sk;
+ bool shell_job;
+ bool handle_file_locks;
+ bool tcp_established_ok;
+ bool evasive_devices;
+ bool link_remap_ok;
+ unsigned int rst_namespaces_flags;
+ bool log_file_per_pid;
+ char *output;
+ char *root;
+ char *pidfile;
+ struct list_head veth_pairs;
+ struct list_head scripts;
+ bool use_page_server;
+ unsigned short ps_port;
+ char *addr;
+ bool track_mem;
+ char *img_parent;
+};
+
+extern struct cr_options opts;
+
+extern void init_opts(void);
+
+#endif
diff --git a/include/crtools.h b/include/crtools.h
index 9b5e909..b7f0336 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -9,41 +9,6 @@
#define CR_FD_PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH)
-struct script {
- struct list_head node;
- char *path;
-};
-
-struct cr_options {
- int final_state;
- char *show_dump_file;
- bool check_ms_kernel;
- bool show_pages_content;
- bool restore_detach;
- bool ext_unix_sk;
- bool shell_job;
- bool handle_file_locks;
- bool tcp_established_ok;
- bool evasive_devices;
- bool link_remap_ok;
- unsigned int rst_namespaces_flags;
- bool log_file_per_pid;
- char *output;
- char *root;
- char *pidfile;
- struct list_head veth_pairs;
- struct list_head scripts;
- bool use_page_server;
- unsigned short ps_port;
- char *addr;
- bool track_mem;
- char *img_parent;
-};
-
-extern struct cr_options opts;
-
-extern void init_opts(void);
-
int check_img_inventory(void);
int write_img_inventory(void);
void kill_inventory(void);
diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h
index 562935c..8d9b6a5 100644
--- a/include/parasite-syscall.h
+++ b/include/parasite-syscall.h
@@ -1,6 +1,7 @@
#ifndef __CR_PARASITE_SYSCALL_H__
#define __CR_PARASITE_SYSCALL_H__
+#include "asm/types.h"
#include "pid.h"
#include "list.h"
diff --git a/include/util-pie.h b/include/util-pie.h
index bdba8ee..e8ede9b 100644
--- a/include/util-pie.h
+++ b/include/util-pie.h
@@ -4,6 +4,8 @@
#include <sys/socket.h>
#include <sys/un.h>
+#include "asm/types.h"
+
#define UNIX_PATH_MAX (sizeof(struct sockaddr_un) - \
(size_t)((struct sockaddr_un *) 0)->sun_path)
diff --git a/ipc_ns.c b/ipc_ns.c
index 318e98b..a997fb4 100644
--- a/ipc_ns.c
+++ b/ipc_ns.c
@@ -8,7 +8,7 @@
#include <sys/shm.h>
#include "util.h"
-#include "crtools.h"
+#include "cr_options.h"
#include "fdset.h"
#include "syscall.h"
#include "namespaces.h"
diff --git a/log.c b/log.c
index a1bd9f7..a3b1472 100644
--- a/log.c
+++ b/log.c
@@ -15,7 +15,7 @@
#include "compiler.h"
#include "asm/types.h"
#include "util.h"
-#include "crtools.h"
+#include "cr_options.h"
#include "servicefd.h"
#define DEFAULT_LOGFD STDERR_FILENO
diff --git a/mem.c b/mem.c
index bebd938..0456c48 100644
--- a/mem.c
+++ b/mem.c
@@ -3,7 +3,7 @@
#include <sys/mman.h>
#include <errno.h>
-#include "crtools.h"
+#include "cr_options.h"
#include "servicefd.h"
#include "mem.h"
#include "parasite-syscall.h"
diff --git a/mount.c b/mount.c
index 1f92653..d244cd1 100644
--- a/mount.c
+++ b/mount.c
@@ -12,7 +12,7 @@
#include <sys/types.h>
#include <sys/wait.h>
-#include "crtools.h"
+#include "cr_options.h"
#include "asm/types.h"
#include "util.h"
#include "util-pie.h"
diff --git a/net.c b/net.c
index 57a755e..60e105b 100644
--- a/net.c
+++ b/net.c
@@ -13,7 +13,7 @@
#include "namespaces.h"
#include "net.h"
#include "libnetlink.h"
-#include "crtools.h"
+#include "cr_options.h"
#include "sk-inet.h"
#include "tun.h"
#include "util-pie.h"
diff --git a/page-xfer.c b/page-xfer.c
index 643285d..28a2c73 100644
--- a/page-xfer.c
+++ b/page-xfer.c
@@ -3,7 +3,8 @@
#include <arpa/inet.h>
#include <unistd.h>
-#include "crtools.h"
+#include "cr_options.h"
+#include "servicefd.h"
#include "image.h"
#include "page-xfer.h"
#include "page-pipe.h"
diff --git a/pstree.c b/pstree.c
index fbd69ff..36ae0d1 100644
--- a/pstree.c
+++ b/pstree.c
@@ -2,6 +2,7 @@
#include <unistd.h>
#include <stdlib.h>
+#include "cr_options.h"
#include "pstree.h"
#include "restorer.h"
#include "util.h"
diff --git a/sk-inet.c b/sk-inet.c
index 69e7548..bd431b8 100644
--- a/sk-inet.c
+++ b/sk-inet.c
@@ -11,7 +11,7 @@
#include "asm/types.h"
#include "libnetlink.h"
-#include "crtools.h"
+#include "cr_options.h"
#include "fdset.h"
#include "inet_diag.h"
#include "files.h"
diff --git a/sk-queue.c b/sk-queue.c
index b2eb08f..d1e8656 100644
--- a/sk-queue.c
+++ b/sk-queue.c
@@ -14,7 +14,9 @@
#include "list.h"
#include "fdset.h"
#include "image.h"
+#include "servicefd.h"
#include "crtools.h"
+#include "cr_options.h"
#include "util.h"
#include "util-pie.h"
#include "sockets.h"
diff --git a/sk-tcp.c b/sk-tcp.c
index 8136aec..a94fb9a 100644
--- a/sk-tcp.c
+++ b/sk-tcp.c
@@ -6,7 +6,7 @@
#include <sys/mman.h>
#include <string.h>
-#include "crtools.h"
+#include "cr_options.h"
#include "util.h"
#include "list.h"
#include "log.h"
diff --git a/sk-unix.c b/sk-unix.c
index 3045489..b6255ba 100644
--- a/sk-unix.c
+++ b/sk-unix.c
@@ -10,7 +10,7 @@
#include "asm/types.h"
#include "libnetlink.h"
-#include "crtools.h"
+#include "cr_options.h"
#include "fdset.h"
#include "unix_diag.h"
#include "files.h"
diff --git a/tty.c b/tty.c
index d1ac692..cdfcbd5 100644
--- a/tty.c
+++ b/tty.c
@@ -17,7 +17,7 @@
#include "syscall.h"
#include "files.h"
-#include "crtools.h"
+#include "cr_options.h"
#include "fdset.h"
#include "servicefd.h"
#include "image.h"
diff --git a/tun.c b/tun.c
index d484e31..d453015 100644
--- a/tun.c
+++ b/tun.c
@@ -4,7 +4,7 @@
#include <linux/if_tun.h>
#include <sys/ioctl.h>
-#include "crtools.h"
+#include "cr_options.h"
#include "fdset.h"
#include "protobuf.h"
#include "cr-show.h"
diff --git a/util.c b/util.c
index 1d0e18a..0b10f0d 100644
--- a/util.c
+++ b/util.c
@@ -39,7 +39,7 @@
#include "image.h"
#include "vma.h"
-#include "crtools.h"
+#include "cr_options.h"
#include "servicefd.h"
#define VMA_OPT_LEN 128
--
1.8.3.1
More information about the CRIU
mailing list