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
Kirill Smelkov
linux
Commits
ea1c089f
Commit
ea1c089f
authored
Apr 07, 2003
by
Alan Cox
Committed by
Linus Torvalds
Apr 07, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] update slip to new tty module locks
parent
49835944
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
30 deletions
+16
-30
drivers/net/slip.c
drivers/net/slip.c
+16
-30
No files found.
drivers/net/slip.c
View file @
ea1c089f
...
@@ -836,8 +836,6 @@ slip_open(struct tty_struct *tty)
...
@@ -836,8 +836,6 @@ slip_open(struct tty_struct *tty)
if
(
!
capable
(
CAP_NET_ADMIN
))
if
(
!
capable
(
CAP_NET_ADMIN
))
return
-
EPERM
;
return
-
EPERM
;
MOD_INC_USE_COUNT
;
/* RTnetlink lock is misused here to serialize concurrent
/* RTnetlink lock is misused here to serialize concurrent
opens of slip channels. There are better ways, but it is
opens of slip channels. There are better ways, but it is
the simplest one.
the simplest one.
...
@@ -905,7 +903,6 @@ slip_open(struct tty_struct *tty)
...
@@ -905,7 +903,6 @@ slip_open(struct tty_struct *tty)
rtnl_unlock
();
rtnl_unlock
();
/* Count references from TTY module */
/* Count references from TTY module */
MOD_DEC_USE_COUNT
;
return
err
;
return
err
;
}
}
...
@@ -953,7 +950,6 @@ slip_close(struct tty_struct *tty)
...
@@ -953,7 +950,6 @@ slip_close(struct tty_struct *tty)
#endif
#endif
/* Count references from TTY module */
/* Count references from TTY module */
MOD_DEC_USE_COUNT
;
}
}
/************************************************************************
/************************************************************************
...
@@ -1122,8 +1118,7 @@ slip_unesc6(struct slip *sl, unsigned char s)
...
@@ -1122,8 +1118,7 @@ slip_unesc6(struct slip *sl, unsigned char s)
#endif
/* CONFIG_SLIP_MODE_SLIP6 */
#endif
/* CONFIG_SLIP_MODE_SLIP6 */
/* Perform I/O control on an active SLIP channel. */
/* Perform I/O control on an active SLIP channel. */
static
int
static
int
slip_ioctl
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
slip_ioctl
(
struct
tty_struct
*
tty
,
void
*
file
,
int
cmd
,
void
*
arg
)
{
{
struct
slip
*
sl
=
(
struct
slip
*
)
tty
->
disc_data
;
struct
slip
*
sl
=
(
struct
slip
*
)
tty
->
disc_data
;
unsigned
int
tmp
;
unsigned
int
tmp
;
...
@@ -1135,11 +1130,8 @@ slip_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
...
@@ -1135,11 +1130,8 @@ slip_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
switch
(
cmd
)
{
switch
(
cmd
)
{
case
SIOCGIFNAME
:
case
SIOCGIFNAME
:
/* Please, do not put this line under copy_to_user,
it breaks my old poor gcc on alpha --ANK
*/
tmp
=
strlen
(
sl
->
dev
->
name
)
+
1
;
tmp
=
strlen
(
sl
->
dev
->
name
)
+
1
;
if
(
copy_to_user
(
arg
,
sl
->
dev
->
name
,
tmp
))
if
(
copy_to_user
(
(
void
*
)
arg
,
sl
->
dev
->
name
,
tmp
))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
...
@@ -1230,7 +1222,7 @@ slip_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
...
@@ -1230,7 +1222,7 @@ slip_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
/* Allow stty to read, but not set, the serial port */
/* Allow stty to read, but not set, the serial port */
case
TCGETS
:
case
TCGETS
:
case
TCGETA
:
case
TCGETA
:
return
n_tty_ioctl
(
tty
,
(
struct
file
*
)
file
,
cmd
,
(
unsigned
long
)
arg
);
return
n_tty_ioctl
(
tty
,
file
,
cmd
,
arg
);
default:
default:
return
-
ENOIOCTLCMD
;
return
-
ENOIOCTLCMD
;
...
@@ -1349,34 +1341,28 @@ int __init slip_init_ctrl_dev(void)
...
@@ -1349,34 +1341,28 @@ int __init slip_init_ctrl_dev(void)
memset
(
slip_ctrls
,
0
,
sizeof
(
void
*
)
*
slip_maxdev
);
/* Pointers */
memset
(
slip_ctrls
,
0
,
sizeof
(
void
*
)
*
slip_maxdev
);
/* Pointers */
/* Fill in our line protocol discipline, and register it */
/* Fill in our line protocol discipline, and register it */
memset
(
&
sl_ldisc
,
0
,
sizeof
(
sl_ldisc
));
sl_ldisc
.
magic
=
TTY_LDISC_MAGIC
;
sl_ldisc
.
name
=
"slip"
;
sl_ldisc
.
flags
=
0
;
sl_ldisc
.
open
=
slip_open
;
sl_ldisc
.
close
=
slip_close
;
sl_ldisc
.
read
=
NULL
;
sl_ldisc
.
write
=
NULL
;
sl_ldisc
.
ioctl
=
(
int
(
*
)(
struct
tty_struct
*
,
struct
file
*
,
unsigned
int
,
unsigned
long
))
slip_ioctl
;
sl_ldisc
.
poll
=
NULL
;
sl_ldisc
.
receive_buf
=
slip_receive_buf
;
sl_ldisc
.
receive_room
=
slip_receive_room
;
sl_ldisc
.
write_wakeup
=
slip_write_wakeup
;
if
((
status
=
tty_register_ldisc
(
N_SLIP
,
&
sl_ldisc
))
!=
0
)
{
if
((
status
=
tty_register_ldisc
(
N_SLIP
,
&
sl_ldisc
))
!=
0
)
{
printk
(
KERN_ERR
"SLIP: can't register line discipline (err = %d)
\n
"
,
status
);
printk
(
KERN_ERR
"SLIP: can't register line discipline (err = %d)
\n
"
,
status
);
}
}
return
status
;
return
status
;
}
}
static
struct
tty_ldisc
sl_ldisc
=
{
.
owner
=
THIS_MODULE
,
.
magic
=
TTY_LDISC_MAGIC
,
.
name
=
"slip"
,
.
open
=
slip_open
,
.
close
=
slip_close
,
.
ioctl
=
slip_ioctl
,
.
receive_buf
=
slip_receive_buf
,
.
receive_room
=
slip_receive_room
,
.
write_wakeup
=
slip_write_wakeup
,
};
#ifdef MODULE
#ifdef MODULE
int
int
init_module
(
void
)
init_module
(
void
)
{
{
return
slip_init_ctrl_dev
();
return
slip_init_ctrl_dev
();
}
}
...
...
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