[CRIU] [PATCH 09/15] crtools: create new header for servicefd stuff
Andrey Vagin
avagin at openvz.org
Mon Nov 4 22:00:31 PST 2013
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
cr-dump.c | 1 +
cr-restore.c | 1 +
include/crtools.h | 31 ++-----------------------------
include/servicefd.h | 32 ++++++++++++++++++++++++++++++++
log.c | 1 +
mem.c | 1 +
page-read.c | 1 +
tty.c | 1 +
util.c | 1 +
9 files changed, 41 insertions(+), 29 deletions(-)
create mode 100644 include/servicefd.h
diff --git a/cr-dump.c b/cr-dump.c
index 7c08fa5..8666f7e 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -36,6 +36,7 @@
#include "kcmp-ids.h"
#include "compiler.h"
#include "crtools.h"
+#include "servicefd.h"
#include "syscall.h"
#include "ptrace.h"
#include "util.h"
diff --git a/cr-restore.c b/cr-restore.c
index 4ab733c..fab01d5 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -29,6 +29,7 @@
#include "asm/types.h"
#include "asm/restorer.h"
+#include "servicefd.h"
#include "image.h"
#include "util.h"
#include "util-pie.h"
diff --git a/include/crtools.h b/include/crtools.h
index a968a4e..a48e785 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -10,6 +10,7 @@
#include "image.h"
#include "lock.h"
#include "cr-show.h"
+#include "servicefd.h"
#include "protobuf/vma.pb-c.h"
@@ -50,35 +51,7 @@ extern struct cr_options opts;
extern void init_opts(void);
-enum sfd_type {
- SERVICE_FD_MIN,
-
- LOG_FD_OFF,
- LOG_DIR_FD_OFF,
- IMG_FD_OFF,
- PROC_FD_OFF, /* fd with /proc for all proc_ calls */
- CTL_TTY_OFF,
- SELF_STDIN_OFF,
- PARENT_FD_OFF,
- CR_PROC_FD_OFF, /* some other's proc fd.
- * For dump -- target ns' proc
- * For restore -- CRIU ns' proc
- */
-
- SERVICE_FD_MAX
-};
-
-#define CR_PARENT_LINK "parent"
-
-extern int clone_service_fd(int id);
-void close_old_servie_fd(int nr);
-extern int init_service_fd(void);
-extern int get_service_fd(enum sfd_type type);
-extern int reserve_service_fd(enum sfd_type type);
-extern int install_service_fd(enum sfd_type type, int fd);
-extern int close_service_fd(enum sfd_type type);
-extern bool is_service_fd(int fd, enum sfd_type type);
-extern bool is_any_service_fd(int fd);
+#define CR_PARENT_LINK "parent"
int check_img_inventory(void);
int write_img_inventory(void);
diff --git a/include/servicefd.h b/include/servicefd.h
new file mode 100644
index 0000000..3c7d07c
--- /dev/null
+++ b/include/servicefd.h
@@ -0,0 +1,32 @@
+#ifndef __CR_SERVICE_FD_H__
+#define __CR_SERVICE_FD_H__
+
+enum sfd_type {
+ SERVICE_FD_MIN,
+
+ LOG_FD_OFF,
+ LOG_DIR_FD_OFF,
+ IMG_FD_OFF,
+ PROC_FD_OFF, /* fd with /proc for all proc_ calls */
+ CTL_TTY_OFF,
+ SELF_STDIN_OFF,
+ PARENT_FD_OFF,
+ CR_PROC_FD_OFF, /* some other's proc fd.
+ * For dump -- target ns' proc
+ * For restore -- CRIU ns' proc
+ */
+
+ SERVICE_FD_MAX
+};
+
+extern int clone_service_fd(int id);
+void close_old_servie_fd(int nr);
+extern int init_service_fd(void);
+extern int get_service_fd(enum sfd_type type);
+extern int reserve_service_fd(enum sfd_type type);
+extern int install_service_fd(enum sfd_type type, int fd);
+extern int close_service_fd(enum sfd_type type);
+extern bool is_service_fd(int fd, enum sfd_type type);
+extern bool is_any_service_fd(int fd);
+
+#endif
diff --git a/log.c b/log.c
index 1e5fcad..34f69e7 100644
--- a/log.c
+++ b/log.c
@@ -16,6 +16,7 @@
#include "asm/types.h"
#include "util.h"
#include "crtools.h"
+#include "servicefd.h"
#define DEFAULT_LOGFD STDERR_FILENO
diff --git a/mem.c b/mem.c
index ee23de0..5d53ed1 100644
--- a/mem.c
+++ b/mem.c
@@ -4,6 +4,7 @@
#include <errno.h>
#include "crtools.h"
+#include "servicefd.h"
#include "mem.h"
#include "parasite-syscall.h"
#include "parasite.h"
diff --git a/page-read.c b/page-read.c
index 78b1303..dff6b62 100644
--- a/page-read.c
+++ b/page-read.c
@@ -3,6 +3,7 @@
#include <unistd.h>
#include "crtools.h"
+#include "servicefd.h"
#include "page-read.h"
#include "protobuf.h"
diff --git a/tty.c b/tty.c
index a1eb73e..98c6698 100644
--- a/tty.c
+++ b/tty.c
@@ -18,6 +18,7 @@
#include "syscall.h"
#include "files.h"
#include "crtools.h"
+#include "servicefd.h"
#include "image.h"
#include "util.h"
#include "log.h"
diff --git a/util.c b/util.c
index 39594eb..26798cc 100644
--- a/util.c
+++ b/util.c
@@ -37,6 +37,7 @@
#include "util.h"
#include "crtools.h"
+#include "servicefd.h"
#define VMA_OPT_LEN 128
--
1.8.3.1
More information about the CRIU
mailing list