mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
FreeBSD: Add support for procfs_list
The procfs_list interface is required by several kstats. Implement this functionality for FreeBSD to provide access to these kstats. Reviewed-by: Allan Jude <allan@klarasystems.com> Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #10890
This commit is contained in:
committed by
Brian Behlendorf
parent
227273efa4
commit
c70c6e004e
@@ -207,6 +207,7 @@ static const kstat_proc_op_t procfs_list_operations = {
|
||||
*/
|
||||
void
|
||||
procfs_list_install(const char *module,
|
||||
const char *submodule,
|
||||
const char *name,
|
||||
mode_t mode,
|
||||
procfs_list_t *procfs_list,
|
||||
@@ -215,6 +216,12 @@ procfs_list_install(const char *module,
|
||||
int (*clear)(procfs_list_t *procfs_list),
|
||||
size_t procfs_list_node_off)
|
||||
{
|
||||
char *modulestr;
|
||||
|
||||
if (submodule != NULL)
|
||||
modulestr = kmem_asprintf("%s/%s", module, submodule);
|
||||
else
|
||||
modulestr = kmem_asprintf("%s", module);
|
||||
mutex_init(&procfs_list->pl_lock, NULL, MUTEX_DEFAULT, NULL);
|
||||
list_create(&procfs_list->pl_list,
|
||||
procfs_list_node_off + sizeof (procfs_list_node_t),
|
||||
@@ -225,9 +232,10 @@ procfs_list_install(const char *module,
|
||||
procfs_list->pl_clear = clear;
|
||||
procfs_list->pl_node_offset = procfs_list_node_off;
|
||||
|
||||
kstat_proc_entry_init(&procfs_list->pl_kstat_entry, module, name);
|
||||
kstat_proc_entry_init(&procfs_list->pl_kstat_entry, modulestr, name);
|
||||
kstat_proc_entry_install(&procfs_list->pl_kstat_entry, mode,
|
||||
&procfs_list_operations, procfs_list);
|
||||
kmem_strfree(modulestr);
|
||||
}
|
||||
EXPORT_SYMBOL(procfs_list_install);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user