chan_user.h 1.7 KB
Newer Older
1
/*
L
Linus Torvalds 已提交
2 3 4 5 6 7 8 9 10 11
 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
 * Licensed under the GPL
 */

#ifndef __CHAN_USER_H__
#define __CHAN_USER_H__

#include "init.h"

struct chan_opts {
12
	void (*const announce)(char *dev_name, int dev);
L
Linus Torvalds 已提交
13
	char *xterm_title;
14
	const int raw;
L
Linus Torvalds 已提交
15 16 17 18 19 20
};

enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE };

struct chan_ops {
	char *type;
J
Jeff Dike 已提交
21
	void *(*init)(char *, int, const struct chan_opts *);
L
Linus Torvalds 已提交
22 23 24 25
	int (*open)(int, int, int, void *, char **);
	void (*close)(int, void *);
	int (*read)(int, char *, void *);
	int (*write)(int, const char *, int, void *);
26
	int (*console_write)(int, const char *, int);
L
Linus Torvalds 已提交
27 28 29 30 31
	int (*window_size)(int, void *, unsigned short *, unsigned short *);
	void (*free)(void *);
	int winch;
};

J
Jeff Dike 已提交
32 33
extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
	tty_ops, xterm_ops;
L
Linus Torvalds 已提交
34 35 36 37

extern void generic_close(int fd, void *unused);
extern int generic_read(int fd, char *c_out, void *unused);
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);
L
Linus Torvalds 已提交
39 40 41 42 43 44
extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
			       unsigned short *cols_out);
extern void generic_free(void *data);

struct tty_struct;
extern void register_winch(int fd,  struct tty_struct *tty);
J
Jeff Dike 已提交
45 46
extern void register_winch_irq(int fd, int tty_fd, int pid,
			       struct tty_struct *tty, unsigned long stack);
L
Linus Torvalds 已提交
47 48 49 50

#define __channel_help(fn, prefix) \
__uml_help(fn, prefix "[0-9]*=<channel description>\n" \
"    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" \
L
Linus Torvalds 已提交
52 53 54 55
"    description of this switch.\n\n" \
);

#endif