aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2007-11-20 01:31:54 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:28 -0500
commite372c41401993b45c721c4d92730e7e0a79f7c1b (patch)
tree8f062f506c0578fc83b7d05c8751a7ccac96e50e /net/packet
parent097e66c578459f79e3a2128c54e9df5194e1419a (diff)
[NET]: Consolidate net namespace related proc files creation.
Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 45e3cbcb2763..ace29f1c4c5b 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1871,7 +1871,7 @@ static inline struct sock *packet_seq_idx(struct net *net, loff_t off)
1871 1871
1872static void *packet_seq_start(struct seq_file *seq, loff_t *pos) 1872static void *packet_seq_start(struct seq_file *seq, loff_t *pos)
1873{ 1873{
1874 struct net *net = seq->private; 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}
@@ -1924,26 +1924,8 @@ static const struct seq_operations packet_seq_ops = {
1924 1924
1925static int packet_seq_open(struct inode *inode, struct file *file) 1925static int packet_seq_open(struct inode *inode, struct file *file)
1926{ 1926{
1927 struct seq_file *seq; 1927 return seq_open_net(inode, file, &packet_seq_ops,
1928 int res; 1928 sizeof(struct seq_net_private));
1929 res = seq_open(file, &packet_seq_ops);
1930 if (!res) {
1931 seq = file->private_data;
1932 seq->private = get_proc_net(inode);
1933 if (!seq->private) {
1934 seq_release(inode, file);
1935 res = -ENXIO;
1936 }
1937 }
1938 return res;
1939}
1940
1941static int packet_seq_release(struct inode *inode, struct file *file)
1942{
1943 struct seq_file *seq= file->private_data;
1944 struct net *net = seq->private;
1945 put_net(net);
1946 return seq_release(inode, file);
1947} 1929}
1948 1930
1949static const struct file_operations packet_seq_fops = { 1931static const struct file_operations packet_seq_fops = {
@@ -1951,7 +1933,7 @@ static const struct file_operations packet_seq_fops = {
1951 .open = packet_seq_open, 1933 .open = packet_seq_open,
1952 .read = seq_read, 1934 .read = seq_read,
1953 .llseek = seq_lseek, 1935 .llseek = seq_lseek,
1954 .release = packet_seq_release, 1936 .release = seq_release_net,
1955}; 1937};
1956 1938
1957#endif 1939#endif