blob: 9b9ced85b70378457479215c85558ebb25e05388 [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
9#include "init.h"
10
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
17enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE };
18
19struct chan_ops {
20 char *type;
Jeff Dike5e7672e2006-09-27 01:50:33 -070021 void *(*init)(char *, int, const struct chan_opts *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 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 *);
Paolo 'Blaisorblade' Giarrusso55c033c2005-11-13 16:07:11 -080026 int (*console_write)(int, const char *, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 int (*window_size)(int, void *, unsigned short *, unsigned short *);
28 void (*free)(void *);
29 int winch;
30};
31
Jeff Dike5e7672e2006-09-27 01:50:33 -070032extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
33 tty_ops, xterm_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
35extern void generic_close(int fd, void *unused);
36extern int generic_read(int fd, char *c_out, void *unused);
37extern int generic_write(int fd, const char *buf, int n, void *unused);
Paolo 'Blaisorblade' Giarrusso55c033c2005-11-13 16:07:11 -080038extern int generic_console_write(int fd, const char *buf, int n);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
40 unsigned short *cols_out);
41extern void generic_free(void *data);
42
43struct tty_struct;
44extern void register_winch(int fd, struct tty_struct *tty);
Jeff Dike42a359e2007-07-15 23:38:55 -070045extern void register_winch_irq(int fd, int tty_fd, int pid,
46 struct tty_struct *tty, unsigned long stack);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
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" \
Karol Swietlicki0ba9d3f2008-02-04 22:30:38 -080051" http://user-mode-linux.sourceforge.net/old/input.html for a complete\n" \
Linus Torvalds1da177e2005-04-16 15:20:36 -070052" description of this switch.\n\n" \
53);
54
55#endif