Commit cb88dfbe authored by Rusty Russell's avatar Rusty Russell Committed by David S. Miller

[AF_UNIX] Cleanup forall_unix_sockets.

parent 71d09b5c
......@@ -13,9 +13,30 @@ extern rwlock_t unix_table_lock;
extern atomic_t unix_tot_inflight;
static inline unix_socket *first_unix_socket(int *i)
{
for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) {
if (unix_socket_table[*i])
return unix_socket_table[*i];
}
return NULL;
}
static inline unix_socket *next_unix_socket(int *i, unix_socket *s)
{
/* More in this chain? */
if (s->next)
return s->next;
/* Look for next non-empty chain. */
for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) {
if (unix_socket_table[*i])
return unix_socket_table[*i];
}
return NULL;
}
#define forall_unix_sockets(i, s) for (i=0; i<=UNIX_HASH_SIZE; i++) \
for (s=unix_socket_table[i]; s; s=s->next)
#define forall_unix_sockets(i, s) \
for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s)))
struct unix_address
{
......
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