vserver 1.9.3
[linux-2.6.git] / arch / um / include / line.h
1 /* 
2  * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #ifndef __LINE_H__
7 #define __LINE_H__
8
9 #include "linux/list.h"
10 #include "linux/workqueue.h"
11 #include "linux/tty.h"
12 #include "linux/interrupt.h"
13 #include "asm/semaphore.h"
14 #include "chan_user.h"
15 #include "mconsole_kern.h"
16
17 struct line_driver {
18         char *name;
19         char *device_name;
20         char *devfs_name;
21         short major;
22         short minor_start;
23         short type;
24         short subtype;
25         int read_irq;
26         char *read_irq_name;
27         int write_irq;
28         char *write_irq_name;
29         char *symlink_from;
30         char *symlink_to;
31         struct mc_device mc;
32 };
33
34 struct line {
35         char *init_str;
36         int init_pri;
37         struct list_head chan_list;
38         int valid;
39         int count;
40         struct tty_struct *tty;
41         struct semaphore sem;
42         char *buffer;
43         char *head;
44         char *tail;
45         int sigio;
46         struct work_struct task;
47         struct line_driver *driver;
48         int have_irq;
49 };
50
51 #define LINE_INIT(str, d) \
52         { init_str :    str, \
53           init_pri :    INIT_STATIC, \
54           chan_list :   { }, \
55           valid :       1, \
56           count :       0, \
57           tty :         NULL, \
58           sem :         { }, \
59           buffer :      NULL, \
60           head :        NULL, \
61           tail :        NULL, \
62           sigio :       0, \
63           driver :      d, \
64           have_irq :    0 }
65
66 struct lines {
67         int num;
68 };
69
70 #define LINES_INIT(n) {  num :          n }
71
72 extern void line_close(struct line *lines, struct tty_struct *tty);
73 extern int line_open(struct line *lines, struct tty_struct *tty, 
74                      struct chan_opts *opts);
75 extern int line_setup(struct line *lines, int num, char *init, 
76                       int all_allowed);
77 extern int line_write(struct line *line, struct tty_struct *tty, int from_user,
78                       const char *buf, int len);
79 extern int line_write_room(struct tty_struct *tty);
80 extern char *add_xterm_umid(char *base);
81 extern int line_setup_irq(int fd, int input, int output, void *data);
82 extern void line_close_chan(struct line *line);
83 extern void line_disable(struct line *line, int current_irq);
84 extern struct tty_driver * line_register_devfs(struct lines *set, 
85                                 struct line_driver *line_driver, 
86                                 struct tty_operations *driver,
87                                 struct line *lines,
88                                 int nlines);
89 extern void lines_init(struct line *lines, int nlines);
90 extern void close_lines(struct line *lines, int nlines);
91 extern int line_config(struct line *lines, int num, char *str);
92 extern int line_remove(struct line *lines, int num, char *str);
93 extern int line_get_config(char *dev, struct line *lines, int num, char *str, 
94                            int size, char **error_out);
95
96 #endif
97
98 /*
99  * Overrides for Emacs so that we follow Linus's tabbing style.
100  * Emacs will notice this stuff at the end of the file and automatically
101  * adjust the settings for this buffer only.  This must remain at the end
102  * of the file.
103  * ---------------------------------------------------------------------------
104  * Local variables:
105  * c-file-style: "linux"
106  * End:
107  */