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
c92eb773
Commit
c92eb773
authored
Apr 09, 2003
by
Hideaki Yoshifuji
Committed by
Stephen Hemminger
Apr 09, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV{4,6}]: Convert from MOD_{INC,DEC}_USE_COUNT.
parent
3add94a5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
32 deletions
+45
-32
net/ipv4/ip_gre.c
net/ipv4/ip_gre.c
+16
-12
net/ipv4/ipip.c
net/ipv4/ipip.c
+11
-8
net/ipv6/af_inet6.c
net/ipv6/af_inet6.c
+6
-3
net/ipv6/ipv6_sockglue.c
net/ipv6/ipv6_sockglue.c
+1
-1
net/ipv6/sit.c
net/ipv6/sit.c
+11
-8
No files found.
net/ipv4/ip_gre.c
View file @
c92eb773
...
@@ -262,10 +262,11 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
...
@@ -262,10 +262,11 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
if
(
!
create
)
if
(
!
create
)
return
NULL
;
return
NULL
;
MOD_INC_USE_COUNT
;
if
(
!
try_module_get
(
THIS_MODULE
))
return
NULL
;
dev
=
kmalloc
(
sizeof
(
*
dev
)
+
sizeof
(
*
t
),
GFP_KERNEL
);
dev
=
kmalloc
(
sizeof
(
*
dev
)
+
sizeof
(
*
t
),
GFP_KERNEL
);
if
(
dev
==
NULL
)
{
if
(
dev
==
NULL
)
{
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
NULL
;
return
NULL
;
}
}
memset
(
dev
,
0
,
sizeof
(
*
dev
)
+
sizeof
(
*
t
));
memset
(
dev
,
0
,
sizeof
(
*
dev
)
+
sizeof
(
*
t
));
...
@@ -297,7 +298,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
...
@@ -297,7 +298,7 @@ static struct ip_tunnel * ipgre_tunnel_locate(struct ip_tunnel_parm *parms, int
failed:
failed:
kfree
(
dev
);
kfree
(
dev
);
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
NULL
;
return
NULL
;
}
}
...
@@ -305,7 +306,7 @@ static void ipgre_tunnel_destructor(struct net_device *dev)
...
@@ -305,7 +306,7 @@ static void ipgre_tunnel_destructor(struct net_device *dev)
{
{
if
(
dev
!=
&
ipgre_fb_tunnel_dev
)
{
if
(
dev
!=
&
ipgre_fb_tunnel_dev
)
{
kfree
(
dev
);
kfree
(
dev
);
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
}
}
}
}
...
@@ -920,7 +921,8 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -920,7 +921,8 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
struct
ip_tunnel_parm
p
;
struct
ip_tunnel_parm
p
;
struct
ip_tunnel
*
t
;
struct
ip_tunnel
*
t
;
MOD_INC_USE_COUNT
;
if
(
!
try_module_get
(
THIS_MODULE
))
return
-
EBUSY
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
SIOCGETTUNNEL
:
case
SIOCGETTUNNEL
:
...
@@ -1035,7 +1037,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -1035,7 +1037,7 @@ ipgre_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
}
}
done:
done:
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
err
;
return
err
;
}
}
...
@@ -1115,7 +1117,8 @@ static int ipgre_open(struct net_device *dev)
...
@@ -1115,7 +1117,8 @@ static int ipgre_open(struct net_device *dev)
{
{
struct
ip_tunnel
*
t
=
(
struct
ip_tunnel
*
)
dev
->
priv
;
struct
ip_tunnel
*
t
=
(
struct
ip_tunnel
*
)
dev
->
priv
;
MOD_INC_USE_COUNT
;
if
(
!
try_module_get
(
THIS_MODULE
))
return
-
EBUSY
;
if
(
MULTICAST
(
t
->
parms
.
iph
.
daddr
))
{
if
(
MULTICAST
(
t
->
parms
.
iph
.
daddr
))
{
struct
flowi
fl
=
{
.
oif
=
t
->
parms
.
link
,
struct
flowi
fl
=
{
.
oif
=
t
->
parms
.
link
,
.
nl_u
=
{
.
ip4_u
=
.
nl_u
=
{
.
ip4_u
=
...
@@ -1125,13 +1128,13 @@ static int ipgre_open(struct net_device *dev)
...
@@ -1125,13 +1128,13 @@ static int ipgre_open(struct net_device *dev)
.
proto
=
IPPROTO_GRE
};
.
proto
=
IPPROTO_GRE
};
struct
rtable
*
rt
;
struct
rtable
*
rt
;
if
(
ip_route_output_key
(
&
rt
,
&
fl
))
{
if
(
ip_route_output_key
(
&
rt
,
&
fl
))
{
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
-
EADDRNOTAVAIL
;
return
-
EADDRNOTAVAIL
;
}
}
dev
=
rt
->
u
.
dst
.
dev
;
dev
=
rt
->
u
.
dst
.
dev
;
ip_rt_put
(
rt
);
ip_rt_put
(
rt
);
if
(
__in_dev_get
(
dev
)
==
NULL
)
{
if
(
__in_dev_get
(
dev
)
==
NULL
)
{
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
-
EADDRNOTAVAIL
;
return
-
EADDRNOTAVAIL
;
}
}
t
->
mlink
=
dev
->
ifindex
;
t
->
mlink
=
dev
->
ifindex
;
...
@@ -1150,7 +1153,7 @@ static int ipgre_close(struct net_device *dev)
...
@@ -1150,7 +1153,7 @@ static int ipgre_close(struct net_device *dev)
in_dev_put
(
in_dev
);
in_dev_put
(
in_dev
);
}
}
}
}
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
0
;
return
0
;
}
}
...
@@ -1247,13 +1250,14 @@ static int ipgre_tunnel_init(struct net_device *dev)
...
@@ -1247,13 +1250,14 @@ static int ipgre_tunnel_init(struct net_device *dev)
#ifdef MODULE
#ifdef MODULE
static
int
ipgre_fb_tunnel_open
(
struct
net_device
*
dev
)
static
int
ipgre_fb_tunnel_open
(
struct
net_device
*
dev
)
{
{
MOD_INC_USE_COUNT
;
if
(
!
try_module_get
(
THIS_MODULE
))
return
-
EBUSY
;
return
0
;
return
0
;
}
}
static
int
ipgre_fb_tunnel_close
(
struct
net_device
*
dev
)
static
int
ipgre_fb_tunnel_close
(
struct
net_device
*
dev
)
{
{
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
0
;
return
0
;
}
}
#endif
#endif
...
...
net/ipv4/ipip.c
View file @
c92eb773
...
@@ -231,10 +231,11 @@ struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int create)
...
@@ -231,10 +231,11 @@ struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int create)
if
(
!
create
)
if
(
!
create
)
return
NULL
;
return
NULL
;
MOD_INC_USE_COUNT
;
if
(
!
try_module_get
(
THIS_MODULE
))
return
NULL
;
dev
=
kmalloc
(
sizeof
(
*
dev
)
+
sizeof
(
*
t
),
GFP_KERNEL
);
dev
=
kmalloc
(
sizeof
(
*
dev
)
+
sizeof
(
*
t
),
GFP_KERNEL
);
if
(
dev
==
NULL
)
{
if
(
dev
==
NULL
)
{
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
NULL
;
return
NULL
;
}
}
memset
(
dev
,
0
,
sizeof
(
*
dev
)
+
sizeof
(
*
t
));
memset
(
dev
,
0
,
sizeof
(
*
dev
)
+
sizeof
(
*
t
));
...
@@ -266,7 +267,7 @@ struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int create)
...
@@ -266,7 +267,7 @@ struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int create)
failed:
failed:
kfree
(
dev
);
kfree
(
dev
);
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
NULL
;
return
NULL
;
}
}
...
@@ -274,7 +275,7 @@ static void ipip_tunnel_destructor(struct net_device *dev)
...
@@ -274,7 +275,7 @@ static void ipip_tunnel_destructor(struct net_device *dev)
{
{
if
(
dev
!=
&
ipip_fb_tunnel_dev
)
{
if
(
dev
!=
&
ipip_fb_tunnel_dev
)
{
kfree
(
dev
);
kfree
(
dev
);
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
}
}
}
}
...
@@ -682,7 +683,8 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -682,7 +683,8 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
struct
ip_tunnel_parm
p
;
struct
ip_tunnel_parm
p
;
struct
ip_tunnel
*
t
;
struct
ip_tunnel
*
t
;
MOD_INC_USE_COUNT
;
if
(
!
try_module_get
(
THIS_MODULE
))
return
-
EBUSY
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
SIOCGETTUNNEL
:
case
SIOCGETTUNNEL
:
...
@@ -782,7 +784,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -782,7 +784,7 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
}
}
done:
done:
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
err
;
return
err
;
}
}
...
@@ -861,13 +863,14 @@ static int ipip_tunnel_init(struct net_device *dev)
...
@@ -861,13 +863,14 @@ static int ipip_tunnel_init(struct net_device *dev)
#ifdef MODULE
#ifdef MODULE
static
int
ipip_fb_tunnel_open
(
struct
net_device
*
dev
)
static
int
ipip_fb_tunnel_open
(
struct
net_device
*
dev
)
{
{
MOD_INC_USE_COUNT
;
if
(
!
try_module_get
(
THIS_MODULE
))
return
-
EBUSY
;
return
0
;
return
0
;
}
}
static
int
ipip_fb_tunnel_close
(
struct
net_device
*
dev
)
static
int
ipip_fb_tunnel_close
(
struct
net_device
*
dev
)
{
{
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
0
;
return
0
;
}
}
#endif
#endif
...
...
net/ipv6/af_inet6.c
View file @
c92eb773
...
@@ -111,7 +111,7 @@ static void inet6_sock_destruct(struct sock *sk)
...
@@ -111,7 +111,7 @@ static void inet6_sock_destruct(struct sock *sk)
#ifdef INET_REFCNT_DEBUG
#ifdef INET_REFCNT_DEBUG
atomic_dec
(
&
inet6_sock_nr
);
atomic_dec
(
&
inet6_sock_nr
);
#endif
#endif
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
}
}
static
__inline__
kmem_cache_t
*
inet6_sk_slab
(
int
protocol
)
static
__inline__
kmem_cache_t
*
inet6_sk_slab
(
int
protocol
)
...
@@ -242,7 +242,10 @@ static int inet6_create(struct socket *sock, int protocol)
...
@@ -242,7 +242,10 @@ static int inet6_create(struct socket *sock, int protocol)
atomic_inc
(
&
inet6_sock_nr
);
atomic_inc
(
&
inet6_sock_nr
);
atomic_inc
(
&
inet_sock_nr
);
atomic_inc
(
&
inet_sock_nr
);
#endif
#endif
MOD_INC_USE_COUNT
;
if
(
!
try_get_module
(
THIS_MODULE
))
{
inet_sock_release
(
sk
);
return
-
EBUSY
;
}
if
(
inet
->
num
)
{
if
(
inet
->
num
)
{
/* It assumes that any protocol which allows
/* It assumes that any protocol which allows
...
@@ -255,7 +258,7 @@ static int inet6_create(struct socket *sock, int protocol)
...
@@ -255,7 +258,7 @@ static int inet6_create(struct socket *sock, int protocol)
if
(
sk
->
prot
->
init
)
{
if
(
sk
->
prot
->
init
)
{
int
err
=
sk
->
prot
->
init
(
sk
);
int
err
=
sk
->
prot
->
init
(
sk
);
if
(
err
!=
0
)
{
if
(
err
!=
0
)
{
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
inet_sock_release
(
sk
);
inet_sock_release
(
sk
);
return
err
;
return
err
;
}
}
...
...
net/ipv6/ipv6_sockglue.c
View file @
c92eb773
...
@@ -196,7 +196,7 @@ int ipv6_setsockopt(struct sock *sk, int level, int optname, char *optval,
...
@@ -196,7 +196,7 @@ int ipv6_setsockopt(struct sock *sk, int level, int optname, char *optval,
#ifdef INET_REFCNT_DEBUG
#ifdef INET_REFCNT_DEBUG
atomic_dec
(
&
inet6_sock_nr
);
atomic_dec
(
&
inet6_sock_nr
);
#endif
#endif
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
retv
=
0
;
retv
=
0
;
break
;
break
;
}
}
...
...
net/ipv6/sit.c
View file @
c92eb773
...
@@ -170,10 +170,11 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
...
@@ -170,10 +170,11 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
if
(
!
create
)
if
(
!
create
)
return
NULL
;
return
NULL
;
MOD_INC_USE_COUNT
;
if
(
!
try_module_get
(
THIS_MODULE
))
return
NULL
;
dev
=
kmalloc
(
sizeof
(
*
dev
)
+
sizeof
(
*
t
),
GFP_KERNEL
);
dev
=
kmalloc
(
sizeof
(
*
dev
)
+
sizeof
(
*
t
),
GFP_KERNEL
);
if
(
dev
==
NULL
)
{
if
(
dev
==
NULL
)
{
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
NULL
;
return
NULL
;
}
}
memset
(
dev
,
0
,
sizeof
(
*
dev
)
+
sizeof
(
*
t
));
memset
(
dev
,
0
,
sizeof
(
*
dev
)
+
sizeof
(
*
t
));
...
@@ -205,7 +206,7 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
...
@@ -205,7 +206,7 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int
failed:
failed:
kfree
(
dev
);
kfree
(
dev
);
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
NULL
;
return
NULL
;
}
}
...
@@ -213,7 +214,7 @@ static void ipip6_tunnel_destructor(struct net_device *dev)
...
@@ -213,7 +214,7 @@ static void ipip6_tunnel_destructor(struct net_device *dev)
{
{
if
(
dev
!=
&
ipip6_fb_tunnel_dev
)
{
if
(
dev
!=
&
ipip6_fb_tunnel_dev
)
{
kfree
(
dev
);
kfree
(
dev
);
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
}
}
}
}
...
@@ -622,7 +623,8 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -622,7 +623,8 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
struct
ip_tunnel_parm
p
;
struct
ip_tunnel_parm
p
;
struct
ip_tunnel
*
t
;
struct
ip_tunnel
*
t
;
MOD_INC_USE_COUNT
;
if
(
!
try_module_get
(
THIS_MODULE
))
return
-
EBUSY
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
SIOCGETTUNNEL
:
case
SIOCGETTUNNEL
:
...
@@ -721,7 +723,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -721,7 +723,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
}
}
done:
done:
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
err
;
return
err
;
}
}
...
@@ -801,13 +803,14 @@ static int ipip6_tunnel_init(struct net_device *dev)
...
@@ -801,13 +803,14 @@ static int ipip6_tunnel_init(struct net_device *dev)
#ifdef MODULE
#ifdef MODULE
static
int
ipip6_fb_tunnel_open
(
struct
net_device
*
dev
)
static
int
ipip6_fb_tunnel_open
(
struct
net_device
*
dev
)
{
{
MOD_INC_USE_COUNT
;
if
(
!
try_module_get
(
THIS_MODULE
))
return
-
EBUSY
;
return
0
;
return
0
;
}
}
static
int
ipip6_fb_tunnel_close
(
struct
net_device
*
dev
)
static
int
ipip6_fb_tunnel_close
(
struct
net_device
*
dev
)
{
{
MOD_DEC_USE_COUNT
;
module_put
(
THIS_MODULE
)
;
return
0
;
return
0
;
}
}
#endif
#endif
...
...
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