[CRIU] [PATCH RFC v2 13/14] files: Kill want_post_open_stage()
Kirill Tkhai
ktkhai at virtuozzo.com
Fri Oct 28 14:07:52 PDT 2016
Since we are going to get rid of stage at all, kill this function
and call file_desc_ops::post_open unconditionally.
This will be used in next patches.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/files.c | 31 +++----------------------------
1 file changed, 3 insertions(+), 28 deletions(-)
diff --git a/criu/files.c b/criu/files.c
index c39238c..7be9f3e 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -859,16 +859,6 @@ int set_fd_flags(int fd, int flags)
struct fd_open_state {
char *name;
int (*cb)(int, struct fdinfo_list_entry *);
-
- /*
- * Two last stages -- receive fds and post-open them -- are
- * not required always. E.g. if no fd sharing takes place
- * or task doens't have any files that need to be post-opened.
- *
- * Thus, in order not to scan through fdinfo-s lists in vain
- * and speed things up a little bit, we may want to skeep these.
- */
- bool required;
};
static int open_fd(int pid, struct fdinfo_list_entry *fle);
@@ -876,13 +866,11 @@ static int receive_fd(int pid, struct fdinfo_list_entry *fle);
static int post_open_fd(int pid, struct fdinfo_list_entry *fle);
static struct fd_open_state states[] = {
- { "create", open_fd, true,},
- { "receive", receive_fd, true,},
- { "post_create", post_open_fd, false,},
+ { "create", open_fd, },
+ { "receive", receive_fd, },
+ { "post_create", post_open_fd, },
};
-#define want_post_open_stage() do { states[2].required = true; } while (0)
-
static void transport_name_gen(struct sockaddr_un *addr, int *len, int pid)
{
addr->sun_family = AF_UNIX;
@@ -1029,9 +1017,6 @@ static int open_fd(int pid, struct fdinfo_list_entry *fle)
struct file_desc *d = fle->desc;
int new_fd;
- if (d->ops->post_open)
- want_post_open_stage();
-
if (fle != file_master(d))
return 0;
@@ -1171,11 +1156,6 @@ int prepare_fds(struct pstree_item *me)
return -1;
for (state = 0; state < ARRAY_SIZE(states); state++) {
- if (!states[state].required) {
- pr_debug("Skipping %s fd stage\n", states[state].name);
- continue;
- }
-
ret = open_fdinfos(me->pid.virt, &rsti(me)->fds, state);
if (ret)
break;
@@ -1202,11 +1182,6 @@ int prepare_fds(struct pstree_item *me)
goto out_w;
for (state = 0; state < ARRAY_SIZE(states); state++) {
- if (!states[state].required) {
- pr_debug("Skipping %s fd stage\n", states[state].name);
- continue;
- }
-
/*
* Opening current TTYs require session to be already set up,
* thus slave peers already handled now it's time for cttys,
More information about the CRIU
mailing list