[CRIU] [PATCH v5 14/19] epoll: Save fields of target files in eventpoll_tfd_entry
Cyrill Gorcunov
gorcunov at gmail.com
Wed Jul 4 18:51:42 MSK 2018
We will use them to fast lookup of targets files.
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
criu/proc_parse.c | 20 +++++++++++++++++---
images/eventpoll.proto | 5 +++++
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/criu/proc_parse.c b/criu/proc_parse.c
index b431168ff2fa..8c52e5044733 100644
--- a/criu/proc_parse.c
+++ b/criu/proc_parse.c
@@ -1835,9 +1835,23 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type, void *arg)
eventpoll_tfd_entry__init(e);
- ret = sscanf(str, "tfd: %d events: %x data: %"PRIx64,
- &e->tfd, &e->events, &e->data);
- if (ret != 3) {
+ ret = sscanf(str, "tfd: %d events: %x data: %llx"
+ " pos:%lli ino:%lx sdev:%x",
+ &e->tfd, &e->events, (long long *)&e->data,
+ (long long *)&e->pos, (long *)&e->inode,
+ &e->dev);
+ if (ret < 3 || ret > 6) {
+ eventpoll_tfd_entry__free_unpacked(e, NULL);
+ goto parse_err;
+ } else if (ret == 3) {
+ e->has_dev = false;
+ e->has_inode = false;
+ e->has_pos = false;
+ } else if (ret == 6) {
+ e->has_dev = true;
+ e->has_inode = true;
+ e->has_pos = true;
+ } else if (ret < 6) {
eventpoll_tfd_entry__free_unpacked(e, NULL);
goto parse_err;
}
diff --git a/images/eventpoll.proto b/images/eventpoll.proto
index 8901d807a577..4a8d1b834ef8 100644
--- a/images/eventpoll.proto
+++ b/images/eventpoll.proto
@@ -7,6 +7,11 @@ message eventpoll_tfd_entry {
required uint32 tfd = 2;
required uint32 events = 3;
required uint64 data = 4;
+
+ /* to find dup'ed target files */
+ optional uint32 dev = 5;
+ optional uint64 inode = 6;
+ optional uint64 pos = 7;
}
message eventpoll_file_entry {
--
2.14.4
More information about the CRIU
mailing list