#define LNET_PROC_VERSION(v) ((unsigned int)((v) & LNET_PROC_VER_MASK))
+static int proc_call_handler(void *data, int write, loff_t *ppos, void *buffer,
+ size_t *lenp, int (*handler)(void *data, int write,
+ loff_t pos, void *buffer, int len))
+{
+ int rc = handler(data, write, *ppos, buffer, *lenp);
+
+ if (rc < 0)
+ return rc;
+
+ if (write) {
+ *ppos += *lenp;
+ } else {
+ *lenp = rc;
+ *ppos += rc;
+ }
+ return 0;
+}
+
static int __proc_lnet_stats(void *data, int write,
loff_t pos, void *buffer, int nob)
{
return rc;
}
-DECLARE_PROC_HANDLER(proc_lnet_stats);
+static int proc_lnet_stats(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ return proc_call_handler(table->data, write, ppos, buffer, lenp,
+ __proc_lnet_stats);
+}
int proc_lnet_routes(struct ctl_table *table, int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
return rc;
}
-DECLARE_PROC_HANDLER(proc_lnet_buffers);
+static int proc_lnet_buffers(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ return proc_call_handler(table->data, write, ppos, buffer, lenp,
+ __proc_lnet_buffers);
+}
int proc_lnet_nis(struct ctl_table *table, int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
LIBCFS_FREE(buf, buf_len);
return rc;
}
-DECLARE_PROC_HANDLER(proc_lnet_portal_rotor);
+
+static int proc_lnet_portal_rotor(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos)
+{
+ return proc_call_handler(table->data, write, ppos, buffer, lenp,
+ __proc_lnet_portal_rotor);
+}
static struct ctl_table lnet_table[] = {
/*
PSDEV_LNET_FAIL_VAL, /* userdata for fail loc */
};
-int
-proc_call_handler(void *data, int write,
- loff_t *ppos, void *buffer, size_t *lenp,
- int (*handler)(void *data, int write,
- loff_t pos, void *buffer, int len))
+static int proc_call_handler(void *data, int write, loff_t *ppos, void *buffer,
+ size_t *lenp, int (*handler)(void *data, int write,
+ loff_t pos, void *buffer, int len))
{
int rc = handler(data, write, *ppos, buffer, *lenp);
}
return 0;
}
-EXPORT_SYMBOL(proc_call_handler);
static int __proc_dobitmasks(void *data, int write,
loff_t pos, void *buffer, int nob)
return rc;
}
-DECLARE_PROC_HANDLER(proc_dobitmasks)
+static int proc_dobitmasks(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ return proc_call_handler(table->data, write, ppos, buffer, lenp,
+ __proc_dobitmasks);
+}
static int min_watchdog_ratelimit = 0; /* disable ratelimiting */
static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */
return cfs_trace_dump_debug_buffer_usrstr(buffer, nob);
}
-DECLARE_PROC_HANDLER(proc_dump_kernel)
+static int proc_dump_kernel(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ return proc_call_handler(table->data, write, ppos, buffer, lenp,
+ __proc_dump_kernel);
+}
static int __proc_daemon_file(void *data, int write,
loff_t pos, void *buffer, int nob)
return cfs_trace_daemon_command_usrstr(buffer, nob);
}
-DECLARE_PROC_HANDLER(proc_daemon_file)
+static int proc_daemon_file(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ return proc_call_handler(table->data, write, ppos, buffer, lenp,
+ __proc_daemon_file);
+}
static int __proc_debug_mb(void *data, int write,
loff_t pos, void *buffer, int nob)
return cfs_trace_set_debug_mb_usrstr(buffer, nob);
}
-DECLARE_PROC_HANDLER(proc_debug_mb)
+static int proc_debug_mb(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ return proc_call_handler(table->data, write, ppos, buffer, lenp,
+ __proc_debug_mb);
+}
int proc_console_max_delay_cs(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
LIBCFS_FREE(buf, len);
return rc;
}
-DECLARE_PROC_HANDLER(proc_cpt_table)
+
+static int proc_cpt_table(struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+ return proc_call_handler(table->data, write, ppos, buffer, lenp,
+ __proc_cpt_table);
+}
static struct ctl_table lnet_table[] = {
/*