blob: 03f1b565c5f9ac9028ed7b91444b89c1dde963f1 [file] [log] [blame]
Jeff Dikeb4ac91a2007-02-10 01:44:07 -08001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * 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 Viro37185b32012-10-08 03:27:32 +01009#include <init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
11struct chan_opts {
Jeff Dikea52f3622007-02-10 01:44:06 -080012 void (*const announce)(char *dev_name, int dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 char *xterm_title;
Jeff Dikea52f3622007-02-10 01:44:06 -080014 const int raw;
Linus Torvalds1da177e2005-04-16 15:20:36 -070015};
16
Linus Torvalds1da177e2005-04-16 15:20:36 -070017struct chan_ops {
18 char *type;
Jeff Dike5e7672e2006-09-27 01:50:33 -070019 void *(*init)(char *, int, const struct chan_opts *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 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' Giarrusso55c033c2005-11-13 16:07:11 -080024 int (*console_write)(int, const char *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070025 int (*window_size)(int, void *, unsigned short *, unsigned short *);
26 void (*free)(void *);
27 int winch;
28};
29
Jeff Dike5e7672e2006-09-27 01:50:33 -070030extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
31 tty_ops, xterm_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
33extern void generic_close(int fd, void *unused);
34extern int generic_read(int fd, char *c_out, void *unused);
35extern int generic_write(int fd, const char *buf, int n, void *unused);
Paolo 'Blaisorblade' Giarrusso55c033c2005-11-13 16:07:11 -080036extern int generic_console_write(int fd, const char *buf, int n);
Linus Torvalds1da177e2005-04-16 15:20:36 -070037extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
38 unsigned short *cols_out);
39extern void generic_free(void *data);
40
Richard Weinberger2116bda2013-03-11 10:05:45 +010041struct tty_port;
42extern void register_winch(int fd, struct tty_port *port);
Jeff Dike42a359e2007-07-15 23:38:55 -070043extern void register_winch_irq(int fd, int tty_fd, int pid,
Richard Weinberger2116bda2013-03-11 10:05:45 +010044 struct tty_port *port, unsigned long stack);
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
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 Swietlicki0ba9d3f2008-02-04 22:30:38 -080049" http://user-mode-linux.sourceforge.net/old/input.html for a complete\n" \
Linus Torvalds1da177e2005-04-16 15:20:36 -070050" description of this switch.\n\n" \
51);
52
53#endif