Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
174cc1e5
Commit
174cc1e5
authored
Jun 11, 2003
by
Alexander Viro
Committed by
Linus Torvalds
Jun 11, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] tty_driver refcounting
drivers/char/vt.c converted to dynamic allocation
parent
51491305
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
33 deletions
+35
-33
drivers/char/tty_io.c
drivers/char/tty_io.c
+2
-2
drivers/char/vt.c
drivers/char/vt.c
+31
-29
drivers/char/vt_ioctl.c
drivers/char/vt_ioctl.c
+2
-2
No files found.
drivers/char/tty_io.c
View file @
174cc1e5
...
@@ -1322,8 +1322,8 @@ static int tty_open(struct inode * inode, struct file * filp)
...
@@ -1322,8 +1322,8 @@ static int tty_open(struct inode * inode, struct file * filp)
#ifdef CONFIG_VT
#ifdef CONFIG_VT
if
(
IS_CONSOLE_DEV
(
device
))
{
if
(
IS_CONSOLE_DEV
(
device
))
{
extern
int
fg_console
;
extern
int
fg_console
;
extern
struct
tty_driver
console_driver
;
extern
struct
tty_driver
*
console_driver
;
driver
=
&
console_driver
;
driver
=
console_driver
;
index
=
fg_console
;
index
=
fg_console
;
noctty
=
1
;
noctty
=
1
;
goto
got_driver
;
goto
got_driver
;
...
...
drivers/char/vt.c
View file @
174cc1e5
...
@@ -2185,12 +2185,12 @@ void vt_console_print(struct console *co, const char * b, unsigned count)
...
@@ -2185,12 +2185,12 @@ void vt_console_print(struct console *co, const char * b, unsigned count)
clear_bit
(
0
,
&
printing
);
clear_bit
(
0
,
&
printing
);
}
}
struct
tty_driver
console_driver
;
struct
tty_driver
*
console_driver
;
static
struct
tty_driver
*
vt_console_device
(
struct
console
*
c
,
int
*
index
)
static
struct
tty_driver
*
vt_console_device
(
struct
console
*
c
,
int
*
index
)
{
{
*
index
=
c
->
index
?
c
->
index
-
1
:
fg_console
;
*
index
=
c
->
index
?
c
->
index
-
1
:
fg_console
;
return
&
console_driver
;
return
console_driver
;
}
}
struct
console
vt_console_driver
=
{
struct
console
vt_console_driver
=
{
...
@@ -2522,35 +2522,37 @@ static int __init con_init(void)
...
@@ -2522,35 +2522,37 @@ static int __init con_init(void)
}
}
console_initcall
(
con_init
);
console_initcall
(
con_init
);
static
struct
tty_operations
con_ops
=
{
.
open
=
con_open
,
.
close
=
con_close
,
.
write
=
con_write
,
.
write_room
=
con_write_room
,
.
put_char
=
con_put_char
,
.
flush_chars
=
con_flush_chars
,
.
chars_in_buffer
=
con_chars_in_buffer
,
.
ioctl
=
vt_ioctl
,
.
stop
=
con_stop
,
.
start
=
con_start
,
.
throttle
=
con_throttle
,
.
unthrottle
=
con_unthrottle
,
};
int
__init
vty_init
(
void
)
int
__init
vty_init
(
void
)
{
{
memset
(
&
console_driver
,
0
,
sizeof
(
struct
tty_driver
));
console_driver
=
alloc_tty_driver
(
MAX_NR_CONSOLES
);
console_driver
.
magic
=
TTY_DRIVER_MAGIC
;
if
(
!
console_driver
)
console_driver
.
owner
=
THIS_MODULE
;
panic
(
"Couldn't allocate console driver
\n
"
);
console_driver
.
devfs_name
=
"vc/"
;
console_driver
->
owner
=
THIS_MODULE
;
console_driver
.
name
=
"tty"
;
console_driver
->
devfs_name
=
"vc/"
;
console_driver
.
name_base
=
1
;
console_driver
->
name
=
"tty"
;
console_driver
.
major
=
TTY_MAJOR
;
console_driver
->
name_base
=
1
;
console_driver
.
minor_start
=
1
;
console_driver
->
major
=
TTY_MAJOR
;
console_driver
.
num
=
MAX_NR_CONSOLES
;
console_driver
->
minor_start
=
1
;
console_driver
.
type
=
TTY_DRIVER_TYPE_CONSOLE
;
console_driver
->
type
=
TTY_DRIVER_TYPE_CONSOLE
;
console_driver
.
init_termios
=
tty_std_termios
;
console_driver
->
init_termios
=
tty_std_termios
;
console_driver
.
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_RESET_TERMIOS
;
console_driver
->
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_RESET_TERMIOS
;
tty_set_operations
(
console_driver
,
&
con_ops
);
console_driver
.
open
=
con_open
;
if
(
tty_register_driver
(
console_driver
))
console_driver
.
close
=
con_close
;
console_driver
.
write
=
con_write
;
console_driver
.
write_room
=
con_write_room
;
console_driver
.
put_char
=
con_put_char
;
console_driver
.
flush_chars
=
con_flush_chars
;
console_driver
.
chars_in_buffer
=
con_chars_in_buffer
;
console_driver
.
ioctl
=
vt_ioctl
;
console_driver
.
stop
=
con_stop
;
console_driver
.
start
=
con_start
;
console_driver
.
throttle
=
con_throttle
;
console_driver
.
unthrottle
=
con_unthrottle
;
if
(
tty_register_driver
(
&
console_driver
))
panic
(
"Couldn't register console driver
\n
"
);
panic
(
"Couldn't register console driver
\n
"
);
kbd_init
();
kbd_init
();
...
...
drivers/char/vt_ioctl.c
View file @
174cc1e5
...
@@ -34,9 +34,9 @@
...
@@ -34,9 +34,9 @@
#include <linux/selection.h>
#include <linux/selection.h>
char
vt_dont_switch
;
char
vt_dont_switch
;
extern
struct
tty_driver
console_driver
;
extern
struct
tty_driver
*
console_driver
;
#define VT_IS_IN_USE(i) (console_driver
.ttys[i] && console_driver.
ttys[i]->count)
#define VT_IS_IN_USE(i) (console_driver
->ttys[i] && console_driver->
ttys[i]->count)
#define VT_BUSY(i) (VT_IS_IN_USE(i) || i == fg_console || i == sel_cons)
#define VT_BUSY(i) (VT_IS_IN_USE(i) || i == fg_console || i == sel_cons)
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment