[Devel] [PATCH rh7] vtty: Make indices to match pcs6 scheme

Vladimir Davydov vdavydov at virtuozzo.com
Thu Oct 15 08:38:34 PDT 2015


On Mon, Oct 05, 2015 at 12:54:26PM +0300, Cyrill Gorcunov wrote:
> In pcs6 vttys are mapped into internal kernel representation in
> nonobvious way. The /dev/console represent [maj:5,min:1], in
> turn /dev/tty[0-...] are defined as [maj:4,min:0...], where
> minor is bijective to symbol postfix of the tty. Internally
> in the pcs6 kernel any open of /dev/ttyX has been mapping
> minor into vtty index as
> 
>  |	if (minor > 0)
>  |		index = minor - 1
>  |	else
>  |		index = 0
> 
> which actually shifts indices and make /dev/tty0 as
> an alias to /dev/console inside container.
> 
> Same time vzctl tool passes console number argument
> in a decremented way, iow when one is typing
> 
> 	vzctl console $ctid 1
> 
> here is 1 is a tty number, the kernel sees is as 0,
> opening containers /dev/console.
> 
> When one types "vzctl console $ctid 2" (which implies
> to open container's /dev/tty2) the vzctl passes index 1
> and the kernel opens /dev/tty2 because of the if/else index
> mapping as show above.
> 
> Lets implement same indices mapping in pcs7 for backward
> compatibility (in pcs7 there is a per-VE vtty_map_t structure
> which reserve up to MAX_NR_VTTY_CONSOLES ttys to track
> and it is simply an array addressed by tty index).
> 
> Same time lets fix a few nits: disable setup of controlling
> terminal on /dev/console only, since all ttys can have
> controlling sign; make sure we're having @tty_fops for
> such terminals.
> 
> https://jira.sw.ru/browse/PSBM-40088
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
> CC: Vladimir Davydov <vdavydov at virtuozzo.com>
> CC: Konstantin Khorenko <khorenko at virtuozzo.com>
> CC: Igor Sukhih <igor at parallels.com>

Reviewed-by: Vladimir Davydov <vdavydov at virtuozzo.com>



More information about the Devel mailing list