FreeBSD kernel kern code
kern_osd.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/errno.h>
#include <sys/jail.h>
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/rmlock.h>
#include <sys/sx.h>
#include <sys/queue.h>
#include <sys/proc.h>
#include <sys/osd.h>
Include dependency graph for kern_osd.c:

Go to the source code of this file.

Macros

#define OSD_DEBUG(...)
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static MALLOC_DEFINE (M_OSD,"osd","Object Specific Data")
 
 TUNABLE_INT ("debug.osd",&osd_debug)
 
 SYSCTL_INT (_debug, OID_AUTO, osd, CTLFLAG_RW,&osd_debug, 0,"OSD debug level")
 
static void do_osd_del (u_int type, struct osd *osd, u_int slot, int list_locked)
 
static LIST_HEAD (osd)
 
static void osd_default_destructor (void *value __unused)
 
int osd_register (u_int type, osd_destructor_t destructor, osd_method_t *methods)
 
void osd_deregister (u_int type, u_int slot)
 
int osd_set (u_int type, struct osd *osd, u_int slot, void *value)
 
void * osd_get (u_int type, struct osd *osd, u_int slot)
 
void osd_del (u_int type, struct osd *osd, u_int slot)
 
int osd_call (u_int type, u_int method, void *obj, void *data)
 
void osd_exit (u_int type, struct osd *osd)
 
static void osd_init (void *arg __unused)
 
 SYSINIT (osd, SI_SUB_LOCK, SI_ORDER_ANY, osd_init, NULL)
 

Variables

static int osd_debug = 0
 
static struct sx osd_module_lock [OSD_LAST+1]
 
static struct rmlock osd_object_lock [OSD_LAST+1]
 
static struct mtx osd_list_lock [OSD_LAST+1]
 

Macro Definition Documentation

#define OSD_DEBUG (   ...)
Value:
do { \
if (osd_debug) { \
printf("OSD (%s:%u): ", __func__, __LINE__); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
static int osd_debug
Definition: kern_osd.c:49
int printf(const char *fmt,...)
Definition: subr_prf.c:367

Definition at line 53 of file kern_osd.c.

Referenced by do_osd_del(), osd_deregister(), osd_exit(), osd_get(), osd_register(), and osd_set().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
static void do_osd_del ( u_int  type,
struct osd *  osd,
u_int  slot,
int  list_locked 
)
static

Definition at line 287 of file kern_osd.c.

References free(), OSD_DEBUG, osd_list_lock, realloc(), and type.

Referenced by osd_del(), osd_deregister(), and osd_exit().

Here is the call graph for this function:

Here is the caller graph for this function:

static LIST_HEAD ( osd  )
static

Definition at line 72 of file kern_osd.c.

static MALLOC_DEFINE ( M_OSD  ,
"osd"  ,
"Object Specific Data"   
)
static
int osd_call ( u_int  type,
u_int  method,
void *  obj,
void *  data 
)

Definition at line 339 of file kern_osd.c.

References osd_module_lock, and type.

static void osd_default_destructor ( void *value  __unused)
static

Definition at line 85 of file kern_osd.c.

Referenced by osd_register().

Here is the caller graph for this function:

void osd_del ( u_int  type,
struct osd *  osd,
u_int  slot 
)

Definition at line 277 of file kern_osd.c.

References do_osd_del(), and osd_object_lock.

Referenced by khelp_remove_osd().

Here is the call graph for this function:

Here is the caller graph for this function:

void osd_deregister ( u_int  type,
u_int  slot 
)

Definition at line 148 of file kern_osd.c.

References do_osd_del(), OSD_DEBUG, osd_list_lock, osd_module_lock, osd_object_lock, realloc(), and type.

Referenced by khelp_deregister_helper(), and TAILQ_HEAD().

Here is the call graph for this function:

Here is the caller graph for this function:

void osd_exit ( u_int  type,
struct osd *  osd 
)

Definition at line 364 of file kern_osd.c.

References do_osd_del(), OSD_DEBUG, and osd_object_lock.

Here is the call graph for this function:

void* osd_get ( u_int  type,
struct osd *  osd,
u_int  slot 
)

Definition at line 254 of file kern_osd.c.

References OSD_DEBUG, osd_object_lock, and value.

Referenced by hhook_run_hooks(), khelp_get_osd(), and khelp_remove_osd().

Here is the caller graph for this function:

static void osd_init ( void *arg  __unused)
static

Definition at line 389 of file kern_osd.c.

References mtx_init(), osd_list_lock, osd_module_lock, osd_object_lock, and rm_init().

Here is the call graph for this function:

int osd_register ( u_int  type,
osd_destructor_t  destructor,
osd_method_t *  methods 
)

Definition at line 91 of file kern_osd.c.

References free(), malloc(), OSD_DEBUG, osd_default_destructor(), osd_module_lock, osd_object_lock, realloc(), and type.

Referenced by TAILQ_HEAD().

Here is the call graph for this function:

Here is the caller graph for this function:

int osd_set ( u_int  type,
struct osd *  osd,
u_int  slot,
void *  value 
)

Definition at line 196 of file kern_osd.c.

References malloc(), OSD_DEBUG, osd_list_lock, osd_object_lock, realloc(), and value.

Referenced by khelp_init_osd().

Here is the call graph for this function:

Here is the caller graph for this function:

SYSCTL_INT ( _debug  ,
OID_AUTO  ,
osd  ,
CTLFLAG_RW  ,
osd_debug,
,
"OSD debug level  
)
SYSINIT ( osd  ,
SI_SUB_LOCK  ,
SI_ORDER_ANY  ,
osd_init  ,
NULL   
)
TUNABLE_INT ( "debug.osd"  ,
osd_debug 
)

Variable Documentation

int osd_debug = 0
static

Definition at line 49 of file kern_osd.c.

struct mtx osd_list_lock[OSD_LAST+1]
static

Definition at line 82 of file kern_osd.c.

Referenced by do_osd_del(), osd_deregister(), osd_init(), and osd_set().

struct sx osd_module_lock[OSD_LAST+1]
static

Definition at line 80 of file kern_osd.c.

Referenced by osd_call(), osd_deregister(), osd_init(), and osd_register().

struct rmlock osd_object_lock[OSD_LAST+1]
static

Definition at line 81 of file kern_osd.c.

Referenced by osd_del(), osd_deregister(), osd_exit(), osd_get(), osd_init(), osd_register(), and osd_set().