mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
libspl: move procfs_list implementation from libzpool
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #17861
This commit is contained in:
committed by
Brian Behlendorf
parent
8700fc669b
commit
ee89fefe4d
@@ -74,65 +74,6 @@ zone_get_hostid(void *zonep)
|
||||
return (hostid);
|
||||
}
|
||||
|
||||
/*
|
||||
* =========================================================================
|
||||
* procfs list
|
||||
* =========================================================================
|
||||
*/
|
||||
|
||||
void
|
||||
seq_printf(struct seq_file *m, const char *fmt, ...)
|
||||
{
|
||||
(void) m, (void) fmt;
|
||||
}
|
||||
|
||||
void
|
||||
procfs_list_install(const char *module,
|
||||
const char *submodule,
|
||||
const char *name,
|
||||
mode_t mode,
|
||||
procfs_list_t *procfs_list,
|
||||
int (*show)(struct seq_file *f, void *p),
|
||||
int (*show_header)(struct seq_file *f),
|
||||
int (*clear)(procfs_list_t *procfs_list),
|
||||
size_t procfs_list_node_off)
|
||||
{
|
||||
(void) module, (void) submodule, (void) name, (void) mode, (void) show,
|
||||
(void) show_header, (void) clear;
|
||||
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),
|
||||
procfs_list_node_off + offsetof(procfs_list_node_t, pln_link));
|
||||
procfs_list->pl_next_id = 1;
|
||||
procfs_list->pl_node_offset = procfs_list_node_off;
|
||||
}
|
||||
|
||||
void
|
||||
procfs_list_uninstall(procfs_list_t *procfs_list)
|
||||
{
|
||||
(void) procfs_list;
|
||||
}
|
||||
|
||||
void
|
||||
procfs_list_destroy(procfs_list_t *procfs_list)
|
||||
{
|
||||
ASSERT(list_is_empty(&procfs_list->pl_list));
|
||||
list_destroy(&procfs_list->pl_list);
|
||||
mutex_destroy(&procfs_list->pl_lock);
|
||||
}
|
||||
|
||||
#define NODE_ID(procfs_list, obj) \
|
||||
(((procfs_list_node_t *)(((char *)obj) + \
|
||||
(procfs_list)->pl_node_offset))->pln_id)
|
||||
|
||||
void
|
||||
procfs_list_add(procfs_list_t *procfs_list, void *p)
|
||||
{
|
||||
ASSERT(MUTEX_HELD(&procfs_list->pl_lock));
|
||||
NODE_ID(procfs_list, p) = procfs_list->pl_next_id++;
|
||||
list_insert_tail(&procfs_list->pl_list, p);
|
||||
}
|
||||
|
||||
/*
|
||||
* =========================================================================
|
||||
* vnode operations
|
||||
|
||||
Reference in New Issue
Block a user