[CRIU] [PATCH 1/5] tty: Introduce TTY_TYPE

Cyrill Gorcunov gorcunov at gmail.com
Wed Oct 15 02:52:10 PDT 2014


On Wed, Oct 15, 2014 at 01:39:23PM +0400, Pavel Emelyanov wrote:
> On 10/13/2014 07:51 PM, Cyrill Gorcunov wrote:
> > Instead of calling case() with majors all over the
> > places lets introduce TTY_TYPE enums and use it
> > in future instead.
> > 
> >  
> > -static char *tty_type(int major)
> > +int tty_type(int major, int minor)
> 
> Can you place it somewhere so that diff doesn't generate such
> a mixed stuff?

It was misnamed in first place, but I can try to move it into the
header, not sure if this improve situation though.

> >  {
> > -	static char *tty_types[] = {
> > -		[UNIX98_PTY_SLAVE_MAJOR]	= "pts",
> > -		[TTYAUX_MAJOR]			= "ptmx",
> > -	};
> > -	static char tty_unknown[]		= "unknown";
> > -
> >  	switch (major) {
> > -	case UNIX98_PTY_SLAVE_MAJOR:
> >  	case TTYAUX_MAJOR:
> > -		return tty_types[major];
> > +		if (minor == 0 || minor == 2)
> 
> The comparison of minor first appeared in this patch which makes
> it not just "introduce the type" but also "fix some bug".

Nope. Not testing minors earlier simply defering exit, I mean in
case of console we simply exit on stage when we trying to fetch
its index, so no, there is no bug-fix.

	Cyrill


More information about the CRIU mailing list