aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_trie.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-10-10 05:29:29 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:55:33 -0400
commitcf7732e4cc14b56d593ff53352673e1fd5e3ba52 (patch)
tree3479e278b72f9d535a58066bc2a26238806252ce /net/ipv4/fib_trie.c
parent39699037a5c94d7cd1363dfe48a50c78c643fd9a (diff)
[NET]: Make core networking code use seq_open_private
This concerns the ipv4 and ipv6 code mostly, but also the netlink and unix sockets. The netlink code is an example of how to use the __seq_open_private() call - it saves the net namespace on this private. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r--net/ipv4/fib_trie.c42
1 files changed, 4 insertions, 38 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index be34bd556d5..81a8285d6d6 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2379,25 +2379,8 @@ static const struct seq_operations fib_trie_seq_ops = {
2379 2379
2380static int fib_trie_seq_open(struct inode *inode, struct file *file) 2380static int fib_trie_seq_open(struct inode *inode, struct file *file)
2381{ 2381{
2382 struct seq_file *seq; 2382 return seq_open_private(file, &fib_trie_seq_ops,
2383 int rc = -ENOMEM; 2383 sizeof(struct fib_trie_iter));
2384 struct fib_trie_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
2385
2386 if (!s)
2387 goto out;
2388
2389 rc = seq_open(file, &fib_trie_seq_ops);
2390 if (rc)
2391 goto out_kfree;
2392
2393 seq = file->private_data;
2394 seq->private = s;
2395 memset(s, 0, sizeof(*s));
2396out:
2397 return rc;
2398out_kfree:
2399 kfree(s);
2400 goto out;
2401} 2384}
2402 2385
2403static const struct file_operations fib_trie_fops = { 2386static const struct file_operations fib_trie_fops = {
@@ -2500,25 +2483,8 @@ static const struct seq_operations fib_route_seq_ops = {
2500 2483
2501static int fib_route_seq_open(struct inode *inode, struct file *file) 2484static int fib_route_seq_open(struct inode *inode, struct file *file)
2502{ 2485{
2503 struct seq_file *seq; 2486 return seq_open_private(file, &fib_route_seq_ops,
2504 int rc = -ENOMEM; 2487 sizeof(struct fib_trie_iter));
2505 struct fib_trie_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
2506
2507 if (!s)
2508 goto out;
2509
2510 rc = seq_open(file, &fib_route_seq_ops);
2511 if (rc)
2512 goto out_kfree;
2513
2514 seq = file->private_data;
2515 seq->private = s;
2516 memset(s, 0, sizeof(*s));
2517out:
2518 return rc;
2519out_kfree:
2520 kfree(s);
2521 goto out;
2522} 2488}
2523 2489
2524static const struct file_operations fib_route_fops = { 2490static const struct file_operations fib_route_fops = {