1 /*
2  * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
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 	const int raw;
15 };
16 
17 enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE };
18 
19 struct chan_ops {
20 	char *type;
21 	void *(*init)(char *, int, const struct chan_opts *);
22 	int (*open)(int, int, int, void *, char **);
23 	void (*close)(int, void *);
24 	int (*read)(int, char *, void *);
25 	int (*write)(int, const char *, int, void *);
26 	int (*console_write)(int, const char *, int);
27 	int (*window_size)(int, void *, unsigned short *, unsigned short *);
28 	void (*free)(void *);
29 	int winch;
30 };
31 
32 extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
33 	tty_ops, xterm_ops;
34 
35 extern void generic_close(int fd, void *unused);
36 extern int generic_read(int fd, char *c_out, void *unused);
37 extern int generic_write(int fd, const char *buf, int n, void *unused);
38 extern int generic_console_write(int fd, const char *buf, int n);
39 extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
40 			       unsigned short *cols_out);
41 extern void generic_free(void *data);
42 
43 struct tty_struct;
44 extern void register_winch(int fd,  struct tty_struct *tty);
45 extern void register_winch_irq(int fd, int tty_fd, int pid,
46 			       struct tty_struct *tty, unsigned long stack);
47 
48 #define __channel_help(fn, prefix) \
49 __uml_help(fn, prefix "[0-9]*=<channel description>\n" \
50 "    Attach a console or serial line to a host channel.  See\n" \
51 "    http://user-mode-linux.sourceforge.net/old/input.html for a complete\n" \
52 "    description of this switch.\n\n" \
53 );
54 
55 #endif
56