[05/10] proc-parse: epoll -- Add primary hash generation

Submitted by Cyrill Gorcunov on Feb. 28, 2017, 3:05 p.m.

Details

Message ID 1488294349-2742-6-git-send-email-gorcunov@openvz.org
State New
Series "epoll: Start using new kcmp operation to find targets"
Headers show

Commit Message

Cyrill Gorcunov Feb. 28, 2017, 3:05 p.m.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 criu/include/fdinfo.h |  2 ++
 criu/proc_parse.c     | 23 ++++++++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/include/fdinfo.h b/criu/include/fdinfo.h
index a36e9138beb9..be516efce5d6 100644
--- a/criu/include/fdinfo.h
+++ b/criu/include/fdinfo.h
@@ -28,6 +28,8 @@  struct fanotify_mark_entry {
 struct eventpoll_tfd_entry {
 	EventpollTfdEntry e;
 	struct list_head node;
+	unsigned int gen_id;
+	int use_kcmp;
 };
 
 union fdinfo_entries {
diff --git a/criu/proc_parse.c b/criu/proc_parse.c
index 5e9780a41ed5..a96123679aa2 100644
--- a/criu/proc_parse.c
+++ b/criu/proc_parse.c
@@ -39,6 +39,7 @@ 
 #include "cgroup-props.h"
 #include "timerfd.h"
 #include "path.h"
+#include "file-ids.h"
 
 #include "protobuf.h"
 #include "images/fdinfo.pb-c.h"
@@ -1734,6 +1735,8 @@  static int parse_fdinfo_pid_s(int pid, int fd, int type,
 		}
 		if (fdinfo_field(str, "tfd")) {
 			union fdinfo_entries *e;
+			unsigned long pos, ino;
+			unsigned int sdev;
 
 			if (type != FD_TYPES__EVENTPOLL)
 				goto parse_err;
@@ -1744,11 +1747,21 @@  static int parse_fdinfo_pid_s(int pid, int fd, int type,
 
 			eventpoll_tfd_entry__init(&e->epl.e);
 
-			ret = sscanf(str, "tfd: %d events: %x data: %"PRIx64,
-					&e->epl.e.tfd, &e->epl.e.events, &e->epl.e.data);
-			if (ret != 3) {
-				free_event_poll_entry(e);
-				goto parse_err;
+			ret = sscanf(str, "tfd: %d events: %x data: %"PRIx64
+				     " pos:%lx ino:%lx sdev:%x",
+				     &e->epl.e.tfd, &e->epl.e.events, &e->epl.e.data,
+				     &pos, &ino, &sdev);
+			if (ret != 6) {
+				if (ret != 3) {
+					free_event_poll_entry(e);
+					goto parse_err;
+				} else {
+					e->epl.gen_id = 0;
+					e->epl.use_kcmp = 0;
+				}
+			} else {
+				e->epl.gen_id = kcmp_fd_make_gen_id(sdev, ino, pos);
+				e->epl.use_kcmp = 1;
 			}
 			ret = cb(e, arg);
 			if (ret)