diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c')
-rw-r--r-- | drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c | 98 |
1 files changed, 39 insertions, 59 deletions
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c index c1ef0c9b5a1a..38a9b319355e 100644 --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c @@ -42,17 +42,17 @@ #include <linux/slab.h> #include <linux/stat.h> #include <linux/ctype.h> -#include <asm/bitops.h> -#include <asm/uaccess.h> +#include <linux/bitops.h> +#include <linux/uaccess.h> #include <linux/utsname.h> #define DEBUG_SUBSYSTEM S_CLASS -#include <obd_support.h> -#include <lprocfs_status.h> +#include "../../include/obd_support.h" +#include "../../include/lprocfs_status.h" #ifdef CONFIG_SYSCTL -ctl_table_header_t *obd_table_header = NULL; +static struct ctl_table_header *obd_table_header; #endif @@ -79,21 +79,22 @@ enum { }; -int LL_PROC_PROTO(proc_set_timeout) +static int proc_set_timeout(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) { int rc; - rc = ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); + rc = proc_dointvec(table, write, buffer, lenp, ppos); if (ldlm_timeout >= obd_timeout) ldlm_timeout = max(obd_timeout / 3, 1U); return rc; } -int LL_PROC_PROTO(proc_memory_alloc) +static int proc_memory_alloc(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) { char buf[22]; int len; - DECLARE_LL_PROC_PPOS_DECL; if (!*lenp || (*ppos && !write)) { *lenp = 0; @@ -102,7 +103,7 @@ int LL_PROC_PROTO(proc_memory_alloc) if (write) return -EINVAL; - len = snprintf(buf, sizeof(buf), LPU64"\n", obd_memory_sum()); + len = snprintf(buf, sizeof(buf), "%llu\n", obd_memory_sum()); if (len > *lenp) len = *lenp; buf[len] = '\0'; @@ -113,11 +114,11 @@ int LL_PROC_PROTO(proc_memory_alloc) return 0; } -int LL_PROC_PROTO(proc_pages_alloc) +static int proc_pages_alloc(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) { char buf[22]; int len; - DECLARE_LL_PROC_PPOS_DECL; if (!*lenp || (*ppos && !write)) { *lenp = 0; @@ -126,7 +127,7 @@ int LL_PROC_PROTO(proc_pages_alloc) if (write) return -EINVAL; - len = snprintf(buf, sizeof(buf), LPU64"\n", obd_pages_sum()); + len = snprintf(buf, sizeof(buf), "%llu\n", obd_pages_sum()); if (len > *lenp) len = *lenp; buf[len] = '\0'; @@ -137,11 +138,11 @@ int LL_PROC_PROTO(proc_pages_alloc) return 0; } -int LL_PROC_PROTO(proc_mem_max) +static int proc_mem_max(struct ctl_table *table, int write, void __user *buffer, + size_t *lenp, loff_t *ppos) { char buf[22]; int len; - DECLARE_LL_PROC_PPOS_DECL; if (!*lenp || (*ppos && !write)) { *lenp = 0; @@ -150,7 +151,7 @@ int LL_PROC_PROTO(proc_mem_max) if (write) return -EINVAL; - len = snprintf(buf, sizeof(buf), LPU64"\n", obd_memory_max()); + len = snprintf(buf, sizeof(buf), "%llu\n", obd_memory_max()); if (len > *lenp) len = *lenp; buf[len] = '\0'; @@ -161,11 +162,11 @@ int LL_PROC_PROTO(proc_mem_max) return 0; } -int LL_PROC_PROTO(proc_pages_max) +static int proc_pages_max(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) { char buf[22]; int len; - DECLARE_LL_PROC_PPOS_DECL; if (!*lenp || (*ppos && !write)) { *lenp = 0; @@ -174,7 +175,7 @@ int LL_PROC_PROTO(proc_pages_max) if (write) return -EINVAL; - len = snprintf(buf, sizeof(buf), LPU64"\n", obd_pages_max()); + len = snprintf(buf, sizeof(buf), "%llu\n", obd_pages_max()); if (len > *lenp) len = *lenp; buf[len] = '\0'; @@ -185,10 +186,10 @@ int LL_PROC_PROTO(proc_pages_max) return 0; } -int LL_PROC_PROTO(proc_max_dirty_pages_in_mb) +static int proc_max_dirty_pages_in_mb(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) { int rc = 0; - DECLARE_LL_PROC_PPOS_DECL; if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { *lenp = 0; @@ -196,7 +197,7 @@ int LL_PROC_PROTO(proc_max_dirty_pages_in_mb) } if (write) { rc = lprocfs_write_frac_helper(buffer, *lenp, - (unsigned int*)table->data, + (unsigned int *)table->data, 1 << (20 - PAGE_CACHE_SHIFT)); /* Don't allow them to let dirty pages exceed 90% of system * memory and set a hard minimum of 4MB. */ @@ -214,7 +215,7 @@ int LL_PROC_PROTO(proc_max_dirty_pages_in_mb) int len; len = lprocfs_read_frac_helper(buf, sizeof(buf), - *(unsigned int*)table->data, + *(unsigned int *)table->data, 1 << (20 - PAGE_CACHE_SHIFT)); if (len > *lenp) len = *lenp; @@ -227,10 +228,10 @@ int LL_PROC_PROTO(proc_max_dirty_pages_in_mb) return rc; } -int LL_PROC_PROTO(proc_alloc_fail_rate) +static int proc_alloc_fail_rate(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) { int rc = 0; - DECLARE_LL_PROC_PPOS_DECL; if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { *lenp = 0; @@ -238,14 +239,14 @@ int LL_PROC_PROTO(proc_alloc_fail_rate) } if (write) { rc = lprocfs_write_frac_helper(buffer, *lenp, - (unsigned int*)table->data, + (unsigned int *)table->data, OBD_ALLOC_FAIL_MULT); } else { char buf[21]; int len; len = lprocfs_read_frac_helper(buf, 21, - *(unsigned int*)table->data, + *(unsigned int *)table->data, OBD_ALLOC_FAIL_MULT); if (len > *lenp) len = *lenp; @@ -258,29 +259,8 @@ int LL_PROC_PROTO(proc_alloc_fail_rate) return rc; } -int LL_PROC_PROTO(proc_at_min) -{ - return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); -} -int LL_PROC_PROTO(proc_at_max) -{ - return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); -} -int LL_PROC_PROTO(proc_at_extra) -{ - return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); -} -int LL_PROC_PROTO(proc_at_early_margin) -{ - return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); -} -int LL_PROC_PROTO(proc_at_history) -{ - return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); -} - #ifdef CONFIG_SYSCTL -static ctl_table_t obd_table[] = { +static struct ctl_table obd_table[] = { { .procname = "timeout", .data = &obd_timeout, @@ -363,40 +343,40 @@ static ctl_table_t obd_table[] = { .data = &at_min, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_at_min + .proc_handler = &proc_dointvec, }, { .procname = "at_max", .data = &at_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_at_max + .proc_handler = &proc_dointvec, }, { .procname = "at_extra", .data = &at_extra, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_at_extra + .proc_handler = &proc_dointvec, }, { .procname = "at_early_margin", .data = &at_early_margin, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_at_early_margin + .proc_handler = &proc_dointvec, }, { .procname = "at_history", .data = &at_history, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = &proc_at_history + .proc_handler = &proc_dointvec, }, {} }; -static ctl_table_t parent_table[] = { +static struct ctl_table parent_table[] = { { .procname = "lustre", .data = NULL, @@ -408,18 +388,18 @@ static ctl_table_t parent_table[] = { }; #endif -void obd_sysctl_init (void) +void obd_sysctl_init(void) { #ifdef CONFIG_SYSCTL - if ( !obd_table_header ) + if (!obd_table_header) obd_table_header = register_sysctl_table(parent_table); #endif } -void obd_sysctl_clean (void) +void obd_sysctl_clean(void) { #ifdef CONFIG_SYSCTL - if ( obd_table_header ) + if (obd_table_header) unregister_sysctl_table(obd_table_header); obd_table_header = NULL; #endif |