Jeff Dike | b4ac91a | 2007-02-10 01:44:07 -0800 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Al Viro | 37185b3 | 2012-10-08 03:27:32 +0100 | [diff] [blame] | 9 | #include <init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | |
| 11 | struct chan_opts { |
Jeff Dike | a52f362 | 2007-02-10 01:44:06 -0800 | [diff] [blame] | 12 | void (*const announce)(char *dev_name, int dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | char *xterm_title; |
Jeff Dike | a52f362 | 2007-02-10 01:44:06 -0800 | [diff] [blame] | 14 | const int raw; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | }; |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | struct chan_ops { |
| 18 | char *type; |
Jeff Dike | 5e7672e | 2006-09-27 01:50:33 -0700 | [diff] [blame] | 19 | void *(*init)(char *, int, const struct chan_opts *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 *); |
Paolo 'Blaisorblade' Giarrusso | 55c033c | 2005-11-13 16:07:11 -0800 | [diff] [blame] | 24 | int (*console_write)(int, const char *, int); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | int (*window_size)(int, void *, unsigned short *, unsigned short *); |
| 26 | void (*free)(void *); |
| 27 | int winch; |
| 28 | }; |
| 29 | |
Jeff Dike | 5e7672e | 2006-09-27 01:50:33 -0700 | [diff] [blame] | 30 | extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops, |
| 31 | tty_ops, xterm_ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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); |
Paolo 'Blaisorblade' Giarrusso | 55c033c | 2005-11-13 16:07:11 -0800 | [diff] [blame] | 36 | extern int generic_console_write(int fd, const char *buf, int n); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Richard Weinberger | 2116bda | 2013-03-11 10:05:45 +0100 | [diff] [blame] | 41 | struct tty_port; |
| 42 | extern void register_winch(int fd, struct tty_port *port); |
Jeff Dike | 42a359e | 2007-07-15 23:38:55 -0700 | [diff] [blame] | 43 | extern void register_winch_irq(int fd, int tty_fd, int pid, |
Richard Weinberger | 2116bda | 2013-03-11 10:05:45 +0100 | [diff] [blame] | 44 | struct tty_port *port, unsigned long stack); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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" \ |
Karol Swietlicki | 0ba9d3f | 2008-02-04 22:30:38 -0800 | [diff] [blame] | 49 | " http://user-mode-linux.sourceforge.net/old/input.html for a complete\n" \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | " description of this switch.\n\n" \ |
| 51 | ); |
| 52 | |
| 53 | #endif |