Loading...
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 "linux/spinlock.h"
14#include "linux/mutex.h"
15#include "chan_user.h"
16#include "mconsole_kern.h"
17
18/* There's only two modifiable fields in this - .mc.list and .driver */
19struct line_driver {
20 const char *name;
21 const char *device_name;
22 const short major;
23 const short minor_start;
24 const short type;
25 const short subtype;
26 const int read_irq;
27 const char *read_irq_name;
28 const int write_irq;
29 const char *write_irq_name;
30 struct mc_device mc;
31 struct tty_driver *driver;
32};
33
34struct line {
35 struct tty_struct *tty;
36 struct mutex count_lock;
37 unsigned long count;
38 int valid;
39
40 char *init_str;
41 struct list_head chan_list;
42 struct chan *chan_in, *chan_out;
43
44 /*This lock is actually, mostly, local to*/
45 spinlock_t lock;
46 int throttled;
47 /* Yes, this is a real circular buffer.
48 * XXX: And this should become a struct kfifo!
49 *
50 * buffer points to a buffer allocated on demand, of length
51 * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/
52 char *buffer;
53 char *head;
54 char *tail;
55
56 int sigio;
57 struct delayed_work task;
58 const struct line_driver *driver;
59};
60
61extern void line_close(struct tty_struct *tty, struct file * filp);
62extern int line_open(struct line *lines, struct tty_struct *tty);
63extern int line_setup(char **conf, unsigned nlines, char **def,
64 char *init, char *name);
65extern int line_write(struct tty_struct *tty, const unsigned char *buf,
66 int len);
67extern int line_put_char(struct tty_struct *tty, unsigned char ch);
68extern void line_set_termios(struct tty_struct *tty, struct ktermios * old);
69extern int line_chars_in_buffer(struct tty_struct *tty);
70extern void line_flush_buffer(struct tty_struct *tty);
71extern void line_flush_chars(struct tty_struct *tty);
72extern int line_write_room(struct tty_struct *tty);
73extern int line_ioctl(struct tty_struct *tty, unsigned int cmd,
74 unsigned long arg);
75extern void line_throttle(struct tty_struct *tty);
76extern void line_unthrottle(struct tty_struct *tty);
77
78extern char *add_xterm_umid(char *base);
79extern int line_setup_irq(int fd, int input, int output, struct line *line,
80 void *data);
81extern void line_close_chan(struct line *line);
82extern int register_lines(struct line_driver *line_driver,
83 const struct tty_operations *driver,
84 struct line *lines, int nlines);
85extern int setup_one_line(struct line *lines, int n, char *init,
86 const struct chan_opts *opts, char **error_out);
87extern void close_lines(struct line *lines, int nlines);
88
89extern int line_config(struct line *lines, unsigned int sizeof_lines,
90 char *str, const struct chan_opts *opts,
91 char **error_out);
92extern int line_id(char **str, int *start_out, int *end_out);
93extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n,
94 char **error_out);
95extern int line_get_config(char *dev, struct line *lines,
96 unsigned int sizeof_lines, char *str,
97 int size, char **error_out);
98
99#endif
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
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 <linux/spinlock.h>
14#include <linux/mutex.h>
15#include "chan_user.h"
16#include "mconsole_kern.h"
17
18/* There's only two modifiable fields in this - .mc.list and .driver */
19struct line_driver {
20 const char *name;
21 const char *device_name;
22 const short major;
23 const short minor_start;
24 const short type;
25 const short subtype;
26 const int read_irq;
27 const char *read_irq_name;
28 const int write_irq;
29 const char *write_irq_name;
30 struct mc_device mc;
31 struct tty_driver *driver;
32};
33
34struct line {
35 struct tty_port port;
36 int valid;
37
38 char *init_str;
39 struct list_head chan_list;
40 struct chan *chan_in, *chan_out;
41
42 /*This lock is actually, mostly, local to*/
43 spinlock_t lock;
44 int throttled;
45 /* Yes, this is a real circular buffer.
46 * XXX: And this should become a struct kfifo!
47 *
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;
53
54 int sigio;
55 struct delayed_work task;
56 const struct line_driver *driver;
57};
58
59extern void line_close(struct tty_struct *tty, struct file * filp);
60extern int line_open(struct tty_struct *tty, struct file *filp);
61extern int line_install(struct tty_driver *driver, struct tty_struct *tty,
62 struct line *line);
63extern void line_cleanup(struct tty_struct *tty);
64extern void line_hangup(struct tty_struct *tty);
65extern int line_setup(char **conf, unsigned nlines, char **def,
66 char *init, char *name);
67extern int line_write(struct tty_struct *tty, const unsigned char *buf,
68 int len);
69extern void line_set_termios(struct tty_struct *tty, struct ktermios * old);
70extern int line_chars_in_buffer(struct tty_struct *tty);
71extern void line_flush_buffer(struct tty_struct *tty);
72extern void line_flush_chars(struct tty_struct *tty);
73extern int line_write_room(struct tty_struct *tty);
74extern void line_throttle(struct tty_struct *tty);
75extern void line_unthrottle(struct tty_struct *tty);
76
77extern char *add_xterm_umid(char *base);
78extern int line_setup_irq(int fd, int input, int output, struct line *line,
79 void *data);
80extern void line_close_chan(struct line *line);
81extern int register_lines(struct line_driver *line_driver,
82 const struct tty_operations *driver,
83 struct line *lines, int nlines);
84extern int setup_one_line(struct line *lines, int n, char *init,
85 const struct chan_opts *opts, char **error_out);
86extern void close_lines(struct line *lines, int nlines);
87
88extern int line_config(struct line *lines, unsigned int sizeof_lines,
89 char *str, const struct chan_opts *opts,
90 char **error_out);
91extern int line_id(char **str, int *start_out, int *end_out);
92extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n,
93 char **error_out);
94extern int line_get_config(char *dev, struct line *lines,
95 unsigned int sizeof_lines, char *str,
96 int size, char **error_out);
97
98#endif