18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#ifndef __CHAN_USER_H__ 78c2ecf20Sopenharmony_ci#define __CHAN_USER_H__ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <init.h> 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cistruct chan_opts { 128c2ecf20Sopenharmony_ci void (*const announce)(char *dev_name, int dev); 138c2ecf20Sopenharmony_ci char *xterm_title; 148c2ecf20Sopenharmony_ci int raw; 158c2ecf20Sopenharmony_ci}; 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cistruct chan_ops { 188c2ecf20Sopenharmony_ci char *type; 198c2ecf20Sopenharmony_ci void *(*init)(char *, int, const struct chan_opts *); 208c2ecf20Sopenharmony_ci int (*open)(int, int, int, void *, char **); 218c2ecf20Sopenharmony_ci void (*close)(int, void *); 228c2ecf20Sopenharmony_ci int (*read)(int, char *, void *); 238c2ecf20Sopenharmony_ci int (*write)(int, const char *, int, void *); 248c2ecf20Sopenharmony_ci int (*console_write)(int, const char *, int); 258c2ecf20Sopenharmony_ci int (*window_size)(int, void *, unsigned short *, unsigned short *); 268c2ecf20Sopenharmony_ci void (*free)(void *); 278c2ecf20Sopenharmony_ci int winch; 288c2ecf20Sopenharmony_ci}; 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ciextern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops, 318c2ecf20Sopenharmony_ci tty_ops, xterm_ops; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciextern void generic_close(int fd, void *unused); 348c2ecf20Sopenharmony_ciextern int generic_read(int fd, char *c_out, void *unused); 358c2ecf20Sopenharmony_ciextern int generic_write(int fd, const char *buf, int n, void *unused); 368c2ecf20Sopenharmony_ciextern int generic_console_write(int fd, const char *buf, int n); 378c2ecf20Sopenharmony_ciextern int generic_window_size(int fd, void *unused, unsigned short *rows_out, 388c2ecf20Sopenharmony_ci unsigned short *cols_out); 398c2ecf20Sopenharmony_ciextern void generic_free(void *data); 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistruct tty_port; 428c2ecf20Sopenharmony_ciextern void register_winch(int fd, struct tty_port *port); 438c2ecf20Sopenharmony_ciextern void register_winch_irq(int fd, int tty_fd, int pid, 448c2ecf20Sopenharmony_ci struct tty_port *port, unsigned long stack); 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define __channel_help(fn, prefix) \ 478c2ecf20Sopenharmony_ci__uml_help(fn, prefix "[0-9]*=<channel description>\n" \ 488c2ecf20Sopenharmony_ci" Attach a console or serial line to a host channel. See\n" \ 498c2ecf20Sopenharmony_ci" http://user-mode-linux.sourceforge.net/old/input.html for a complete\n" \ 508c2ecf20Sopenharmony_ci" description of this switch.\n\n" \ 518c2ecf20Sopenharmony_ci); 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#endif 54