mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
staging/lustre/libcfs: get rid of debugfs/lnet/console_{min, max}_delay_centisecs
They are just fancy module parameters wrappers, so just the same functionality now would be accessible via /sys/module/libcfs/parameters/libcfs_console_{min,max}_delay Also install compatibility symlinks Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8dc08446d0
commit
35ca907d24
@ -106,16 +106,75 @@ module_param(libcfs_console_ratelimit, uint, 0644);
|
||||
MODULE_PARM_DESC(libcfs_console_ratelimit, "Lustre kernel debug console ratelimit (0 to disable)");
|
||||
EXPORT_SYMBOL(libcfs_console_ratelimit);
|
||||
|
||||
unsigned int libcfs_console_max_delay;
|
||||
module_param(libcfs_console_max_delay, uint, 0644);
|
||||
MODULE_PARM_DESC(libcfs_console_max_delay, "Lustre kernel debug console max delay (jiffies)");
|
||||
EXPORT_SYMBOL(libcfs_console_max_delay);
|
||||
static int param_set_delay_minmax(const char *val,
|
||||
const struct kernel_param *kp,
|
||||
long min, long max)
|
||||
{
|
||||
long d;
|
||||
int sec;
|
||||
int rc;
|
||||
|
||||
rc = kstrtoint(val, 0, &sec);
|
||||
if (rc)
|
||||
return -EINVAL;
|
||||
|
||||
d = cfs_time_seconds(sec) / 100;
|
||||
if (d < min || d > max)
|
||||
return -EINVAL;
|
||||
|
||||
*((unsigned int *)kp->arg) = d;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int param_get_delay(char *buffer, const struct kernel_param *kp)
|
||||
{
|
||||
unsigned int d = *(unsigned int *)kp->arg;
|
||||
|
||||
return sprintf(buffer, "%u", (unsigned int)cfs_duration_sec(d * 100));
|
||||
}
|
||||
|
||||
unsigned int libcfs_console_max_delay;
|
||||
EXPORT_SYMBOL(libcfs_console_max_delay);
|
||||
unsigned int libcfs_console_min_delay;
|
||||
module_param(libcfs_console_min_delay, uint, 0644);
|
||||
MODULE_PARM_DESC(libcfs_console_min_delay, "Lustre kernel debug console min delay (jiffies)");
|
||||
EXPORT_SYMBOL(libcfs_console_min_delay);
|
||||
|
||||
static int param_set_console_max_delay(const char *val,
|
||||
const struct kernel_param *kp)
|
||||
{
|
||||
return param_set_delay_minmax(val, kp,
|
||||
libcfs_console_min_delay, INT_MAX);
|
||||
}
|
||||
|
||||
static struct kernel_param_ops param_ops_console_max_delay = {
|
||||
.set = param_set_console_max_delay,
|
||||
.get = param_get_delay,
|
||||
};
|
||||
|
||||
#define param_check_console_max_delay(name, p) \
|
||||
__param_check(name, p, unsigned int)
|
||||
|
||||
module_param(libcfs_console_max_delay, console_max_delay, 0644);
|
||||
MODULE_PARM_DESC(libcfs_console_max_delay, "Lustre kernel debug console max delay (jiffies)");
|
||||
|
||||
static int param_set_console_min_delay(const char *val,
|
||||
const struct kernel_param *kp)
|
||||
{
|
||||
return param_set_delay_minmax(val, kp,
|
||||
1, libcfs_console_max_delay);
|
||||
}
|
||||
|
||||
static struct kernel_param_ops param_ops_console_min_delay = {
|
||||
.set = param_set_console_min_delay,
|
||||
.get = param_get_delay,
|
||||
};
|
||||
|
||||
#define param_check_console_min_delay(name, p) \
|
||||
__param_check(name, p, unsigned int)
|
||||
|
||||
module_param(libcfs_console_min_delay, console_min_delay, 0644);
|
||||
MODULE_PARM_DESC(libcfs_console_min_delay, "Lustre kernel debug console min delay (jiffies)");
|
||||
|
||||
static int param_set_uint_minmax(const char *val,
|
||||
const struct kernel_param *kp,
|
||||
unsigned int min, unsigned int max)
|
||||
|
@ -550,72 +550,6 @@ static int proc_daemon_file(struct ctl_table *table, int write,
|
||||
__proc_daemon_file);
|
||||
}
|
||||
|
||||
static int proc_console_max_delay_cs(struct ctl_table *table, int write,
|
||||
void __user *buffer, size_t *lenp,
|
||||
loff_t *ppos)
|
||||
{
|
||||
int rc, max_delay_cs;
|
||||
struct ctl_table dummy = *table;
|
||||
long d;
|
||||
|
||||
dummy.data = &max_delay_cs;
|
||||
dummy.proc_handler = &proc_dointvec;
|
||||
|
||||
if (!write) { /* read */
|
||||
max_delay_cs = cfs_duration_sec(libcfs_console_max_delay * 100);
|
||||
rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* write */
|
||||
max_delay_cs = 0;
|
||||
rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
if (max_delay_cs <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
d = cfs_time_seconds(max_delay_cs) / 100;
|
||||
if (d == 0 || d < libcfs_console_min_delay)
|
||||
return -EINVAL;
|
||||
libcfs_console_max_delay = d;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int proc_console_min_delay_cs(struct ctl_table *table, int write,
|
||||
void __user *buffer, size_t *lenp,
|
||||
loff_t *ppos)
|
||||
{
|
||||
int rc, min_delay_cs;
|
||||
struct ctl_table dummy = *table;
|
||||
long d;
|
||||
|
||||
dummy.data = &min_delay_cs;
|
||||
dummy.proc_handler = &proc_dointvec;
|
||||
|
||||
if (!write) { /* read */
|
||||
min_delay_cs = cfs_duration_sec(libcfs_console_min_delay * 100);
|
||||
rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* write */
|
||||
min_delay_cs = 0;
|
||||
rc = proc_dointvec(&dummy, write, buffer, lenp, ppos);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
if (min_delay_cs <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
d = cfs_time_seconds(min_delay_cs) / 100;
|
||||
if (d == 0 || d > libcfs_console_max_delay)
|
||||
return -EINVAL;
|
||||
libcfs_console_min_delay = d;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int libcfs_force_lbug(struct ctl_table *table, int write,
|
||||
void __user *buffer,
|
||||
size_t *lenp, loff_t *ppos)
|
||||
@ -712,18 +646,6 @@ static struct ctl_table lnet_table[] = {
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_dobitmasks,
|
||||
},
|
||||
{
|
||||
.procname = "console_max_delay_centisecs",
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_console_max_delay_cs
|
||||
},
|
||||
{
|
||||
.procname = "console_min_delay_centisecs",
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = &proc_console_min_delay_cs
|
||||
},
|
||||
{
|
||||
.procname = "cpu_partition_table",
|
||||
.maxlen = 128,
|
||||
@ -805,6 +727,10 @@ struct lnet_debugfs_symlink_def lnet_debugfs_symlinks[] = {
|
||||
"/sys/module/libcfs/parameters/libcfs_console_backoff"},
|
||||
{ "debug_mb",
|
||||
"/sys/module/libcfs/parameters/libcfs_debug_mb"},
|
||||
{ "console_min_delay_centisecs",
|
||||
"/sys/module/libcfs/parameters/libcfs_console_min_delay"},
|
||||
{ "console_max_delay_centisecs",
|
||||
"/sys/module/libcfs/parameters/libcfs_console_max_delay"},
|
||||
{},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user