cleanup
[linux-2.4.21-pre4.git] / include / net1 / af_unix.h
1 #ifndef __LINUX_NET_AFUNIX_H
2 #define __LINUX_NET_AFUNIX_H
3 extern void unix_proto_init(struct net_proto *pro);
4 extern void unix_inflight(struct file *fp);
5 extern void unix_notinflight(struct file *fp);
6 typedef struct sock unix_socket;
7 extern void unix_gc(void);
8
9 #define UNIX_HASH_SIZE  256
10
11 extern unix_socket *unix_socket_table[UNIX_HASH_SIZE+1];
12 extern rwlock_t unix_table_lock;
13
14 extern atomic_t unix_tot_inflight;
15
16
17 #define forall_unix_sockets(i, s) for (i=0; i<=UNIX_HASH_SIZE; i++) \
18                                     for (s=unix_socket_table[i]; s; s=s->next)
19
20 struct unix_address
21 {
22         atomic_t        refcnt;
23         int             len;
24         unsigned        hash;
25         struct sockaddr_un name[0];
26 };
27
28 struct unix_skb_parms
29 {
30         struct ucred            creds;          /* Skb credentials      */
31         struct scm_fp_list      *fp;            /* Passed files         */
32 };
33
34 #define UNIXCB(skb)     (*(struct unix_skb_parms*)&((skb)->cb))
35 #define UNIXCREDS(skb)  (&UNIXCB((skb)).creds)
36
37 #define unix_state_rlock(s)     read_lock(&(s)->protinfo.af_unix.lock)
38 #define unix_state_runlock(s)   read_unlock(&(s)->protinfo.af_unix.lock)
39 #define unix_state_wlock(s)     write_lock(&(s)->protinfo.af_unix.lock)
40 #define unix_state_wunlock(s)   write_unlock(&(s)->protinfo.af_unix.lock)
41
42 #endif