ctl_table.proc_handler has taken 5 arguments since v2.6.32.
We remove the test and dead code. Also eliminate the ll_* prefixed
compatibility shims and empty macros. I've left the LL_PROC_PROTO
macro because it definitely simplifies the appearance of the handler
definitions.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I8c5fc509e1c8bc52705090f5eedf8fb10d549cf5
Reviewed-on: http://review.whamcloud.com/5411
Tested-by: Hudson
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
static int \
LL_PROC_PROTO(name) \
{ \
- DECLARE_LL_PROC_PPOS_DECL; \
- \
return proc_call_handler(table->data, write, \
ppos, buffer, lenp, \
__##name); \
#define __user
#endif
-#ifdef HAVE_5ARGS_SYSCTL_PROC_HANDLER
-#define ll_proc_dointvec(table, write, filp, buffer, lenp, ppos) \
- proc_dointvec(table, write, buffer, lenp, ppos);
-
-#define ll_proc_dolongvec(table, write, filp, buffer, lenp, ppos) \
- proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
-#define ll_proc_dostring(table, write, filp, buffer, lenp, ppos) \
- proc_dostring(table, write, buffer, lenp, ppos);
-#define LL_PROC_PROTO(name) \
- name(struct ctl_table *table, int write, \
- void __user *buffer, size_t *lenp, loff_t *ppos)
-#else
-#define ll_proc_dointvec(table, write, filp, buffer, lenp, ppos) \
- proc_dointvec(table, write, filp, buffer, lenp, ppos);
-
-#define ll_proc_dolongvec(table, write, filp, buffer, lenp, ppos) \
- proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos);
-#define ll_proc_dostring(table, write, filp, buffer, lenp, ppos) \
- proc_dostring(table, write, filp, buffer, lenp, ppos);
-#define LL_PROC_PROTO(name) \
- name(struct ctl_table *table, int write, struct file *filp, \
- void __user *buffer, size_t *lenp, loff_t *ppos)
-#endif
-#define DECLARE_LL_PROC_PPOS_DECL
+#define LL_PROC_PROTO(name) \
+ name(struct ctl_table *table, int write, \
+ void __user *buffer, size_t *lenp, loff_t *ppos)
/* helper for sysctl handlers */
int proc_call_handler(void *data, int write,
#define clear_tsk_thread_flag(current, TIF_SIGPENDING) do {} while(0)
#endif
-#define ll_proc_dointvec(table, write, filp, buffer, lenp, ppos) \
- proc_dointvec(table, write, filp, buffer, lenp)
-#define ll_proc_dostring(table, write, filp, buffer, lenp, ppos) \
- proc_dostring(table, write, filp, buffer, lenp)
#define LL_PROC_PROTO(name) \
name(struct ctl_table *table, int write, struct file *filp, \
void __user *buffer, size_t *lenp)
-#define DECLARE_LL_PROC_PPOS_DECL loff_t *ppos = &filp->f_pos
#endif /* _PORTALS_COMPAT_H */
if (!write) { /* read */
max_delay_cs = cfs_duration_sec(libcfs_console_max_delay * 100);
- rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
return rc;
}
/* write */
max_delay_cs = 0;
- rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
if (rc < 0)
return rc;
if (max_delay_cs <= 0)
if (!write) { /* read */
min_delay_cs = cfs_duration_sec(libcfs_console_min_delay * 100);
- rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
return rc;
}
/* write */
min_delay_cs = 0;
- rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
if (rc < 0)
return rc;
if (min_delay_cs <= 0)
if (!write) { /* read */
backoff= libcfs_console_backoff;
- rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
return rc;
}
/* write */
backoff = 0;
- rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
if (rc < 0)
return rc;
if (backoff <= 0)
int rc;
long old_fail_loc = cfs_fail_loc;
- rc = ll_proc_dolongvec(table, write, filp, buffer, lenp, ppos);
+ rc = proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
if (old_fail_loc != cfs_fail_loc)
wake_up(&cfs_race_waitq);
return rc;
#define OP_MIN 4
-static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp,
+static int do_proc_dointvec(struct ctl_table *table, int write,
void *buffer, size_t *lenp, int conv, int op)
{
int *i, vleft, first=1, neg, val;
if (write && first)
return -EINVAL;
*lenp -= left;
- memset(&(filp->f_pos) , 0, sizeof(loff_t));
- filp->f_pos += (loff_t)(*lenp);
return 0;
}
* proc_dointvec - read a vector of integers
* @table: the sysctl table
* @write: %TRUE if this is a write to the sysctl file
- * @filp: the file structure
* @buffer: the user buffer
* @lenp: the size of the user buffer
*
*
* Returns 0 on success.
*/
-int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
+int proc_dointvec(struct ctl_table *table, int write,
void *buffer, size_t *lenp)
{
- return do_proc_dointvec(table,write,filp,buffer,lenp,1,OP_SET);
+ return do_proc_dointvec(table,write,buffer,lenp,1,OP_SET);
}
* proc_dostring - read a string sysctl
* @table: the sysctl table
* @write: %TRUE if this is a write to the sysctl file
- * @filp: the file structure
* @buffer: the user buffer
* @lenp: the size of the user buffer
*
*
* Returns 0 on success.
*/
-int proc_dostring(struct ctl_table *table, int write, struct file *filp,
+int proc_dostring(struct ctl_table *table, int write,
void *buffer, size_t *lenp)
{
size_t len;
char *p, c;
if (!table->data || !table->maxlen || !*lenp ||
- (filp->f_pos && !write)) {
+ (!write)) {
*lenp = 0;
return 0;
}
if (copy_from_user(table->data, buffer, len))
return -EFAULT;
((char *) table->data)[len] = 0;
- filp->f_pos += *lenp;
} else {
len = (size_t)strlen(table->data);
if (len > (size_t)table->maxlen)
len++;
}
*lenp = len;
- filp->f_pos += len;
}
return 0;
}
[
])
-# See if sysctl proc_handler wants only 5 arguments (since 2.6.32)
-AC_DEFUN([LN_5ARGS_SYSCTL_PROC_HANDLER],
-[AC_MSG_CHECKING([if sysctl proc_handler wants 5 args])
-LB_LINUX_TRY_COMPILE([
- #include <linux/sysctl.h>
-],[
- struct ctl_table *table = NULL;
- int write = 1;
- void __user *buffer = NULL;
- size_t *lenp = NULL;
- loff_t *ppos = NULL;
-
- proc_handler *proc_handler = NULL;
- proc_handler(table, write, buffer, lenp, ppos);
-
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_5ARGS_SYSCTL_PROC_HANDLER, 1,
- [sysctl proc_handler wants 5 args])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
#
# 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
#
LN_CONFIG_GNILND
LN_CONFIG_PTLLND
LN_CONFIG_MX
-# 2.6.32
-LN_5ARGS_SYSCTL_PROC_HANDLER
# 2.6.36
LN_CONFIG_TCP_SENDPAGE
])
int ver;
int off;
- DECLARE_LL_PROC_PPOS_DECL;
-
CLASSERT(sizeof(loff_t) >= 4);
off = LNET_PROC_HOFF_GET(*ppos);
int ver;
int off;
- DECLARE_LL_PROC_PPOS_DECL;
-
off = LNET_PROC_HOFF_GET(*ppos);
ver = LNET_PROC_VER_GET(*ppos);
char *s;
int len;
- DECLARE_LL_PROC_PPOS_DECL;
-
LASSERT (!write);
if (*lenp == 0)
{
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;
{
char buf[22];
int len;
- DECLARE_LL_PROC_PPOS_DECL;
if (!*lenp || (*ppos && !write)) {
*lenp = 0;
{
char buf[22];
int len;
- DECLARE_LL_PROC_PPOS_DECL;
if (!*lenp || (*ppos && !write)) {
*lenp = 0;
{
char buf[22];
int len;
- DECLARE_LL_PROC_PPOS_DECL;
if (!*lenp || (*ppos && !write)) {
*lenp = 0;
{
char buf[22];
int len;
- DECLARE_LL_PROC_PPOS_DECL;
if (!*lenp || (*ppos && !write)) {
*lenp = 0;
int LL_PROC_PROTO(proc_max_dirty_pages_in_mb)
{
int rc = 0;
- DECLARE_LL_PROC_PPOS_DECL;
if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) {
*lenp = 0;
}
#ifdef RANDOM_FAIL_ALLOC
-int LL_PROC_PROTO(proc_alloc_fail_rate)
+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;
int LL_PROC_PROTO(proc_at_min)
{
- return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos);
+ return proc_dointvec(table, write, buffer, lenp, ppos);
}
int LL_PROC_PROTO(proc_at_max)
{
- return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos);
+ return proc_dointvec(table, write, buffer, lenp, ppos);
}
int LL_PROC_PROTO(proc_at_extra)
{
- return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos);
+ return proc_dointvec(table, write, buffer, lenp, ppos);
}
int LL_PROC_PROTO(proc_at_early_margin)
{
- return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos);
+ return proc_dointvec(table, write, buffer, lenp, ppos);
}
int LL_PROC_PROTO(proc_at_history)
{
- return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos);
+ return proc_dointvec(table, write, buffer, lenp, ppos);
}
#ifdef CONFIG_SYSCTL