[PATCH] const struct tty_operations
[linux-2.6-block.git] / arch / um / include / line.h
CommitLineData
1da177e4
LT
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"
b97b77cc 13#include "linux/spinlock.h"
1da177e4
LT
14#include "chan_user.h"
15#include "mconsole_kern.h"
16
17struct line_driver {
18 char *name;
19 char *device_name;
1da177e4
LT
20 short major;
21 short minor_start;
22 short type;
23 short subtype;
24 int read_irq;
25 char *read_irq_name;
26 int write_irq;
27 char *write_irq_name;
28 char *symlink_from;
29 char *symlink_to;
30 struct mc_device mc;
31};
32
33struct line {
165dc591 34 struct tty_struct *tty;
1da177e4
LT
35 char *init_str;
36 int init_pri;
37 struct list_head chan_list;
38 int valid;
39 int count;
e4dcee80 40 int throttled;
b97b77cc
PBG
41 /*This lock is actually, mostly, local to*/
42 spinlock_t lock;
43
44 /* Yes, this is a real circular buffer.
45 * XXX: And this should become a struct kfifo!
46 *
47 * buffer points to a buffer allocated on demand, of length
48 * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/
1da177e4
LT
49 char *buffer;
50 char *head;
51 char *tail;
b97b77cc 52
1da177e4
LT
53 int sigio;
54 struct work_struct task;
5e7672ec 55 const struct line_driver *driver;
1da177e4
LT
56 int have_irq;
57};
58
59#define LINE_INIT(str, d) \
4d338e1a
AV
60 { .init_str = str, \
61 .init_pri = INIT_STATIC, \
62 .valid = 1, \
63 .lock = SPIN_LOCK_UNLOCKED, \
64 .driver = d }
1da177e4
LT
65
66struct lines {
67 int num;
68};
69
4d338e1a 70#define LINES_INIT(n) { .num = n }
1da177e4
LT
71
72extern void line_close(struct tty_struct *tty, struct file * filp);
1f80171e 73extern int line_open(struct line *lines, struct tty_struct *tty);
d571cd18
JD
74extern int line_setup(struct line *lines, unsigned int sizeof_lines,
75 char *init);
d50084a2
JD
76extern int line_write(struct tty_struct *tty, const unsigned char *buf,
77 int len);
1da177e4
LT
78extern void line_put_char(struct tty_struct *tty, unsigned char ch);
79extern void line_set_termios(struct tty_struct *tty, struct termios * old);
80extern int line_chars_in_buffer(struct tty_struct *tty);
b97b77cc
PBG
81extern void line_flush_buffer(struct tty_struct *tty);
82extern void line_flush_chars(struct tty_struct *tty);
1da177e4
LT
83extern int line_write_room(struct tty_struct *tty);
84extern int line_ioctl(struct tty_struct *tty, struct file * file,
85 unsigned int cmd, unsigned long arg);
e4dcee80
JD
86extern void line_throttle(struct tty_struct *tty);
87extern void line_unthrottle(struct tty_struct *tty);
b97b77cc 88
1da177e4 89extern char *add_xterm_umid(char *base);
165dc591
JD
90extern int line_setup_irq(int fd, int input, int output, struct line *line,
91 void *data);
1da177e4 92extern void line_close_chan(struct line *line);
d50084a2 93extern struct tty_driver * line_register_devfs(struct lines *set,
b68e31d0
JD
94 struct line_driver *line_driver,
95 const struct tty_operations *driver,
96 struct line *lines, int nlines);
1f80171e 97extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts);
1da177e4 98extern void close_lines(struct line *lines, int nlines);
b97b77cc 99
d50084a2 100extern int line_config(struct line *lines, unsigned int sizeof_lines,
5e7672ec 101 char *str, const struct chan_opts *opts);
29d56cfe
JD
102extern int line_id(char **str, int *start_out, int *end_out);
103extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n);
d50084a2
JD
104extern int line_get_config(char *dev, struct line *lines,
105 unsigned int sizeof_lines, char *str,
1da177e4
LT
106 int size, char **error_out);
107
108#endif