Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.25-rc7 /net/sctp/proc.c

Filename:/net/sctp/proc.c
Lines Added:10
Lines Deleted:34
Also changed in: (Previous) 2.6.25-rc6  2.6.25-rc5  2.6.25-rc4  2.6.25-rc3-git6  2.6.25-rc3-git5  2.6.25-rc3-git4 
(Following) 2.6.25-rc8  2.6.25-rc9  2.6.25  2.6.25-git2  2.6.25-git3  2.6.25-git4 

Location
[  2.6.25-rc7
  [  net
    [  sctp
       o  proc.c

Patch

diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 2499732..973f1db 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -1,15 +1,15 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel implementation
  * Copyright (c) 2003 International Business Machines, Corp.
  *
- * This file is part of the SCTP kernel reference Implementation
+ * This file is part of the SCTP kernel implementation
  *
- * The SCTP reference implementation is free software;
+ * This SCTP implementation is free software;
  * you can redistribute it and/or modify it under the terms of
  * the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
  *
- * The SCTP reference implementation is distributed in the hope that it
+ * This SCTP implementation is distributed in the hope that it
  * will be useful, but WITHOUT ANY WARRANTY; without even the implied
  *                 ************************
  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -38,6 +38,7 @@
 #include <linux/seq_file.h>
 #include <linux/init.h>
 #include <net/sctp/sctp.h>
+#include <net/ip.h> /* for snmp_fold_field */
 
 static struct snmp_mib sctp_snmp_list[] = {
    SNMP_MIB_ITEM("SctpCurrEstab", SCTP_MIB_CURRESTAB),
@@ -75,26 +76,6 @@ static struct snmp_mib sctp_snmp_list[] = {
    SNMP_MIB_SENTINEL
 };
 
-/* Return the current value of a particular entry in the mib by adding its
- * per cpu counters.
- */
-static unsigned long
-fold_field(void *mib[], int nr)
-{
-   unsigned long res = 0;
-   int i;
-
-   for_each_possible_cpu(i) {
-      res +=
-          *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) +
-                sizeof (unsigned long) * nr));
-      res +=
-          *((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) +
-                sizeof (unsigned long) * nr));
-   }
-   return res;
-}
-
 /* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */
 static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
 {
@@ -102,7 +83,7 @@ static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
 
    for (i = 0; sctp_snmp_list[i].name != NULL; i++)
       seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name,
-            fold_field((void **)sctp_statistics,
+            snmp_fold_field((void **)sctp_statistics,
                   sctp_snmp_list[i].entry));
 
    return 0;
@@ -127,12 +108,10 @@ int __init sctp_snmp_proc_init(void)
 {
    struct proc_dir_entry *p;
 
-   p = create_proc_entry("snmp", S_IRUGO, proc_net_sctp);
+   p = proc_create("snmp", S_IRUGO, proc_net_sctp, &sctp_snmp_seq_fops);
    if (!p)
       return -ENOMEM;
 
-   p->proc_fops = &sctp_snmp_seq_fops;
-
    return 0;
 }
 
@@ -277,12 +256,10 @@ int __init sctp_eps_proc_init(void)
 {
    struct proc_dir_entry *p;
 
-   p = create_proc_entry("eps", S_IRUGO, proc_net_sctp);
+   p = proc_create("eps", S_IRUGO, proc_net_sctp, &sctp_eps_seq_fops);
    if (!p)
       return -ENOMEM;
 
-   p->proc_fops = &sctp_eps_seq_fops;
-
    return 0;
 }
 
@@ -388,12 +365,11 @@ int __init sctp_assocs_proc_init(void)
 {
    struct proc_dir_entry *p;
 
-   p = create_proc_entry("assocs", S_IRUGO, proc_net_sctp);
+   p = proc_create("assocs", S_IRUGO, proc_net_sctp,
+         &sctp_assocs_seq_fops);
    if (!p)
       return -ENOMEM;
 
-   p->proc_fops = &sctp_assocs_seq_fops;
-
    return 0;
 }
 


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.