aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-16 16:54:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:12:36 -0400
commit7a4d29f426f17479395980ded8fa5e3bdd6d94e4 (patch)
tree1a5464e4633264f91045a0813f407dca88136523 /include
parenta88487c79bfefb715030c5baa68fbedc1b8732e8 (diff)
tty.h: clean up
Coding style clean up and white space tidy Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/tty.h165
1 files changed, 85 insertions, 80 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h
index d7c695b65c0e..46008e86b191 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -71,7 +71,8 @@ struct tty_bufhead {
71 struct tty_buffer *head; /* Queue head */ 71 struct tty_buffer *head; /* Queue head */
72 struct tty_buffer *tail; /* Active buffer */ 72 struct tty_buffer *tail; /* Active buffer */
73 struct tty_buffer *free; /* Free queue head */ 73 struct tty_buffer *free; /* Free queue head */
74 int memory_used; /* Buffer space used excluding free queue */ 74 int memory_used; /* Buffer space used excluding
75 free queue */
75}; 76};
76/* 77/*
77 * When a break, frame error, or parity error happens, these codes are 78 * When a break, frame error, or parity error happens, these codes are
@@ -101,68 +102,68 @@ struct tty_bufhead {
101#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT]) 102#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT])
102#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2]) 103#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2])
103 104
104#define _I_FLAG(tty,f) ((tty)->termios->c_iflag & (f)) 105#define _I_FLAG(tty, f) ((tty)->termios->c_iflag & (f))
105#define _O_FLAG(tty,f) ((tty)->termios->c_oflag & (f)) 106#define _O_FLAG(tty, f) ((tty)->termios->c_oflag & (f))
106#define _C_FLAG(tty,f) ((tty)->termios->c_cflag & (f)) 107#define _C_FLAG(tty, f) ((tty)->termios->c_cflag & (f))
107#define _L_FLAG(tty,f) ((tty)->termios->c_lflag & (f)) 108#define _L_FLAG(tty, f) ((tty)->termios->c_lflag & (f))
108 109
109#define I_IGNBRK(tty) _I_FLAG((tty),IGNBRK) 110#define I_IGNBRK(tty) _I_FLAG((tty), IGNBRK)
110#define I_BRKINT(tty) _I_FLAG((tty),BRKINT) 111#define I_BRKINT(tty) _I_FLAG((tty), BRKINT)
111#define I_IGNPAR(tty) _I_FLAG((tty),IGNPAR) 112#define I_IGNPAR(tty) _I_FLAG((tty), IGNPAR)
112#define I_PARMRK(tty) _I_FLAG((tty),PARMRK) 113#define I_PARMRK(tty) _I_FLAG((tty), PARMRK)
113#define I_INPCK(tty) _I_FLAG((tty),INPCK) 114#define I_INPCK(tty) _I_FLAG((tty), INPCK)
114#define I_ISTRIP(tty) _I_FLAG((tty),ISTRIP) 115#define I_ISTRIP(tty) _I_FLAG((tty), ISTRIP)
115#define I_INLCR(tty) _I_FLAG((tty),INLCR) 116#define I_INLCR(tty) _I_FLAG((tty), INLCR)
116#define I_IGNCR(tty) _I_FLAG((tty),IGNCR) 117#define I_IGNCR(tty) _I_FLAG((tty), IGNCR)
117#define I_ICRNL(tty) _I_FLAG((tty),ICRNL) 118#define I_ICRNL(tty) _I_FLAG((tty), ICRNL)
118#define I_IUCLC(tty) _I_FLAG((tty),IUCLC) 119#define I_IUCLC(tty) _I_FLAG((tty), IUCLC)
119#define I_IXON(tty) _I_FLAG((tty),IXON) 120#define I_IXON(tty) _I_FLAG((tty), IXON)
120#define I_IXANY(tty) _I_FLAG((tty),IXANY) 121#define I_IXANY(tty) _I_FLAG((tty), IXANY)
121#define I_IXOFF(tty) _I_FLAG((tty),IXOFF) 122#define I_IXOFF(tty) _I_FLAG((tty), IXOFF)
122#define I_IMAXBEL(tty) _I_FLAG((tty),IMAXBEL) 123#define I_IMAXBEL(tty) _I_FLAG((tty), IMAXBEL)
123#define I_IUTF8(tty) _I_FLAG((tty),IUTF8) 124#define I_IUTF8(tty) _I_FLAG((tty), IUTF8)
124 125
125#define O_OPOST(tty) _O_FLAG((tty),OPOST) 126#define O_OPOST(tty) _O_FLAG((tty), OPOST)
126#define O_OLCUC(tty) _O_FLAG((tty),OLCUC) 127#define O_OLCUC(tty) _O_FLAG((tty), OLCUC)
127#define O_ONLCR(tty) _O_FLAG((tty),ONLCR) 128#define O_ONLCR(tty) _O_FLAG((tty), ONLCR)
128#define O_OCRNL(tty) _O_FLAG((tty),OCRNL) 129#define O_OCRNL(tty) _O_FLAG((tty), OCRNL)
129#define O_ONOCR(tty) _O_FLAG((tty),ONOCR) 130#define O_ONOCR(tty) _O_FLAG((tty), ONOCR)
130#define O_ONLRET(tty) _O_FLAG((tty),ONLRET) 131#define O_ONLRET(tty) _O_FLAG((tty), ONLRET)
131#define O_OFILL(tty) _O_FLAG((tty),OFILL) 132#define O_OFILL(tty) _O_FLAG((tty), OFILL)
132#define O_OFDEL(tty) _O_FLAG((tty),OFDEL) 133#define O_OFDEL(tty) _O_FLAG((tty), OFDEL)
133#define O_NLDLY(tty) _O_FLAG((tty),NLDLY) 134#define O_NLDLY(tty) _O_FLAG((tty), NLDLY)
134#define O_CRDLY(tty) _O_FLAG((tty),CRDLY) 135#define O_CRDLY(tty) _O_FLAG((tty), CRDLY)
135#define O_TABDLY(tty) _O_FLAG((tty),TABDLY) 136#define O_TABDLY(tty) _O_FLAG((tty), TABDLY)
136#define O_BSDLY(tty) _O_FLAG((tty),BSDLY) 137#define O_BSDLY(tty) _O_FLAG((tty), BSDLY)
137#define O_VTDLY(tty) _O_FLAG((tty),VTDLY) 138#define O_VTDLY(tty) _O_FLAG((tty), VTDLY)
138#define O_FFDLY(tty) _O_FLAG((tty),FFDLY) 139#define O_FFDLY(tty) _O_FLAG((tty), FFDLY)
139 140
140#define C_BAUD(tty) _C_FLAG((tty),CBAUD) 141#define C_BAUD(tty) _C_FLAG((tty), CBAUD)
141#define C_CSIZE(tty) _C_FLAG((tty),CSIZE) 142#define C_CSIZE(tty) _C_FLAG((tty), CSIZE)
142#define C_CSTOPB(tty) _C_FLAG((tty),CSTOPB) 143#define C_CSTOPB(tty) _C_FLAG((tty), CSTOPB)
143#define C_CREAD(tty) _C_FLAG((tty),CREAD) 144#define C_CREAD(tty) _C_FLAG((tty), CREAD)
144#define C_PARENB(tty) _C_FLAG((tty),PARENB) 145#define C_PARENB(tty) _C_FLAG((tty), PARENB)
145#define C_PARODD(tty) _C_FLAG((tty),PARODD) 146#define C_PARODD(tty) _C_FLAG((tty), PARODD)
146#define C_HUPCL(tty) _C_FLAG((tty),HUPCL) 147#define C_HUPCL(tty) _C_FLAG((tty), HUPCL)
147#define C_CLOCAL(tty) _C_FLAG((tty),CLOCAL) 148#define C_CLOCAL(tty) _C_FLAG((tty), CLOCAL)
148#define C_CIBAUD(tty) _C_FLAG((tty),CIBAUD) 149#define C_CIBAUD(tty) _C_FLAG((tty), CIBAUD)
149#define C_CRTSCTS(tty) _C_FLAG((tty),CRTSCTS) 150#define C_CRTSCTS(tty) _C_FLAG((tty), CRTSCTS)
150 151
151#define L_ISIG(tty) _L_FLAG((tty),ISIG) 152#define L_ISIG(tty) _L_FLAG((tty), ISIG)
152#define L_ICANON(tty) _L_FLAG((tty),ICANON) 153#define L_ICANON(tty) _L_FLAG((tty), ICANON)
153#define L_XCASE(tty) _L_FLAG((tty),XCASE) 154#define L_XCASE(tty) _L_FLAG((tty), XCASE)
154#define L_ECHO(tty) _L_FLAG((tty),ECHO) 155#define L_ECHO(tty) _L_FLAG((tty), ECHO)
155#define L_ECHOE(tty) _L_FLAG((tty),ECHOE) 156#define L_ECHOE(tty) _L_FLAG((tty), ECHOE)
156#define L_ECHOK(tty) _L_FLAG((tty),ECHOK) 157#define L_ECHOK(tty) _L_FLAG((tty), ECHOK)
157#define L_ECHONL(tty) _L_FLAG((tty),ECHONL) 158#define L_ECHONL(tty) _L_FLAG((tty), ECHONL)
158#define L_NOFLSH(tty) _L_FLAG((tty),NOFLSH) 159#define L_NOFLSH(tty) _L_FLAG((tty), NOFLSH)
159#define L_TOSTOP(tty) _L_FLAG((tty),TOSTOP) 160#define L_TOSTOP(tty) _L_FLAG((tty), TOSTOP)
160#define L_ECHOCTL(tty) _L_FLAG((tty),ECHOCTL) 161#define L_ECHOCTL(tty) _L_FLAG((tty), ECHOCTL)
161#define L_ECHOPRT(tty) _L_FLAG((tty),ECHOPRT) 162#define L_ECHOPRT(tty) _L_FLAG((tty), ECHOPRT)
162#define L_ECHOKE(tty) _L_FLAG((tty),ECHOKE) 163#define L_ECHOKE(tty) _L_FLAG((tty), ECHOKE)
163#define L_FLUSHO(tty) _L_FLAG((tty),FLUSHO) 164#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO)
164#define L_PENDIN(tty) _L_FLAG((tty),PENDIN) 165#define L_PENDIN(tty) _L_FLAG((tty), PENDIN)
165#define L_IEXTEN(tty) _L_FLAG((tty),IEXTEN) 166#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN)
166 167
167struct device; 168struct device;
168struct signal_struct; 169struct signal_struct;
@@ -177,7 +178,7 @@ struct signal_struct;
177 * of the tty object but in many cases port -> tty mappings are valid only 178 * of the tty object but in many cases port -> tty mappings are valid only
178 * until a hangup so don't use the wrong path. 179 * until a hangup so don't use the wrong path.
179 */ 180 */
180 181
181struct tty_port { 182struct tty_port {
182 struct tty_struct *tty; /* Back pointer */ 183 struct tty_struct *tty; /* Back pointer */
183 int blocked_open; /* Waiting to open */ 184 int blocked_open; /* Waiting to open */
@@ -273,14 +274,14 @@ struct tty_struct {
273 274
274/* 275/*
275 * These bits are used in the flags field of the tty structure. 276 * These bits are used in the flags field of the tty structure.
276 * 277 *
277 * So that interrupts won't be able to mess up the queues, 278 * So that interrupts won't be able to mess up the queues,
278 * copy_to_cooked must be atomic with respect to itself, as must 279 * copy_to_cooked must be atomic with respect to itself, as must
279 * tty->write. Thus, you must use the inline functions set_bit() and 280 * tty->write. Thus, you must use the inline functions set_bit() and
280 * clear_bit() to make things atomic. 281 * clear_bit() to make things atomic.
281 */ 282 */
282#define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */ 283#define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */
283#define TTY_IO_ERROR 1 /* Canse an I/O error (may be no ldisc too) */ 284#define TTY_IO_ERROR 1 /* Cause an I/O error (may be no ldisc too) */
284#define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */ 285#define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */
285#define TTY_EXCLUSIVE 3 /* Exclusive open mode */ 286#define TTY_EXCLUSIVE 3 /* Exclusive open mode */
286#define TTY_DEBUG 4 /* Debugging */ 287#define TTY_DEBUG 4 /* Debugging */
@@ -310,10 +311,10 @@ extern int vcs_init(void);
310extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, 311extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
311 const char *routine); 312 const char *routine);
312extern char *tty_name(struct tty_struct *tty, char *buf); 313extern char *tty_name(struct tty_struct *tty, char *buf);
313extern void tty_wait_until_sent(struct tty_struct * tty, long timeout); 314extern void tty_wait_until_sent(struct tty_struct *tty, long timeout);
314extern int tty_check_change(struct tty_struct * tty); 315extern int tty_check_change(struct tty_struct *tty);
315extern void stop_tty(struct tty_struct * tty); 316extern void stop_tty(struct tty_struct *tty);
316extern void start_tty(struct tty_struct * tty); 317extern void start_tty(struct tty_struct *tty);
317extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); 318extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
318extern int tty_unregister_ldisc(int disc); 319extern int tty_unregister_ldisc(int disc);
319extern int tty_register_driver(struct tty_driver *driver); 320extern int tty_register_driver(struct tty_driver *driver);
@@ -335,10 +336,10 @@ extern int is_current_pgrp_orphaned(void);
335extern struct pid *tty_get_pgrp(struct tty_struct *tty); 336extern struct pid *tty_get_pgrp(struct tty_struct *tty);
336extern int is_ignored(int sig); 337extern int is_ignored(int sig);
337extern int tty_signal(int sig, struct tty_struct *tty); 338extern int tty_signal(int sig, struct tty_struct *tty);
338extern void tty_hangup(struct tty_struct * tty); 339extern void tty_hangup(struct tty_struct *tty);
339extern void tty_vhangup(struct tty_struct * tty); 340extern void tty_vhangup(struct tty_struct *tty);
340extern void tty_unhangup(struct file *filp); 341extern void tty_unhangup(struct file *filp);
341extern int tty_hung_up_p(struct file * filp); 342extern int tty_hung_up_p(struct file *filp);
342extern void do_SAK(struct tty_struct *tty); 343extern void do_SAK(struct tty_struct *tty);
343extern void __do_SAK(struct tty_struct *tty); 344extern void __do_SAK(struct tty_struct *tty);
344extern void disassociate_ctty(int priv); 345extern void disassociate_ctty(int priv);
@@ -347,8 +348,10 @@ extern void tty_flip_buffer_push(struct tty_struct *tty);
347extern speed_t tty_get_baud_rate(struct tty_struct *tty); 348extern speed_t tty_get_baud_rate(struct tty_struct *tty);
348extern speed_t tty_termios_baud_rate(struct ktermios *termios); 349extern speed_t tty_termios_baud_rate(struct ktermios *termios);
349extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 350extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
350extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud); 351extern void tty_termios_encode_baud_rate(struct ktermios *termios,
351extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud); 352 speed_t ibaud, speed_t obaud);
353extern void tty_encode_baud_rate(struct tty_struct *tty,
354 speed_t ibaud, speed_t obaud);
352extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 355extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
353extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); 356extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
354 357
@@ -390,7 +393,8 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
390extern void tty_audit_exit(void); 393extern void tty_audit_exit(void);
391extern void tty_audit_fork(struct signal_struct *sig); 394extern void tty_audit_fork(struct signal_struct *sig);
392extern void tty_audit_push(struct tty_struct *tty); 395extern void tty_audit_push(struct tty_struct *tty);
393extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid); 396extern void tty_audit_push_task(struct task_struct *tsk,
397 uid_t loginuid, u32 sessionid);
394#else 398#else
395static inline void tty_audit_add_data(struct tty_struct *tty, 399static inline void tty_audit_add_data(struct tty_struct *tty,
396 unsigned char *data, size_t size) 400 unsigned char *data, size_t size)
@@ -405,19 +409,20 @@ static inline void tty_audit_fork(struct signal_struct *sig)
405static inline void tty_audit_push(struct tty_struct *tty) 409static inline void tty_audit_push(struct tty_struct *tty)
406{ 410{
407} 411}
408static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) 412static inline void tty_audit_push_task(struct task_struct *tsk,
413 uid_t loginuid, u32 sessionid)
409{ 414{
410} 415}
411#endif 416#endif
412 417
413/* tty_ioctl.c */ 418/* tty_ioctl.c */
414extern int n_tty_ioctl(struct tty_struct * tty, struct file * file, 419extern int n_tty_ioctl(struct tty_struct *tty, struct file *file,
415 unsigned int cmd, unsigned long arg); 420 unsigned int cmd, unsigned long arg);
416 421
417/* serial.c */ 422/* serial.c */
418 423
419extern void serial_console_init(void); 424extern void serial_console_init(void);
420 425
421/* pcxx.c */ 426/* pcxx.c */
422 427
423extern int pcxe_open(struct tty_struct *tty, struct file *filp); 428extern int pcxe_open(struct tty_struct *tty, struct file *filp);
@@ -428,7 +433,7 @@ extern void console_print(const char *);
428 433
429/* vt.c */ 434/* vt.c */
430 435
431extern int vt_ioctl(struct tty_struct *tty, struct file * file, 436extern int vt_ioctl(struct tty_struct *tty, struct file *file,
432 unsigned int cmd, unsigned long arg); 437 unsigned int cmd, unsigned long arg);
433 438
434#endif /* __KERNEL__ */ 439#endif /* __KERNEL__ */