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
2908a20e
Commit
2908a20e
authored
Jun 02, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Eliminate init_etherdev usage from arch/um drivers.
parent
bea71ef2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
91 deletions
+73
-91
arch/um/drivers/daemon_kern.c
arch/um/drivers/daemon_kern.c
+5
-10
arch/um/drivers/mcast_kern.c
arch/um/drivers/mcast_kern.c
+5
-7
arch/um/drivers/net_kern.c
arch/um/drivers/net_kern.c
+46
-50
arch/um/drivers/pcap_kern.c
arch/um/drivers/pcap_kern.c
+4
-8
arch/um/os-Linux/drivers/ethertap_kern.c
arch/um/os-Linux/drivers/ethertap_kern.c
+6
-8
arch/um/os-Linux/drivers/tuntap_kern.c
arch/um/os-Linux/drivers/tuntap_kern.c
+7
-8
No files found.
arch/um/drivers/daemon_kern.c
View file @
2908a20e
...
...
@@ -24,18 +24,13 @@ void daemon_init(struct net_device *dev, void *data)
struct
daemon_data
*
dpri
;
struct
daemon_init
*
init
=
data
;
init_etherdev
(
dev
,
0
);
pri
=
dev
->
priv
;
dpri
=
(
struct
daemon_data
*
)
pri
->
user
;
*
dpri
=
((
struct
daemon_data
)
{
.
sock_type
=
init
->
sock_type
,
.
ctl_sock
=
init
->
ctl_sock
,
.
ctl_addr
=
NULL
,
.
data_addr
=
NULL
,
.
local_addr
=
NULL
,
.
fd
=
-
1
,
.
control
=
-
1
,
.
dev
=
dev
});
dpri
->
sock_type
=
init
->
sock_type
;
dpri
->
ctl_sock
=
init
->
ctl_sock
;
dpri
->
fd
=
-
1
;
dpri
->
control
=
-
1
;
dpri
->
dev
=
dev
;
printk
(
"daemon backend (uml_switch version %d) - %s:%s"
,
SWITCH_VERSION
,
dpri
->
sock_type
,
dpri
->
ctl_sock
);
...
...
arch/um/drivers/mcast_kern.c
View file @
2908a20e
...
...
@@ -32,15 +32,13 @@ void mcast_init(struct net_device *dev, void *data)
struct
mcast_data
*
dpri
;
struct
mcast_init
*
init
=
data
;
init_etherdev
(
dev
,
0
);
pri
=
dev
->
priv
;
dpri
=
(
struct
mcast_data
*
)
pri
->
user
;
*
dpri
=
((
struct
mcast_data
)
{
.
addr
=
init
->
addr
,
.
port
=
init
->
port
,
.
ttl
=
init
->
ttl
,
.
mcast_addr
=
NULL
,
.
dev
=
dev
});
dpri
->
addr
=
init
->
addr
;
dpri
->
port
=
init
->
port
;
dpri
->
ttl
=
init
->
ttl
;
dpri
->
dev
=
dev
;
printk
(
"mcast backend "
);
printk
(
"multicast adddress: %s:%u, TTL:%u "
,
dpri
->
addr
,
dpri
->
port
,
dpri
->
ttl
);
...
...
arch/um/drivers/net_kern.c
View file @
2908a20e
...
...
@@ -292,45 +292,46 @@ static int eth_configure(int n, void *init, char *mac,
struct
uml_net
*
device
;
struct
net_device
*
dev
;
struct
uml_net_private
*
lp
;
int
save
,
err
,
size
;
int
err
,
size
;
size
=
transport
->
private_size
+
sizeof
(
struct
uml_net_private
)
+
sizeof
(((
struct
uml_net_private
*
)
0
)
->
user
);
device
=
kmalloc
(
sizeof
(
*
device
),
GFP_KERNEL
);
if
(
device
==
NULL
)
{
if
(
device
==
NULL
)
{
printk
(
KERN_ERR
"eth_configure failed to allocate uml_net
\n
"
);
return
(
1
);
}
*
device
=
((
struct
uml_net
)
{
.
list
=
LIST_HEAD_INIT
(
device
->
list
),
.
dev
=
NULL
,
.
index
=
n
,
.
mac
=
{
[
0
...
5
]
=
0
},
.
have_mac
=
0
});
memset
(
device
,
0
,
sizeof
(
*
device
));
device
->
list
=
LIST_HEAD_INIT
(
device
->
list
);
device
->
index
=
n
;
spin_lock
(
&
devices_lock
);
list_add
(
&
device
->
list
,
&
devices
);
spin_unlock
(
&
devices_lock
);
if
(
setup_etheraddr
(
mac
,
device
->
mac
))
if
(
setup_etheraddr
(
mac
,
device
->
mac
))
device
->
have_mac
=
1
;
printk
(
KERN_INFO
"Netdevice %d "
,
n
);
if
(
device
->
have_mac
)
printk
(
"(%02x:%02x:%02x:%02x:%02x:%02x) "
,
device
->
mac
[
0
],
device
->
mac
[
1
],
device
->
mac
[
2
],
device
->
mac
[
3
],
device
->
mac
[
4
],
device
->
mac
[
5
]);
if
(
device
->
have_mac
)
printk
(
"(%02x:%02x:%02x:%02x:%02x:%02x) "
,
device
->
mac
[
0
],
device
->
mac
[
1
],
device
->
mac
[
2
],
device
->
mac
[
3
],
device
->
mac
[
4
],
device
->
mac
[
5
]);
printk
(
": "
);
dev
=
kmalloc
(
sizeof
(
*
dev
)
+
size
,
GFP_KERNEL
);
if
(
dev
==
NULL
)
{
dev
=
alloc_etherdev
(
size
);
if
(
dev
==
NULL
)
{
printk
(
KERN_ERR
"eth_configure: failed to allocate device
\n
"
);
return
(
1
)
;
return
1
;
}
memset
(
dev
,
0
,
sizeof
(
*
dev
)
+
size
);
/* If this name ends up conflicting with an existing registered
* netdevice, that is OK, register_netdev{,ice}() will notice this
* and fail.
*/
snprintf
(
dev
->
name
,
sizeof
(
dev
->
name
),
"eth%d"
,
n
);
dev
->
priv
=
(
void
*
)
&
dev
[
1
];
device
->
dev
=
dev
;
dev
->
hard_header
=
uml_net_hard_header
;
...
...
@@ -357,42 +358,35 @@ static int eth_configure(int n, void *init, char *mac,
rtnl_lock
();
err
=
register_netdevice
(
dev
);
rtnl_unlock
();
if
(
err
)
return
(
1
)
;
if
(
err
)
return
1
;
lp
=
dev
->
priv
;
/* lp.user is the first four bytes of the transport data, which
* has already been initialized. This structure assignment will
* overwrite that, so we make sure that .user gets overwritten with
* what it already has.
*/
save
=
lp
->
user
[
0
];
*
lp
=
((
struct
uml_net_private
)
{
.
list
=
LIST_HEAD_INIT
(
lp
->
list
),
.
lock
=
SPIN_LOCK_UNLOCKED
,
.
dev
=
dev
,
.
fd
=
-
1
,
.
mac
=
{
0xfe
,
0xfd
,
0x0
,
0x0
,
0x0
,
0x0
},
.
have_mac
=
device
->
have_mac
,
.
protocol
=
transport
->
kern
->
protocol
,
.
open
=
transport
->
user
->
open
,
.
close
=
transport
->
user
->
close
,
.
remove
=
transport
->
user
->
remove
,
.
read
=
transport
->
kern
->
read
,
.
write
=
transport
->
kern
->
write
,
.
add_address
=
transport
->
user
->
add_address
,
.
delete_address
=
transport
->
user
->
delete_address
,
.
set_mtu
=
transport
->
user
->
set_mtu
,
.
user
=
{
save
}
});
lp
->
list
=
LIST_HEAD_INIT
(
lp
->
list
);
spin_lock_init
(
&
lp
->
lock
);
lp
->
dev
=
dev
;
lp
->
fd
=
-
1
;
lp
->
mac
=
{
0xfe
,
0xfd
,
0x0
,
0x0
,
0x0
,
0x0
};
lp
->
have_mac
=
device
->
have_mac
;
lp
->
protocol
=
transport
->
kern
->
protocol
;
lp
->
open
=
transport
->
user
->
open
;
lp
->
close
=
transport
->
user
->
close
;
lp
->
remove
=
transport
->
user
->
remove
;
lp
->
read
=
transport
->
kern
->
read
;
lp
->
write
=
transport
->
kern
->
write
;
lp
->
add_address
=
transport
->
user
->
add_address
;
lp
->
delete_address
=
transport
->
user
->
delete_address
;
lp
->
set_mtu
=
transport
->
user
->
set_mtu
;
init_timer
(
&
lp
->
tl
);
lp
->
tl
.
function
=
uml_net_user_timer_expire
;
memset
(
&
lp
->
stats
,
0
,
sizeof
(
lp
->
stats
));
if
(
lp
->
have_mac
)
memcpy
(
lp
->
mac
,
device
->
mac
,
sizeof
(
lp
->
mac
));
if
(
lp
->
have_mac
)
memcpy
(
lp
->
mac
,
device
->
mac
,
sizeof
(
lp
->
mac
));
if
(
transport
->
user
->
init
)
if
(
transport
->
user
->
init
)
(
*
transport
->
user
->
init
)(
&
lp
->
user
,
dev
);
if
(
device
->
have_mac
)
if
(
device
->
have_mac
)
set_ether_mac
(
dev
,
device
->
mac
);
return
(
0
);
}
...
...
@@ -538,13 +532,15 @@ static int eth_setup(char *str)
if
(
err
)
return
(
1
);
new
=
alloc_bootmem
(
sizeof
(
new
));
if
(
new
==
NULL
){
if
(
new
==
NULL
){
printk
(
"eth_init : alloc_bootmem failed
\n
"
);
return
(
1
);
}
*
new
=
((
struct
eth_init
)
{
.
list
=
LIST_HEAD_INIT
(
new
->
list
),
.
index
=
n
,
.
init
=
str
});
new
->
list
=
LIST_HEAD_INIT
(
new
->
list
);
new
->
index
=
n
;
new
->
init
=
str
;
list_add_tail
(
&
new
->
list
,
&
eth_cmd_line
);
return
(
1
);
}
...
...
arch/um/drivers/pcap_kern.c
View file @
2908a20e
...
...
@@ -23,16 +23,12 @@ void pcap_init(struct net_device *dev, void *data)
struct
pcap_data
*
ppri
;
struct
pcap_init
*
init
=
data
;
init_etherdev
(
dev
,
0
);
pri
=
dev
->
priv
;
ppri
=
(
struct
pcap_data
*
)
pri
->
user
;
*
ppri
=
((
struct
pcap_data
)
{
.
host_if
=
init
->
host_if
,
.
promisc
=
init
->
promisc
,
.
optimize
=
init
->
optimize
,
.
filter
=
init
->
filter
,
.
compiled
=
NULL
,
.
pcap
=
NULL
});
ppri
->
host_if
=
init
->
host_if
;
ppri
->
promisc
=
init
->
promisc
;
ppri
->
optimize
=
init
->
optimize
;
ppri
->
filter
=
init
->
filter
;
}
static
int
pcap_read
(
int
fd
,
struct
sk_buff
**
skb
,
...
...
arch/um/os-Linux/drivers/ethertap_kern.c
View file @
2908a20e
...
...
@@ -24,18 +24,16 @@ static void etap_init(struct net_device *dev, void *data)
struct
ethertap_data
*
epri
;
struct
ethertap_init
*
init
=
data
;
init_etherdev
(
dev
,
0
);
pri
=
dev
->
priv
;
epri
=
(
struct
ethertap_data
*
)
pri
->
user
;
*
epri
=
((
struct
ethertap_data
)
{
.
dev_name
=
init
->
dev_name
,
.
gate_addr
=
init
->
gate_addr
,
.
data_fd
=
-
1
,
.
control_fd
=
-
1
,
.
dev
=
dev
});
epri
->
dev_name
=
init
->
dev_name
;
epri
->
gate_addr
=
init
->
gate_addr
;
epri
->
data_fd
=
-
1
;
epri
->
control_fd
=
-
1
;
epri
->
dev
=
dev
;
printk
(
"ethertap backend - %s"
,
epri
->
dev_name
);
if
(
epri
->
gate_addr
!=
NULL
)
if
(
epri
->
gate_addr
!=
NULL
)
printk
(
", IP = %s"
,
epri
->
gate_addr
);
printk
(
"
\n
"
);
}
...
...
arch/um/os-Linux/drivers/tuntap_kern.c
View file @
2908a20e
...
...
@@ -24,17 +24,16 @@ static void tuntap_init(struct net_device *dev, void *data)
struct
tuntap_data
*
tpri
;
struct
tuntap_init
*
init
=
data
;
init_etherdev
(
dev
,
0
);
pri
=
dev
->
priv
;
tpri
=
(
struct
tuntap_data
*
)
pri
->
user
;
*
tpri
=
((
struct
tuntap_data
)
{
.
dev_name
=
init
->
dev_name
,
.
fixed_config
=
(
init
->
dev_name
!=
NULL
),
.
gate_addr
=
init
->
gate_addr
,
.
fd
=
-
1
,
.
dev
=
dev
});
tpri
->
dev_name
=
init
->
dev_name
;
tpri
->
fixed_config
=
(
init
->
dev_name
!=
NULL
);
tpri
->
gate_addr
=
init
->
gate_addr
;
tpri
->
fd
=
-
1
;
tpri
->
dev
=
dev
;
printk
(
"TUN/TAP backend - "
);
if
(
tpri
->
gate_addr
!=
NULL
)
if
(
tpri
->
gate_addr
!=
NULL
)
printk
(
"IP = %s"
,
tpri
->
gate_addr
);
printk
(
"
\n
"
);
}
...
...
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