[PATCH] uml: Add throttling to console driver
[linux-2.6/x86.git] / arch / um / include / line.h
blob6f4d680dc1d4a810cb531b6370c61a2ad0206a94
1 /*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
6 #ifndef __LINE_H__
7 #define __LINE_H__
9 #include "linux/list.h"
10 #include "linux/workqueue.h"
11 #include "linux/tty.h"
12 #include "linux/interrupt.h"
13 #include "linux/spinlock.h"
14 #include "chan_user.h"
15 #include "mconsole_kern.h"
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;
34 struct line {
35 struct tty_struct *tty;
36 char *init_str;
37 int init_pri;
38 struct list_head chan_list;
39 int valid;
40 int count;
41 int throttled;
42 /*This lock is actually, mostly, local to*/
43 spinlock_t lock;
45 /* Yes, this is a real circular buffer.
46 * XXX: And this should become a struct kfifo!
48 * buffer points to a buffer allocated on demand, of length
49 * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/
50 char *buffer;
51 char *head;
52 char *tail;
54 int sigio;
55 struct work_struct task;
56 struct line_driver *driver;
57 int have_irq;
60 #define LINE_INIT(str, d) \
61 { init_str : str, \
62 init_pri : INIT_STATIC, \
63 valid : 1, \
64 throttled : 0, \
65 lock : SPIN_LOCK_UNLOCKED, \
66 buffer : NULL, \
67 head : NULL, \
68 tail : NULL, \
69 sigio : 0, \
70 driver : d, \
71 have_irq : 0 }
73 struct lines {
74 int num;
77 #define LINES_INIT(n) { num : n }
79 extern void line_close(struct tty_struct *tty, struct file * filp);
80 extern int line_open(struct line *lines, struct tty_struct *tty);
81 extern int line_setup(struct line *lines, unsigned int sizeof_lines,
82 char *init);
83 extern int line_write(struct tty_struct *tty, const unsigned char *buf,
84 int len);
85 extern void line_put_char(struct tty_struct *tty, unsigned char ch);
86 extern void line_set_termios(struct tty_struct *tty, struct termios * old);
87 extern int line_chars_in_buffer(struct tty_struct *tty);
88 extern void line_flush_buffer(struct tty_struct *tty);
89 extern void line_flush_chars(struct tty_struct *tty);
90 extern int line_write_room(struct tty_struct *tty);
91 extern int line_ioctl(struct tty_struct *tty, struct file * file,
92 unsigned int cmd, unsigned long arg);
93 extern void line_throttle(struct tty_struct *tty);
94 extern void line_unthrottle(struct tty_struct *tty);
96 extern char *add_xterm_umid(char *base);
97 extern int line_setup_irq(int fd, int input, int output, struct line *line,
98 void *data);
99 extern void line_close_chan(struct line *line);
100 extern struct tty_driver * line_register_devfs(struct lines *set,
101 struct line_driver *line_driver,
102 struct tty_operations *driver,
103 struct line *lines,
104 int nlines);
105 extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts);
106 extern void close_lines(struct line *lines, int nlines);
108 extern int line_config(struct line *lines, unsigned int sizeof_lines,
109 char *str, struct chan_opts *opts);
110 extern int line_id(char **str, int *start_out, int *end_out);
111 extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n);
112 extern int line_get_config(char *dev, struct line *lines,
113 unsigned int sizeof_lines, char *str,
114 int size, char **error_out);
116 #endif