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
fc761690
Commit
fc761690
authored
Jun 16, 2003
by
Arnaldo Carvalho de Melo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
o af_unix: remove typedef unix_socket, use plain struct sock
parent
0b13af99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
46 deletions
+45
-46
include/net/af_unix.h
include/net/af_unix.h
+2
-3
net/unix/af_unix.c
net/unix/af_unix.c
+30
-30
net/unix/garbage.c
net/unix/garbage.c
+13
-13
No files found.
include/net/af_unix.h
View file @
fc761690
...
...
@@ -2,7 +2,6 @@
#define __LINUX_NET_AFUNIX_H
extern
void
unix_inflight
(
struct
file
*
fp
);
extern
void
unix_notinflight
(
struct
file
*
fp
);
typedef
struct
sock
unix_socket
;
extern
void
unix_gc
(
void
);
#define UNIX_HASH_SIZE 256
...
...
@@ -12,7 +11,7 @@ extern rwlock_t unix_table_lock;
extern
atomic_t
unix_tot_inflight
;
static
inline
unix_socket
*
first_unix_socket
(
int
*
i
)
static
inline
struct
sock
*
first_unix_socket
(
int
*
i
)
{
for
(
*
i
=
0
;
*
i
<=
UNIX_HASH_SIZE
;
(
*
i
)
++
)
{
if
(
!
hlist_empty
(
&
unix_socket_table
[
*
i
]))
...
...
@@ -21,7 +20,7 @@ static inline unix_socket *first_unix_socket(int *i)
return
NULL
;
}
static
inline
unix_socket
*
next_unix_socket
(
int
*
i
,
unix_socket
*
s
)
static
inline
struct
sock
*
next_unix_socket
(
int
*
i
,
struct
sock
*
s
)
{
struct
sock
*
next
=
sk_next
(
s
);
/* More in this chain? */
...
...
net/unix/af_unix.c
View file @
fc761690
...
...
@@ -147,19 +147,19 @@ static inline unsigned unix_hash_fold(unsigned hash)
#define unix_peer(sk) ((sk)->sk_pair)
static
inline
int
unix_our_peer
(
unix_socket
*
sk
,
unix_socket
*
osk
)
static
inline
int
unix_our_peer
(
struct
sock
*
sk
,
struct
sock
*
osk
)
{
return
unix_peer
(
osk
)
==
sk
;
}
static
inline
int
unix_may_send
(
unix_socket
*
sk
,
unix_socket
*
osk
)
static
inline
int
unix_may_send
(
struct
sock
*
sk
,
struct
sock
*
osk
)
{
return
(
unix_peer
(
osk
)
==
NULL
||
unix_our_peer
(
sk
,
osk
));
}
static
unix_socket
*
unix_peer_get
(
unix_socket
*
s
)
static
struct
sock
*
unix_peer_get
(
struct
sock
*
s
)
{
unix_socket
*
peer
;
struct
sock
*
peer
;
unix_state_rlock
(
s
);
peer
=
unix_peer
(
s
);
...
...
@@ -209,37 +209,37 @@ static int unix_mkname(struct sockaddr_un * sunaddr, int len, unsigned *hashp)
return
len
;
}
static
void
__unix_remove_socket
(
unix_socket
*
sk
)
static
void
__unix_remove_socket
(
struct
sock
*
sk
)
{
if
(
sk_del_node_init
(
sk
))
__sock_put
(
sk
);
}
static
void
__unix_insert_socket
(
struct
hlist_head
*
list
,
unix_socket
*
sk
)
static
void
__unix_insert_socket
(
struct
hlist_head
*
list
,
struct
sock
*
sk
)
{
BUG_TRAP
(
sk_unhashed
(
sk
));
sk_add_node
(
sk
,
list
);
sock_hold
(
sk
);
}
static
inline
void
unix_remove_socket
(
unix_socket
*
sk
)
static
inline
void
unix_remove_socket
(
struct
sock
*
sk
)
{
write_lock
(
&
unix_table_lock
);
__unix_remove_socket
(
sk
);
write_unlock
(
&
unix_table_lock
);
}
static
inline
void
unix_insert_socket
(
struct
hlist_head
*
list
,
unix_socket
*
sk
)
static
inline
void
unix_insert_socket
(
struct
hlist_head
*
list
,
struct
sock
*
sk
)
{
write_lock
(
&
unix_table_lock
);
__unix_insert_socket
(
list
,
sk
);
write_unlock
(
&
unix_table_lock
);
}
static
unix_socket
*
__unix_find_socket_byname
(
struct
sockaddr_un
*
sunname
,
static
struct
sock
*
__unix_find_socket_byname
(
struct
sockaddr_un
*
sunname
,
int
len
,
int
type
,
unsigned
hash
)
{
unix_socket
*
s
;
struct
sock
*
s
;
struct
hlist_node
*
node
;
sk_for_each
(
s
,
node
,
&
unix_socket_table
[
hash
^
type
])
{
...
...
@@ -254,11 +254,11 @@ static unix_socket *__unix_find_socket_byname(struct sockaddr_un *sunname,
return
s
;
}
static
inline
unix_socket
*
unix_find_socket_byname
(
struct
sockaddr_un
*
sunnam
e
,
int
len
,
int
type
,
unsigned
hash
)
static
inline
struct
sock
*
unix_find_socket_byname
(
struct
sockaddr_un
*
sunname
,
int
len
,
int
typ
e
,
unsigned
hash
)
{
unix_socket
*
s
;
struct
sock
*
s
;
read_lock
(
&
unix_table_lock
);
s
=
__unix_find_socket_byname
(
sunname
,
len
,
type
,
hash
);
...
...
@@ -268,9 +268,9 @@ unix_find_socket_byname(struct sockaddr_un *sunname,
return
s
;
}
static
unix_socket
*
unix_find_socket_byinode
(
struct
inode
*
i
)
static
struct
sock
*
unix_find_socket_byinode
(
struct
inode
*
i
)
{
unix_socket
*
s
;
struct
sock
*
s
;
struct
hlist_node
*
node
;
read_lock
(
&
unix_table_lock
);
...
...
@@ -350,12 +350,12 @@ static void unix_sock_destructor(struct sock *sk)
#endif
}
static
int
unix_release_sock
(
unix_socket
*
sk
,
int
embrion
)
static
int
unix_release_sock
(
struct
sock
*
sk
,
int
embrion
)
{
struct
unix_sock
*
u
=
unix_sk
(
sk
);
struct
dentry
*
dentry
;
struct
vfsmount
*
mnt
;
unix_socket
*
skpair
;
struct
sock
*
skpair
;
struct
sk_buff
*
skb
;
int
state
;
...
...
@@ -525,7 +525,7 @@ static int unix_create(struct socket *sock, int protocol)
static
int
unix_release
(
struct
socket
*
sock
)
{
unix_socket
*
sk
=
sock
->
sk
;
struct
sock
*
sk
=
sock
->
sk
;
if
(
!
sk
)
return
0
;
...
...
@@ -585,10 +585,10 @@ out: up(&u->readsem);
return
err
;
}
static
unix_socket
*
unix_find_other
(
struct
sockaddr_un
*
sunname
,
int
len
,
static
struct
sock
*
unix_find_other
(
struct
sockaddr_un
*
sunname
,
int
len
,
int
type
,
unsigned
hash
,
int
*
error
)
{
unix_socket
*
u
;
struct
sock
*
u
;
struct
nameidata
nd
;
int
err
=
0
;
...
...
@@ -839,7 +839,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
return
err
;
}
static
long
unix_wait_for_peer
(
unix_socket
*
other
,
long
timeo
)
static
long
unix_wait_for_peer
(
struct
sock
*
other
,
long
timeo
)
{
struct
unix_sock
*
u
=
unix_sk
(
other
);
int
sched
;
...
...
@@ -868,7 +868,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
struct
sock
*
sk
=
sock
->
sk
;
struct
unix_sock
*
u
=
unix_sk
(
sk
),
*
newu
,
*
otheru
;
struct
sock
*
newsk
=
NULL
;
unix_socket
*
other
=
NULL
;
struct
sock
*
other
=
NULL
;
struct
sk_buff
*
skb
=
NULL
;
unsigned
hash
;
int
st
;
...
...
@@ -1061,8 +1061,8 @@ static int unix_socketpair(struct socket *socka, struct socket *sockb)
static
int
unix_accept
(
struct
socket
*
sock
,
struct
socket
*
newsock
,
int
flags
)
{
unix_socket
*
sk
=
sock
->
sk
;
unix_socket
*
tsk
;
struct
sock
*
sk
=
sock
->
sk
;
struct
sock
*
tsk
;
struct
sk_buff
*
skb
;
int
err
;
...
...
@@ -1183,7 +1183,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
struct
sock
*
sk
=
sock
->
sk
;
struct
unix_sock
*
u
=
unix_sk
(
sk
);
struct
sockaddr_un
*
sunaddr
=
msg
->
msg_name
;
unix_socket
*
other
=
NULL
;
struct
sock
*
other
=
NULL
;
int
namelen
=
0
;
/* fake GCC */
int
err
;
unsigned
hash
;
...
...
@@ -1329,7 +1329,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
{
struct
sock_iocb
*
siocb
=
kiocb_to_siocb
(
kiocb
);
struct
sock
*
sk
=
sock
->
sk
;
unix_socket
*
other
=
NULL
;
struct
sock
*
other
=
NULL
;
struct
sockaddr_un
*
sunaddr
=
msg
->
msg_name
;
int
err
,
size
;
struct
sk_buff
*
skb
;
...
...
@@ -1525,7 +1525,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock,
* Sleep until data has arrive. But check for races..
*/
static
long
unix_stream_data_wait
(
unix_socket
*
sk
,
long
timeo
)
static
long
unix_stream_data_wait
(
struct
sock
*
sk
,
long
timeo
)
{
DEFINE_WAIT
(
wait
);
...
...
@@ -1699,7 +1699,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
static
int
unix_shutdown
(
struct
socket
*
sock
,
int
mode
)
{
struct
sock
*
sk
=
sock
->
sk
;
unix_socket
*
other
;
struct
sock
*
other
;
mode
=
(
mode
+
1
)
&
(
RCV_SHUTDOWN
|
SEND_SHUTDOWN
);
...
...
@@ -1814,7 +1814,7 @@ static int unix_read_proc(char *buffer, char **start, off_t offset,
off_t
begin
=
0
;
int
len
=
0
;
int
i
;
unix_socket
*
s
;
struct
sock
*
s
;
len
+=
sprintf
(
buffer
,
"Num RefCount Protocol Flags Type St "
"Inode Path
\n
"
);
...
...
net/unix/garbage.c
View file @
fc761690
...
...
@@ -84,17 +84,17 @@
/* Internal data structures and random procedures: */
#define GC_HEAD ((
unix_socket
*)(-1))
#define GC_ORPHAN ((
unix_socket
*)(-3))
#define GC_HEAD ((
struct sock
*)(-1))
#define GC_ORPHAN ((
struct sock
*)(-3))
static
unix_socket
*
gc_current
=
GC_HEAD
;
/* stack of objects to mark */
static
struct
sock
*
gc_current
=
GC_HEAD
;
/* stack of objects to mark */
atomic_t
unix_tot_inflight
=
ATOMIC_INIT
(
0
);
static
unix_socket
*
unix_get_socket
(
struct
file
*
filp
)
static
struct
sock
*
unix_get_socket
(
struct
file
*
filp
)
{
unix_socket
*
u_sock
=
NULL
;
struct
sock
*
u_sock
=
NULL
;
struct
inode
*
inode
=
filp
->
f_dentry
->
d_inode
;
/*
...
...
@@ -120,7 +120,7 @@ static unix_socket *unix_get_socket(struct file *filp)
void
unix_inflight
(
struct
file
*
fp
)
{
unix_socket
*
s
=
unix_get_socket
(
fp
);
struct
sock
*
s
=
unix_get_socket
(
fp
);
if
(
s
)
{
atomic_inc
(
&
unix_sk
(
s
)
->
inflight
);
atomic_inc
(
&
unix_tot_inflight
);
...
...
@@ -129,7 +129,7 @@ void unix_inflight(struct file *fp)
void
unix_notinflight
(
struct
file
*
fp
)
{
unix_socket
*
s
=
unix_get_socket
(
fp
);
struct
sock
*
s
=
unix_get_socket
(
fp
);
if
(
s
)
{
atomic_dec
(
&
unix_sk
(
s
)
->
inflight
);
atomic_dec
(
&
unix_tot_inflight
);
...
...
@@ -141,9 +141,9 @@ void unix_notinflight(struct file *fp)
* Garbage Collector Support Functions
*/
static
inline
unix_socket
*
pop_stack
(
void
)
static
inline
struct
sock
*
pop_stack
(
void
)
{
unix_socket
*
p
=
gc_current
;
struct
sock
*
p
=
gc_current
;
gc_current
=
unix_sk
(
p
)
->
gc_tree
;
return
p
;
}
...
...
@@ -153,7 +153,7 @@ static inline int empty_stack(void)
return
gc_current
==
GC_HEAD
;
}
static
void
maybe_unmark_and_push
(
unix_socket
*
x
)
static
void
maybe_unmark_and_push
(
struct
sock
*
x
)
{
struct
unix_sock
*
u
=
unix_sk
(
x
);
...
...
@@ -171,7 +171,7 @@ void unix_gc(void)
{
static
DECLARE_MUTEX
(
unix_gc_sem
);
int
i
;
unix_socket
*
s
;
struct
sock
*
s
;
struct
sk_buff_head
hitlist
;
struct
sk_buff
*
skb
;
...
...
@@ -231,8 +231,8 @@ void unix_gc(void)
while
(
!
empty_stack
())
{
unix_socket
*
x
=
pop_stack
();
unix_socket
*
sk
;
struct
sock
*
x
=
pop_stack
();
struct
sock
*
sk
;
spin_lock
(
&
x
->
sk_receive_queue
.
lock
);
skb
=
skb_peek
(
&
x
->
sk_receive_queue
);
...
...
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