2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-01 23:05:39 +00:00

tty: Make tty_type to use @major argument

This makes this helper more wide usable.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov
2012-10-29 13:37:11 +04:00
committed by Pavel Emelyanov
parent 4dc29af3ee
commit f8fa75ae86

8
tty.c
View File

@@ -361,7 +361,7 @@ static int tty_restore_ctl_terminal(struct file_desc *d, int fd)
return ret; return ret;
} }
static char *tty_type(struct tty_info *info) static char *tty_type(int major)
{ {
static char *tty_types[] = { static char *tty_types[] = {
[UNIX98_PTY_SLAVE_MAJOR] = "pts", [UNIX98_PTY_SLAVE_MAJOR] = "pts",
@@ -369,10 +369,10 @@ static char *tty_type(struct tty_info *info)
}; };
static char tty_unknown[] = "unknown"; static char tty_unknown[] = "unknown";
switch (info->major) { switch (major) {
case UNIX98_PTY_SLAVE_MAJOR: case UNIX98_PTY_SLAVE_MAJOR:
case TTYAUX_MAJOR: case TTYAUX_MAJOR:
return tty_types[info->major]; return tty_types[major];
} }
return tty_unknown; return tty_unknown;
@@ -391,7 +391,7 @@ static bool pty_is_hung(struct tty_info *info)
static void tty_show_pty_info(char *prefix, struct tty_info *info) static void tty_show_pty_info(char *prefix, struct tty_info *info)
{ {
pr_info("%s type %s id %#x index %d (master %d sid %d pgrp %d)\n", pr_info("%s type %s id %#x index %d (master %d sid %d pgrp %d)\n",
prefix, tty_type(info), info->tfe->id, info->tie->pty->index, prefix, tty_type(info->major), info->tfe->id, info->tie->pty->index,
pty_is_master(info), info->tie->sid, info->tie->pgrp); pty_is_master(info), info->tie->sid, info->tie->pgrp);
} }