mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-01 16:57:18 +09:00
staging: lustre: clean up some proc file declarations
This removes the DECLARE_PROC_HANDLER macro, and makes proc_call_handler a static function (horrible name to be in a module). This makes the linux-prim.h file empty now, so it can be removed soon. Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -61,16 +61,4 @@
|
||||
|
||||
#include "linux-time.h"
|
||||
|
||||
/*
|
||||
* Sysctl register
|
||||
*/
|
||||
#define DECLARE_PROC_HANDLER(name) \
|
||||
static int name(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, \
|
||||
__##name); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -84,10 +84,4 @@
|
||||
#define ll_proc_dolongvec(table, write, filp, buffer, lenp, ppos) \
|
||||
proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
|
||||
|
||||
/* helper for sysctl handlers */
|
||||
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));
|
||||
|
||||
#endif /* _PORTALS_COMPAT_H */
|
||||
|
||||
@@ -90,6 +90,24 @@ enum {
|
||||
|
||||
#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)
|
||||
{
|
||||
@@ -139,7 +157,12 @@ static int __proc_lnet_stats(void *data, int write,
|
||||
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)
|
||||
@@ -627,7 +650,12 @@ static int __proc_lnet_buffers(void *data, int write,
|
||||
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)
|
||||
@@ -847,7 +875,14 @@ out:
|
||||
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[] = {
|
||||
/*
|
||||
|
||||
@@ -98,11 +98,9 @@ enum {
|
||||
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);
|
||||
|
||||
@@ -117,7 +115,6 @@ proc_call_handler(void *data, int write,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(proc_call_handler);
|
||||
|
||||
static int __proc_dobitmasks(void *data, int write,
|
||||
loff_t pos, void *buffer, int nob)
|
||||
@@ -160,7 +157,12 @@ static int __proc_dobitmasks(void *data, int write,
|
||||
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 */
|
||||
@@ -174,7 +176,12 @@ static int __proc_dump_kernel(void *data, int write,
|
||||
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)
|
||||
@@ -192,7 +199,12 @@ static int __proc_daemon_file(void *data, int write,
|
||||
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)
|
||||
@@ -212,7 +224,12 @@ static int __proc_debug_mb(void *data, int write,
|
||||
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)
|
||||
@@ -366,7 +383,13 @@ static int __proc_cpt_table(void *data, int write,
|
||||
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[] = {
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user