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
c6f03202
Commit
c6f03202
authored
Sep 25, 2003
by
Chas Williams
Committed by
David S. Miller
Sep 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ATM]: Use new ioctl code for lane [3/3]
parent
526d13dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
96 deletions
+43
-96
net/atm/ioctl.c
net/atm/ioctl.c
+3
-72
net/atm/lec.c
net/atm/lec.c
+40
-12
net/atm/lec.h
net/atm/lec.h
+0
-12
No files found.
net/atm/ioctl.c
View file @
c6f03202
...
...
@@ -16,42 +16,12 @@
#include <linux/atmsvc.h>
#include <linux/atmmpc.h>
#include <net/atmclip.h>
#include <linux/atmlec.h>
#include <asm/ioctls.h>
#include "resources.h"
#include "signaling.h"
/* for WAITING and sigd_attach */
#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
#include <linux/atmlec.h>
#include "lec.h"
#include "lec_arpc.h"
struct
atm_lane_ops
*
atm_lane_ops
;
static
DECLARE_MUTEX
(
atm_lane_ops_mutex
);
void
atm_lane_ops_set
(
struct
atm_lane_ops
*
hook
)
{
down
(
&
atm_lane_ops_mutex
);
atm_lane_ops
=
hook
;
up
(
&
atm_lane_ops_mutex
);
}
int
try_atm_lane_ops
(
void
)
{
down
(
&
atm_lane_ops_mutex
);
if
(
atm_lane_ops
&&
try_module_get
(
atm_lane_ops
->
owner
))
{
up
(
&
atm_lane_ops_mutex
);
return
1
;
}
up
(
&
atm_lane_ops_mutex
);
return
0
;
}
#if defined(CONFIG_ATM_LANE_MODULE) || defined(CONFIG_ATM_MPOA_MODULE)
EXPORT_SYMBOL
(
atm_lane_ops
);
EXPORT_SYMBOL
(
try_atm_lane_ops
);
EXPORT_SYMBOL
(
atm_lane_ops_set
);
#endif
#endif
static
DECLARE_MUTEX
(
ioctl_mutex
);
static
LIST_HEAD
(
ioctl_list
);
...
...
@@ -137,47 +107,6 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
if
(
!
error
)
sock
->
state
=
SS_CONNECTED
;
goto
done
;
#if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
case
ATMLEC_CTRL
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
error
=
-
EPERM
;
goto
done
;
}
#if defined(CONFIG_ATM_LANE_MODULE)
if
(
!
atm_lane_ops
)
request_module
(
"lec"
);
#endif
if
(
try_atm_lane_ops
())
{
error
=
atm_lane_ops
->
lecd_attach
(
vcc
,
(
int
)
arg
);
module_put
(
atm_lane_ops
->
owner
);
if
(
error
>=
0
)
sock
->
state
=
SS_CONNECTED
;
}
else
error
=
-
ENOSYS
;
goto
done
;
case
ATMLEC_MCAST
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
error
=
-
EPERM
;
goto
done
;
}
if
(
try_atm_lane_ops
())
{
error
=
atm_lane_ops
->
mcast_attach
(
vcc
,
(
int
)
arg
);
module_put
(
atm_lane_ops
->
owner
);
}
else
error
=
-
ENOSYS
;
goto
done
;
case
ATMLEC_DATA
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
error
=
-
EPERM
;
goto
done
;
}
if
(
try_atm_lane_ops
())
{
error
=
atm_lane_ops
->
vcc_attach
(
vcc
,
(
void
*
)
arg
);
module_put
(
atm_lane_ops
->
owner
);
}
else
error
=
-
ENOSYS
;
goto
done
;
#endif
default:
break
;
}
...
...
@@ -186,6 +115,8 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
request_module
(
"mpoa"
);
if
(
cmd
==
ATMARPD_CTRL
)
request_module
(
"clip"
);
if
(
cmd
==
ATMLEC_CTRL
)
request_module
(
"lec"
);
error
=
-
ENOIOCTLCMD
;
...
...
net/atm/lec.c
View file @
c6f03202
...
...
@@ -839,16 +839,6 @@ lecd_attach(struct atm_vcc *vcc, int arg)
return
i
;
}
static
struct
atm_lane_ops
__atm_lane_ops
=
{
.
lecd_attach
=
lecd_attach
,
.
mcast_attach
=
lec_mcast_attach
,
.
vcc_attach
=
lec_vcc_attach
,
.
get_lec
=
get_dev_lec
,
.
owner
=
THIS_MODULE
};
#ifdef CONFIG_PROC_FS
static
char
*
lec_arp_get_status_string
(
unsigned
char
status
)
{
...
...
@@ -1096,6 +1086,44 @@ static struct file_operations lec_seq_fops = {
};
#endif
static
int
lane_ioctl
(
struct
socket
*
sock
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
atm_vcc
*
vcc
=
ATM_SD
(
sock
);
int
err
=
0
;
switch
(
cmd
)
{
case
ATMLEC_CTRL
:
case
ATMLEC_MCAST
:
case
ATMLEC_DATA
:
if
(
!
capable
(
CAP_NET_ADMIN
))
return
-
EPERM
;
break
;
default:
return
-
ENOIOCTLCMD
;
}
switch
(
cmd
)
{
case
ATMLEC_CTRL
:
err
=
lecd_attach
(
vcc
,
(
int
)
arg
);
if
(
err
>=
0
)
sock
->
state
=
SS_CONNECTED
;
break
;
case
ATMLEC_MCAST
:
err
=
lec_mcast_attach
(
vcc
,
(
int
)
arg
);
break
;
case
ATMLEC_DATA
:
err
=
lec_vcc_attach
(
vcc
,
(
void
*
)
arg
);
break
;
}
return
err
;
}
static
struct
atm_ioctl
lane_ioctl_ops
=
{
.
owner
=
THIS_MODULE
,
.
ioctl
=
lane_ioctl
,
};
static
int
__init
lane_module_init
(
void
)
{
#ifdef CONFIG_PROC_FS
...
...
@@ -1106,7 +1134,7 @@ static int __init lane_module_init(void)
p
->
proc_fops
=
&
lec_seq_fops
;
#endif
atm_lane_ops_set
(
&
__atm_lane
_ops
);
register_atm_ioctl
(
&
lane_ioctl
_ops
);
printk
(
"lec.c: "
__DATE__
" "
__TIME__
" initialized
\n
"
);
return
0
;
}
...
...
@@ -1118,7 +1146,7 @@ static void __exit lane_module_cleanup(void)
remove_proc_entry
(
"lec"
,
atm_proc_root
);
atm_lane_ops_set
(
NULL
);
deregister_atm_ioctl
(
&
lane_ioctl_ops
);
for
(
i
=
0
;
i
<
MAX_LEC_ITF
;
i
++
)
{
if
(
dev_lec
[
i
]
!=
NULL
)
{
...
...
net/atm/lec.h
View file @
c6f03202
...
...
@@ -60,14 +60,6 @@ struct lane2_ops {
u8
*
tlvs
,
u32
sizeoftlvs
);
};
struct
atm_lane_ops
{
int
(
*
lecd_attach
)(
struct
atm_vcc
*
vcc
,
int
arg
);
int
(
*
mcast_attach
)(
struct
atm_vcc
*
vcc
,
int
arg
);
int
(
*
vcc_attach
)(
struct
atm_vcc
*
vcc
,
void
*
arg
);
struct
net_device
*
(
*
get_lec
)(
int
itf
);
struct
module
*
owner
;
};
/*
* ATM LAN Emulation supports both LLC & Dix Ethernet EtherType
* frames.
...
...
@@ -157,9 +149,5 @@ int send_to_lecd(struct lec_priv *priv,
unsigned
char
*
atm_addr
,
struct
sk_buff
*
data
);
void
lec_push
(
struct
atm_vcc
*
vcc
,
struct
sk_buff
*
skb
);
extern
struct
atm_lane_ops
*
atm_lane_ops
;
void
atm_lane_ops_set
(
struct
atm_lane_ops
*
hook
);
int
try_atm_lane_ops
(
void
);
#endif
/* _LEC_H_ */
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