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