[CRIU] [PATCH 03/11] tty: Introduce dump_one_tty helper

Cyrill Gorcunov gorcunov at gmail.com
Tue Oct 7 14:02:02 PDT 2014


On Wed, Oct 08, 2014 at 12:46:28AM +0400, Pavel Emelyanov wrote:
> >  
> > +static int dump_one_tty(int lfd, u32 id, const struct fd_parms *p)
> > +{
> > +	int major = major(p->stat.st_rdev);
> > +	int minor = minor(p->stat.st_rdev);
> > +
> > +	pr_info("Dumping tty (%d:%d) %d with id %#x\n",
> > +		major, minor, lfd, id);
> > +
> > +	switch (major) {
> > +	case TTYAUX_MAJOR:
> > +		if (minor == 0 || minor == 2)
> > +			return dump_one_pty(lfd, id, p, major, minor);
> > +		break;
> > +	case UNIX98_PTY_MASTER_MAJOR ... (UNIX98_PTY_MASTER_MAJOR + UNIX98_PTY_MAJOR_COUNT - 1):
> > +	case UNIX98_PTY_SLAVE_MAJOR:
> > +		return dump_one_pty(lfd, id, p, major, minor);
> > +	default:
> > +		break;
> > +	}
> 
> We already have similar switch in files.c. Please, don't introduce
> another one. If will will need to distinguish ptys from smth else
> let's extend the switch from files.c and introduce another fdtype_ops.

Pavel, at the moment I'm trying to not interfere with other parts of
criu, but making changes local to tty layer. Once I get everything
working I can change code in a more general way. Frankly, I don't
know what else I'll be needed in tty layer or in wich form it ends
up once I bring back (third time ;) regfiles engine usage. Thus the
primary target for me is to keep changes as local as possibe, at
least for now.


More information about the CRIU mailing list