22
22
struct cmd_context;
38
struct config_value *next; /* for arrays */
43
struct config_node *parent, *sib, *child;
44
struct config_value *v;
48
struct config_node *root;
51
struct config_tree_list {
53
struct config_tree *cft;
56
struct config_tree *create_config_tree(const char *filename, int keep_open);
57
struct config_tree *create_config_tree_from_string(const char *config_settings);
59
24
int override_config_tree_from_string(struct cmd_context *cmd,
60
25
const char *config_settings);
61
void destroy_config_tree(struct config_tree *cft);
26
struct dm_config_tree *remove_overridden_config_tree(struct cmd_context *cmd);
63
28
typedef uint32_t (*checksum_fn_t) (uint32_t initial, const uint8_t *buf, uint32_t size);
65
int read_config_fd(struct config_tree *cft, struct device *dev,
66
off_t offset, size_t size, off_t offset2, size_t size2,
67
checksum_fn_t checksum_fn, uint32_t checksum);
69
int read_config_file(struct config_tree *cft);
70
int write_config_file(struct config_tree *cft, const char *file,
71
int argc, char **argv);
73
typedef int (*putline_fn)(const char *line, void *baton);
74
int write_config_node(const struct config_node *cn, putline_fn putline, void *baton);
76
time_t config_file_timestamp(struct config_tree *cft);
77
int config_file_changed(struct config_tree *cft);
78
int merge_config_tree(struct cmd_context *cmd, struct config_tree *cft,
79
struct config_tree *newdata);
81
const struct config_node *find_config_node(const struct config_node *cn,
83
const char *find_config_str(const struct config_node *cn, const char *path,
85
int find_config_int(const struct config_node *cn, const char *path, int fail);
86
float find_config_float(const struct config_node *cn, const char *path,
30
struct dm_config_tree *config_file_open(const char *filename, int keep_open);
31
int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,
32
off_t offset, size_t size, off_t offset2, size_t size2,
33
checksum_fn_t checksum_fn, uint32_t checksum);
34
int config_file_read(struct dm_config_tree *cft);
35
int config_write(struct dm_config_tree *cft, const char *file,
36
int argc, char **argv);
37
void config_file_destroy(struct dm_config_tree *cft);
39
time_t config_file_timestamp(struct dm_config_tree *cft);
40
int config_file_changed(struct dm_config_tree *cft);
41
int config_file_check(struct dm_config_tree *cft, const char **filename, struct stat *info);
44
int merge_config_tree(struct cmd_context *cmd, struct dm_config_tree *cft,
45
struct dm_config_tree *newdata);
90
48
* These versions check an override tree, if present, first.
92
const struct config_node *find_config_tree_node(struct cmd_context *cmd,
50
const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd,
94
52
const char *find_config_tree_str(struct cmd_context *cmd,
95
53
const char *path, const char *fail);
54
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd,
55
const char *path, const char *fail);
96
56
int find_config_tree_int(struct cmd_context *cmd, const char *path,
98
58
int64_t find_config_tree_int64(struct cmd_context *cmd, const char *path,
100
60
float find_config_tree_float(struct cmd_context *cmd, const char *path,
104
* Understands (0, ~0), (y, n), (yes, no), (on,
105
* off), (true, false).
107
int find_config_bool(const struct config_node *cn, const char *path, int fail);
108
63
int find_config_tree_bool(struct cmd_context *cmd, const char *path, int fail);
110
int get_config_uint32(const struct config_node *cn, const char *path,
113
int get_config_uint64(const struct config_node *cn, const char *path,
116
int get_config_str(const struct config_node *cn, const char *path,
117
const char **result);
119
unsigned maybe_config_section(const char *str, unsigned len);
121
const char *config_parent_name(const struct config_node *n);
123
struct config_node *clone_config_node_with_mem(struct dm_pool *mem,
124
const struct config_node *node,
126
struct config_node *create_config_node(struct config_tree *cft, const char *key);
127
struct config_value *create_config_value(struct config_tree *cft);
128
struct config_node *clone_config_node(struct config_tree *cft, const struct config_node *cn,
131
struct dm_pool *config_tree_memory(struct config_tree *cft);