FreeBSD kernel kern code
subr_hints.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/lock.h>
#include <sys/kenv.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/bus.h>
Include dependency graph for subr_hints.c:

Go to the source code of this file.

Macros

#define FBACK_MDENV   0 /* MD env (e.g. loader.conf) */
 
#define FBACK_STENV   1 /* Static env */
 
#define FBACK_STATIC   2 /* static_hints */
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void static_hints_to_env (void *data __unused)
 
 SYSINIT (hintenv, SI_SUB_KMEM+1, SI_ORDER_SECOND, static_hints_to_env, NULL)
 
static bool _res_checkenv (char *envp)
 
static int res_find (char **hintp_cookie, int *line, int *startln, const char *name, int *unit, const char *resname, const char *value, const char **ret_name, int *ret_namelen, int *ret_unit, const char **ret_resname, int *ret_resnamelen, const char **ret_value)
 
static int resource_find (int *line, int *startln, const char *name, int *unit, const char *resname, const char *value, const char **ret_name, int *ret_namelen, int *ret_unit, const char **ret_resname, int *ret_resnamelen, const char **ret_value)
 
int resource_int_value (const char *name, int unit, const char *resname, int *result)
 
int resource_long_value (const char *name, int unit, const char *resname, long *result)
 
int resource_string_value (const char *name, int unit, const char *resname, const char **result)
 
static const char * resource_string_copy (const char *s, int len)
 
int resource_find_match (int *anchor, const char **name, int *unit, const char *resname, const char *value)
 
int resource_find_dev (int *anchor, const char *name, int *unit, const char *resname, const char *value)
 
int resource_disabled (const char *name, int unit)
 
int resource_unset_value (const char *name, int unit, const char *resname)
 

Variables

static bool hintenv_merged
 
static bool stenv_skip
 
static bool sthints_skip
 

Macro Definition Documentation

◆ FBACK_MDENV

#define FBACK_MDENV   0 /* MD env (e.g. loader.conf) */

Definition at line 42 of file subr_hints.c.

◆ FBACK_STATIC

#define FBACK_STATIC   2 /* static_hints */

Definition at line 44 of file subr_hints.c.

◆ FBACK_STENV

#define FBACK_STENV   1 /* Static env */

Definition at line 43 of file subr_hints.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ _res_checkenv()

static bool _res_checkenv ( char *  envp)
static

Definition at line 102 of file subr_hints.c.

Referenced by res_find().

Here is the caller graph for this function:

◆ res_find()

static int res_find ( char **  hintp_cookie,
int *  line,
int *  startln,
const char *  name,
int *  unit,
const char *  resname,
const char *  value,
const char **  ret_name,
int *  ret_namelen,
int *  ret_unit,
const char **  ret_resname,
int *  ret_resnamelen,
const char **  ret_value 
)
static

Definition at line 125 of file subr_hints.c.

References _res_checkenv(), FBACK_MDENV, FBACK_STATIC, FBACK_STENV, hintenv_merged, kenv_lock, kenvp, kern_envp, md_envp, name, printf(), sscanf(), stenv_skip, sthints_skip, and value.

Referenced by resource_find().

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

◆ resource_disabled()

int resource_disabled ( const char *  name,
int  unit 
)

Definition at line 485 of file subr_hints.c.

References name, resource_int_value(), and value.

Referenced by devctl2_ioctl(), and device_attach().

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

◆ resource_find()

static int resource_find ( int *  line,
int *  startln,
const char *  name,
int *  unit,
const char *  resname,
const char *  value,
const char **  ret_name,
int *  ret_namelen,
int *  ret_unit,
const char **  ret_resname,
int *  ret_resnamelen,
const char **  ret_value 
)
static

Definition at line 310 of file subr_hints.c.

References name, res_find(), and value.

Referenced by resource_find_dev(), resource_find_match(), resource_int_value(), resource_long_value(), resource_string_value(), and resource_unset_value().

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

◆ resource_find_dev()

int resource_find_dev ( int *  anchor,
const char *  name,
int *  unit,
const char *  resname,
const char *  value 
)

Definition at line 464 of file subr_hints.c.

References name, resource_find(), and value.

Here is the call graph for this function:

◆ resource_find_match()

int resource_find_match ( int *  anchor,
const char **  name,
int *  unit,
const char *  resname,
const char *  value 
)

Definition at line 436 of file subr_hints.c.

References name, resource_find(), resource_string_copy(), and value.

Referenced by bus_enumerate_hinted_children().

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

◆ resource_int_value()

int resource_int_value ( const char *  name,
int  unit,
const char *  resname,
int *  result 
)

Definition at line 341 of file subr_hints.c.

References name, resource_find(), and result.

Referenced by device_probe_child(), and resource_disabled().

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

◆ resource_long_value()

int resource_long_value ( const char *  name,
int  unit,
const char *  resname,
long *  result 
)

Definition at line 364 of file subr_hints.c.

References name, resource_find(), and result.

Here is the call graph for this function:

◆ resource_string_copy()

static const char * resource_string_copy ( const char *  s,
int  len 
)
static

Definition at line 408 of file subr_hints.c.

Referenced by resource_find_match().

Here is the caller graph for this function:

◆ resource_string_value()

int resource_string_value ( const char *  name,
int  unit,
const char *  resname,
const char **  result 
)

Definition at line 388 of file subr_hints.c.

References name, resource_find(), and result.

Referenced by devclass_alloc_unit().

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

◆ resource_unset_value()

int resource_unset_value ( const char *  name,
int  unit,
const char *  resname 
)

Definition at line 501 of file subr_hints.c.

References kern_unsetenv(), name, and resource_find().

Referenced by devctl2_ioctl().

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

◆ static_hints_to_env()

static void static_hints_to_env ( void *data  __unused)
static

Definition at line 61 of file subr_hints.c.

References free(), hintenv_merged, kern_setenv(), malloc(), and testenv().

Here is the call graph for this function:

◆ SYSINIT()

SYSINIT ( hintenv  ,
SI_SUB_KMEM+  1,
SI_ORDER_SECOND  ,
static_hints_to_env  ,
NULL   
)

Variable Documentation

◆ hintenv_merged

bool hintenv_merged
static

Definition at line 52 of file subr_hints.c.

Referenced by res_find(), and static_hints_to_env().

◆ stenv_skip

bool stenv_skip
static

Definition at line 54 of file subr_hints.c.

Referenced by res_find().

◆ sthints_skip

bool sthints_skip
static

Definition at line 55 of file subr_hints.c.

Referenced by res_find().