[CRIU] [PATCH 1/4] files: Pass stat information into fd_id_generate_special
Pavel Emelyanov
xemul at parallels.com
Tue Feb 4 08:02:53 PST 2014
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
cr-dump.c | 8 ++++----
file-ids.c | 3 ++-
files-reg.c | 2 +-
include/file-ids.h | 4 +++-
sk-unix.c | 2 +-
5 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/cr-dump.c b/cr-dump.c
index 3cd4684..5f0b617 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -255,7 +255,7 @@ static int dump_task_exe_link(pid_t pid, MmEntry *mm)
return -1;
}
- mm->exe_file_id = fd_id_generate_special();
+ mm->exe_file_id = fd_id_generate_special(¶ms.stat);
ret = dump_one_reg_file(fd, mm->exe_file_id, ¶ms);
close(fd);
@@ -281,7 +281,7 @@ static int dump_task_fs(pid_t pid, struct parasite_dump_misc *misc, struct cr_fd
return -1;
}
- fe.cwd_id = fd_id_generate_special();
+ fe.cwd_id = fd_id_generate_special(&p.stat);
ret = dump_one_reg_file(fd, fe.cwd_id, &p);
if (ret < 0)
@@ -299,7 +299,7 @@ static int dump_task_fs(pid_t pid, struct parasite_dump_misc *misc, struct cr_fd
return -1;
}
- fe.root_id = fd_id_generate_special();
+ fe.root_id = fd_id_generate_special(&p.stat);
ret = dump_one_reg_file(fd, fe.root_id, &p);
if (ret < 0)
@@ -356,7 +356,7 @@ static int dump_filemap(pid_t pid, struct vma_area *vma_area,
p.flags = O_RDWR;
else
p.flags = O_RDONLY;
- vma->shmid = fd_id_generate_special();
+ vma->shmid = fd_id_generate_special(&p.stat);
return dump_one_reg_file(vma_area->vm_file_fd, vma->shmid, &p);
}
diff --git a/file-ids.c b/file-ids.c
index 22b3ac5..d98e5f2 100644
--- a/file-ids.c
+++ b/file-ids.c
@@ -17,6 +17,7 @@
#include "syscall.h"
#include "image.h"
#include "util.h"
+#include "irmap.h"
static DECLARE_KCMP_TREE(fd_tree, KCMP_FILE);
@@ -25,7 +26,7 @@ void fd_id_show_tree(void)
kid_show_tree(&fd_tree);
}
-u32 fd_id_generate_special(void)
+u32 fd_id_generate_special(struct stat *st)
{
return fd_tree.subid++;
}
diff --git a/files-reg.c b/files-reg.c
index f98c792..424c300 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -382,7 +382,7 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp)
tmp--;
}
- rfe.id = *idp = fd_id_generate_special();
+ rfe.id = *idp = fd_id_generate_special(NULL);
rfe.flags = 0;
rfe.pos = 0;
rfe.fown = &fwn;
diff --git a/include/file-ids.h b/include/file-ids.h
index ce9029d..317617d 100644
--- a/include/file-ids.h
+++ b/include/file-ids.h
@@ -11,8 +11,10 @@
#define FD_DESC_INVALID (-3U)
struct fdinfo_entry;
+struct stat;
+
extern int fd_id_generate(pid_t pid, FdinfoEntry *fe);
-extern u32 fd_id_generate_special(void);
+extern u32 fd_id_generate_special(struct stat *);
extern void fd_id_show_tree(void);
#endif /* __CR_FILE_IDS_H__ */
diff --git a/sk-unix.c b/sk-unix.c
index aa6d22f..f82fd67 100644
--- a/sk-unix.c
+++ b/sk-unix.c
@@ -581,7 +581,7 @@ int fix_external_unix_sockets(void)
BUG_ON(sk->sd.already_dumped);
- e.id = fd_id_generate_special();
+ e.id = fd_id_generate_special(NULL);
e.ino = sk->sd.ino;
e.type = SOCK_DGRAM;
e.state = TCP_LISTEN;
--
1.8.4.2
More information about the CRIU
mailing list