[CRIU] [PATCH v2 06/28] files: Add fle_init() for initialization new fdinfo_list_entry

Pavel Emelyanov xemul at virtuozzo.com
Mon Dec 5 01:52:02 PST 2016


On 11/30/2016 07:29 PM, Kirill Tkhai wrote:
> No functional changes
> 
> 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 151980d..df76e0d 100644
> --- a/criu/autofs.c
> +++ b/criu/autofs.c
> @@ -874,8 +874,7 @@ static int autofs_create_fle(struct pstree_item *task, FdinfoEntry *fe,
>  	le = (void *)ALIGN((long)le, sizeof(int));
>  
>  	futex_init(&le->real_pid);

Why is this guy left overboard?

> -	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..de4ef17 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 d2882d4..c9b59c3 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