[CRIU] [PATCH v4 05/33] files: Add fle_init() for initialization new fdinfo_list_entry
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Dec 13 07:04:52 PST 2016
No functional changes
v3: Also do real_pid futex initialization
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/autofs.c | 4 +---
criu/files.c | 4 +---
criu/include/files.h | 7 +++++++
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/criu/autofs.c b/criu/autofs.c
index 151980d..d9f518f 100644
--- a/criu/autofs.c
+++ b/criu/autofs.c
@@ -873,9 +873,7 @@ static int autofs_create_fle(struct pstree_item *task, FdinfoEntry *fe,
return -1;
le = (void *)ALIGN((long)le, sizeof(int));
- futex_init(&le->real_pid);
- le->pid = task->pid.virt;
- le->fe = fe;
+ fle_init(le, task->pid.virt, fe);
collect_gen_fd(le, rst_info);
diff --git a/criu/files.c b/criu/files.c
index ec32f30..8cdeaef 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -694,9 +694,7 @@ static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
if (!new_le)
return -1;
- futex_init(&new_le->real_pid);
- new_le->pid = pid;
- new_le->fe = e;
+ fle_init(new_le, pid, e);
fdesc = find_file_desc(e);
if (fdesc == NULL) {
diff --git a/criu/include/files.h b/criu/include/files.h
index d2882d4..1275a2b 100644
--- a/criu/include/files.h
+++ b/criu/include/files.h
@@ -74,6 +74,13 @@ struct fdinfo_list_entry {
FdinfoEntry *fe;
};
+static inline void fle_init(struct fdinfo_list_entry *fle, int pid, FdinfoEntry *fe)
+{
+ futex_init(&fle->real_pid);
+ fle->pid = pid;
+ fle->fe = fe;
+}
+
/* reports whether fd_a takes prio over fd_b */
static inline int fdinfo_rst_prio(struct fdinfo_list_entry *fd_a, struct fdinfo_list_entry *fd_b)
{
More information about the CRIU
mailing list