o af_unix: remove MOD_{INC,DEC}_USE_COUNT

Now the core networking infrastructure will (finally) do that for the net
protocol families, its just a matter of setting the ->owner field in the
registered struct net_proto_family to THIS_MODULE.
parent 62bfb89d
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
* Alexey Kuznetsov : Full scale SMP. Lot of bugs are introduced 8) * Alexey Kuznetsov : Full scale SMP. Lot of bugs are introduced 8)
* Malcolm Beattie : Set peercred for socketpair * Malcolm Beattie : Set peercred for socketpair
* Michal Ostrowski : Module initialization cleanup. * Michal Ostrowski : Module initialization cleanup.
* Arnaldo C. Melo : Remove MOD_{INC,DEC}_USE_COUNT,
* the core infrastructure is doing that
* for all net proto families now (2.5.69+)
* *
* *
* Known differences from reference BSD that was tested: * Known differences from reference BSD that was tested:
...@@ -360,7 +363,6 @@ static void unix_sock_destructor(struct sock *sk) ...@@ -360,7 +363,6 @@ static void unix_sock_destructor(struct sock *sk)
#ifdef UNIX_REFCNT_DEBUG #ifdef UNIX_REFCNT_DEBUG
printk(KERN_DEBUG "UNIX %p is destroyed, %d are still alive.\n", sk, atomic_read(&unix_nr_socks)); printk(KERN_DEBUG "UNIX %p is destroyed, %d are still alive.\n", sk, atomic_read(&unix_nr_socks));
#endif #endif
MOD_DEC_USE_COUNT;
} }
static int unix_release_sock (unix_socket *sk, int embrion) static int unix_release_sock (unix_socket *sk, int embrion)
...@@ -478,19 +480,16 @@ extern struct proto_ops unix_dgram_ops; ...@@ -478,19 +480,16 @@ extern struct proto_ops unix_dgram_ops;
static struct sock * unix_create1(struct socket *sock) static struct sock * unix_create1(struct socket *sock)
{ {
struct sock *sk; struct sock *sk = NULL;
struct unix_sock *u; struct unix_sock *u;
if (atomic_read(&unix_nr_socks) >= 2*files_stat.max_files) if (atomic_read(&unix_nr_socks) >= 2*files_stat.max_files)
return NULL; goto out;
MOD_INC_USE_COUNT;
sk = sk_alloc(PF_UNIX, GFP_KERNEL, sizeof(struct unix_sock), sk = sk_alloc(PF_UNIX, GFP_KERNEL, sizeof(struct unix_sock),
unix_sk_cachep); unix_sk_cachep);
if (!sk) { if (!sk)
MOD_DEC_USE_COUNT; goto out;
return NULL;
}
atomic_inc(&unix_nr_socks); atomic_inc(&unix_nr_socks);
...@@ -509,7 +508,7 @@ static struct sock * unix_create1(struct socket *sock) ...@@ -509,7 +508,7 @@ static struct sock * unix_create1(struct socket *sock)
init_MUTEX(&u->readsem); /* single task reading lock */ init_MUTEX(&u->readsem); /* single task reading lock */
init_waitqueue_head(&u->peer_wait); init_waitqueue_head(&u->peer_wait);
unix_insert_socket(&unix_sockets_unbound, sk); unix_insert_socket(&unix_sockets_unbound, sk);
out:
return sk; return sk;
} }
...@@ -1928,6 +1927,7 @@ struct proto_ops unix_dgram_ops = { ...@@ -1928,6 +1927,7 @@ struct proto_ops unix_dgram_ops = {
struct net_proto_family unix_family_ops = { struct net_proto_family unix_family_ops = {
.family = PF_UNIX, .family = PF_UNIX,
.create = unix_create, .create = unix_create,
.owner = THIS_MODULE,
}; };
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment