diff options
author | Joe Millenbach <jmillenbach@gmail.com> | 2013-01-18 01:44:22 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-18 19:15:27 -0500 |
commit | 4f73bc4dd3e8563ef4109f293a092820dff66d92 (patch) | |
tree | 8ebd5d01abaceb70da1932db1a5e7219630b0fd3 /include/linux | |
parent | a1bf9584429d61b7096f93ae09325e1ba538e9e8 (diff) |
tty: Added a CONFIG_TTY option to allow removal of TTY
The option allows you to remove TTY and compile without errors. This
saves space on systems that won't support TTY interfaces anyway.
bloat-o-meter output is below.
The bulk of this patch consists of Kconfig changes adding "depends on
TTY" to various serial devices and similar drivers that require the TTY
layer. Ideally, these dependencies would occur on a common intermediate
symbol such as SERIO, but most drivers "select SERIO" rather than
"depends on SERIO", and "select" does not respect dependencies.
bloat-o-meter output comparing our previous minimal to new minimal by
removing TTY. The list is filtered to not show removed entries with awk
'$3 != "-"' as the list was very long.
add/remove: 0/226 grow/shrink: 2/14 up/down: 6/-35356 (-35350)
function old new delta
chr_dev_init 166 170 +4
allow_signal 80 82 +2
static.__warned 143 142 -1
disallow_signal 63 62 -1
__set_special_pids 95 94 -1
unregister_console 126 121 -5
start_kernel 546 541 -5
register_console 593 588 -5
copy_from_user 45 40 -5
sys_setsid 128 120 -8
sys_vhangup 32 19 -13
do_exit 1543 1526 -17
bitmap_zero 60 40 -20
arch_local_irq_save 137 117 -20
release_task 674 652 -22
static.spin_unlock_irqrestore 308 260 -48
Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/console.h | 5 | ||||
-rw-r--r-- | include/linux/proc_fs.h | 5 | ||||
-rw-r--r-- | include/linux/tty.h | 44 |
3 files changed, 43 insertions, 11 deletions
diff --git a/include/linux/console.h b/include/linux/console.h index dedb082fe50f..3b709da1786e 100644 --- a/include/linux/console.h +++ b/include/linux/console.h | |||
@@ -157,7 +157,12 @@ extern int is_console_locked(void); | |||
157 | extern int braille_register_console(struct console *, int index, | 157 | extern int braille_register_console(struct console *, int index, |
158 | char *console_options, char *braille_options); | 158 | char *console_options, char *braille_options); |
159 | extern int braille_unregister_console(struct console *); | 159 | extern int braille_unregister_console(struct console *); |
160 | #ifdef CONFIG_TTY | ||
160 | extern void console_sysfs_notify(void); | 161 | extern void console_sysfs_notify(void); |
162 | #else | ||
163 | static inline void console_sysfs_notify(void) | ||
164 | { } | ||
165 | #endif | ||
161 | extern bool console_suspend_enabled; | 166 | extern bool console_suspend_enabled; |
162 | 167 | ||
163 | /* Suspend and resume console messages over PM events */ | 168 | /* Suspend and resume console messages over PM events */ |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 32676b35d2f5..3c22538aab66 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -127,7 +127,12 @@ extern void pid_ns_release_proc(struct pid_namespace *ns); | |||
127 | * proc_tty.c | 127 | * proc_tty.c |
128 | */ | 128 | */ |
129 | struct tty_driver; | 129 | struct tty_driver; |
130 | #ifdef CONFIG_TTY | ||
130 | extern void proc_tty_init(void); | 131 | extern void proc_tty_init(void); |
132 | #else | ||
133 | static inline void proc_tty_init(void) | ||
134 | { } | ||
135 | #endif | ||
131 | extern void proc_tty_register_driver(struct tty_driver *driver); | 136 | extern void proc_tty_register_driver(struct tty_driver *driver); |
132 | extern void proc_tty_unregister_driver(struct tty_driver *driver); | 137 | extern void proc_tty_unregister_driver(struct tty_driver *driver); |
133 | 138 | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index f89acd1ed6d3..c75d886b0307 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -318,11 +318,43 @@ struct tty_file_private { | |||
318 | 318 | ||
319 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) | 319 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) |
320 | 320 | ||
321 | #ifdef CONFIG_TTY | ||
322 | extern void console_init(void); | ||
323 | extern void tty_kref_put(struct tty_struct *tty); | ||
324 | extern struct pid *tty_get_pgrp(struct tty_struct *tty); | ||
325 | extern void tty_vhangup_self(void); | ||
326 | extern void disassociate_ctty(int priv); | ||
327 | extern dev_t tty_devnum(struct tty_struct *tty); | ||
328 | extern void proc_clear_tty(struct task_struct *p); | ||
329 | extern struct tty_struct *get_current_tty(void); | ||
330 | /* tty_io.c */ | ||
331 | extern int __init tty_init(void); | ||
332 | #else | ||
333 | static inline void console_init(void) | ||
334 | { } | ||
335 | static inline void tty_kref_put(struct tty_struct *tty) | ||
336 | { } | ||
337 | static inline struct pid *tty_get_pgrp(struct tty_struct *tty) | ||
338 | { return NULL; } | ||
339 | static inline void tty_vhangup_self(void) | ||
340 | { } | ||
341 | static inline void disassociate_ctty(int priv) | ||
342 | { } | ||
343 | static inline dev_t tty_devnum(struct tty_struct *tty) | ||
344 | { return 0; } | ||
345 | static inline void proc_clear_tty(struct task_struct *p) | ||
346 | { } | ||
347 | static inline struct tty_struct *get_current_tty(void) | ||
348 | { return NULL; } | ||
349 | /* tty_io.c */ | ||
350 | static inline int __init tty_init(void) | ||
351 | { return 0; } | ||
352 | #endif | ||
353 | |||
321 | extern void tty_write_flush(struct tty_struct *); | 354 | extern void tty_write_flush(struct tty_struct *); |
322 | 355 | ||
323 | extern struct ktermios tty_std_termios; | 356 | extern struct ktermios tty_std_termios; |
324 | 357 | ||
325 | extern void console_init(void); | ||
326 | extern int vcs_init(void); | 358 | extern int vcs_init(void); |
327 | 359 | ||
328 | extern struct class *tty_class; | 360 | extern struct class *tty_class; |
@@ -342,7 +374,6 @@ static inline struct tty_struct *tty_kref_get(struct tty_struct *tty) | |||
342 | kref_get(&tty->kref); | 374 | kref_get(&tty->kref); |
343 | return tty; | 375 | return tty; |
344 | } | 376 | } |
345 | extern void tty_kref_put(struct tty_struct *tty); | ||
346 | 377 | ||
347 | extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, | 378 | extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, |
348 | const char *routine); | 379 | const char *routine); |
@@ -374,18 +405,15 @@ extern void tty_driver_remove_tty(struct tty_driver *driver, | |||
374 | struct tty_struct *tty); | 405 | struct tty_struct *tty); |
375 | extern void tty_free_termios(struct tty_struct *tty); | 406 | extern void tty_free_termios(struct tty_struct *tty); |
376 | extern int is_current_pgrp_orphaned(void); | 407 | extern int is_current_pgrp_orphaned(void); |
377 | extern struct pid *tty_get_pgrp(struct tty_struct *tty); | ||
378 | extern int is_ignored(int sig); | 408 | extern int is_ignored(int sig); |
379 | extern int tty_signal(int sig, struct tty_struct *tty); | 409 | extern int tty_signal(int sig, struct tty_struct *tty); |
380 | extern void tty_hangup(struct tty_struct *tty); | 410 | extern void tty_hangup(struct tty_struct *tty); |
381 | extern void tty_vhangup(struct tty_struct *tty); | 411 | extern void tty_vhangup(struct tty_struct *tty); |
382 | extern void tty_vhangup_locked(struct tty_struct *tty); | 412 | extern void tty_vhangup_locked(struct tty_struct *tty); |
383 | extern void tty_vhangup_self(void); | ||
384 | extern void tty_unhangup(struct file *filp); | 413 | extern void tty_unhangup(struct file *filp); |
385 | extern int tty_hung_up_p(struct file *filp); | 414 | extern int tty_hung_up_p(struct file *filp); |
386 | extern void do_SAK(struct tty_struct *tty); | 415 | extern void do_SAK(struct tty_struct *tty); |
387 | extern void __do_SAK(struct tty_struct *tty); | 416 | extern void __do_SAK(struct tty_struct *tty); |
388 | extern void disassociate_ctty(int priv); | ||
389 | extern void no_tty(void); | 417 | extern void no_tty(void); |
390 | extern void tty_flush_to_ldisc(struct tty_struct *tty); | 418 | extern void tty_flush_to_ldisc(struct tty_struct *tty); |
391 | extern void tty_buffer_free_all(struct tty_port *port); | 419 | extern void tty_buffer_free_all(struct tty_port *port); |
@@ -415,9 +443,6 @@ extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | |||
415 | extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, | 443 | extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, |
416 | unsigned int cmd, unsigned long arg); | 444 | unsigned int cmd, unsigned long arg); |
417 | extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); | 445 | extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); |
418 | extern dev_t tty_devnum(struct tty_struct *tty); | ||
419 | extern void proc_clear_tty(struct task_struct *p); | ||
420 | extern struct tty_struct *get_current_tty(void); | ||
421 | extern void tty_default_fops(struct file_operations *fops); | 446 | extern void tty_default_fops(struct file_operations *fops); |
422 | extern struct tty_struct *alloc_tty_struct(void); | 447 | extern struct tty_struct *alloc_tty_struct(void); |
423 | extern int tty_alloc_file(struct file *file); | 448 | extern int tty_alloc_file(struct file *file); |
@@ -543,9 +568,6 @@ static inline int tty_audit_push_task(struct task_struct *tsk, | |||
543 | } | 568 | } |
544 | #endif | 569 | #endif |
545 | 570 | ||
546 | /* tty_io.c */ | ||
547 | extern int __init tty_init(void); | ||
548 | |||
549 | /* tty_ioctl.c */ | 571 | /* tty_ioctl.c */ |
550 | extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, | 572 | extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, |
551 | unsigned int cmd, unsigned long arg); | 573 | unsigned int cmd, unsigned long arg); |