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.

Data Structures

struct  osd_master
 

Macros

#define OSD_DEBUG(...)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_OSD, "osd", "Object Specific Data")
 
 SYSCTL_INT (_debug, OID_AUTO, osd, CTLFLAG_RWTUN, &osd_debug, 0, "OSD debug level")
 
static void do_osd_del (u_int type, struct osd *osd, u_int slot, int list_locked)
 
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_reserve (u_int slot)
 
int osd_set_reserved (u_int type, struct osd *osd, u_int slot, void **rsv, void *value)
 
void osd_free_reserved (void **rsv)
 
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
 
struct osd_master osdm [OSD_LAST+1]
 

Macro Definition Documentation

◆ OSD_DEBUG

#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:68

Definition at line 71 of file kern_osd.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ do_osd_del()

static void do_osd_del ( u_int  type,
struct osd *  osd,
u_int  slot,
int  list_locked 
)
static

Definition at line 332 of file kern_osd.c.

References free(), OSD_DEBUG, osdm, 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:

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_OSD  ,
"osd"  ,
"Object Specific Data"   
)
static

◆ osd_call()

int osd_call ( u_int  type,
u_int  method,
void *  obj,
void *  data 
)

Definition at line 384 of file kern_osd.c.

References data, osdm, and type.

◆ osd_default_destructor()

static void osd_default_destructor ( void *value  __unused)
static

Definition at line 90 of file kern_osd.c.

Referenced by osd_register().

Here is the caller graph for this function:

◆ osd_del()

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

Definition at line 322 of file kern_osd.c.

References do_osd_del(), osdm, and type.

Referenced by khelp_remove_osd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ osd_deregister()

void osd_deregister ( u_int  type,
u_int  slot 
)

Definition at line 153 of file kern_osd.c.

References do_osd_del(), OSD_DEBUG, osdm, realloc(), and type.

Referenced by khelp_deregister_helper().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ osd_exit()

void osd_exit ( u_int  type,
struct osd *  osd 
)

Definition at line 409 of file kern_osd.c.

References do_osd_del(), OSD_DEBUG, osdm, and type.

Here is the call graph for this function:

◆ osd_free_reserved()

void osd_free_reserved ( void **  rsv)

Definition at line 290 of file kern_osd.c.

References free(), and OSD_DEBUG.

Referenced by msg_prison_set(), msginit(), osd_set_reserved(), sem_prison_set(), seminit(), shm_prison_set(), and shminit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ osd_get()

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

Definition at line 298 of file kern_osd.c.

References OSD_DEBUG, osdm, type, and value.

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

Here is the caller graph for this function:

◆ osd_init()

static void osd_init ( void *arg  __unused)
static

Definition at line 434 of file kern_osd.c.

References osdm, and rm_init().

Here is the call graph for this function:

◆ osd_register()

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

Definition at line 96 of file kern_osd.c.

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

Here is the call graph for this function:

◆ osd_reserve()

void ** osd_reserve ( u_int  slot)

Definition at line 209 of file kern_osd.c.

References malloc(), and OSD_DEBUG.

Referenced by msg_prison_set(), msginit(), sem_prison_set(), seminit(), shm_prison_set(), and shminit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ osd_set()

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

Definition at line 202 of file kern_osd.c.

References osd_set_reserved(), type, and value.

Referenced by khelp_init_osd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ osd_set_reserved()

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

Definition at line 219 of file kern_osd.c.

References free(), OSD_DEBUG, osd_free_reserved(), osdm, realloc(), type, and value.

Referenced by osd_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SYSCTL_INT()

SYSCTL_INT ( _debug  ,
OID_AUTO  ,
osd  ,
CTLFLAG_RWTUN  ,
osd_debug,
,
"OSD debug level  
)

◆ SYSINIT()

SYSINIT ( osd  ,
SI_SUB_LOCK  ,
SI_ORDER_ANY  ,
osd_init  ,
NULL   
)

Variable Documentation

◆ osd_debug

int osd_debug = 0
static

Definition at line 68 of file kern_osd.c.

◆ osdm

struct osd_master osdm[OSD_LAST+1]
Initial value:
= {
[OSD_JAIL] = { .osd_nmethods = PR_MAXMETHOD },
}

Definition at line 85 of file kern_osd.c.

Referenced by do_osd_del(), osd_call(), osd_del(), osd_deregister(), osd_exit(), osd_get(), osd_init(), osd_register(), and osd_set_reserved().