#include <stdarg.h>
#include <dlfcn.h>
#include <limits.h>
#include <sys/stat.h>
#include <pthread.h>
#include <locale.h>
#include "local.h"
Include dependency graph for conf.c:
Go to the source code of this file.
Data Structures | |
struct | _snd_config |
struct | filedesc |
struct | input_t |
struct | local_string |
struct | finfo |
struct | _snd_config_update |
Defines | |
#define | LOCAL_ERROR (-0x68000000) |
#define | LOCAL_UNTERMINATED_STRING (LOCAL_ERROR - 0) |
#define | LOCAL_UNTERMINATED_QUOTE (LOCAL_ERROR - 1) |
#define | LOCAL_UNEXPECTED_CHAR (LOCAL_ERROR - 2) |
#define | LOCAL_UNEXPECTED_EOF (LOCAL_ERROR - 3) |
#define | LOCAL_STR_BUFSIZE 64 |
#define | SND_CONFIG_SEARCH(config, key, result, extra_code) |
#define | SND_CONFIG_SEARCHA(root, config, key, result, fcn, extra_code) |
#define | SND_CONFIG_SEARCHV(config, result, fcn) |
#define | SND_CONFIG_SEARCHVA(root, config, result, fcn) |
#define | SND_CONFIG_SEARCH_ALIAS(config, base, key, result, fcn1, fcn2) |
#define | ALSA_CONFIG_PATH_VAR "ALSA_CONFIG_PATH" |
#define | ALSA_CONFIG_PATH_DEFAULT "/share/alsa/alsa.conf" |
Typedefs | |
typedef enum _snd_config_walk_pass | snd_config_walk_pass_t |
typedef int(*) | snd_config_walk_callback_t (snd_config_t *src, snd_config_t *root, snd_config_t **dst, snd_config_walk_pass_t pass, snd_config_t *private_data) |
Enumerations | |
enum | _snd_config_walk_pass { SND_CONFIG_WALK_PASS_PRE, SND_CONFIG_WALK_PASS_POST, SND_CONFIG_WALK_PASS_LEAF } |
Functions | |
static int | safe_strtoll (const char *str, long long *val) |
int | safe_strtol (const char *str, long *val) |
static int | safe_strtod (const char *str, double *val) |
static int | get_char (input_t *input) |
static void | unget_char (int c, input_t *input) |
static int | get_delimstring (char **string, int delim, input_t *input) |
static int | get_char_skip_comments (input_t *input) |
static int | get_nonwhite (input_t *input) |
static int | get_quotedchar (input_t *input) |
static void | init_local_string (struct local_string *s) |
static void | free_local_string (struct local_string *s) |
static int | add_char_local_string (struct local_string *s, int c) |
static char * | copy_local_string (struct local_string *s) |
static int | get_freestring (char **string, int id, input_t *input) |
static int | get_string (char **string, int id, input_t *input) |
static int | _snd_config_make (snd_config_t **config, char **id, snd_config_type_t type) |
static int | _snd_config_make_add (snd_config_t **config, char **id, snd_config_type_t type, snd_config_t *father) |
static int | _snd_config_search (snd_config_t *config, const char *id, int len, snd_config_t **result) |
static int | parse_value (snd_config_t **_n, snd_config_t *father, input_t *input, char **id, int skip) |
static int | parse_defs (snd_config_t *father, input_t *input, int skip, int override) |
static int | parse_array_defs (snd_config_t *farther, input_t *input, int skip, int override) |
static int | parse_array_def (snd_config_t *father, input_t *input, int idx, int skip, int override) |
static int | parse_def (snd_config_t *father, input_t *input, int skip, int override) |
static void | string_print (char *str, int id, snd_output_t *out) |
static int | _snd_config_save_leaves (snd_config_t *config, snd_output_t *out, unsigned int level, unsigned int joins) |
static int | _snd_config_save_leaf (snd_config_t *n, snd_output_t *out, unsigned int level) |
static void | id_print (snd_config_t *n, snd_output_t *out, unsigned int joins) |
int | snd_config_substitute (snd_config_t *dst, snd_config_t *src) |
Substitutes one configuration node to another. | |
int | snd_config_get_type_ascii (const char *ascii, snd_config_type_t *type) |
Converts an ASCII string to a configuration node type. | |
snd_config_type_t | snd_config_get_type (const snd_config_t *config) |
Returns the type of a configuration node. | |
int | snd_config_get_id (const snd_config_t *config, const char **id) |
Returns the id of a configuration node. | |
int | snd_config_set_id (snd_config_t *config, const char *id) |
Sets the id of a configuration node. | |
int | snd_config_top (snd_config_t **config) |
Creates a top level configuration node. | |
static int | snd_config_load1 (snd_config_t *config, snd_input_t *in, int override) |
int | snd_config_load (snd_config_t *config, snd_input_t *in) |
Loads a configuration tree. | |
int | snd_config_load_override (snd_config_t *config, snd_input_t *in) |
Loads a configuration tree and overrides existing configuration nodes. | |
int | snd_config_add (snd_config_t *father, snd_config_t *leaf) |
Adds a child to a compound configuration node. | |
int | snd_config_remove (snd_config_t *config) |
Removes a configuration node from its tree. | |
int | snd_config_delete (snd_config_t *config) |
Deletes a configuration node (freeing all its related resources). | |
int | snd_config_delete_compound_members (const snd_config_t *config) |
Deletes the children of a compound configuration node (freeing all its related resources). | |
int | snd_config_make (snd_config_t **config, const char *id, snd_config_type_t type) |
Creates a configuration node. | |
int | snd_config_make_integer (snd_config_t **config, const char *id) |
Creates an integer configuration node. | |
int | snd_config_make_integer64 (snd_config_t **config, const char *id) |
Creates an integer64 configuration node. | |
int | snd_config_make_real (snd_config_t **config, const char *id) |
Creates a real configuration node. | |
int | snd_config_make_string (snd_config_t **config, const char *id) |
Creates a string configuration node. | |
int | snd_config_make_pointer (snd_config_t **config, const char *id) |
Creates a pointer configuration node. | |
int | snd_config_make_compound (snd_config_t **config, const char *id, int join) |
Creates an empty compound configuration node. | |
int | snd_config_imake_integer (snd_config_t **config, const char *id, const long value) |
Creates an integer configuration node with the given initial value. | |
int | snd_config_imake_integer64 (snd_config_t **config, const char *id, const long long value) |
Creates an integer configuration node with the given initial value. | |
int | snd_config_imake_real (snd_config_t **config, const char *id, const double value) |
Creates a real configuration node with the given initial value. | |
int | snd_config_imake_string (snd_config_t **config, const char *id, const char *value) |
Creates a string configuration node with the given initial value. | |
int | snd_config_imake_pointer (snd_config_t **config, const char *id, const void *value) |
Creates a pointer configuration node with the given initial value. | |
int | snd_config_set_integer (snd_config_t *config, long value) |
Changes the value of an integer configuration node. | |
int | snd_config_set_integer64 (snd_config_t *config, long long value) |
Changes the value of an integer64 configuration node. | |
int | snd_config_set_real (snd_config_t *config, double value) |
Changes the value of a real configuration node. | |
int | snd_config_set_string (snd_config_t *config, const char *value) |
Changes the value of a string configuration node. | |
int | snd_config_set_pointer (snd_config_t *config, const void *value) |
Changes the value of a pointer configuration node. | |
int | snd_config_set_ascii (snd_config_t *config, const char *ascii) |
Changes the value of a configuration node. | |
int | snd_config_get_integer (const snd_config_t *config, long *ptr) |
Returns the value of an integer configuration node. | |
int | snd_config_get_integer64 (const snd_config_t *config, long long *ptr) |
Returns the value of an integer64 configuration node. | |
int | snd_config_get_real (const snd_config_t *config, double *ptr) |
Returns the value of a real configuration node. | |
int | snd_config_get_ireal (const snd_config_t *config, double *ptr) |
Returns the value of a real or integer configuration node. | |
int | snd_config_get_string (const snd_config_t *config, const char **ptr) |
Returns the value of a string configuration node. | |
int | snd_config_get_pointer (const snd_config_t *config, const void **ptr) |
Returns the value of a pointer configuration node. | |
int | snd_config_get_ascii (const snd_config_t *config, char **ascii) |
Returns the value of a configuration node as a string. | |
int | snd_config_test_id (const snd_config_t *config, const char *id) |
Compares the id of a configuration node to a given string. | |
int | snd_config_save (snd_config_t *config, snd_output_t *out) |
Dumps the contents of a configuration node or tree. | |
int | snd_config_search (snd_config_t *config, const char *key, snd_config_t **result) |
Searches for a node in a configuration tree. | |
int | snd_config_searcha (snd_config_t *root, snd_config_t *config, const char *key, snd_config_t **result) |
Searches for a node in a configuration tree, expanding aliases. | |
int | snd_config_searchv (snd_config_t *config, snd_config_t **result,...) |
Searches for a node in a configuration tree. | |
int | snd_config_searchva (snd_config_t *root, snd_config_t *config, snd_config_t **result,...) |
Searches for a node in a configuration tree, expanding aliases. | |
int | snd_config_search_alias (snd_config_t *config, const char *base, const char *key, snd_config_t **result) |
Searches for a node in a configuration tree, using an alias. | |
static int | snd_config_hooks (snd_config_t *config, snd_config_t *private_data) |
int | snd_config_search_hooks (snd_config_t *config, const char *key, snd_config_t **result) |
Searches for a node in a configuration tree and expands hooks. | |
int | snd_config_searcha_hooks (snd_config_t *root, snd_config_t *config, const char *key, snd_config_t **result) |
Searches for a node in a configuration tree, expanding aliases and hooks. | |
int | snd_config_searchva_hooks (snd_config_t *root, snd_config_t *config, snd_config_t **result,...) |
Searches for a node in a configuration tree, expanding aliases and hooks. | |
int | snd_config_search_alias_hooks (snd_config_t *config, const char *base, const char *key, snd_config_t **result) |
Searches for a node in a configuration tree, using an alias and expanding hooks. | |
static int | snd_config_hooks_call (snd_config_t *root, snd_config_t *config, snd_config_t *private_data) |
int | snd_config_hook_load (snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data) |
Loads and parses the given configurations files. | |
SND_DLSYM_BUILD_VERSION (snd_config_hook_load, SND_CONFIG_DLSYM_VERSION_HOOK) | |
int | snd_determine_driver (int card, char **driver) |
int | snd_config_hook_load_for_all_cards (snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data ATTRIBUTE_UNUSED) |
Loads and parses the given configurations files for each installed sound card. | |
SND_DLSYM_BUILD_VERSION (snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK) | |
int | snd_config_update_r (snd_config_t **_top, snd_config_update_t **_update, const char *cfgs) |
Updates a configuration tree by rereading the configuration files (if needed). | |
int | snd_config_update (void) |
Updates snd_config by rereading the global configuration files (if needed). | |
int | snd_config_update_free (snd_config_update_t *update) |
Frees a private update structure. | |
int | snd_config_update_free_global (void) |
Frees the global configuration tree in snd_config. | |
snd_config_iterator_t | snd_config_iterator_first (const snd_config_t *node) |
Returns an iterator pointing to the first child of a compound configuration node. | |
snd_config_iterator_t | snd_config_iterator_next (const snd_config_iterator_t iterator) |
Returns an iterator pointing to the next sibling. | |
snd_config_iterator_t | snd_config_iterator_end (const snd_config_t *node) |
Returns an iterator pointing past the last child of a compound configuration node. | |
snd_config_t * | snd_config_iterator_entry (const snd_config_iterator_t iterator) |
Returns the configuration node handle pointed to by an iterator. | |
static int | snd_config_walk (snd_config_t *src, snd_config_t *root, snd_config_t **dst, snd_config_walk_callback_t callback, snd_config_t *private_data) |
static int | _snd_config_copy (snd_config_t *src, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t **dst, snd_config_walk_pass_t pass, snd_config_t *private_data ATTRIBUTE_UNUSED) |
int | snd_config_copy (snd_config_t **dst, snd_config_t *src) |
Creates a copy of a configuration node. | |
static int | _snd_config_expand (snd_config_t *src, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t **dst, snd_config_walk_pass_t pass, snd_config_t *private_data) |
static int | _snd_config_evaluate (snd_config_t *src, snd_config_t *root, snd_config_t **dst ATTRIBUTE_UNUSED, snd_config_walk_pass_t pass, snd_config_t *private_data) |
int | snd_config_evaluate (snd_config_t *config, snd_config_t *root, snd_config_t *private_data, snd_config_t **result) |
Evaluates a configuration node at runtime. | |
static int | load_defaults (snd_config_t *subs, snd_config_t *defs) |
static void | skip_blank (const char **ptr) |
static int | parse_char (const char **ptr) |
static int | parse_id (const char **ptr) |
static int | parse_string (const char **ptr, char **val) |
static int | parse_arg (const char **ptr, unsigned int *varlen, char **val) |
static int | parse_args (snd_config_t *subs, const char *str, snd_config_t *defs) |
int | snd_config_expand (snd_config_t *config, snd_config_t *root, const char *args, snd_config_t *private_data, snd_config_t **result) |
Expands a configuration node applying arguments and functions. | |
int | snd_config_search_definition (snd_config_t *config, const char *base, const char *name, snd_config_t **result) |
Searches for a definition in a configuration tree, using aliases and expanding hooks and arguments. | |
void | snd_config_set_hop (snd_config_t *conf, int hop) |
int | snd_config_check_hop (snd_config_t *conf) |
Variables | |
snd_config_t * | snd_config = NULL |
static snd_config_update_t * | snd_config_global_update = NULL |
static pthread_mutex_t | snd_config_update_mutex = PTHREAD_MUTEX_INITIALIZER |
See the Configuration files page for more details.
Definition in file conf.c.
#define ALSA_CONFIG_PATH_DEFAULT "/share/alsa/alsa.conf" |
The name of the default files used by snd_config_update.
Definition at line 2608 of file conf.c.
Referenced by snd_config_update_r().
#define ALSA_CONFIG_PATH_VAR "ALSA_CONFIG_PATH" |
The name of the environment variable containing the files list for snd_config_update.
Definition at line 2605 of file conf.c.
Referenced by snd_config_update_r().
#define LOCAL_STR_BUFSIZE 64 |
#define LOCAL_UNEXPECTED_CHAR (LOCAL_ERROR - 2) |
Definition at line 457 of file conf.c.
Referenced by get_string(), parse_array_def(), parse_def(), and snd_config_load1().
#define LOCAL_UNEXPECTED_EOF (LOCAL_ERROR - 3) |
Definition at line 458 of file conf.c.
Referenced by get_char(), get_freestring(), parse_defs(), and snd_config_load1().
#define LOCAL_UNTERMINATED_QUOTE (LOCAL_ERROR - 1) |
#define LOCAL_UNTERMINATED_STRING (LOCAL_ERROR - 0) |
#define SND_CONFIG_SEARCH | ( | config, | |||
key, | |||||
result, | |||||
extra_code | ) |
Value:
{ \ snd_config_t *n; \ int err; \ const char *p; \ assert(config && key); \ while (1) { \ if (config->type != SND_CONFIG_TYPE_COMPOUND) \ return -ENOENT; \ { extra_code ; } \ p = strchr(key, '.'); \ if (p) { \ err = _snd_config_search(config, key, p - key, &n); \ if (err < 0) \ return err; \ config = n; \ key = p + 1; \ } else \ return _snd_config_search(config, key, -1, result); \ } \ }
Definition at line 2311 of file conf.c.
Referenced by snd_config_search(), and snd_config_search_hooks().
#define SND_CONFIG_SEARCH_ALIAS | ( | config, | |||
base, | |||||
key, | |||||
result, | |||||
fcn1, | |||||
fcn2 | ) |
Definition at line 2404 of file conf.c.
Referenced by snd_config_search_alias(), and snd_config_search_alias_hooks().
#define SND_CONFIG_SEARCHA | ( | root, | |||
config, | |||||
key, | |||||
result, | |||||
fcn, | |||||
extra_code | ) |
Value:
{ \ snd_config_t *n; \ int err; \ const char *p; \ assert(config && key); \ while (1) { \ if (config->type != SND_CONFIG_TYPE_COMPOUND) { \ if (snd_config_get_string(config, &p) < 0) \ return -ENOENT; \ err = fcn(root, root, p, &config); \ if (err < 0) \ return err; \ } \ { extra_code ; } \ p = strchr(key, '.'); \ if (p) { \ err = _snd_config_search(config, key, p - key, &n); \ if (err < 0) \ return err; \ config = n; \ key = p + 1; \ } else \ return _snd_config_search(config, key, -1, result); \ } \ }
Definition at line 2333 of file conf.c.
Referenced by snd_config_searcha(), and snd_config_searcha_hooks().
#define SND_CONFIG_SEARCHV | ( | config, | |||
result, | |||||
fcn | ) |
Value:
{ \ snd_config_t *n; \ va_list arg; \ assert(config); \ va_start(arg, result); \ while (1) { \ const char *k = va_arg(arg, const char *); \ int err; \ if (!k) \ break; \ err = fcn(config, k, &n); \ if (err < 0) \ return err; \ config = n; \ } \ va_end(arg); \ if (result) \ *result = n; \ return 0; \ }
Definition at line 2360 of file conf.c.
Referenced by snd_config_searchv().
#define SND_CONFIG_SEARCHVA | ( | root, | |||
config, | |||||
result, | |||||
fcn | ) |
Value:
{ \ snd_config_t *n; \ va_list arg; \ assert(config); \ va_start(arg, result); \ while (1) { \ const char *k = va_arg(arg, const char *); \ int err; \ if (!k) \ break; \ err = fcn(root, config, k, &n); \ if (err < 0) \ return err; \ config = n; \ } \ va_end(arg); \ if (result) \ *result = n; \ return 0; \ }
Definition at line 2382 of file conf.c.
Referenced by snd_config_searchva(), and snd_config_searchva_hooks().
typedef int(*) snd_config_walk_callback_t(snd_config_t *src, snd_config_t *root, snd_config_t **dst, snd_config_walk_pass_t pass, snd_config_t *private_data) |
typedef enum _snd_config_walk_pass snd_config_walk_pass_t |
static int _snd_config_copy | ( | snd_config_t * | src, | |
snd_config_t *root | ATTRIBUTE_UNUSED, | |||
snd_config_t ** | dst, | |||
snd_config_walk_pass_t | pass, | |||
snd_config_t *private_data | ATTRIBUTE_UNUSED | |||
) | [static] |
Definition at line 3251 of file conf.c.
References s, snd_config_get_integer(), snd_config_get_integer64(), snd_config_get_real(), snd_config_get_string(), snd_config_get_type(), snd_config_make(), snd_config_make_compound(), snd_config_set_integer(), snd_config_set_integer64(), snd_config_set_real(), snd_config_set_string(), SND_CONFIG_WALK_PASS_LEAF, SND_CONFIG_WALK_PASS_PRE, and type.
Referenced by snd_config_copy().
static int _snd_config_evaluate | ( | snd_config_t * | src, | |
snd_config_t * | root, | |||
snd_config_t **dst | ATTRIBUTE_UNUSED, | |||
snd_config_walk_pass_t | pass, | |||
snd_config_t * | private_data | |||
) | [static] |
Definition at line 3414 of file conf.c.
References buf, eval(), free(), int, malloc(), n, snd_config_delete(), snd_config_delete_compound_members(), snd_config_get_string(), snd_config_get_type(), snd_config_iterator_entry(), snd_config_search(), snd_config_search_definition(), snd_config_substitute(), SND_CONFIG_WALK_PASS_PRE, and snprintf().
Referenced by snd_config_evaluate().
static int _snd_config_expand | ( | snd_config_t * | src, | |
snd_config_t *root | ATTRIBUTE_UNUSED, | |||
snd_config_t ** | dst, | |||
snd_config_walk_pass_t | pass, | |||
snd_config_t * | private_data | |||
) | [static] |
Definition at line 3328 of file conf.c.
References s, snd_config_copy(), snd_config_delete(), snd_config_get_integer(), snd_config_get_integer64(), snd_config_get_real(), snd_config_get_string(), snd_config_get_type(), snd_config_imake_integer(), snd_config_imake_integer64(), snd_config_imake_real(), snd_config_imake_string(), snd_config_make_compound(), snd_config_search(), snd_config_set_id(), SND_CONFIG_WALK_PASS_LEAF, SND_CONFIG_WALK_PASS_PRE, and type.
Referenced by snd_config_expand().
static int _snd_config_make | ( | snd_config_t ** | config, | |
char ** | id, | |||
snd_config_type_t | type | |||
) | [static] |
Definition at line 855 of file conf.c.
Referenced by _snd_config_make_add(), snd_config_make(), and snd_config_top().
static int _snd_config_make_add | ( | snd_config_t ** | config, | |
char ** | id, | |||
snd_config_type_t | type, | |||
snd_config_t * | father | |||
) | [static] |
Definition at line 879 of file conf.c.
References _snd_config_make(), and n.
Referenced by parse_array_def(), parse_def(), and parse_value().
static int _snd_config_save_leaf | ( | snd_config_t * | n, | |
snd_output_t * | out, | |||
unsigned int | level | |||
) | [static] |
Definition at line 1330 of file conf.c.
References _snd_config_save_leaves(), and string_print().
Referenced by _snd_config_save_leaves(), and snd_config_save().
static int _snd_config_save_leaves | ( | snd_config_t * | config, | |
snd_output_t * | out, | |||
unsigned int | level, | |||
unsigned int | joins | |||
) | [static] |
Definition at line 1376 of file conf.c.
References _snd_config_save_leaf(), id_print(), n, and snd_config_iterator_entry().
Referenced by _snd_config_save_leaf(), and snd_config_save().
static int _snd_config_search | ( | snd_config_t * | config, | |
const char * | id, | |||
int | len, | |||
snd_config_t ** | result | |||
) | [static] |
Definition at line 894 of file conf.c.
References n, and snd_config_iterator_entry().
Referenced by parse_def().
static int add_char_local_string | ( | struct local_string * | s, | |
int | c | |||
) | [static] |
Definition at line 700 of file conf.c.
References malloc(), memcpy(), ptr, and s.
Referenced by get_delimstring(), and get_freestring().
static char* copy_local_string | ( | struct local_string * | s | ) | [static] |
Definition at line 721 of file conf.c.
References dst, malloc(), memcpy(), and s.
Referenced by get_delimstring(), and get_freestring().
static void free_local_string | ( | struct local_string * | s | ) | [static] |
static int get_char | ( | input_t * | input | ) | [static] |
Definition at line 525 of file conf.c.
References input_t::ch, input_t::current, fd, free(), LOCAL_UNEXPECTED_EOF, and input_t::unget.
Referenced by get_char_skip_comments(), get_delimstring(), get_freestring(), get_quotedchar(), and snd_config_load1().
static int get_char_skip_comments | ( | input_t * | input | ) | [static] |
Definition at line 569 of file conf.c.
References input_t::current, fd, free(), get_char(), get_delimstring(), filedesc::in, filedesc::line, and malloc().
Referenced by get_nonwhite().
static int get_delimstring | ( | char ** | string, | |
int | delim, | |||
input_t * | input | |||
) | [static] |
Definition at line 790 of file conf.c.
References add_char_local_string(), copy_local_string(), free_local_string(), get_char(), get_quotedchar(), and init_local_string().
Referenced by get_char_skip_comments(), and get_string().
static int get_freestring | ( | char ** | string, | |
int | id, | |||
input_t * | input | |||
) | [static] |
Definition at line 731 of file conf.c.
References add_char_local_string(), copy_local_string(), free_local_string(), get_char(), init_local_string(), LOCAL_UNEXPECTED_EOF, and unget_char().
Referenced by get_string().
static int get_nonwhite | ( | input_t * | input | ) | [static] |
Definition at line 624 of file conf.c.
References get_char_skip_comments().
Referenced by get_string(), parse_array_def(), parse_array_defs(), parse_def(), and parse_defs().
static int get_quotedchar | ( | input_t * | input | ) | [static] |
Definition at line 642 of file conf.c.
References get_char(), num, and unget_char().
Referenced by get_delimstring().
static int get_string | ( | char ** | string, | |
int | id, | |||
input_t * | input | |||
) | [static] |
Definition at line 824 of file conf.c.
References get_delimstring(), get_freestring(), get_nonwhite(), LOCAL_UNEXPECTED_CHAR, and unget_char().
Referenced by parse_def(), and parse_value().
static void id_print | ( | snd_config_t * | n, | |
snd_output_t * | out, | |||
unsigned int | joins | |||
) | [static] |
Definition at line 1366 of file conf.c.
References string_print().
Referenced by _snd_config_save_leaves().
static void init_local_string | ( | struct local_string * | s | ) | [static] |
Definition at line 687 of file conf.c.
References LOCAL_STR_BUFSIZE, memset(), and s.
Referenced by get_delimstring(), and get_freestring().
static int load_defaults | ( | snd_config_t * | subs, | |
snd_config_t * | defs | |||
) | [static] |
Definition at line 3538 of file conf.c.
References d, f, snd_config_add(), snd_config_copy(), snd_config_delete(), snd_config_get_type(), snd_config_iterator_entry(), and snd_config_set_id().
Referenced by snd_config_expand().
static int parse_arg | ( | const char ** | ptr, | |
unsigned int * | varlen, | |||
char ** | val | |||
) | [static] |
Definition at line 3712 of file conf.c.
References malloc(), memcpy(), parse_id(), parse_string(), and skip_blank().
Referenced by parse_args().
static int parse_args | ( | snd_config_t * | subs, | |
const char * | str, | |||
snd_config_t * | defs | |||
) | [static] |
Definition at line 3762 of file conf.c.
References buf, d, free(), memcpy(), n, parse_arg(), safe_strtod(), safe_strtol(), safe_strtoll(), skip_blank(), snd_config_add(), snd_config_delete(), snd_config_get_string(), snd_config_get_type(), snd_config_iterator_entry(), snd_config_load_override(), snd_config_make(), snd_config_search(), snd_config_search_alias(), snd_config_set_id(), snd_config_set_integer(), snd_config_set_integer64(), snd_config_set_real(), and snd_config_set_string().
Referenced by snd_config_expand().
static int parse_array_def | ( | snd_config_t * | father, | |
input_t * | input, | |||
int | idx, | |||
int | skip, | |||
int | override | |||
) | [static] |
Definition at line 992 of file conf.c.
References _snd_config_make_add(), free(), get_nonwhite(), LOCAL_UNEXPECTED_CHAR, n, parse_array_defs(), parse_defs(), parse_value(), snd_config_delete(), snprintf(), and unget_char().
Referenced by parse_array_defs().
static int parse_array_defs | ( | snd_config_t * | farther, | |
input_t * | input, | |||
int | skip, | |||
int | override | |||
) | [static] |
Definition at line 1062 of file conf.c.
References get_nonwhite(), local_string::idx, parse_array_def(), and unget_char().
Referenced by parse_array_def(), and parse_def().
static int parse_char | ( | const char ** | ptr | ) | [static] |
static int parse_def | ( | snd_config_t * | father, | |
input_t * | input, | |||
int | skip, | |||
int | override | |||
) | [static] |
Definition at line 1079 of file conf.c.
References _snd_config_make_add(), _snd_config_search(), free(), get_nonwhite(), get_string(), LOCAL_UNEXPECTED_CHAR, mode, n, parse_array_defs(), parse_defs(), parse_value(), snd_config_delete(), and unget_char().
Referenced by parse_defs().
static int parse_defs | ( | snd_config_t * | father, | |
input_t * | input, | |||
int | skip, | |||
int | override | |||
) | [static] |
Definition at line 1223 of file conf.c.
References get_nonwhite(), LOCAL_UNEXPECTED_EOF, parse_def(), and unget_char().
Referenced by parse_array_def(), parse_def(), and snd_config_load1().
static int parse_id | ( | const char ** | ptr | ) | [static] |
static int parse_string | ( | const char ** | ptr, | |
char ** | val | |||
) | [static] |
static int parse_value | ( | snd_config_t ** | _n, | |
snd_config_t * | father, | |||
input_t * | input, | |||
char ** | id, | |||
int | skip | |||
) | [static] |
Definition at line 913 of file conf.c.
References _snd_config_make_add(), free(), get_string(), n, s, safe_strtod(), and safe_strtoll().
Referenced by parse_array_def(), and parse_def().
static int safe_strtod | ( | const char * | str, | |
double * | val | |||
) | [static] |
Definition at line 497 of file conf.c.
References snprintf().
Referenced by parse_args(), parse_value(), and snd_config_set_ascii().
int safe_strtol | ( | const char * | str, | |
long * | val | |||
) |
Definition at line 481 of file conf.c.
Referenced by parse_args(), snd_config_get_ctl_iface_ascii(), snd_config_hook_load(), snd_config_hooks(), snd_config_set_ascii(), snd_func_concat(), snd_func_getenv(), and snd_func_igetenv().
static int safe_strtoll | ( | const char * | str, | |
long long * | val | |||
) | [static] |
Definition at line 466 of file conf.c.
Referenced by parse_args(), parse_value(), and snd_config_set_ascii().
static void skip_blank | ( | const char ** | ptr | ) | [static] |
int snd_config_add | ( | snd_config_t * | father, | |
snd_config_t * | leaf | |||
) |
Adds a child to a compound configuration node.
father | Handle to the compound configuration node. | |
leaf | Handle to the configuration node to be added to father . |
Definition at line 1635 of file conf.c.
References n, filedesc::next, and snd_config_iterator_entry().
Referenced by load_defaults(), parse_args(), and snd_config_walk().
int snd_config_copy | ( | snd_config_t ** | dst, | |
snd_config_t * | src | |||
) |
Creates a copy of a configuration node.
dst | The function puts the handle to the new configuration node at the address specified by dst . | |
src | Handle to the source configuration node. |
Definition at line 3322 of file conf.c.
References _snd_config_copy(), and snd_config_walk().
Referenced by _snd_config_expand(), load_defaults(), snd_config_expand(), snd_func_private_pcm_subdevice(), snd_func_private_string(), and snd_func_refer().
int snd_config_delete | ( | snd_config_t * | config | ) |
Deletes a configuration node (freeing all its related resources).
config | Handle to the configuration node to be deleted. |
Definition at line 1674 of file conf.c.
References free(), and snd_config_iterator_entry().
Referenced by _snd_config_evaluate(), _snd_config_expand(), load_defaults(), parse_args(), parse_array_def(), parse_def(), snd_config_delete_compound_members(), snd_config_expand(), snd_config_hook_load(), snd_config_hook_load_for_all_cards(), snd_config_hooks(), snd_config_hooks_call(), snd_config_imake_string(), snd_config_update_free_global(), snd_config_walk(), snd_func_card_driver(), snd_func_igetenv(), snd_func_refer(), and snd_mixer_simple_basic_register().
int snd_config_delete_compound_members | ( | const snd_config_t * | config | ) |
Deletes the children of a compound configuration node (freeing all its related resources).
config | Handle to the compound configuration node. |
config
are deleted recursively.
Definition at line 1713 of file conf.c.
References snd_config_delete(), and snd_config_iterator_entry().
Referenced by _snd_config_evaluate(), and snd_config_substitute().
int snd_config_evaluate | ( | snd_config_t * | config, | |
snd_config_t * | root, | |||
snd_config_t * | private_data, | |||
snd_config_t ** | result | |||
) |
Evaluates a configuration node at runtime.
config | Handle to the source configuration node. | |
root | Handle to the root of the source configuration. | |
private_data | Handle to the private data node for runtime evaluation. | |
result | The function puts the handle to the result node at the address specified by result . result is NULL for in-place evaluation. |
Definition at line 3530 of file conf.c.
References _snd_config_evaluate(), and snd_config_walk().
Referenced by snd_config_expand(), snd_func_card_driver(), snd_func_card_id(), snd_func_concat(), snd_func_getenv(), snd_func_pcm_args_by_class(), snd_func_pcm_id(), and snd_func_refer().
int snd_config_expand | ( | snd_config_t * | config, | |
snd_config_t * | root, | |||
const char * | args, | |||
snd_config_t * | private_data, | |||
snd_config_t ** | result | |||
) |
Expands a configuration node applying arguments and functions.
config | Handle to the configuration node. | |
root | Handle to the root configuration node. | |
args | Arguments string (optional). | |
private_data | Handle to the private data node for functions. | |
result | The function puts the handle to the result configuration node at the address specified by result . |
Definition at line 3931 of file conf.c.
References _end, _snd_config_expand(), load_defaults(), parse_args(), snd_config_copy(), snd_config_delete(), snd_config_evaluate(), snd_config_search(), snd_config_top(), and snd_config_walk().
Referenced by snd_config_hook_load(), and snd_config_search_definition().
int snd_config_get_ascii | ( | const snd_config_t * | config, | |
char ** | ascii | |||
) |
Returns the value of a configuration node as a string.
config | Handle to the configuration node. | |
ascii | The function puts the pointer to the returned string at the address specified by ascii . |
free()
when it is no longer used.
Definition at line 2213 of file conf.c.
References ptr, and snprintf().
Referenced by snd_config_hook_load(), snd_func_card_driver(), snd_func_concat(), and snd_func_getenv().
int snd_config_get_id | ( | const snd_config_t * | config, | |
const char ** | id | |||
) |
Returns the id of a configuration node.
config | Handle to the configuration node. | |
id | The function puts the pointer to the id string at the address specified by id . |
Definition at line 1507 of file conf.c.
Referenced by find_module(), snd_config_get_bool(), snd_config_get_ctl_iface(), snd_func_card_id(), snd_func_concat(), snd_func_datadir(), snd_func_getenv(), snd_func_igetenv(), snd_func_pcm_args_by_class(), snd_func_pcm_id(), snd_func_private_card_driver(), snd_func_private_pcm_subdevice(), snd_func_private_string(), and snd_func_refer().
int snd_config_get_integer | ( | const snd_config_t * | config, | |
long * | ptr | |||
) |
Returns the value of an integer configuration node.
config | Handle to the configuration node. | |
ptr | The function puts the node's value at the address specified by ptr . |
Definition at line 2103 of file conf.c.
Referenced by _snd_config_copy(), _snd_config_expand(), snd_config_get_bool(), snd_config_get_ctl_iface(), snd_func_card_id(), snd_func_pcm_args_by_class(), snd_func_pcm_id(), and snd_func_private_card_driver().
int snd_config_get_integer64 | ( | const snd_config_t * | config, | |
long long * | ptr | |||
) |
Returns the value of an integer64 configuration node.
config | Handle to the configuration node. | |
ptr | The function puts the node's value at the address specified by ptr . |
Definition at line 2119 of file conf.c.
Referenced by _snd_config_copy(), and _snd_config_expand().
int snd_config_get_ireal | ( | const snd_config_t * | config, | |
double * | ptr | |||
) |
Returns the value of a real or integer configuration node.
config | Handle to the configuration node. | |
ptr | The function puts the node's value at the address specified by ptr . |
double
type on the fly.
int snd_config_get_pointer | ( | const snd_config_t * | config, | |
const void ** | ptr | |||
) |
Returns the value of a pointer configuration node.
config | Handle to the configuration node. | |
ptr | The function puts the node's value at the address specified by ptr . |
Definition at line 2194 of file conf.c.
Referenced by snd_func_private_pcm_subdevice().
int snd_config_get_real | ( | const snd_config_t * | config, | |
double * | ptr | |||
) |
Returns the value of a real configuration node.
config | Handle to the configuration node. | |
ptr | The function puts the node's value at the address specified by ptr . |
Definition at line 2135 of file conf.c.
Referenced by _snd_config_copy(), and _snd_config_expand().
int snd_config_get_string | ( | const snd_config_t * | config, | |
const char ** | ptr | |||
) |
Returns the value of a string configuration node.
config | Handle to the configuration node. | |
ptr | The function puts the node's value at the address specified by ptr . |
Definition at line 2178 of file conf.c.
Referenced by _snd_config_copy(), _snd_config_evaluate(), _snd_config_expand(), find_module(), parse_args(), snd_config_get_bool(), snd_config_get_ctl_iface(), snd_config_hook_load(), snd_config_hook_load_for_all_cards(), snd_config_hooks_call(), snd_func_getenv(), snd_func_igetenv(), snd_func_private_string(), and snd_func_refer().
snd_config_type_t snd_config_get_type | ( | const snd_config_t * | config | ) |
Returns the type of a configuration node.
config | Handle to the configuration node. |
Definition at line 1492 of file conf.c.
Referenced by _snd_config_copy(), _snd_config_evaluate(), _snd_config_expand(), load_defaults(), parse_args(), snd_config_hook_load(), snd_config_hooks_call(), snd_config_walk(), and snd_func_getenv().
int snd_config_get_type_ascii | ( | const char * | ascii, | |
snd_config_type_t * | type | |||
) |
int snd_config_hook_load | ( | snd_config_t * | root, | |
snd_config_t * | config, | |||
snd_config_t ** | dst, | |||
snd_config_t * | private_data | |||
) |
Loads and parses the given configurations files.
root | Handle to the root configuration node. | |
config | Handle to the configuration node for this hook. | |
dst | The function puts the handle to the configuration node loaded from the file(s) at the address specified by dst . | |
private_data | Handle to the private data configuration node. |
Definition at line 2768 of file conf.c.
References free(), n, name, safe_strtol(), snd_config_delete(), snd_config_expand(), snd_config_get_ascii(), snd_config_get_bool_ascii(), snd_config_get_string(), snd_config_get_type(), snd_config_iterator_entry(), snd_config_load(), and snd_config_search().
Referenced by snd_config_hook_load_for_all_cards().
int snd_config_hook_load_for_all_cards | ( | snd_config_t * | root, | |
snd_config_t * | config, | |||
snd_config_t ** | dst, | |||
snd_config_t *private_data | ATTRIBUTE_UNUSED | |||
) |
Loads and parses the given configurations files for each installed sound card.
root | Handle to the root configuration node. | |
config | Handle to the configuration node for this hook. | |
dst | The function puts the handle to the configuration node loaded from the file(s) at the address specified by dst . | |
private_data | Handle to the private data configuration node. |
Definition at line 2882 of file conf.c.
References free(), n, s, snd_config_delete(), snd_config_get_string(), snd_config_hook_load(), snd_config_imake_string(), snd_config_search(), and snd_determine_driver().
static int snd_config_hooks | ( | snd_config_t * | config, | |
snd_config_t * | private_data | |||
) | [static] |
Definition at line 2723 of file conf.c.
References n, safe_strtol(), snd_config_delete(), snd_config_hooks_call(), snd_config_iterator_entry(), snd_config_remove(), and snd_config_search().
Referenced by snd_config_search_hooks(), and snd_config_searcha_hooks().
static int snd_config_hooks_call | ( | snd_config_t * | root, | |
snd_config_t * | config, | |||
snd_config_t * | private_data | |||
) | [static] |
Definition at line 2632 of file conf.c.
References buf, dst, free(), int, malloc(), n, snd_config_delete(), snd_config_get_string(), snd_config_get_type(), snd_config_iterator_entry(), snd_config_search(), snd_config_search_definition(), snd_config_substitute(), and snprintf().
Referenced by snd_config_hooks().
int snd_config_imake_integer | ( | snd_config_t ** | config, | |
const char * | id, | |||
const long | value | |||
) |
Creates an integer configuration node with the given initial value.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. | |
value | The initial value of the new node. |
Definition at line 1853 of file conf.c.
References snd_config_make().
Referenced by _snd_config_expand(), snd_func_card_driver(), snd_func_igetenv(), and snd_func_private_pcm_subdevice().
int snd_config_imake_integer64 | ( | snd_config_t ** | config, | |
const char * | id, | |||
const long long | value | |||
) |
Creates an integer configuration node with the given initial value.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. | |
value | The initial value of the new node. |
Definition at line 1872 of file conf.c.
References snd_config_make().
Referenced by _snd_config_expand().
int snd_config_imake_pointer | ( | snd_config_t ** | config, | |
const char * | id, | |||
const void * | value | |||
) |
Creates a pointer configuration node with the given initial value.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. | |
value | The initial value of the new node. May be NULL . |
Definition at line 1941 of file conf.c.
References snd_config_make().
int snd_config_imake_real | ( | snd_config_t ** | config, | |
const char * | id, | |||
const double | value | |||
) |
Creates a real configuration node with the given initial value.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. | |
value | The initial value of the new node. |
Definition at line 1891 of file conf.c.
References snd_config_make().
Referenced by _snd_config_expand().
int snd_config_imake_string | ( | snd_config_t ** | config, | |
const char * | id, | |||
const char * | value | |||
) |
Creates a string configuration node with the given initial value.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. | |
value | The initial value of the new node. May be NULL . |
Definition at line 1912 of file conf.c.
References snd_config_delete(), and snd_config_make().
Referenced by _snd_config_expand(), snd_config_hook_load_for_all_cards(), snd_func_card_id(), snd_func_concat(), snd_func_datadir(), snd_func_getenv(), snd_func_pcm_args_by_class(), snd_func_pcm_id(), snd_func_private_card_driver(), and snd_func_private_string().
snd_config_iterator_t snd_config_iterator_end | ( | const snd_config_t * | node | ) |
snd_config_t* snd_config_iterator_entry | ( | const snd_config_iterator_t | iterator | ) |
Returns the configuration node handle pointed to by an iterator.
iterator | A configuration node iterator. |
iterator
. Definition at line 3186 of file conf.c.
Referenced by _snd_config_evaluate(), _snd_config_save_leaves(), _snd_config_search(), find_module(), load_defaults(), parse_args(), snd_config_add(), snd_config_delete(), snd_config_delete_compound_members(), snd_config_hook_load(), snd_config_hooks(), snd_config_hooks_call(), snd_config_substitute(), snd_config_walk(), snd_func_concat(), and snd_func_getenv().
snd_config_iterator_t snd_config_iterator_first | ( | const snd_config_t * | node | ) |
snd_config_iterator_t snd_config_iterator_next | ( | const snd_config_iterator_t | iterator | ) |
Returns an iterator pointing to the next sibling.
iterator | An iterator pointing to a child configuration node. |
iterator
. If iterator
is the last sibling, the returned value is the same as the result of calling snd_config_iterator_end on the father of the nodes. int snd_config_load | ( | snd_config_t * | config, | |
snd_input_t * | in | |||
) |
Loads a configuration tree.
config | Handle to a top level configuration node. | |
in | Input handle to read the configuration from. |
Definition at line 1613 of file conf.c.
References snd_config_load1().
Referenced by snd_config_hook_load(), snd_func_refer(), and snd_mixer_simple_basic_register().
static int snd_config_load1 | ( | snd_config_t * | config, | |
snd_input_t * | in, | |||
int | override | |||
) | [static] |
Definition at line 1546 of file conf.c.
References _end, input_t::current, fd, free(), get_char(), LOCAL_UNEXPECTED_CHAR, LOCAL_UNEXPECTED_EOF, LOCAL_UNTERMINATED_QUOTE, LOCAL_UNTERMINATED_STRING, malloc(), filedesc::next, parse_defs(), and input_t::unget.
Referenced by snd_config_load(), and snd_config_load_override().
int snd_config_load_override | ( | snd_config_t * | config, | |
snd_input_t * | in | |||
) |
Loads a configuration tree and overrides existing configuration nodes.
config | Handle to a top level configuration node. | |
in | Input handle to read the configuration from. |
Definition at line 1624 of file conf.c.
References snd_config_load1().
Referenced by parse_args().
int snd_config_make | ( | snd_config_t ** | config, | |
const char * | id, | |||
snd_config_type_t | type | |||
) |
Creates a configuration node.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. | |
type | The type of the new node. |
Definition at line 1741 of file conf.c.
References _snd_config_make().
Referenced by _snd_config_copy(), parse_args(), snd_config_imake_integer(), snd_config_imake_integer64(), snd_config_imake_pointer(), snd_config_imake_real(), snd_config_imake_string(), snd_config_make_compound(), snd_config_make_integer(), snd_config_make_integer64(), snd_config_make_pointer(), snd_config_make_real(), and snd_config_make_string().
int snd_config_make_compound | ( | snd_config_t ** | config, | |
const char * | id, | |||
int | join | |||
) |
Creates an empty compound configuration node.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. | |
join | Join flag. This is checked in snd_config_save to change look. (Huh?) |
Definition at line 1834 of file conf.c.
References snd_config_make().
Referenced by _snd_config_copy(), and _snd_config_expand().
int snd_config_make_integer | ( | snd_config_t ** | config, | |
const char * | id | |||
) |
Creates an integer configuration node.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. |
Definition at line 1764 of file conf.c.
References snd_config_make().
int snd_config_make_integer64 | ( | snd_config_t ** | config, | |
const char * | id | |||
) |
Creates an integer64 configuration node.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. |
Definition at line 1778 of file conf.c.
References snd_config_make().
int snd_config_make_pointer | ( | snd_config_t ** | config, | |
const char * | id | |||
) |
Creates a pointer configuration node.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. |
NULL
.
Definition at line 1820 of file conf.c.
References snd_config_make().
int snd_config_make_real | ( | snd_config_t ** | config, | |
const char * | id | |||
) |
Creates a real configuration node.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. |
Definition at line 1792 of file conf.c.
References snd_config_make().
int snd_config_make_string | ( | snd_config_t ** | config, | |
const char * | id | |||
) |
Creates a string configuration node.
config | The function puts the handle to the new node at the address specified by config . | |
id | The id of the new node. |
NULL
.
Definition at line 1806 of file conf.c.
References snd_config_make().
int snd_config_remove | ( | snd_config_t * | config | ) |
Removes a configuration node from its tree.
config | Handle to the configuration node to be removed. |
Definition at line 1656 of file conf.c.
Referenced by snd_config_hooks().
int snd_config_save | ( | snd_config_t * | config, | |
snd_output_t * | out | |||
) |
Dumps the contents of a configuration node or tree.
config | Handle to the (root) configuration node. | |
out | Output handle. |
Definition at line 2296 of file conf.c.
References _snd_config_save_leaf(), and _snd_config_save_leaves().
int snd_config_search | ( | snd_config_t * | config, | |
const char * | key, | |||
snd_config_t ** | result | |||
) |
Searches for a node in a configuration tree.
config | Handle to the root of the configuration (sub)tree to search. | |
key | Search key: one or more node keys, separated with dots. | |
result | The function puts the handle to the node found at the address specified by result . |
Definition at line 2458 of file conf.c.
References SND_CONFIG_SEARCH.
Referenced by _snd_config_evaluate(), _snd_config_expand(), parse_args(), snd_config_expand(), snd_config_hook_load(), snd_config_hook_load_for_all_cards(), snd_config_hooks(), snd_config_hooks_call(), snd_config_searchv(), snd_func_card_driver(), snd_func_card_id(), snd_func_concat(), snd_func_getenv(), snd_func_pcm_args_by_class(), snd_func_pcm_id(), and snd_func_refer().
int snd_config_search_alias | ( | snd_config_t * | config, | |
const char * | base, | |||
const char * | key, | |||
snd_config_t ** | result | |||
) |
Searches for a node in a configuration tree, using an alias.
config | Handle to the root of the configuration (sub)tree to search. | |
base | Search key base, or NULL . | |
key | Search key suffix. | |
result | The function puts the handle to the node found at the address specified by result . |
key
is tried, then, if nothing is found, base.key
is tried. If the value found is a string, this is recursively tried in the same way.
Definition at line 2519 of file conf.c.
References SND_CONFIG_SEARCH_ALIAS, snd_config_searcha(), and snd_config_searchva().
Referenced by parse_args().
int snd_config_search_alias_hooks | ( | snd_config_t * | config, | |
const char * | base, | |||
const char * | key, | |||
snd_config_t ** | result | |||
) |
Searches for a node in a configuration tree, using an alias and expanding hooks.
config | Handle to the root of the configuration (sub)tree to search. | |
base | Search key base, or NULL . | |
key | Search key suffix. | |
result | The function puts the handle to the node found at the address specified by result . |
key
is tried, then, if nothing is found, base.key
is tried. If the value found is a string, this is recursively tried in the same way.
Definition at line 2595 of file conf.c.
References SND_CONFIG_SEARCH_ALIAS, snd_config_searcha_hooks(), and snd_config_searchva_hooks().
Referenced by snd_config_search_definition().
int snd_config_search_definition | ( | snd_config_t * | config, | |
const char * | base, | |||
const char * | name, | |||
snd_config_t ** | result | |||
) |
Searches for a definition in a configuration tree, using aliases and expanding hooks and arguments.
config | Handle to the configuration (sub)tree to search. | |
base | Implicit key base, or NULL for none. | |
name | Key suffix. | |
result | The function puts the handle to the expanded found node at the address specified by result . |
If key
contains a dot (.), the implicit base is ignored and the key starts from the root given by config
.
Definition at line 3996 of file conf.c.
References memcpy(), snd_config_expand(), and snd_config_search_alias_hooks().
Referenced by _snd_config_evaluate(), snd_config_hooks_call(), and snd_func_refer().
int snd_config_search_hooks | ( | snd_config_t * | config, | |
const char * | key, | |||
snd_config_t ** | result | |||
) |
Searches for a node in a configuration tree and expands hooks.
config | Handle to the root of the configuration (sub)tree to search. | |
key | Search key: one or more node keys, separated with dots. | |
result | The function puts the handle to the node found at the address specified by result . |
Definition at line 2537 of file conf.c.
References snd_config_hooks(), and SND_CONFIG_SEARCH.
int snd_config_searcha | ( | snd_config_t * | root, | |
snd_config_t * | config, | |||
const char * | key, | |||
snd_config_t ** | result | |||
) |
Searches for a node in a configuration tree, expanding aliases.
root | Handle to the root configuration node containing alias definitions. | |
config | Handle to the root of the configuration (sub)tree to search. | |
key | Search key: one or more node keys, separated with dots. | |
result | The function puts the handle to the node found at the address specified by result . |
Definition at line 2473 of file conf.c.
References SND_CONFIG_SEARCHA.
Referenced by snd_config_search_alias(), and snd_config_searchva().
int snd_config_searcha_hooks | ( | snd_config_t * | root, | |
snd_config_t * | config, | |||
const char * | key, | |||
snd_config_t ** | result | |||
) |
Searches for a node in a configuration tree, expanding aliases and hooks.
root | Handle to the root configuration node containing alias definitions. | |
config | Handle to the root of the configuration (sub)tree to search. | |
key | Search key: one or more node keys, separated with dots. | |
result | The function puts the handle to the node found at the address specified by result . |
Definition at line 2556 of file conf.c.
References snd_config_hooks(), and SND_CONFIG_SEARCHA.
Referenced by snd_config_search_alias_hooks(), and snd_config_searchva_hooks().
int snd_config_searchv | ( | snd_config_t * | config, | |
snd_config_t ** | result, | |||
... | ||||
) |
Searches for a node in a configuration tree.
config | Handle to the root of the configuration (sub)tree to search. | |
result | The function puts the handle to the node found at the address specified by result . | |
... | One or more concatenated dot separated search keys, terminated with NULL . |
Definition at line 2486 of file conf.c.
References snd_config_search(), and SND_CONFIG_SEARCHV.
int snd_config_searchva | ( | snd_config_t * | root, | |
snd_config_t * | config, | |||
snd_config_t ** | result, | |||
... | ||||
) |
Searches for a node in a configuration tree, expanding aliases.
root | Handle to the root configuration node containing alias definitions. | |
config | Handle to the root of the configuration (sub)tree to search. | |
result | The function puts the handle to the node found at the address specified by result . | |
... | One or more concatenated dot separated search keys, terminated with NULL . |
Definition at line 2501 of file conf.c.
References snd_config_searcha(), and SND_CONFIG_SEARCHVA.
Referenced by snd_config_search_alias().
int snd_config_searchva_hooks | ( | snd_config_t * | root, | |
snd_config_t * | config, | |||
snd_config_t ** | result, | |||
... | ||||
) |
Searches for a node in a configuration tree, expanding aliases and hooks.
root | Handle to the root configuration node containing alias definitions. | |
config | Handle to the root of the configuration (sub)tree to search. | |
result | The function puts the handle to the node found at the address specified by result . | |
... | One or more concatenated dot separated search keys, terminated with NULL . |
Definition at line 2576 of file conf.c.
References snd_config_searcha_hooks(), and SND_CONFIG_SEARCHVA.
Referenced by snd_config_search_alias_hooks().
int snd_config_set_ascii | ( | snd_config_t * | config, | |
const char * | ascii | |||
) |
Changes the value of a configuration node.
config | Handle to the configuration node. | |
ascii | The new value for the node as an ASCII string. ascii must not be NULL , not even for a string node. |
Definition at line 2050 of file conf.c.
References d, free(), ptr, safe_strtod(), safe_strtol(), and safe_strtoll().
int snd_config_set_id | ( | snd_config_t * | config, | |
const char * | id | |||
) |
Sets the id of a configuration node.
config | Handle to the configuration node. | |
id | The new node id. |
Definition at line 1520 of file conf.c.
References free().
Referenced by _snd_config_expand(), load_defaults(), parse_args(), and snd_func_refer().
int snd_config_set_integer | ( | snd_config_t * | config, | |
long | value | |||
) |
Changes the value of an integer configuration node.
config | Handle to the configuration node. | |
value | The new value for the node. |
Definition at line 1958 of file conf.c.
Referenced by _snd_config_copy(), and parse_args().
int snd_config_set_integer64 | ( | snd_config_t * | config, | |
long long | value | |||
) |
Changes the value of an integer64 configuration node.
config | Handle to the configuration node. | |
value | The new value for the node. |
Definition at line 1973 of file conf.c.
Referenced by _snd_config_copy(), and parse_args().
int snd_config_set_pointer | ( | snd_config_t * | config, | |
const void * | value | |||
) |
Changes the value of a pointer configuration node.
config | Handle to the configuration node. | |
value | The new value for the node. May be NULL . |
int snd_config_set_real | ( | snd_config_t * | config, | |
double | value | |||
) |
Changes the value of a real configuration node.
config | Handle to the configuration node. | |
value | The new value for the node. |
Definition at line 1988 of file conf.c.
Referenced by _snd_config_copy(), and parse_args().
int snd_config_set_string | ( | snd_config_t * | config, | |
const char * | value | |||
) |
Changes the value of a string configuration node.
config | Handle to the configuration node. | |
value | The new value for the node. May be NULL . |
Definition at line 2006 of file conf.c.
References free(), and new_string().
Referenced by _snd_config_copy(), and parse_args().
int snd_config_substitute | ( | snd_config_t * | dst, | |
snd_config_t * | src | |||
) |
Substitutes one configuration node to another.
dst | Handle to the destination node. | |
src | Handle to the source node. Must not be the same as dst . |
If the destination node is a compound and the source node is an ordinary type, the compound members are deleted (including their contents).
A successful call to this function invalidates the source node.
Definition at line 1428 of file conf.c.
References free(), n, snd_config_delete_compound_members(), and snd_config_iterator_entry().
Referenced by _snd_config_evaluate(), and snd_config_hooks_call().
int snd_config_test_id | ( | const snd_config_t * | config, | |
const char * | id | |||
) |
Compares the id of a configuration node to a given string.
config | Handle to the configuration node. | |
id | ASCII id. |
strcmp
function. Definition at line 2284 of file conf.c.
Referenced by snd_func_private_card_driver(), snd_func_private_pcm_subdevice(), and snd_func_private_string().
int snd_config_top | ( | snd_config_t ** | config | ) |
Creates a top level configuration node.
config | The function puts the handle to the new node at the address specified by config . |
Definition at line 1540 of file conf.c.
References _snd_config_make().
Referenced by snd_config_expand(), and snd_mixer_simple_basic_register().
int snd_config_update | ( | void | ) |
Updates snd_config by rereading the global configuration files (if needed).
0 | No action is needed. | |
1 | The configuration tree has been rebuilt. |
ALSA_CONFIG_PATH
. If this is not set, the default value is "/usr/share/alsa/alsa.conf".
Definition at line 3098 of file conf.c.
References snd_config, snd_config_global_update, and snd_config_update_r().
int snd_config_update_free | ( | snd_config_update_t * | update | ) |
Frees a private update structure.
update | The private update structure to free. |
Definition at line 3113 of file conf.c.
References free().
Referenced by snd_config_update_free_global().
int snd_config_update_free_global | ( | void | ) |
Frees the global configuration tree in snd_config.
Definition at line 3129 of file conf.c.
References snd_config, snd_config_delete(), snd_config_global_update, and snd_config_update_free().
int snd_config_update_r | ( | snd_config_t ** | _top, | |
snd_config_update_t ** | _update, | |||
const char * | cfgs | |||
) |
Updates a configuration tree by rereading the configuration files (if needed).
_top | Address of the handle to the top level node. | |
_update | Address of a pointer to private update information. | |
cfgs | A list of configuration file names, delimited with ':'. If cfgs is set to NULL , the default global configuration file is used ("/usr/share/alsa/alsa.conf"). |
0 | No action is needed. | |
1 | The configuration tree has been rebuilt. |
ALSA_CONFIG_PATH
.
Definition at line 2947 of file conf.c.
References _end, ALSA_CONFIG_PATH_DEFAULT, ALSA_CONFIG_PATH_VAR, finfo::dev, free(), finfo::ino, memcpy(), finfo::mtime, finfo::name, and name.
Referenced by snd_config_update().
static int snd_config_walk | ( | snd_config_t * | src, | |
snd_config_t * | root, | |||
snd_config_t ** | dst, | |||
snd_config_walk_callback_t | callback, | |||
snd_config_t * | private_data | |||
) | [static] |
Definition at line 3209 of file conf.c.
References d, s, snd_config_add(), snd_config_delete(), snd_config_get_type(), snd_config_iterator_entry(), SND_CONFIG_WALK_PASS_LEAF, SND_CONFIG_WALK_PASS_POST, and SND_CONFIG_WALK_PASS_PRE.
Referenced by snd_config_copy(), snd_config_evaluate(), and snd_config_expand().
int snd_determine_driver | ( | int | card, | |
char ** | driver | |||
) |
Definition at line 548 of file confmisc.c.
References ctl, and open_ctl().
Referenced by snd_config_hook_load_for_all_cards(), and snd_func_private_card_driver().
SND_DLSYM_BUILD_VERSION | ( | snd_config_hook_load_for_all_cards | , | |
SND_CONFIG_DLSYM_VERSION_HOOK | ||||
) |
SND_DLSYM_BUILD_VERSION | ( | snd_config_hook_load | , | |
SND_CONFIG_DLSYM_VERSION_HOOK | ||||
) |
static void string_print | ( | char * | str, | |
int | id, | |||
snd_output_t * | out | |||
) | [static] |
static void unget_char | ( | int | c, | |
input_t * | input | |||
) | [static] |
Definition at line 560 of file conf.c.
References input_t::ch, and input_t::unget.
Referenced by get_freestring(), get_quotedchar(), get_string(), parse_array_def(), parse_array_defs(), parse_def(), and parse_defs().
snd_config_t* snd_config = NULL |
Configuration top level node (the global configuration).
Definition at line 2614 of file conf.c.
Referenced by snd_config_update(), and snd_config_update_free_global().
snd_config_update_t* snd_config_global_update = NULL [static] |
Definition at line 2630 of file conf.c.
Referenced by snd_config_update(), and snd_config_update_free_global().
pthread_mutex_t snd_config_update_mutex = PTHREAD_MUTEX_INITIALIZER [static] |