Commit 708a24c1 authored by James Simmons's avatar James Simmons Committed by Greg Kroah-Hartman

staging: lustre: make LNet use lprocfs_call_handler

Sometime ago a patch was submitted to duplicate the
proc_call_handler code in the LNet layer. This was
due to the thinking libcfs was not used by the LNet
layer. This was a wrong assumption so lets make LNet
use the lprocfs_call_handler from the libcfs layer.
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5900ba93
...@@ -154,5 +154,9 @@ struct lnet_debugfs_symlink_def { ...@@ -154,5 +154,9 @@ struct lnet_debugfs_symlink_def {
void lustre_insert_debugfs(struct ctl_table *table, void lustre_insert_debugfs(struct ctl_table *table,
const struct lnet_debugfs_symlink_def *symlinks); const struct lnet_debugfs_symlink_def *symlinks);
int lprocfs_call_handler(void *data, int write, loff_t *ppos,
void __user *buffer, size_t *lenp,
int (*handler)(void *data, int write,
loff_t pos, void __user *buffer, int len));
#endif /* _LIBCFS_H */ #endif /* _LIBCFS_H */
...@@ -73,26 +73,6 @@ ...@@ -73,26 +73,6 @@
#define LNET_PROC_VERSION(v) ((unsigned int)((v) & LNET_PROC_VER_MASK)) #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 __user *buffer, size_t *lenp,
int (*handler)(void *data, int write,
loff_t pos, void __user *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, static int __proc_lnet_stats(void *data, int write,
loff_t pos, void __user *buffer, int nob) loff_t pos, void __user *buffer, int nob)
{ {
...@@ -144,7 +124,7 @@ static int __proc_lnet_stats(void *data, int write, ...@@ -144,7 +124,7 @@ static int __proc_lnet_stats(void *data, int write,
static int proc_lnet_stats(struct ctl_table *table, int write, static int proc_lnet_stats(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos) void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
return proc_call_handler(table->data, write, ppos, buffer, lenp, return lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
__proc_lnet_stats); __proc_lnet_stats);
} }
...@@ -640,7 +620,7 @@ static int __proc_lnet_buffers(void *data, int write, ...@@ -640,7 +620,7 @@ static int __proc_lnet_buffers(void *data, int write,
static int proc_lnet_buffers(struct ctl_table *table, int write, static int proc_lnet_buffers(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos) void __user *buffer, size_t *lenp, loff_t *ppos)
{ {
return proc_call_handler(table->data, write, ppos, buffer, lenp, return lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
__proc_lnet_buffers); __proc_lnet_buffers);
} }
...@@ -865,7 +845,7 @@ static int proc_lnet_portal_rotor(struct ctl_table *table, int write, ...@@ -865,7 +845,7 @@ static int proc_lnet_portal_rotor(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, void __user *buffer, size_t *lenp,
loff_t *ppos) loff_t *ppos)
{ {
return proc_call_handler(table->data, write, ppos, buffer, lenp, return lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
__proc_lnet_portal_rotor); __proc_lnet_portal_rotor);
} }
......
...@@ -217,7 +217,7 @@ struct cfs_psdev_ops libcfs_psdev_ops = { ...@@ -217,7 +217,7 @@ struct cfs_psdev_ops libcfs_psdev_ops = {
libcfs_ioctl libcfs_ioctl
}; };
static int lprocfs_call_handler(void *data, int write, loff_t *ppos, int lprocfs_call_handler(void *data, int write, loff_t *ppos,
void __user *buffer, size_t *lenp, void __user *buffer, size_t *lenp,
int (*handler)(void *data, int write, loff_t pos, int (*handler)(void *data, int write, loff_t pos,
void __user *buffer, int len)) void __user *buffer, int len))
...@@ -235,6 +235,7 @@ static int lprocfs_call_handler(void *data, int write, loff_t *ppos, ...@@ -235,6 +235,7 @@ static int lprocfs_call_handler(void *data, int write, loff_t *ppos,
} }
return 0; return 0;
} }
EXPORT_SYMBOL(lprocfs_call_handler);
static int __proc_dobitmasks(void *data, int write, static int __proc_dobitmasks(void *data, int write,
loff_t pos, void __user *buffer, int nob) loff_t pos, void __user *buffer, int nob)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment