[CRIU] [PATCH 2/7] files: Add fill_fdlink helper

Cyrill Gorcunov gorcunov at openvz.org
Thu May 9 14:49:29 EDT 2013


On Thu, May 09, 2013 at 09:51:51PM +0400, Pavel Emelyanov wrote:
> >  
> > -	if (S_ISREG(p.stat.st_mode) || S_ISDIR(p.stat.st_mode))
> > +	if (S_ISREG(p.stat.st_mode) || S_ISDIR(p.stat.st_mode)) {
> > +		char path[PATH_MAX + 1];
> > +
> > +		p.nmlink = path;
> > +		p.nmsize = sizeof(path);
> > +
> > +		if (fill_fdlink(lfd, &p)) {
> > +			pr_err("Can't fill fdlink params\n");
> > +			return -1;
> > +		}
> > +
> >  		return dump_reg_file(&p, lfd, fdinfo);
> 
> dump_reg_file will end up calling dump_one_reg_file, which in turn, will
> call read_fd_link, so why calling one here via a wrapper?

This read_fd_link will be called in dump_one_reg_file only if the caller
is not here (we call dump_one_reg_file for mm_exe and other special files).
So to not call read_fd_link twice this optimisation is done.


More information about the CRIU mailing list