aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tty.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r--include/linux/tty.h258
1 files changed, 170 insertions, 88 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 324a3b231d40..3b8121d4e36f 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,7 +23,7 @@
23 */ 23 */
24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
26#define NR_LDISCS 18 26#define NR_LDISCS 19
27 27
28/* line disciplines */ 28/* line disciplines */
29#define N_TTY 0 29#define N_TTY 0
@@ -45,6 +45,7 @@
45#define N_HCI 15 /* Bluetooth HCI UART */ 45#define N_HCI 15 /* Bluetooth HCI UART */
46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ 46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */
47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ 47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
48#define N_PPS 18 /* Pulse per Second */
48 49
49/* 50/*
50 * This character is the same as _POSIX_VDISABLE: it cannot be used as 51 * This character is the same as _POSIX_VDISABLE: it cannot be used as
@@ -71,7 +72,8 @@ struct tty_bufhead {
71 struct tty_buffer *head; /* Queue head */ 72 struct tty_buffer *head; /* Queue head */
72 struct tty_buffer *tail; /* Active buffer */ 73 struct tty_buffer *tail; /* Active buffer */
73 struct tty_buffer *free; /* Free queue head */ 74 struct tty_buffer *free; /* Free queue head */
74 int memory_used; /* Buffer space used excluding free queue */ 75 int memory_used; /* Buffer space used excluding
76 free queue */
75}; 77};
76/* 78/*
77 * When a break, frame error, or parity error happens, these codes are 79 * When a break, frame error, or parity error happens, these codes are
@@ -101,71 +103,97 @@ struct tty_bufhead {
101#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT]) 103#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT])
102#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2]) 104#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2])
103 105
104#define _I_FLAG(tty,f) ((tty)->termios->c_iflag & (f)) 106#define _I_FLAG(tty, f) ((tty)->termios->c_iflag & (f))
105#define _O_FLAG(tty,f) ((tty)->termios->c_oflag & (f)) 107#define _O_FLAG(tty, f) ((tty)->termios->c_oflag & (f))
106#define _C_FLAG(tty,f) ((tty)->termios->c_cflag & (f)) 108#define _C_FLAG(tty, f) ((tty)->termios->c_cflag & (f))
107#define _L_FLAG(tty,f) ((tty)->termios->c_lflag & (f)) 109#define _L_FLAG(tty, f) ((tty)->termios->c_lflag & (f))
108 110
109#define I_IGNBRK(tty) _I_FLAG((tty),IGNBRK) 111#define I_IGNBRK(tty) _I_FLAG((tty), IGNBRK)
110#define I_BRKINT(tty) _I_FLAG((tty),BRKINT) 112#define I_BRKINT(tty) _I_FLAG((tty), BRKINT)
111#define I_IGNPAR(tty) _I_FLAG((tty),IGNPAR) 113#define I_IGNPAR(tty) _I_FLAG((tty), IGNPAR)
112#define I_PARMRK(tty) _I_FLAG((tty),PARMRK) 114#define I_PARMRK(tty) _I_FLAG((tty), PARMRK)
113#define I_INPCK(tty) _I_FLAG((tty),INPCK) 115#define I_INPCK(tty) _I_FLAG((tty), INPCK)
114#define I_ISTRIP(tty) _I_FLAG((tty),ISTRIP) 116#define I_ISTRIP(tty) _I_FLAG((tty), ISTRIP)
115#define I_INLCR(tty) _I_FLAG((tty),INLCR) 117#define I_INLCR(tty) _I_FLAG((tty), INLCR)
116#define I_IGNCR(tty) _I_FLAG((tty),IGNCR) 118#define I_IGNCR(tty) _I_FLAG((tty), IGNCR)
117#define I_ICRNL(tty) _I_FLAG((tty),ICRNL) 119#define I_ICRNL(tty) _I_FLAG((tty), ICRNL)
118#define I_IUCLC(tty) _I_FLAG((tty),IUCLC) 120#define I_IUCLC(tty) _I_FLAG((tty), IUCLC)
119#define I_IXON(tty) _I_FLAG((tty),IXON) 121#define I_IXON(tty) _I_FLAG((tty), IXON)
120#define I_IXANY(tty) _I_FLAG((tty),IXANY) 122#define I_IXANY(tty) _I_FLAG((tty), IXANY)
121#define I_IXOFF(tty) _I_FLAG((tty),IXOFF) 123#define I_IXOFF(tty) _I_FLAG((tty), IXOFF)
122#define I_IMAXBEL(tty) _I_FLAG((tty),IMAXBEL) 124#define I_IMAXBEL(tty) _I_FLAG((tty), IMAXBEL)
123#define I_IUTF8(tty) _I_FLAG((tty),IUTF8) 125#define I_IUTF8(tty) _I_FLAG((tty), IUTF8)
124 126
125#define O_OPOST(tty) _O_FLAG((tty),OPOST) 127#define O_OPOST(tty) _O_FLAG((tty), OPOST)
126#define O_OLCUC(tty) _O_FLAG((tty),OLCUC) 128#define O_OLCUC(tty) _O_FLAG((tty), OLCUC)
127#define O_ONLCR(tty) _O_FLAG((tty),ONLCR) 129#define O_ONLCR(tty) _O_FLAG((tty), ONLCR)
128#define O_OCRNL(tty) _O_FLAG((tty),OCRNL) 130#define O_OCRNL(tty) _O_FLAG((tty), OCRNL)
129#define O_ONOCR(tty) _O_FLAG((tty),ONOCR) 131#define O_ONOCR(tty) _O_FLAG((tty), ONOCR)
130#define O_ONLRET(tty) _O_FLAG((tty),ONLRET) 132#define O_ONLRET(tty) _O_FLAG((tty), ONLRET)
131#define O_OFILL(tty) _O_FLAG((tty),OFILL) 133#define O_OFILL(tty) _O_FLAG((tty), OFILL)
132#define O_OFDEL(tty) _O_FLAG((tty),OFDEL) 134#define O_OFDEL(tty) _O_FLAG((tty), OFDEL)
133#define O_NLDLY(tty) _O_FLAG((tty),NLDLY) 135#define O_NLDLY(tty) _O_FLAG((tty), NLDLY)
134#define O_CRDLY(tty) _O_FLAG((tty),CRDLY) 136#define O_CRDLY(tty) _O_FLAG((tty), CRDLY)
135#define O_TABDLY(tty) _O_FLAG((tty),TABDLY) 137#define O_TABDLY(tty) _O_FLAG((tty), TABDLY)
136#define O_BSDLY(tty) _O_FLAG((tty),BSDLY) 138#define O_BSDLY(tty) _O_FLAG((tty), BSDLY)
137#define O_VTDLY(tty) _O_FLAG((tty),VTDLY) 139#define O_VTDLY(tty) _O_FLAG((tty), VTDLY)
138#define O_FFDLY(tty) _O_FLAG((tty),FFDLY) 140#define O_FFDLY(tty) _O_FLAG((tty), FFDLY)
139 141
140#define C_BAUD(tty) _C_FLAG((tty),CBAUD) 142#define C_BAUD(tty) _C_FLAG((tty), CBAUD)
141#define C_CSIZE(tty) _C_FLAG((tty),CSIZE) 143#define C_CSIZE(tty) _C_FLAG((tty), CSIZE)
142#define C_CSTOPB(tty) _C_FLAG((tty),CSTOPB) 144#define C_CSTOPB(tty) _C_FLAG((tty), CSTOPB)
143#define C_CREAD(tty) _C_FLAG((tty),CREAD) 145#define C_CREAD(tty) _C_FLAG((tty), CREAD)
144#define C_PARENB(tty) _C_FLAG((tty),PARENB) 146#define C_PARENB(tty) _C_FLAG((tty), PARENB)
145#define C_PARODD(tty) _C_FLAG((tty),PARODD) 147#define C_PARODD(tty) _C_FLAG((tty), PARODD)
146#define C_HUPCL(tty) _C_FLAG((tty),HUPCL) 148#define C_HUPCL(tty) _C_FLAG((tty), HUPCL)
147#define C_CLOCAL(tty) _C_FLAG((tty),CLOCAL) 149#define C_CLOCAL(tty) _C_FLAG((tty), CLOCAL)
148#define C_CIBAUD(tty) _C_FLAG((tty),CIBAUD) 150#define C_CIBAUD(tty) _C_FLAG((tty), CIBAUD)
149#define C_CRTSCTS(tty) _C_FLAG((tty),CRTSCTS) 151#define C_CRTSCTS(tty) _C_FLAG((tty), CRTSCTS)
150 152
151#define L_ISIG(tty) _L_FLAG((tty),ISIG) 153#define L_ISIG(tty) _L_FLAG((tty), ISIG)
152#define L_ICANON(tty) _L_FLAG((tty),ICANON) 154#define L_ICANON(tty) _L_FLAG((tty), ICANON)
153#define L_XCASE(tty) _L_FLAG((tty),XCASE) 155#define L_XCASE(tty) _L_FLAG((tty), XCASE)
154#define L_ECHO(tty) _L_FLAG((tty),ECHO) 156#define L_ECHO(tty) _L_FLAG((tty), ECHO)
155#define L_ECHOE(tty) _L_FLAG((tty),ECHOE) 157#define L_ECHOE(tty) _L_FLAG((tty), ECHOE)
156#define L_ECHOK(tty) _L_FLAG((tty),ECHOK) 158#define L_ECHOK(tty) _L_FLAG((tty), ECHOK)
157#define L_ECHONL(tty) _L_FLAG((tty),ECHONL) 159#define L_ECHONL(tty) _L_FLAG((tty), ECHONL)
158#define L_NOFLSH(tty) _L_FLAG((tty),NOFLSH) 160#define L_NOFLSH(tty) _L_FLAG((tty), NOFLSH)
159#define L_TOSTOP(tty) _L_FLAG((tty),TOSTOP) 161#define L_TOSTOP(tty) _L_FLAG((tty), TOSTOP)
160#define L_ECHOCTL(tty) _L_FLAG((tty),ECHOCTL) 162#define L_ECHOCTL(tty) _L_FLAG((tty), ECHOCTL)
161#define L_ECHOPRT(tty) _L_FLAG((tty),ECHOPRT) 163#define L_ECHOPRT(tty) _L_FLAG((tty), ECHOPRT)
162#define L_ECHOKE(tty) _L_FLAG((tty),ECHOKE) 164#define L_ECHOKE(tty) _L_FLAG((tty), ECHOKE)
163#define L_FLUSHO(tty) _L_FLAG((tty),FLUSHO) 165#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO)
164#define L_PENDIN(tty) _L_FLAG((tty),PENDIN) 166#define L_PENDIN(tty) _L_FLAG((tty), PENDIN)
165#define L_IEXTEN(tty) _L_FLAG((tty),IEXTEN) 167#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN)
166 168
167struct device; 169struct device;
168struct signal_struct; 170struct signal_struct;
171
172/*
173 * Port level information. Each device keeps its own port level information
174 * so provide a common structure for those ports wanting to use common support
175 * routines.
176 *
177 * The tty port has a different lifetime to the tty so must be kept apart.
178 * In addition be careful as tty -> port mappings are valid for the life
179 * of the tty object but in many cases port -> tty mappings are valid only
180 * until a hangup so don't use the wrong path.
181 */
182
183struct tty_port {
184 struct tty_struct *tty; /* Back pointer */
185 spinlock_t lock; /* Lock protecting tty field */
186 int blocked_open; /* Waiting to open */
187 int count; /* Usage count */
188 wait_queue_head_t open_wait; /* Open waiters */
189 wait_queue_head_t close_wait; /* Close waiters */
190 unsigned long flags; /* TTY flags ASY_*/
191 struct mutex mutex; /* Locking */
192 unsigned char *xmit_buf; /* Optional buffer */
193 int close_delay; /* Close port delay */
194 int closing_wait; /* Delay for output */
195};
196
169/* 197/*
170 * Where all of the state associated with a tty is kept while the tty 198 * Where all of the state associated with a tty is kept while the tty
171 * is open. Since the termios state should be kept even if the tty 199 * is open. Since the termios state should be kept even if the tty
@@ -182,14 +210,17 @@ struct tty_operations;
182 210
183struct tty_struct { 211struct tty_struct {
184 int magic; 212 int magic;
213 struct kref kref;
185 struct tty_driver *driver; 214 struct tty_driver *driver;
186 const struct tty_operations *ops; 215 const struct tty_operations *ops;
187 int index; 216 int index;
217 /* The ldisc objects are protected by tty_ldisc_lock at the moment */
188 struct tty_ldisc ldisc; 218 struct tty_ldisc ldisc;
189 struct mutex termios_mutex; 219 struct mutex termios_mutex;
190 spinlock_t ctrl_lock; 220 spinlock_t ctrl_lock;
191 /* Termios values are protected by the termios mutex */ 221 /* Termios values are protected by the termios mutex */
192 struct ktermios *termios, *termios_locked; 222 struct ktermios *termios, *termios_locked;
223 struct termiox *termiox; /* May be NULL for unsupported */
193 char name[64]; 224 char name[64];
194 struct pid *pgrp; /* Protected by ctrl lock */ 225 struct pid *pgrp; /* Protected by ctrl lock */
195 struct pid *session; 226 struct pid *session;
@@ -213,7 +244,7 @@ struct tty_struct {
213 struct list_head tty_files; 244 struct list_head tty_files;
214 245
215#define N_TTY_BUF_SIZE 4096 246#define N_TTY_BUF_SIZE 4096
216 247
217 /* 248 /*
218 * The following is data for the N_TTY line discipline. For 249 * The following is data for the N_TTY line discipline. For
219 * historical reasons, this is included in the tty structure. 250 * historical reasons, this is included in the tty structure.
@@ -241,6 +272,7 @@ struct tty_struct {
241 spinlock_t read_lock; 272 spinlock_t read_lock;
242 /* If the tty has a pending do_SAK, queue it here - akpm */ 273 /* If the tty has a pending do_SAK, queue it here - akpm */
243 struct work_struct SAK_work; 274 struct work_struct SAK_work;
275 struct tty_port *port;
244}; 276};
245 277
246/* tty magic number */ 278/* tty magic number */
@@ -248,14 +280,14 @@ struct tty_struct {
248 280
249/* 281/*
250 * These bits are used in the flags field of the tty structure. 282 * These bits are used in the flags field of the tty structure.
251 * 283 *
252 * So that interrupts won't be able to mess up the queues, 284 * So that interrupts won't be able to mess up the queues,
253 * copy_to_cooked must be atomic with respect to itself, as must 285 * copy_to_cooked must be atomic with respect to itself, as must
254 * tty->write. Thus, you must use the inline functions set_bit() and 286 * tty->write. Thus, you must use the inline functions set_bit() and
255 * clear_bit() to make things atomic. 287 * clear_bit() to make things atomic.
256 */ 288 */
257#define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */ 289#define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */
258#define TTY_IO_ERROR 1 /* Canse an I/O error (may be no ldisc too) */ 290#define TTY_IO_ERROR 1 /* Cause an I/O error (may be no ldisc too) */
259#define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */ 291#define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */
260#define TTY_EXCLUSIVE 3 /* Exclusive open mode */ 292#define TTY_EXCLUSIVE 3 /* Exclusive open mode */
261#define TTY_DEBUG 4 /* Debugging */ 293#define TTY_DEBUG 4 /* Debugging */
@@ -282,15 +314,32 @@ extern int kmsg_redirect;
282extern void console_init(void); 314extern void console_init(void);
283extern int vcs_init(void); 315extern int vcs_init(void);
284 316
317extern struct class *tty_class;
318
319/**
320 * tty_kref_get - get a tty reference
321 * @tty: tty device
322 *
323 * Return a new reference to a tty object. The caller must hold
324 * sufficient locks/counts to ensure that their existing reference cannot
325 * go away
326 */
327
328extern inline struct tty_struct *tty_kref_get(struct tty_struct *tty)
329{
330 if (tty)
331 kref_get(&tty->kref);
332 return tty;
333}
334extern void tty_kref_put(struct tty_struct *tty);
335
285extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, 336extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
286 const char *routine); 337 const char *routine);
287extern char *tty_name(struct tty_struct *tty, char *buf); 338extern char *tty_name(struct tty_struct *tty, char *buf);
288extern void tty_wait_until_sent(struct tty_struct * tty, long timeout); 339extern void tty_wait_until_sent(struct tty_struct *tty, long timeout);
289extern int tty_check_change(struct tty_struct * tty); 340extern int tty_check_change(struct tty_struct *tty);
290extern void stop_tty(struct tty_struct * tty); 341extern void stop_tty(struct tty_struct *tty);
291extern void start_tty(struct tty_struct * tty); 342extern void start_tty(struct tty_struct *tty);
292extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
293extern int tty_unregister_ldisc(int disc);
294extern int tty_register_driver(struct tty_driver *driver); 343extern int tty_register_driver(struct tty_driver *driver);
295extern int tty_unregister_driver(struct tty_driver *driver); 344extern int tty_unregister_driver(struct tty_driver *driver);
296extern struct device *tty_register_device(struct tty_driver *driver, 345extern struct device *tty_register_device(struct tty_driver *driver,
@@ -305,34 +354,41 @@ extern int tty_write_room(struct tty_struct *tty);
305extern void tty_driver_flush_buffer(struct tty_struct *tty); 354extern void tty_driver_flush_buffer(struct tty_struct *tty);
306extern void tty_throttle(struct tty_struct *tty); 355extern void tty_throttle(struct tty_struct *tty);
307extern void tty_unthrottle(struct tty_struct *tty); 356extern void tty_unthrottle(struct tty_struct *tty);
308 357extern int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty,
358 struct winsize *ws);
359extern void tty_shutdown(struct tty_struct *tty);
360extern void tty_free_termios(struct tty_struct *tty);
309extern int is_current_pgrp_orphaned(void); 361extern int is_current_pgrp_orphaned(void);
310extern struct pid *tty_get_pgrp(struct tty_struct *tty); 362extern struct pid *tty_get_pgrp(struct tty_struct *tty);
311extern int is_ignored(int sig); 363extern int is_ignored(int sig);
312extern int tty_signal(int sig, struct tty_struct *tty); 364extern int tty_signal(int sig, struct tty_struct *tty);
313extern void tty_hangup(struct tty_struct * tty); 365extern void tty_hangup(struct tty_struct *tty);
314extern void tty_vhangup(struct tty_struct * tty); 366extern void tty_vhangup(struct tty_struct *tty);
367extern void tty_vhangup_self(void);
315extern void tty_unhangup(struct file *filp); 368extern void tty_unhangup(struct file *filp);
316extern int tty_hung_up_p(struct file * filp); 369extern int tty_hung_up_p(struct file *filp);
317extern void do_SAK(struct tty_struct *tty); 370extern void do_SAK(struct tty_struct *tty);
318extern void __do_SAK(struct tty_struct *tty); 371extern void __do_SAK(struct tty_struct *tty);
319extern void disassociate_ctty(int priv); 372extern void disassociate_ctty(int priv);
320extern void no_tty(void); 373extern void no_tty(void);
321extern void tty_flip_buffer_push(struct tty_struct *tty); 374extern void tty_flip_buffer_push(struct tty_struct *tty);
375extern void tty_buffer_free_all(struct tty_struct *tty);
376extern void tty_buffer_flush(struct tty_struct *tty);
377extern void tty_buffer_init(struct tty_struct *tty);
322extern speed_t tty_get_baud_rate(struct tty_struct *tty); 378extern speed_t tty_get_baud_rate(struct tty_struct *tty);
323extern speed_t tty_termios_baud_rate(struct ktermios *termios); 379extern speed_t tty_termios_baud_rate(struct ktermios *termios);
324extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 380extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
325extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud); 381extern void tty_termios_encode_baud_rate(struct ktermios *termios,
326extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud); 382 speed_t ibaud, speed_t obaud);
383extern void tty_encode_baud_rate(struct tty_struct *tty,
384 speed_t ibaud, speed_t obaud);
327extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 385extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
328extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); 386extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
329 387
330extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 388extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
331extern void tty_ldisc_deref(struct tty_ldisc *); 389extern void tty_ldisc_deref(struct tty_ldisc *);
332extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *); 390extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *);
333 391extern const struct file_operations tty_ldiscs_proc_fops;
334extern struct tty_ldisc *tty_ldisc_get(int);
335extern void tty_ldisc_put(int);
336 392
337extern void tty_wakeup(struct tty_struct *tty); 393extern void tty_wakeup(struct tty_struct *tty);
338extern void tty_ldisc_flush(struct tty_struct *tty); 394extern void tty_ldisc_flush(struct tty_struct *tty);
@@ -344,6 +400,15 @@ extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
344extern dev_t tty_devnum(struct tty_struct *tty); 400extern dev_t tty_devnum(struct tty_struct *tty);
345extern void proc_clear_tty(struct task_struct *p); 401extern void proc_clear_tty(struct task_struct *p);
346extern struct tty_struct *get_current_tty(void); 402extern struct tty_struct *get_current_tty(void);
403extern void tty_default_fops(struct file_operations *fops);
404extern struct tty_struct *alloc_tty_struct(void);
405extern void free_tty_struct(struct tty_struct *tty);
406extern void initialize_tty_struct(struct tty_struct *tty,
407 struct tty_driver *driver, int idx);
408extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
409 int first_ok);
410extern void tty_release_dev(struct file *filp);
411extern int tty_init_termios(struct tty_struct *tty);
347 412
348extern struct mutex tty_mutex; 413extern struct mutex tty_mutex;
349 414
@@ -351,10 +416,25 @@ extern void tty_write_unlock(struct tty_struct *tty);
351extern int tty_write_lock(struct tty_struct *tty, int ndelay); 416extern int tty_write_lock(struct tty_struct *tty, int ndelay);
352#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) 417#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock))
353 418
419extern void tty_port_init(struct tty_port *port);
420extern int tty_port_alloc_xmit_buf(struct tty_port *port);
421extern void tty_port_free_xmit_buf(struct tty_port *port);
422extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
423extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
424
425extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
426extern int tty_unregister_ldisc(int disc);
427extern int tty_set_ldisc(struct tty_struct *tty, int ldisc);
428extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty);
429extern void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty);
430extern void tty_ldisc_init(struct tty_struct *tty);
431extern void tty_ldisc_begin(void);
432/* This last one is just for the tty layer internals and shouldn't be used elsewhere */
433extern void tty_ldisc_enable(struct tty_struct *tty);
354 434
355 435
356/* n_tty.c */ 436/* n_tty.c */
357extern struct tty_ldisc tty_ldisc_N_TTY; 437extern struct tty_ldisc_ops tty_ldisc_N_TTY;
358 438
359/* tty_audit.c */ 439/* tty_audit.c */
360#ifdef CONFIG_AUDIT 440#ifdef CONFIG_AUDIT
@@ -363,7 +443,8 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
363extern void tty_audit_exit(void); 443extern void tty_audit_exit(void);
364extern void tty_audit_fork(struct signal_struct *sig); 444extern void tty_audit_fork(struct signal_struct *sig);
365extern void tty_audit_push(struct tty_struct *tty); 445extern void tty_audit_push(struct tty_struct *tty);
366extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid); 446extern void tty_audit_push_task(struct task_struct *tsk,
447 uid_t loginuid, u32 sessionid);
367#else 448#else
368static inline void tty_audit_add_data(struct tty_struct *tty, 449static inline void tty_audit_add_data(struct tty_struct *tty,
369 unsigned char *data, size_t size) 450 unsigned char *data, size_t size)
@@ -378,19 +459,20 @@ static inline void tty_audit_fork(struct signal_struct *sig)
378static inline void tty_audit_push(struct tty_struct *tty) 459static inline void tty_audit_push(struct tty_struct *tty)
379{ 460{
380} 461}
381static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) 462static inline void tty_audit_push_task(struct task_struct *tsk,
463 uid_t loginuid, u32 sessionid)
382{ 464{
383} 465}
384#endif 466#endif
385 467
386/* tty_ioctl.c */ 468/* tty_ioctl.c */
387extern int n_tty_ioctl(struct tty_struct * tty, struct file * file, 469extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
388 unsigned int cmd, unsigned long arg); 470 unsigned int cmd, unsigned long arg);
389 471
390/* serial.c */ 472/* serial.c */
391 473
392extern void serial_console_init(void); 474extern void serial_console_init(void);
393 475
394/* pcxx.c */ 476/* pcxx.c */
395 477
396extern int pcxe_open(struct tty_struct *tty, struct file *filp); 478extern int pcxe_open(struct tty_struct *tty, struct file *filp);
@@ -401,7 +483,7 @@ extern void console_print(const char *);
401 483
402/* vt.c */ 484/* vt.c */
403 485
404extern int vt_ioctl(struct tty_struct *tty, struct file * file, 486extern int vt_ioctl(struct tty_struct *tty, struct file *file,
405 unsigned int cmd, unsigned long arg); 487 unsigned int cmd, unsigned long arg);
406 488
407#endif /* __KERNEL__ */ 489#endif /* __KERNEL__ */