diff options
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index e48b8549a..121e4d9de 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1,5 +1,5 @@ /* - * NET3: Implementation of BSD Unix domain sockets. + * NET4: Implementation of BSD Unix domain sockets. * * Authors: Alan Cox, <alan.cox@linux.org> * @@ -8,7 +8,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Version: $Id: af_unix.c,v 1.108 2000/11/10 04:02:04 davem Exp $ + * Version: $Id: af_unix.c,v 1.109 2001/01/06 00:42:23 davem Exp $ * * Fixes: * Linus Torvalds : Assorted bug cures. @@ -124,13 +124,12 @@ static atomic_t unix_nr_socks = ATOMIC_INIT(0); #define UNIX_ABSTRACT(sk) ((sk)->protinfo.af_unix.addr->hash!=UNIX_HASH_SIZE) /* - SMP locking strategy. - * hash table is protceted with rwlock unix_table_lock - * each socket state is protected by separate rwlock. - + * SMP locking strategy: + * hash table is protected with rwlock unix_table_lock + * each socket state is protected by separate rwlock. */ -extern __inline__ unsigned unix_hash_fold(unsigned hash) +static inline unsigned unix_hash_fold(unsigned hash) { hash ^= hash>>16; hash ^= hash>>8; @@ -139,17 +138,17 @@ extern __inline__ unsigned unix_hash_fold(unsigned hash) #define unix_peer(sk) ((sk)->pair) -extern __inline__ int unix_our_peer(unix_socket *sk, unix_socket *osk) +static inline int unix_our_peer(unix_socket *sk, unix_socket *osk) { return unix_peer(osk) == sk; } -extern __inline__ int unix_may_send(unix_socket *sk, unix_socket *osk) +static inline int unix_may_send(unix_socket *sk, unix_socket *osk) { return (unix_peer(osk) == NULL || unix_our_peer(sk, osk)); } -static __inline__ unix_socket * unix_peer_get(unix_socket *s) +static inline unix_socket * unix_peer_get(unix_socket *s) { unix_socket *peer; @@ -161,7 +160,7 @@ static __inline__ unix_socket * unix_peer_get(unix_socket *s) return peer; } -extern __inline__ void unix_release_addr(struct unix_address *addr) +extern inline void unix_release_addr(struct unix_address *addr) { if (atomic_dec_and_test(&addr->refcnt)) kfree(addr); @@ -231,14 +230,14 @@ static void __unix_insert_socket(unix_socket **list, unix_socket *sk) sock_hold(sk); } -static __inline__ void unix_remove_socket(unix_socket *sk) +static inline void unix_remove_socket(unix_socket *sk) { write_lock(&unix_table_lock); __unix_remove_socket(sk); write_unlock(&unix_table_lock); } -static __inline__ void unix_insert_socket(unix_socket **list, unix_socket *sk) +static inline void unix_insert_socket(unix_socket **list, unix_socket *sk) { write_lock(&unix_table_lock); __unix_insert_socket(list, sk); @@ -258,7 +257,7 @@ static unix_socket *__unix_find_socket_byname(struct sockaddr_un *sunname, return NULL; } -static __inline__ unix_socket * +static inline unix_socket * unix_find_socket_byname(struct sockaddr_un *sunname, int len, int type, unsigned hash) { @@ -291,7 +290,7 @@ static unix_socket *unix_find_socket_byinode(struct inode *i) return s; } -static __inline__ int unix_writable(struct sock *sk) +static inline int unix_writable(struct sock *sk) { return ((atomic_read(&sk->wmem_alloc)<<2) <= sk->sndbuf); } @@ -1823,7 +1822,7 @@ struct proto_ops unix_stream_ops = { struct proto_ops unix_dgram_ops = { family: PF_UNIX, - + release: unix_release, bind: unix_bind, connect: unix_dgram_connect, @@ -1842,20 +1841,25 @@ struct proto_ops unix_dgram_ops = { }; struct net_proto_family unix_family_ops = { - PF_UNIX, - unix_create + family: PF_UNIX, + create: unix_create }; #ifdef CONFIG_SYSCTL extern void unix_sysctl_register(void); extern void unix_sysctl_unregister(void); +#else +static inline unix_sysctl_register() {}; +static inline unix_sysctl_unregister() {}; #endif +static const char banner[] __initdata = KERN_INFO "NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.\n"; + static int __init af_unix_init(void) { struct sk_buff *dummy_skb; - - printk(KERN_INFO "NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.\n"); + + printk(banner); if (sizeof(struct unix_skb_parms) > sizeof(dummy_skb->cb)) { printk(KERN_CRIT "unix_proto_init: panic\n"); @@ -1865,23 +1869,15 @@ static int __init af_unix_init(void) #ifdef CONFIG_PROC_FS create_proc_read_entry("net/unix", 0, 0, unix_read_proc, NULL); #endif - -#ifdef CONFIG_SYSCTL unix_sysctl_register(); -#endif - return 0; } static void __exit af_unix_exit(void) { sock_unregister(PF_UNIX); -#ifdef CONFIG_SYSCTL unix_sysctl_unregister(); -#endif -#ifdef CONFIG_PROC_FS remove_proc_entry("net/unix", 0); -#endif } module_init(af_unix_init); |