[CRIU] Re: [PATCH 5/8] pipes: Add c/r for fifo files

Cyrill Gorcunov gorcunov at openvz.org
Fri Jun 22 09:25:20 EDT 2012


On Fri, Jun 22, 2012 at 05:10:06PM +0400, Pavel Emelyanov wrote:
> On 06/22/2012 04:24 PM, Cyrill Gorcunov wrote:
> > 
> > Basically pipes are superset over fifos, so we integrate
> > fifo c/r into pipes.c file.
> > 
> > There os acatually a trick used to open fifo files --
> > since fifo may block on opening we create a fake fifo
> > to be able to proceed without sleeping.
> > 
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> >  cr-dump.c       |    8 ++-
> >  cr-show.c       |   15 +++-
> >  include/image.h |   10 +++
> >  include/pipes.h |   14 ++-
> >  pipes.c         |  220 +++++++++++++++++++++++++++++++++++++++++++++++-------
> >  5 files changed, 229 insertions(+), 38 deletions(-)
> > 
> 
> After more thinking. Why fifos has anything to do with pipes.c except for the
> "pipe data". The whole (other than pipedata) code in pipe.c was written to handle
> the double-ended pipe nature. With fifos you can _just_ dump it as a regular file
> (plus the trick with fake fifo) and restore the pipe data at the end. No?

Nope ;) I can't dump it the same way as we do for regular files, the only common
point between files and fifos are that they both do have a path on filesystem.

[ Also fifos do share a number of code with pipes in kernel (same mechanism for
  buffers and such) which points to -- the fifo is rather a pipe than a file and
  I think we should reflect this in our code base too, no? ]

In summay -- I think grouping fifo code into pipe is a good idea, file-regs should
remain for regular files handling only, the lack of a general path-remap mechanism
(which would be suitable to use with non-reg files as well) doesn't justify
spreading fifo code between regular files and pipes. I think ;)

After all, Pavel, I might be missing something, because I can imagine how would
we use reg-files code for fifo dumping.

	Cyrill


More information about the CRIU mailing list