^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifndef __CHAN_USER_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define __CHAN_USER_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct chan_opts {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) void (*const announce)(char *dev_name, int dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) char *xterm_title;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) int raw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct chan_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) char *type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) void *(*init)(char *, int, const struct chan_opts *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) int (*open)(int, int, int, void *, char **);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) void (*close)(int, void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) int (*read)(int, char *, void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int (*write)(int, const char *, int, void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) int (*console_write)(int, const char *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) int (*window_size)(int, void *, unsigned short *, unsigned short *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) void (*free)(void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) int winch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) tty_ops, xterm_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) extern void generic_close(int fd, void *unused);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) extern int generic_read(int fd, char *c_out, void *unused);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) extern int generic_write(int fd, const char *buf, int n, void *unused);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) extern int generic_console_write(int fd, const char *buf, int n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) unsigned short *cols_out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) extern void generic_free(void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct tty_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) extern void register_winch(int fd, struct tty_port *port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) extern void register_winch_irq(int fd, int tty_fd, int pid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct tty_port *port, unsigned long stack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define __channel_help(fn, prefix) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) __uml_help(fn, prefix "[0-9]*=<channel description>\n" \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) " Attach a console or serial line to a host channel. See\n" \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) " http://user-mode-linux.sourceforge.net/old/input.html for a complete\n" \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) " description of this switch.\n\n" \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #endif