Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90206
b: refs/heads/master
c: fc8717b
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Mar 22, 2008
1 parent 1b6da32 commit a8cb2b3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6ba5a3c52da00015e739469e3b00cd6d0d4c5c67
refs/heads/master: fc8717baa8f52dd8d1b90df9008300ef3ec794ed
4 changes: 2 additions & 2 deletions trunk/include/net/raw.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int raw_seq_open(struct inode *ino, struct file *file,

#endif

void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h);
void raw_unhash_sk(struct sock *sk, struct raw_hashinfo *h);
void raw_hash_sk(struct sock *sk);
void raw_unhash_sk(struct sock *sk);

#endif /* _RAW_H */
2 changes: 2 additions & 0 deletions trunk/include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ extern int sk_wait_data(struct sock *sk, long *timeo);
struct request_sock_ops;
struct timewait_sock_ops;
struct inet_hashinfo;
struct raw_hashinfo;

/* Networking protocol blocks we attach to sockets.
* socket layer -> transport layer interface
Expand Down Expand Up @@ -589,6 +590,7 @@ struct proto {
union {
struct inet_hashinfo *hashinfo;
struct hlist_head *udp_hash;
struct raw_hashinfo *raw_hash;
} h;

struct module *owner;
Expand Down
22 changes: 8 additions & 14 deletions trunk/net/ipv4/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ static struct raw_hashinfo raw_v4_hashinfo = {
.lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock),
};

void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h)
void raw_hash_sk(struct sock *sk)
{
struct raw_hashinfo *h = sk->sk_prot->h.raw_hash;
struct hlist_head *head;

head = &h->ht[inet_sk(sk)->num & (RAW_HTABLE_SIZE - 1)];
Expand All @@ -97,25 +98,17 @@ void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h)
}
EXPORT_SYMBOL_GPL(raw_hash_sk);

void raw_unhash_sk(struct sock *sk, struct raw_hashinfo *h)
void raw_unhash_sk(struct sock *sk)
{
struct raw_hashinfo *h = sk->sk_prot->h.raw_hash;

write_lock_bh(&h->lock);
if (sk_del_node_init(sk))
sock_prot_inuse_add(sk->sk_prot, -1);
write_unlock_bh(&h->lock);
}
EXPORT_SYMBOL_GPL(raw_unhash_sk);

static void raw_v4_hash(struct sock *sk)
{
raw_hash_sk(sk, &raw_v4_hashinfo);
}

static void raw_v4_unhash(struct sock *sk)
{
raw_unhash_sk(sk, &raw_v4_hashinfo);
}

static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
unsigned short num, __be32 raddr, __be32 laddr, int dif)
{
Expand Down Expand Up @@ -841,9 +834,10 @@ struct proto raw_prot = {
.recvmsg = raw_recvmsg,
.bind = raw_bind,
.backlog_rcv = raw_rcv_skb,
.hash = raw_v4_hash,
.unhash = raw_v4_unhash,
.hash = raw_hash_sk,
.unhash = raw_unhash_sk,
.obj_size = sizeof(struct raw_sock),
.h.raw_hash = &raw_v4_hashinfo,
#ifdef CONFIG_COMPAT
.compat_setsockopt = compat_raw_setsockopt,
.compat_getsockopt = compat_raw_getsockopt,
Expand Down
16 changes: 3 additions & 13 deletions trunk/net/ipv6/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,6 @@ static struct raw_hashinfo raw_v6_hashinfo = {
.lock = __RW_LOCK_UNLOCKED(raw_v6_hashinfo.lock),
};

static void raw_v6_hash(struct sock *sk)
{
raw_hash_sk(sk, &raw_v6_hashinfo);
}

static void raw_v6_unhash(struct sock *sk)
{
raw_unhash_sk(sk, &raw_v6_hashinfo);
}


static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk,
unsigned short num, struct in6_addr *loc_addr,
struct in6_addr *rmt_addr, int dif)
Expand Down Expand Up @@ -1201,9 +1190,10 @@ struct proto rawv6_prot = {
.recvmsg = rawv6_recvmsg,
.bind = rawv6_bind,
.backlog_rcv = rawv6_rcv_skb,
.hash = raw_v6_hash,
.unhash = raw_v6_unhash,
.hash = raw_hash_sk,
.unhash = raw_unhash_sk,
.obj_size = sizeof(struct raw6_sock),
.h.raw_hash = &raw_v6_hashinfo,
#ifdef CONFIG_COMPAT
.compat_setsockopt = compat_rawv6_setsockopt,
.compat_getsockopt = compat_rawv6_getsockopt,
Expand Down

0 comments on commit a8cb2b3

Please sign in to comment.