aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--net/ipv4/arp.c20
-rw-r--r--net/ipv4/fib_hash.c20
-rw-r--r--net/ipv4/fib_trie.c42
-rw-r--r--net/ipv4/igmp.c38
-rw-r--r--net/ipv4/ipmr.c43
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c20
-rw-r--r--net/ipv4/raw.c20
-rw-r--r--net/ipv4/route.c19
-rw-r--r--net/ipv6/addrconf.c20
-rw-r--r--net/ipv6/anycast.c20
-rw-r--r--net/ipv6/ip6_flowlabel.c20
-rw-r--r--net/ipv6/mcast.c40
-rw-r--r--net/ipv6/raw.c17
-rw-r--r--net/netlink/af_netlink.c13
-rw-r--r--net/unix/af_unix.c20
15 files changed, 37 insertions, 335 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index d8248198bcd7..36d6798947b5 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1378,24 +1378,8 @@ static const struct seq_operations arp_seq_ops = {
1378 1378
1379static int arp_seq_open(struct inode *inode, struct file *file) 1379static int arp_seq_open(struct inode *inode, struct file *file)
1380{ 1380{
1381 struct seq_file *seq; 1381 return seq_open_private(file, &arp_seq_ops,
1382 int rc = -ENOMEM; 1382 sizeof(struct neigh_seq_state));
1383 struct neigh_seq_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
1384
1385 if (!s)
1386 goto out;
1387
1388 rc = seq_open(file, &arp_seq_ops);
1389 if (rc)
1390 goto out_kfree;
1391
1392 seq = file->private_data;
1393 seq->private = s;
1394out:
1395 return rc;
1396out_kfree:
1397 kfree(s);
1398 goto out;
1399} 1383}
1400 1384
1401static const struct file_operations arp_seq_fops = { 1385static const struct file_operations arp_seq_fops = {
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 9fafbeea8fe6..527a6e0af5b6 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -1039,24 +1039,8 @@ static const struct seq_operations fib_seq_ops = {
1039 1039
1040static int fib_seq_open(struct inode *inode, struct file *file) 1040static int fib_seq_open(struct inode *inode, struct file *file)
1041{ 1041{
1042 struct seq_file *seq; 1042 return seq_open_private(file, &fib_seq_ops,
1043 int rc = -ENOMEM; 1043 sizeof(struct fib_iter_state));
1044 struct fib_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
1045
1046 if (!s)
1047 goto out;
1048
1049 rc = seq_open(file, &fib_seq_ops);
1050 if (rc)
1051 goto out_kfree;
1052
1053 seq = file->private_data;
1054 seq->private = s;
1055out:
1056 return rc;
1057out_kfree:
1058 kfree(s);
1059 goto out;
1060} 1044}
1061 1045
1062static const struct file_operations fib_seq_fops = { 1046static const struct file_operations fib_seq_fops = {
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index be34bd556d58..81a8285d6d6a 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 = {
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 2b6e59c4c0d0..7dbc282d4f9f 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2410,23 +2410,8 @@ static const struct seq_operations igmp_mc_seq_ops = {
2410 2410
2411static int igmp_mc_seq_open(struct inode *inode, struct file *file) 2411static int igmp_mc_seq_open(struct inode *inode, struct file *file)
2412{ 2412{
2413 struct seq_file *seq; 2413 return seq_open_private(file, &igmp_mc_seq_ops,
2414 int rc = -ENOMEM; 2414 sizeof(struct igmp_mc_iter_state));
2415 struct igmp_mc_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
2416
2417 if (!s)
2418 goto out;
2419 rc = seq_open(file, &igmp_mc_seq_ops);
2420 if (rc)
2421 goto out_kfree;
2422
2423 seq = file->private_data;
2424 seq->private = s;
2425out:
2426 return rc;
2427out_kfree:
2428 kfree(s);
2429 goto out;
2430} 2415}
2431 2416
2432static const struct file_operations igmp_mc_seq_fops = { 2417static const struct file_operations igmp_mc_seq_fops = {
@@ -2584,23 +2569,8 @@ static const struct seq_operations igmp_mcf_seq_ops = {
2584 2569
2585static int igmp_mcf_seq_open(struct inode *inode, struct file *file) 2570static int igmp_mcf_seq_open(struct inode *inode, struct file *file)
2586{ 2571{
2587 struct seq_file *seq; 2572 return seq_open_private(file, &igmp_mcf_seq_ops,
2588 int rc = -ENOMEM; 2573 sizeof(struct igmp_mcf_iter_state));
2589 struct igmp_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
2590
2591 if (!s)
2592 goto out;
2593 rc = seq_open(file, &igmp_mcf_seq_ops);
2594 if (rc)
2595 goto out_kfree;
2596
2597 seq = file->private_data;
2598 seq->private = s;
2599out:
2600 return rc;
2601out_kfree:
2602 kfree(s);
2603 goto out;
2604} 2574}
2605 2575
2606static const struct file_operations igmp_mcf_seq_fops = { 2576static const struct file_operations igmp_mcf_seq_fops = {
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index b8b4b497fb57..37bb497d92af 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1714,26 +1714,8 @@ static const struct seq_operations ipmr_vif_seq_ops = {
1714 1714
1715static int ipmr_vif_open(struct inode *inode, struct file *file) 1715static int ipmr_vif_open(struct inode *inode, struct file *file)
1716{ 1716{
1717 struct seq_file *seq; 1717 return seq_open_private(file, &ipmr_vif_seq_ops,
1718 int rc = -ENOMEM; 1718 sizeof(struct ipmr_vif_iter));
1719 struct ipmr_vif_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
1720
1721 if (!s)
1722 goto out;
1723
1724 rc = seq_open(file, &ipmr_vif_seq_ops);
1725 if (rc)
1726 goto out_kfree;
1727
1728 s->ct = 0;
1729 seq = file->private_data;
1730 seq->private = s;
1731out:
1732 return rc;
1733out_kfree:
1734 kfree(s);
1735 goto out;
1736
1737} 1719}
1738 1720
1739static const struct file_operations ipmr_vif_fops = { 1721static const struct file_operations ipmr_vif_fops = {
@@ -1877,25 +1859,8 @@ static const struct seq_operations ipmr_mfc_seq_ops = {
1877 1859
1878static int ipmr_mfc_open(struct inode *inode, struct file *file) 1860static int ipmr_mfc_open(struct inode *inode, struct file *file)
1879{ 1861{
1880 struct seq_file *seq; 1862 return seq_open_private(file, &ipmr_mfc_seq_ops,
1881 int rc = -ENOMEM; 1863 sizeof(struct ipmr_mfc_iter));
1882 struct ipmr_mfc_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
1883
1884 if (!s)
1885 goto out;
1886
1887 rc = seq_open(file, &ipmr_mfc_seq_ops);
1888 if (rc)
1889 goto out_kfree;
1890
1891 seq = file->private_data;
1892 seq->private = s;
1893out:
1894 return rc;
1895out_kfree:
1896 kfree(s);
1897 goto out;
1898
1899} 1864}
1900 1865
1901static const struct file_operations ipmr_mfc_fops = { 1866static const struct file_operations ipmr_mfc_fops = {
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index 61d023d58b5d..7345fc252a23 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -1792,24 +1792,8 @@ static const struct seq_operations ip_vs_info_seq_ops = {
1792 1792
1793static int ip_vs_info_open(struct inode *inode, struct file *file) 1793static int ip_vs_info_open(struct inode *inode, struct file *file)
1794{ 1794{
1795 struct seq_file *seq; 1795 return seq_open_private(file, &ip_vs_info_seq_ops,
1796 int rc = -ENOMEM; 1796 sizeof(struct ip_vs_iter));
1797 struct ip_vs_iter *s = kzalloc(sizeof(*s), GFP_KERNEL);
1798
1799 if (!s)
1800 goto out;
1801
1802 rc = seq_open(file, &ip_vs_info_seq_ops);
1803 if (rc)
1804 goto out_kfree;
1805
1806 seq = file->private_data;
1807 seq->private = s;
1808out:
1809 return rc;
1810out_kfree:
1811 kfree(s);
1812 goto out;
1813} 1797}
1814 1798
1815static const struct file_operations ip_vs_info_fops = { 1799static const struct file_operations ip_vs_info_fops = {
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 07070c7067f3..3916faca3afe 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -902,24 +902,8 @@ static const struct seq_operations raw_seq_ops = {
902 902
903static int raw_seq_open(struct inode *inode, struct file *file) 903static int raw_seq_open(struct inode *inode, struct file *file)
904{ 904{
905 struct seq_file *seq; 905 return seq_open_private(file, &raw_seq_ops,
906 int rc = -ENOMEM; 906 sizeof(struct raw_iter_state));
907 struct raw_iter_state *s;
908
909 s = kzalloc(sizeof(*s), GFP_KERNEL);
910 if (!s)
911 goto out;
912 rc = seq_open(file, &raw_seq_ops);
913 if (rc)
914 goto out_kfree;
915
916 seq = file->private_data;
917 seq->private = s;
918out:
919 return rc;
920out_kfree:
921 kfree(s);
922 goto out;
923} 907}
924 908
925static const struct file_operations raw_seq_fops = { 909static const struct file_operations raw_seq_fops = {
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 307e1f1107ca..21b12de9e653 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -375,23 +375,8 @@ static const struct seq_operations rt_cache_seq_ops = {
375 375
376static int rt_cache_seq_open(struct inode *inode, struct file *file) 376static int rt_cache_seq_open(struct inode *inode, struct file *file)
377{ 377{
378 struct seq_file *seq; 378 return seq_open_private(file, &rt_cache_seq_ops,
379 int rc = -ENOMEM; 379 sizeof(struct rt_cache_iter_state));
380 struct rt_cache_iter_state *s;
381
382 s = kzalloc(sizeof(*s), GFP_KERNEL);
383 if (!s)
384 goto out;
385 rc = seq_open(file, &rt_cache_seq_ops);
386 if (rc)
387 goto out_kfree;
388 seq = file->private_data;
389 seq->private = s;
390out:
391 return rc;
392out_kfree:
393 kfree(s);
394 goto out;
395} 380}
396 381
397static const struct file_operations rt_cache_seq_fops = { 382static const struct file_operations rt_cache_seq_fops = {
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 6d5c3c299148..8b2d760ddf26 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2806,24 +2806,8 @@ static const struct seq_operations if6_seq_ops = {
2806 2806
2807static int if6_seq_open(struct inode *inode, struct file *file) 2807static int if6_seq_open(struct inode *inode, struct file *file)
2808{ 2808{
2809 struct seq_file *seq; 2809 return seq_open_private(file, &if6_seq_ops,
2810 int rc = -ENOMEM; 2810 sizeof(struct if6_iter_state));
2811 struct if6_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
2812
2813 if (!s)
2814 goto out;
2815
2816 rc = seq_open(file, &if6_seq_ops);
2817 if (rc)
2818 goto out_kfree;
2819
2820 seq = file->private_data;
2821 seq->private = s;
2822out:
2823 return rc;
2824out_kfree:
2825 kfree(s);
2826 goto out;
2827} 2811}
2828 2812
2829static const struct file_operations if6_fops = { 2813static const struct file_operations if6_fops = {
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 5810852c558a..f915c4df9820 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -549,24 +549,8 @@ static const struct seq_operations ac6_seq_ops = {
549 549
550static int ac6_seq_open(struct inode *inode, struct file *file) 550static int ac6_seq_open(struct inode *inode, struct file *file)
551{ 551{
552 struct seq_file *seq; 552 return seq_open_private(file, &ac6_seq_ops,
553 int rc = -ENOMEM; 553 sizeof(struct ac6_iter_state));
554 struct ac6_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
555
556 if (!s)
557 goto out;
558
559 rc = seq_open(file, &ac6_seq_ops);
560 if (rc)
561 goto out_kfree;
562
563 seq = file->private_data;
564 seq->private = s;
565out:
566 return rc;
567out_kfree:
568 kfree(s);
569 goto out;
570} 554}
571 555
572static const struct file_operations ac6_seq_fops = { 556static const struct file_operations ac6_seq_fops = {
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 1791399c7f10..217d60f9fc80 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -658,24 +658,8 @@ static const struct seq_operations ip6fl_seq_ops = {
658 658
659static int ip6fl_seq_open(struct inode *inode, struct file *file) 659static int ip6fl_seq_open(struct inode *inode, struct file *file)
660{ 660{
661 struct seq_file *seq; 661 return seq_open_private(file, &ip6fl_seq_ops,
662 int rc = -ENOMEM; 662 sizeof(struct ip6fl_iter_state));
663 struct ip6fl_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
664
665 if (!s)
666 goto out;
667
668 rc = seq_open(file, &ip6fl_seq_ops);
669 if (rc)
670 goto out_kfree;
671
672 seq = file->private_data;
673 seq->private = s;
674out:
675 return rc;
676out_kfree:
677 kfree(s);
678 goto out;
679} 663}
680 664
681static const struct file_operations ip6fl_seq_fops = { 665static const struct file_operations ip6fl_seq_fops = {
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index cc8d4e2a9531..331d728c2035 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -2426,24 +2426,8 @@ static const struct seq_operations igmp6_mc_seq_ops = {
2426 2426
2427static int igmp6_mc_seq_open(struct inode *inode, struct file *file) 2427static int igmp6_mc_seq_open(struct inode *inode, struct file *file)
2428{ 2428{
2429 struct seq_file *seq; 2429 return seq_open_private(file, &igmp6_mc_seq_ops,
2430 int rc = -ENOMEM; 2430 sizeof(struct igmp6_mc_iter_state));
2431 struct igmp6_mc_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
2432
2433 if (!s)
2434 goto out;
2435
2436 rc = seq_open(file, &igmp6_mc_seq_ops);
2437 if (rc)
2438 goto out_kfree;
2439
2440 seq = file->private_data;
2441 seq->private = s;
2442out:
2443 return rc;
2444out_kfree:
2445 kfree(s);
2446 goto out;
2447} 2431}
2448 2432
2449static const struct file_operations igmp6_mc_seq_fops = { 2433static const struct file_operations igmp6_mc_seq_fops = {
@@ -2600,24 +2584,8 @@ static const struct seq_operations igmp6_mcf_seq_ops = {
2600 2584
2601static int igmp6_mcf_seq_open(struct inode *inode, struct file *file) 2585static int igmp6_mcf_seq_open(struct inode *inode, struct file *file)
2602{ 2586{
2603 struct seq_file *seq; 2587 return seq_open_private(file, &igmp6_mcf_seq_ops,
2604 int rc = -ENOMEM; 2588 sizeof(struct igmp6_mcf_iter_state));
2605 struct igmp6_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
2606
2607 if (!s)
2608 goto out;
2609
2610 rc = seq_open(file, &igmp6_mcf_seq_ops);
2611 if (rc)
2612 goto out_kfree;
2613
2614 seq = file->private_data;
2615 seq->private = s;
2616out:
2617 return rc;
2618out_kfree:
2619 kfree(s);
2620 goto out;
2621} 2589}
2622 2590
2623static const struct file_operations igmp6_mcf_seq_fops = { 2591static const struct file_operations igmp6_mcf_seq_fops = {
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index bdd0974e6775..ca24ef19cd8f 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1289,21 +1289,8 @@ static const struct seq_operations raw6_seq_ops = {
1289 1289
1290static int raw6_seq_open(struct inode *inode, struct file *file) 1290static int raw6_seq_open(struct inode *inode, struct file *file)
1291{ 1291{
1292 struct seq_file *seq; 1292 return seq_open_private(file, &raw6_seq_ops,
1293 int rc = -ENOMEM; 1293 sizeof(struct raw6_iter_state));
1294 struct raw6_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
1295 if (!s)
1296 goto out;
1297 rc = seq_open(file, &raw6_seq_ops);
1298 if (rc)
1299 goto out_kfree;
1300 seq = file->private_data;
1301 seq->private = s;
1302out:
1303 return rc;
1304out_kfree:
1305 kfree(s);
1306 goto out;
1307} 1294}
1308 1295
1309static const struct file_operations raw6_seq_fops = { 1296static const struct file_operations raw6_seq_fops = {
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 3ef32825da71..f934f54fbfd5 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1845,27 +1845,18 @@ static const struct seq_operations netlink_seq_ops = {
1845 1845
1846static int netlink_seq_open(struct inode *inode, struct file *file) 1846static int netlink_seq_open(struct inode *inode, struct file *file)
1847{ 1847{
1848 struct seq_file *seq;
1849 struct nl_seq_iter *iter; 1848 struct nl_seq_iter *iter;
1850 int err;
1851 1849
1852 iter = kzalloc(sizeof(*iter), GFP_KERNEL); 1850 iter = __seq_open_private(file, &netlink_seq_ops, sizeof(*iter));
1853 if (!iter) 1851 if (!iter)
1854 return -ENOMEM; 1852 return -ENOMEM;
1855 1853
1856 err = seq_open(file, &netlink_seq_ops);
1857 if (err) {
1858 kfree(iter);
1859 return err;
1860 }
1861
1862 seq = file->private_data;
1863 seq->private = iter;
1864 iter->net = get_proc_net(inode); 1854 iter->net = get_proc_net(inode);
1865 if (!iter->net) { 1855 if (!iter->net) {
1866 seq_release_private(inode, file); 1856 seq_release_private(inode, file);
1867 return -ENXIO; 1857 return -ENXIO;
1868 } 1858 }
1859
1869 return 0; 1860 return 0;
1870} 1861}
1871 1862
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 10e73122c34c..2b57eaf66abc 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2086,25 +2086,7 @@ static const struct seq_operations unix_seq_ops = {
2086 2086
2087static int unix_seq_open(struct inode *inode, struct file *file) 2087static int unix_seq_open(struct inode *inode, struct file *file)
2088{ 2088{
2089 struct seq_file *seq; 2089 return seq_open_private(file, &unix_seq_ops, sizeof(int));
2090 int rc = -ENOMEM;
2091 int *iter = kmalloc(sizeof(int), GFP_KERNEL);
2092
2093 if (!iter)
2094 goto out;
2095
2096 rc = seq_open(file, &unix_seq_ops);
2097 if (rc)
2098 goto out_kfree;
2099
2100 seq = file->private_data;
2101 seq->private = iter;
2102 *iter = 0;
2103out:
2104 return rc;
2105out_kfree:
2106 kfree(iter);
2107 goto out;
2108} 2090}
2109 2091
2110static const struct file_operations unix_seq_fops = { 2092static const struct file_operations unix_seq_fops = {