diff options
author | Denis V. Lunev <den@openvz.org> | 2007-12-11 07:19:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:57:15 -0500 |
commit | 2aaef4e47fef8a6c0bc7fc5d9d3eea4af290e04c (patch) | |
tree | c78dfe5a76f1c19cf1167b94d623feed3f4cc9d5 /net/packet/af_packet.c | |
parent | a0a53c8ba95451feef6c1975016f0a1eb3044ad4 (diff) |
[NETNS]: separate af_packet netns data
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r-- | net/packet/af_packet.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index ace29f1c4c5b..485af5691d64 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -803,9 +803,9 @@ static int packet_release(struct socket *sock) | |||
803 | net = sk->sk_net; | 803 | net = sk->sk_net; |
804 | po = pkt_sk(sk); | 804 | po = pkt_sk(sk); |
805 | 805 | ||
806 | write_lock_bh(&net->packet_sklist_lock); | 806 | write_lock_bh(&net->packet.sklist_lock); |
807 | sk_del_node_init(sk); | 807 | sk_del_node_init(sk); |
808 | write_unlock_bh(&net->packet_sklist_lock); | 808 | write_unlock_bh(&net->packet.sklist_lock); |
809 | 809 | ||
810 | /* | 810 | /* |
811 | * Unhook packet receive handler. | 811 | * Unhook packet receive handler. |
@@ -1015,9 +1015,9 @@ static int packet_create(struct net *net, struct socket *sock, int protocol) | |||
1015 | po->running = 1; | 1015 | po->running = 1; |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | write_lock_bh(&net->packet_sklist_lock); | 1018 | write_lock_bh(&net->packet.sklist_lock); |
1019 | sk_add_node(sk, &net->packet_sklist); | 1019 | sk_add_node(sk, &net->packet.sklist); |
1020 | write_unlock_bh(&net->packet_sklist_lock); | 1020 | write_unlock_bh(&net->packet.sklist_lock); |
1021 | return(0); | 1021 | return(0); |
1022 | out: | 1022 | out: |
1023 | return err; | 1023 | return err; |
@@ -1452,8 +1452,8 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void | |||
1452 | struct net_device *dev = data; | 1452 | struct net_device *dev = data; |
1453 | struct net *net = dev->nd_net; | 1453 | struct net *net = dev->nd_net; |
1454 | 1454 | ||
1455 | read_lock(&net->packet_sklist_lock); | 1455 | read_lock(&net->packet.sklist_lock); |
1456 | sk_for_each(sk, node, &net->packet_sklist) { | 1456 | sk_for_each(sk, node, &net->packet.sklist) { |
1457 | struct packet_sock *po = pkt_sk(sk); | 1457 | struct packet_sock *po = pkt_sk(sk); |
1458 | 1458 | ||
1459 | switch (msg) { | 1459 | switch (msg) { |
@@ -1492,7 +1492,7 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void | |||
1492 | break; | 1492 | break; |
1493 | } | 1493 | } |
1494 | } | 1494 | } |
1495 | read_unlock(&net->packet_sklist_lock); | 1495 | read_unlock(&net->packet.sklist_lock); |
1496 | return NOTIFY_DONE; | 1496 | return NOTIFY_DONE; |
1497 | } | 1497 | } |
1498 | 1498 | ||
@@ -1862,7 +1862,7 @@ static inline struct sock *packet_seq_idx(struct net *net, loff_t off) | |||
1862 | struct sock *s; | 1862 | struct sock *s; |
1863 | struct hlist_node *node; | 1863 | struct hlist_node *node; |
1864 | 1864 | ||
1865 | sk_for_each(s, node, &net->packet_sklist) { | 1865 | sk_for_each(s, node, &net->packet.sklist) { |
1866 | if (!off--) | 1866 | if (!off--) |
1867 | return s; | 1867 | return s; |
1868 | } | 1868 | } |
@@ -1872,7 +1872,7 @@ static inline struct sock *packet_seq_idx(struct net *net, loff_t off) | |||
1872 | static void *packet_seq_start(struct seq_file *seq, loff_t *pos) | 1872 | static void *packet_seq_start(struct seq_file *seq, loff_t *pos) |
1873 | { | 1873 | { |
1874 | struct net *net = seq_file_net(seq); | 1874 | struct net *net = seq_file_net(seq); |
1875 | read_lock(&net->packet_sklist_lock); | 1875 | read_lock(&net->packet.sklist_lock); |
1876 | return *pos ? packet_seq_idx(net, *pos - 1) : SEQ_START_TOKEN; | 1876 | return *pos ? packet_seq_idx(net, *pos - 1) : SEQ_START_TOKEN; |
1877 | } | 1877 | } |
1878 | 1878 | ||
@@ -1881,14 +1881,14 @@ static void *packet_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1881 | struct net *net = seq->private; | 1881 | struct net *net = seq->private; |
1882 | ++*pos; | 1882 | ++*pos; |
1883 | return (v == SEQ_START_TOKEN) | 1883 | return (v == SEQ_START_TOKEN) |
1884 | ? sk_head(&net->packet_sklist) | 1884 | ? sk_head(&net->packet.sklist) |
1885 | : sk_next((struct sock*)v) ; | 1885 | : sk_next((struct sock*)v) ; |
1886 | } | 1886 | } |
1887 | 1887 | ||
1888 | static void packet_seq_stop(struct seq_file *seq, void *v) | 1888 | static void packet_seq_stop(struct seq_file *seq, void *v) |
1889 | { | 1889 | { |
1890 | struct net *net = seq->private; | 1890 | struct net *net = seq->private; |
1891 | read_unlock(&net->packet_sklist_lock); | 1891 | read_unlock(&net->packet.sklist_lock); |
1892 | } | 1892 | } |
1893 | 1893 | ||
1894 | static int packet_seq_show(struct seq_file *seq, void *v) | 1894 | static int packet_seq_show(struct seq_file *seq, void *v) |
@@ -1940,8 +1940,8 @@ static const struct file_operations packet_seq_fops = { | |||
1940 | 1940 | ||
1941 | static int packet_net_init(struct net *net) | 1941 | static int packet_net_init(struct net *net) |
1942 | { | 1942 | { |
1943 | rwlock_init(&net->packet_sklist_lock); | 1943 | rwlock_init(&net->packet.sklist_lock); |
1944 | INIT_HLIST_HEAD(&net->packet_sklist); | 1944 | INIT_HLIST_HEAD(&net->packet.sklist); |
1945 | 1945 | ||
1946 | if (!proc_net_fops_create(net, "packet", 0, &packet_seq_fops)) | 1946 | if (!proc_net_fops_create(net, "packet", 0, &packet_seq_fops)) |
1947 | return -ENOMEM; | 1947 | return -ENOMEM; |