[CRIU] [PATCH 05/21] files: Print symbolic meaning of file restoring status

Cyrill Gorcunov gorcunov at openvz.org
Wed Jun 6 18:21:45 EDT 2012


 |	Restoring fd 5 (state -> create)
 |		Create fd for 5
 |			Going to dup 5 into 5
 |	Restoring fd 0 (state -> receive)

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 files.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/files.c b/files.c
index 599281b..dd68edf 100644
--- a/files.c
+++ b/files.c
@@ -630,13 +630,21 @@ static int receive_fd(int pid, struct fdinfo_entry *fe, struct file_desc *d)
 	return 0;
 }
 
+static char *fdinfo_states[FD_STATE_MAX] = {
+	[FD_STATE_PREP]		= "prepare",
+	[FD_STATE_CREATE]	= "create",
+	[FD_STATE_RECV]		= "receive",
+};
+
 static int open_fdinfo(int pid, struct fdinfo_entry *fe, int state)
 {
 	int ret = 0;
 	struct file_desc *fdesc;
 
+	BUG_ON(state >= FD_STATE_MAX);
+
 	fdesc = find_file_desc(fe);
-	pr_info("\tRestoring fd %d (state -> %d)\n", fe->fd, state);
+	pr_info("\tRestoring fd %d (state -> %s)\n", fe->fd, fdinfo_states[state]);
 
 	switch (state) {
 	case FD_STATE_PREP:
-- 
1.7.7.6



More information about the CRIU mailing list