}
/**
- * lprocfs interface
+ * debugfs interface
*/
-#ifdef CONFIG_PROC_FS
-
/**
* This allows to bundle the policy name into the lprocfs_vars::data pointer
* so that lprocfs read/write functions can be used by both the ORR and TRR
val = lprocfs_find_named_value(kernbuf, NRS_LPROCFS_QUANTUM_NAME_REG,
&count_copy);
if (val != kernbuf) {
- quantum_reg = simple_strtol(val, NULL, 10);
-
+ rc = kstrtol(val, 10, &quantum_reg);
+ if (rc)
+ return rc;
queue |= PTLRPC_NRS_QUEUE_REG;
}
if (!nrs_svc_has_hp(svc))
return -ENODEV;
- quantum_hp = simple_strtol(val, NULL, 10);
+ rc = kstrtol(val, 10, &quantum_hp);
+ if (rc)
+ return rc;
queue |= PTLRPC_NRS_QUEUE_HP;
}
* value
*/
if (queue == 0) {
- if (!isdigit(kernbuf[0]))
- return -EINVAL;
-
- quantum_reg = simple_strtol(kernbuf, NULL, 10);
+ rc = kstrtol(kernbuf, 10, &quantum_reg);
+ if (rc)
+ return rc;
queue = PTLRPC_NRS_QUEUE_REG;
return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
}
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_quantum);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_quantum);
#define LPROCFS_NRS_OFF_NAME_REG "reg_offset_type:"
#define LPROCFS_NRS_OFF_NAME_HP "hp_offset_type:"
return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
}
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_offset_type);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_offset_type);
#define NRS_LPROCFS_REQ_SUPP_NAME_REG "reg_supported:"
#define NRS_LPROCFS_REQ_SUPP_NAME_HP "hp_supported:"
return rc == -ENODEV && rc2 == -ENODEV ? -ENODEV : count;
}
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_supported);
+
+LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_supported);
static int nrs_orr_lprocfs_init(struct ptlrpc_service *svc)
{
{ NULL }
};
- if (svc->srv_procroot == NULL)
+ if (IS_ERR_OR_NULL(svc->srv_debugfs_entry))
return 0;
lprocfs_orr_data.svc = svc;
for (i = 0; i < ARRAY_SIZE(nrs_orr_lprocfs_vars); i++)
nrs_orr_lprocfs_vars[i].data = &lprocfs_orr_data;
- return lprocfs_add_vars(svc->srv_procroot, nrs_orr_lprocfs_vars, NULL);
-}
-
-static void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc)
-{
- if (svc->srv_procroot == NULL)
- return;
-
- lprocfs_remove_proc_entry("nrs_orr_quantum", svc->srv_procroot);
- lprocfs_remove_proc_entry("nrs_orr_offset_type", svc->srv_procroot);
- lprocfs_remove_proc_entry("nrs_orr_supported", svc->srv_procroot);
+ return ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_orr_lprocfs_vars,
+ NULL);
}
-#endif /* CONFIG_PROC_FS */
-
static const struct ptlrpc_nrs_pol_ops nrs_orr_ops = {
.op_policy_init = nrs_orr_init,
.op_policy_start = nrs_orr_start,
.op_req_enqueue = nrs_orr_req_add,
.op_req_dequeue = nrs_orr_req_del,
.op_req_stop = nrs_orr_req_stop,
-#ifdef CONFIG_PROC_FS
.op_lprocfs_init = nrs_orr_lprocfs_init,
- .op_lprocfs_fini = nrs_orr_lprocfs_fini,
-#endif
};
struct ptlrpc_nrs_pol_conf nrs_conf_orr = {
*
* TRR reuses much of the functions and data structures of ORR
*/
-
-#ifdef CONFIG_PROC_FS
-
static int nrs_trr_lprocfs_init(struct ptlrpc_service *svc)
{
int i;
{ NULL }
};
- if (svc->srv_procroot == NULL)
+ if (IS_ERR_OR_NULL(svc->srv_debugfs_entry))
return 0;
lprocfs_trr_data.svc = svc;
for (i = 0; i < ARRAY_SIZE(nrs_trr_lprocfs_vars); i++)
nrs_trr_lprocfs_vars[i].data = &lprocfs_trr_data;
- return lprocfs_add_vars(svc->srv_procroot, nrs_trr_lprocfs_vars, NULL);
+ return ldebugfs_add_vars(svc->srv_debugfs_entry, nrs_trr_lprocfs_vars,
+ NULL);
}
-static void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc)
-{
- if (svc->srv_procroot == NULL)
- return;
-
- lprocfs_remove_proc_entry("nrs_trr_quantum", svc->srv_procroot);
- lprocfs_remove_proc_entry("nrs_trr_offset_type", svc->srv_procroot);
- lprocfs_remove_proc_entry("nrs_trr_supported", svc->srv_procroot);
-}
-
-#endif /* CONFIG_PROC_FS */
-
/**
* Reuse much of the ORR functionality for TRR.
*/
.op_req_enqueue = nrs_orr_req_add,
.op_req_dequeue = nrs_orr_req_del,
.op_req_stop = nrs_orr_req_stop,
-#ifdef CONFIG_PROC_FS
.op_lprocfs_init = nrs_trr_lprocfs_init,
- .op_lprocfs_fini = nrs_trr_lprocfs_fini,
-#endif
};
struct ptlrpc_nrs_pol_conf nrs_conf_trr = {