[CRIU] [PATCH RFC 08/30] files: Add fle_init() for initialization new fdinfo_list_entry
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Nov 1 07:31:37 PDT 2016
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/autofs.c | 3 +--
criu/files.c | 3 +--
criu/include/files.h | 6 ++++++
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/criu/autofs.c b/criu/autofs.c
index 345a703..1ee79f0 100644
--- a/criu/autofs.c
+++ b/criu/autofs.c
@@ -877,8 +877,7 @@ static int autofs_create_fle(struct pstree_item *task, FdinfoEntry *fe,
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 63c9624..a7c5bbe 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -695,8 +695,7 @@ static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
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 9388a8a..26d971e 100644
--- a/criu/include/files.h
+++ b/criu/include/files.h
@@ -74,6 +74,12 @@ struct fdinfo_list_entry {
FdinfoEntry *fe;
};
+static inline void fle_init(struct fdinfo_list_entry *fle, int pid, FdinfoEntry *fe)
+{
+ 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