FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/hhook.h>
#include <sys/khelp.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/module_khelp.h>
#include <sys/osd.h>
#include <sys/queue.h>
#include <sys/refcount.h>
#include <sys/systm.h>
#include <net/vnet.h>
Go to the source code of this file.
Data Structures | |
struct | hhook |
Macros | |
#define | V_hhook_vhead_list VNET(hhook_vhead_list) |
#define | HHHLIST_LOCK() mtx_lock(&hhook_head_list_lock) |
#define | HHHLIST_UNLOCK() mtx_unlock(&hhook_head_list_lock) |
#define | HHHLIST_LOCK_ASSERT() mtx_assert(&hhook_head_list_lock, MA_OWNED) |
#define | HHH_LOCK_INIT(hhh) rm_init(&(hhh)->hhh_lock, "hhook_head rm lock") |
#define | HHH_LOCK_DESTROY(hhh) rm_destroy(&(hhh)->hhh_lock) |
#define | HHH_WLOCK(hhh) rm_wlock(&(hhh)->hhh_lock) |
#define | HHH_WUNLOCK(hhh) rm_wunlock(&(hhh)->hhh_lock) |
#define | HHH_RLOCK(hhh, rmpt) rm_rlock(&(hhh)->hhh_lock, (rmpt)) |
#define | HHH_RUNLOCK(hhh, rmpt) rm_runlock(&(hhh)->hhh_lock, (rmpt)) |
Functions | |
__FBSDID ("$BSDSUniX$") | |
static | MALLOC_DEFINE (M_HHOOK,"hhook","Helper hooks are linked off hhook_head lists") |
LIST_HEAD (hhookheadhead, hhook_head) | |
VNET_DEFINE (struct hhookheadhead, hhook_vhead_list) | |
MTX_SYSINIT (hhookheadlistlock,&hhook_head_list_lock,"hhook_head list lock", MTX_DEF) | |
static void | hhook_head_destroy (struct hhook_head *hhh) |
void | khelp_new_hhook_registered (struct hhook_head *hhh, uint32_t flags) |
void | hhook_run_hooks (struct hhook_head *hhh, void *ctx_data, struct osd *hosd) |
int | hhook_add_hook (struct hhook_head *hhh, struct hookinfo *hki, uint32_t flags) |
int | hhook_add_hook_lookup (struct hookinfo *hki, uint32_t flags) |
int | hhook_remove_hook (struct hhook_head *hhh, struct hookinfo *hki) |
int | hhook_remove_hook_lookup (struct hookinfo *hki) |
int | hhook_head_register (int32_t hhook_type, int32_t hhook_id, struct hhook_head **hhh, uint32_t flags) |
int | hhook_head_deregister (struct hhook_head *hhh) |
int | hhook_head_deregister_lookup (int32_t hhook_type, int32_t hhook_id) |
struct hhook_head * | hhook_head_get (int32_t hhook_type, int32_t hhook_id) |
void | hhook_head_release (struct hhook_head *hhh) |
uint32_t | hhook_head_is_virtualised (struct hhook_head *hhh) |
uint32_t | hhook_head_is_virtualised_lookup (int32_t hook_type, int32_t hook_id) |
static void | hhook_vnet_init (const void *unused __unused) |
static void | hhook_vnet_uninit (const void *unused __unused) |
VNET_SYSINIT (hhook_vnet_init, SI_SUB_MBUF, SI_ORDER_FIRST, hhook_vnet_init, NULL) | |
VNET_SYSUNINIT (hhook_vnet_uninit, SI_SUB_MBUF, SI_ORDER_ANY, hhook_vnet_uninit, NULL) | |
Variables | |
struct hhookheadhead | hhook_head_list |
static struct mtx | hhook_head_list_lock |
static uint32_t | n_hhookheads |
#define HHH_LOCK_DESTROY | ( | hhh | ) | rm_destroy(&(hhh)->hhh_lock) |
Definition at line 84 of file kern_hhook.c.
Referenced by hhook_head_destroy().
#define HHH_LOCK_INIT | ( | hhh | ) | rm_init(&(hhh)->hhh_lock, "hhook_head rm lock") |
Definition at line 83 of file kern_hhook.c.
Referenced by hhook_head_register().
#define HHH_RLOCK | ( | hhh, | |
rmpt | |||
) | rm_rlock(&(hhh)->hhh_lock, (rmpt)) |
Definition at line 87 of file kern_hhook.c.
Referenced by hhook_run_hooks().
#define HHH_RUNLOCK | ( | hhh, | |
rmpt | |||
) | rm_runlock(&(hhh)->hhh_lock, (rmpt)) |
Definition at line 88 of file kern_hhook.c.
Referenced by hhook_run_hooks().
#define HHH_WLOCK | ( | hhh | ) | rm_wlock(&(hhh)->hhh_lock) |
Definition at line 85 of file kern_hhook.c.
Referenced by hhook_add_hook(), hhook_head_destroy(), and hhook_remove_hook().
#define HHH_WUNLOCK | ( | hhh | ) | rm_wunlock(&(hhh)->hhh_lock) |
Definition at line 86 of file kern_hhook.c.
Referenced by hhook_add_hook(), hhook_head_destroy(), and hhook_remove_hook().
#define HHHLIST_LOCK | ( | ) | mtx_lock(&hhook_head_list_lock) |
Definition at line 79 of file kern_hhook.c.
Referenced by hhook_add_hook_lookup(), hhook_head_deregister(), hhook_head_get(), hhook_head_register(), hhook_remove_hook_lookup(), and hhook_vnet_uninit().
#define HHHLIST_LOCK_ASSERT | ( | ) | mtx_assert(&hhook_head_list_lock, MA_OWNED) |
Definition at line 81 of file kern_hhook.c.
Referenced by hhook_head_destroy().
#define HHHLIST_UNLOCK | ( | ) | mtx_unlock(&hhook_head_list_lock) |
Definition at line 80 of file kern_hhook.c.
Referenced by hhook_add_hook_lookup(), hhook_head_deregister(), hhook_head_get(), hhook_head_register(), hhook_remove_hook_lookup(), and hhook_vnet_uninit().
#define V_hhook_vhead_list VNET(hhook_vhead_list) |
Definition at line 66 of file kern_hhook.c.
Referenced by hhook_head_register(), hhook_vnet_init(), and hhook_vnet_uninit().
__FBSDID | ( | "$BSDSUniX$" | ) |
int hhook_add_hook | ( | struct hhook_head * | hhh, |
struct hookinfo * | hki, | ||
uint32_t | flags | ||
) |
Definition at line 130 of file kern_hhook.c.
References free(), HHH_WLOCK, HHH_WUNLOCK, hhook::hhk_func, hhook::hhk_helper, hhook::hhk_udata, and malloc().
Referenced by hhook_add_hook_lookup(), and khelp_new_hhook_registered().
int hhook_add_hook_lookup | ( | struct hookinfo * | hki, |
uint32_t | flags | ||
) |
Definition at line 187 of file kern_hhook.c.
References free(), HHHLIST_LOCK, HHHLIST_UNLOCK, hhook_add_hook(), malloc(), and n_hhookheads.
Referenced by khelp_add_hhook(), and TAILQ_HEAD().
int hhook_head_deregister | ( | struct hhook_head * | hhh | ) |
Definition at line 366 of file kern_hhook.c.
References HHHLIST_LOCK, HHHLIST_UNLOCK, and hhook_head_destroy().
Referenced by hhook_head_deregister_lookup().
int hhook_head_deregister_lookup | ( | int32_t | hhook_type, |
int32_t | hhook_id | ||
) |
Definition at line 388 of file kern_hhook.c.
References hhook_head_deregister(), hhook_head_get(), and hhook_head_release().
|
static |
Definition at line 341 of file kern_hhook.c.
References free(), HHH_LOCK_DESTROY, HHH_WLOCK, HHH_WUNLOCK, HHHLIST_LOCK_ASSERT, and hhook_head_is_virtualised().
Referenced by hhook_head_deregister(), and hhook_vnet_uninit().
struct hhook_head* hhook_head_get | ( | int32_t | hhook_type, |
int32_t | hhook_id | ||
) |
Definition at line 407 of file kern_hhook.c.
References HHHLIST_LOCK, HHHLIST_UNLOCK, and hhook_head_is_virtualised().
Referenced by hhook_head_deregister_lookup(), hhook_head_is_virtualised_lookup(), and hhook_head_register().
uint32_t hhook_head_is_virtualised | ( | struct hhook_head * | hhh | ) |
Definition at line 445 of file kern_hhook.c.
Referenced by hhook_head_destroy(), hhook_head_get(), and hhook_head_is_virtualised_lookup().
uint32_t hhook_head_is_virtualised_lookup | ( | int32_t | hook_type, |
int32_t | hook_id | ||
) |
Definition at line 460 of file kern_hhook.c.
References hhook_head_get(), hhook_head_is_virtualised(), and hhook_head_release().
int hhook_head_register | ( | int32_t | hhook_type, |
int32_t | hhook_id, | ||
struct hhook_head ** | hhh, | ||
uint32_t | flags | ||
) |
Definition at line 291 of file kern_hhook.c.
References HHH_LOCK_INIT, HHHLIST_LOCK, HHHLIST_UNLOCK, hhook_head_get(), hhook_head_release(), khelp_new_hhook_registered(), malloc(), and V_hhook_vhead_list.
void hhook_head_release | ( | struct hhook_head * | hhh | ) |
Definition at line 432 of file kern_hhook.c.
Referenced by hhook_head_deregister_lookup(), hhook_head_is_virtualised_lookup(), and hhook_head_register().
int hhook_remove_hook | ( | struct hhook_head * | hhh, |
struct hookinfo * | hki | ||
) |
Definition at line 245 of file kern_hhook.c.
References free(), HHH_WLOCK, HHH_WUNLOCK, hhook::hhk_func, and hhook::hhk_udata.
Referenced by hhook_remove_hook_lookup().
int hhook_remove_hook_lookup | ( | struct hookinfo * | hki | ) |
Definition at line 272 of file kern_hhook.c.
References HHHLIST_LOCK, HHHLIST_UNLOCK, and hhook_remove_hook().
Referenced by khelp_deregister_helper(), khelp_remove_hhook(), and TAILQ_HEAD().
void hhook_run_hooks | ( | struct hhook_head * | hhh, |
void * | ctx_data, | ||
struct osd * | hosd | ||
) |
Definition at line 94 of file kern_hhook.c.
References HHH_RLOCK, HHH_RUNLOCK, hhook::hhk_func, hhook::hhk_helper, hhook::hhk_udata, and osd_get().
|
static |
Definition at line 480 of file kern_hhook.c.
References V_hhook_vhead_list.
|
static |
Definition at line 490 of file kern_hhook.c.
References HHHLIST_LOCK, HHHLIST_UNLOCK, hhook_head_destroy(), printf(), and V_hhook_vhead_list.
void khelp_new_hhook_registered | ( | struct hhook_head * | hhh, |
uint32_t | flags | ||
) |
Definition at line 289 of file kern_khelp.c.
References hhook_add_hook(), KHELP_LIST_RLOCK, KHELP_LIST_RUNLOCK, and printf().
Referenced by hhook_head_register().
LIST_HEAD | ( | hhookheadhead | , |
hhook_head | |||
) |
|
static |
MTX_SYSINIT | ( | hhookheadlistlock | , |
& | hhook_head_list_lock, | ||
"hhook_head list lock" | , | ||
MTX_DEF | |||
) |
VNET_DEFINE | ( | struct hhookheadhead | , |
hhook_vhead_list | |||
) |
VNET_SYSINIT | ( | hhook_vnet_init | , |
SI_SUB_MBUF | , | ||
SI_ORDER_FIRST | , | ||
hhook_vnet_init | , | ||
NULL | |||
) |
VNET_SYSUNINIT | ( | hhook_vnet_uninit | , |
SI_SUB_MBUF | , | ||
SI_ORDER_ANY | , | ||
hhook_vnet_uninit | , | ||
NULL | |||
) |
struct hhookheadhead hhook_head_list |
Definition at line 64 of file kern_hhook.c.
|
static |
Definition at line 68 of file kern_hhook.c.
|
static |
Definition at line 73 of file kern_hhook.c.
Referenced by hhook_add_hook_lookup().