mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 18:07:57 +00:00
tty: add serial driver & popular serial majors
Fixes restoring on AMBA serial line. That is /dev/ttyAMA0, which is the default serial port to use on qemu-system-aarch64. (at least in those articles, which I meet it's in boot cmdline) Also should add support for C/R /dev/ttyUSB* One may check major numbers on https://www.kernel.org/doc/Documentation/devices.txt Also by grepping on kernel repository. Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com> Acked-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
9191ce422c
commit
adca1244bf
@ -9,6 +9,10 @@
|
|||||||
/* Kernel's limit */
|
/* Kernel's limit */
|
||||||
#define TERMIOS_NCC 19
|
#define TERMIOS_NCC 19
|
||||||
|
|
||||||
|
/* Popular serial console's majors, which not defined in <linux/major.h> */
|
||||||
|
#define USB_SERIAL_MAJOR 188
|
||||||
|
#define LOW_DENSE_SERIAL_MAJOR 204
|
||||||
|
|
||||||
extern const struct fdtype_ops tty_dump_ops;
|
extern const struct fdtype_ops tty_dump_ops;
|
||||||
|
|
||||||
struct tty_driver;
|
struct tty_driver;
|
||||||
|
12
criu/tty.c
12
criu/tty.c
@ -210,6 +210,12 @@ static struct tty_driver ext_driver = {
|
|||||||
.open = open_ext_tty,
|
.open = open_ext_tty,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct tty_driver serial_driver = {
|
||||||
|
.type = TTY_TYPE__SERIAL,
|
||||||
|
.name = "serial",
|
||||||
|
.open = open_simple_tty,
|
||||||
|
};
|
||||||
|
|
||||||
static int pts_fd_get_index(int fd, const struct fd_parms *p)
|
static int pts_fd_get_index(int fd, const struct fd_parms *p)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
@ -268,6 +274,10 @@ struct tty_driver *get_tty_driver(dev_t rdev, dev_t dev)
|
|||||||
* of kernel).
|
* of kernel).
|
||||||
*/
|
*/
|
||||||
return &vt_driver;
|
return &vt_driver;
|
||||||
|
/* Other minors points to UART serial ports */
|
||||||
|
case USB_SERIAL_MAJOR:
|
||||||
|
case LOW_DENSE_SERIAL_MAJOR:
|
||||||
|
return &serial_driver;
|
||||||
case UNIX98_PTY_MASTER_MAJOR ... (UNIX98_PTY_MASTER_MAJOR + UNIX98_PTY_MAJOR_COUNT - 1):
|
case UNIX98_PTY_MASTER_MAJOR ... (UNIX98_PTY_MASTER_MAJOR + UNIX98_PTY_MAJOR_COUNT - 1):
|
||||||
return &ptm_driver;
|
return &ptm_driver;
|
||||||
case UNIX98_PTY_SLAVE_MAJOR:
|
case UNIX98_PTY_SLAVE_MAJOR:
|
||||||
@ -668,6 +678,7 @@ static bool tty_is_master(struct tty_info *info)
|
|||||||
case TTY_TYPE__CONSOLE:
|
case TTY_TYPE__CONSOLE:
|
||||||
case TTY_TYPE__CTTY:
|
case TTY_TYPE__CTTY:
|
||||||
return true;
|
return true;
|
||||||
|
case TTY_TYPE__SERIAL:
|
||||||
case TTY_TYPE__VT:
|
case TTY_TYPE__VT:
|
||||||
if (!opts.shell_job)
|
if (!opts.shell_job)
|
||||||
return true;
|
return true;
|
||||||
@ -1368,6 +1379,7 @@ static int collect_one_tty_info_entry(void *obj, ProtobufCMessage *msg, struct c
|
|||||||
break;
|
break;
|
||||||
case TTY_TYPE__CTTY:
|
case TTY_TYPE__CTTY:
|
||||||
case TTY_TYPE__CONSOLE:
|
case TTY_TYPE__CONSOLE:
|
||||||
|
case TTY_TYPE__SERIAL:
|
||||||
case TTY_TYPE__VT:
|
case TTY_TYPE__VT:
|
||||||
case TTY_TYPE__EXT_TTY:
|
case TTY_TYPE__EXT_TTY:
|
||||||
if (info->tie->pty) {
|
if (info->tie->pty) {
|
||||||
|
@ -31,6 +31,7 @@ enum TtyType {
|
|||||||
VT = 3;
|
VT = 3;
|
||||||
CTTY = 4;
|
CTTY = 4;
|
||||||
EXT_TTY = 5;
|
EXT_TTY = 5;
|
||||||
|
SERIAL = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message tty_info_entry {
|
message tty_info_entry {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user