Whamcloud - gitweb
LU-3974 libcfs: replace num_physpages with totalram_pages
[fs/lustre-release.git] / libcfs / libcfs / linux / linux-proc.c
index 874347e..bbc363a 100644 (file)
@@ -68,7 +68,7 @@
 #include "tracefile.h"
 
 #ifdef CONFIG_SYSCTL
-static cfs_sysctl_table_header_t *lnet_table_header = NULL;
+static struct ctl_table_header *lnet_table_header = NULL;
 #endif
 extern char lnet_upcall[1024];
 /**
@@ -246,9 +246,9 @@ DECLARE_PROC_HANDLER(proc_debug_mb)
 
 int LL_PROC_PROTO(proc_console_max_delay_cs)
 {
-        int rc, max_delay_cs;
-        cfs_sysctl_table_t dummy = *table;
-        cfs_duration_t d;
+       int rc, max_delay_cs;
+       struct ctl_table dummy = *table;
+       cfs_duration_t d;
 
         dummy.data = &max_delay_cs;
         dummy.proc_handler = &proc_dointvec;
@@ -277,60 +277,60 @@ int LL_PROC_PROTO(proc_console_max_delay_cs)
 
 int LL_PROC_PROTO(proc_console_min_delay_cs)
 {
-        int rc, min_delay_cs;
-        cfs_sysctl_table_t dummy = *table;
-        cfs_duration_t d;
+       int rc, min_delay_cs;
+       struct ctl_table dummy = *table;
+       cfs_duration_t d;
 
-        dummy.data = &min_delay_cs;
-        dummy.proc_handler = &proc_dointvec;
+       dummy.data = &min_delay_cs;
+       dummy.proc_handler = &proc_dointvec;
 
-        if (!write) { /* read */
-                min_delay_cs = cfs_duration_sec(libcfs_console_min_delay * 100);
-                rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
-                return rc;
-        }
+       if (!write) { /* read */
+               min_delay_cs = cfs_duration_sec(libcfs_console_min_delay * 100);
+               rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+               return rc;
+       }
 
-        /* write */
-        min_delay_cs = 0;
-        rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
-        if (rc < 0)
-                return rc;
-        if (min_delay_cs <= 0)
-                return -EINVAL;
+       /* write */
+       min_delay_cs = 0;
+       rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+       if (rc < 0)
+               return rc;
+       if (min_delay_cs <= 0)
+               return -EINVAL;
 
-        d = cfs_time_seconds(min_delay_cs) / 100;
-        if (d == 0 || d > libcfs_console_max_delay)
-                return -EINVAL;
-        libcfs_console_min_delay = d;
+       d = cfs_time_seconds(min_delay_cs) / 100;
+       if (d == 0 || d > libcfs_console_max_delay)
+               return -EINVAL;
+       libcfs_console_min_delay = d;
 
-        return rc;
+       return rc;
 }
 
 int LL_PROC_PROTO(proc_console_backoff)
 {
-        int rc, backoff;
-        cfs_sysctl_table_t dummy = *table;
+       int rc, backoff;
+       struct ctl_table dummy = *table;
 
-        dummy.data = &backoff;
-        dummy.proc_handler = &proc_dointvec;
+       dummy.data = &backoff;
+       dummy.proc_handler = &proc_dointvec;
 
-        if (!write) { /* read */
-                backoff= libcfs_console_backoff;
-                rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
-                return rc;
-        }
+       if (!write) { /* read */
+               backoff= libcfs_console_backoff;
+               rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+               return rc;
+       }
 
-        /* write */
-        backoff = 0;
-        rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
-        if (rc < 0)
-                return rc;
-        if (backoff <= 0)
-                return -EINVAL;
+       /* write */
+       backoff = 0;
+       rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+       if (rc < 0)
+               return rc;
+       if (backoff <= 0)
+               return -EINVAL;
 
-        libcfs_console_backoff = backoff;
+       libcfs_console_backoff = backoff;
 
-        return rc;
+       return rc;
 }
 
 int LL_PROC_PROTO(libcfs_force_lbug)
@@ -342,13 +342,13 @@ int LL_PROC_PROTO(libcfs_force_lbug)
 
 int LL_PROC_PROTO(proc_fail_loc)
 {
-        int rc;
-        long old_fail_loc = cfs_fail_loc;
+       int rc;
+       long old_fail_loc = cfs_fail_loc;
 
-        rc = ll_proc_dolongvec(table, write, filp, buffer, lenp, ppos);
-        if (old_fail_loc != cfs_fail_loc)
-                cfs_waitq_signal(&cfs_race_waitq);
-        return rc;
+       rc = ll_proc_dolongvec(table, write, filp, buffer, lenp, ppos);
+       if (old_fail_loc != cfs_fail_loc)
+               wake_up(&cfs_race_waitq);
+       return rc;
 }
 
 static int __proc_cpt_table(void *data, int write,
@@ -393,7 +393,7 @@ static int __proc_cpt_table(void *data, int write,
 }
 DECLARE_PROC_HANDLER(proc_cpt_table)
 
-static cfs_sysctl_table_t lnet_table[] = {
+static struct ctl_table lnet_table[] = {
         /*
          * NB No .strategy entries have been provided since sysctl(8) prefers
          * to go via /proc for portability.
@@ -571,7 +571,7 @@ static cfs_sysctl_table_t lnet_table[] = {
 };
 
 #ifdef CONFIG_SYSCTL
-static cfs_sysctl_table_t top_table[] = {
+static struct ctl_table top_table[] = {
         {
                 INIT_CTL_NAME(CTL_LNET)
                 .procname = "lnet",
@@ -589,18 +589,18 @@ static cfs_sysctl_table_t top_table[] = {
 int insert_proc(void)
 {
 #ifdef CONFIG_SYSCTL
-        if (lnet_table_header == NULL)
-                lnet_table_header = cfs_register_sysctl_table(top_table, 0);
+       if (lnet_table_header == NULL)
+               lnet_table_header = register_sysctl_table(top_table);
 #endif
-        return 0;
+       return 0;
 }
 
 void remove_proc(void)
 {
 #ifdef CONFIG_SYSCTL
-        if (lnet_table_header != NULL)
-                cfs_unregister_sysctl_table(lnet_table_header);
+       if (lnet_table_header != NULL)
+               unregister_sysctl_table(lnet_table_header);
 
-        lnet_table_header = NULL;
+       lnet_table_header = NULL;
 #endif
 }