/src/barebox/include/globalvar.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | | #ifndef __GLOBALVAR_H |
3 | | #define __GLOBALVAR_H |
4 | | |
5 | | #include <param.h> |
6 | | #include <driver.h> |
7 | | #include <linux/err.h> |
8 | | #include <linux/uuid.h> |
9 | | #include <stringlist.h> |
10 | | |
11 | | extern struct device global_device; |
12 | | |
13 | | #ifdef CONFIG_GLOBALVAR |
14 | | |
15 | | static inline const char *globalvar_get(const char *name) |
16 | 0 | { |
17 | 0 | return dev_get_param(&global_device, name); |
18 | 0 | } Unexecuted instantiation: console_common.c:globalvar_get Unexecuted instantiation: startup.c:globalvar_get Unexecuted instantiation: misc.c:globalvar_get Unexecuted instantiation: bootm.c:globalvar_get Unexecuted instantiation: console.c:globalvar_get Unexecuted instantiation: console_ctrlc.c:globalvar_get Unexecuted instantiation: environment.c:globalvar_get Unexecuted instantiation: bootargs.c:globalvar_get Unexecuted instantiation: globalvar.c:globalvar_get Unexecuted instantiation: oftree.c:globalvar_get Unexecuted instantiation: partitions.c:globalvar_get Unexecuted instantiation: efi.c:globalvar_get Unexecuted instantiation: reset_source.c:globalvar_get Unexecuted instantiation: firmware.c:globalvar_get Unexecuted instantiation: boot.c:globalvar_get Unexecuted instantiation: fastboot.c:globalvar_get Unexecuted instantiation: peb.c:globalvar_get Unexecuted instantiation: partition.c:globalvar_get Unexecuted instantiation: overlay.c:globalvar_get Unexecuted instantiation: reboot-mode.c:globalvar_get Unexecuted instantiation: loadenv.c:globalvar_get Unexecuted instantiation: bfetch.c:globalvar_get Unexecuted instantiation: global.c:globalvar_get Unexecuted instantiation: dmesg.c:globalvar_get Unexecuted instantiation: nv.c:globalvar_get Unexecuted instantiation: defaultenv.c:globalvar_get Unexecuted instantiation: tutorial.c:globalvar_get Unexecuted instantiation: parameter.c:globalvar_get Unexecuted instantiation: process_escape_sequence.c:globalvar_get Unexecuted instantiation: password.c:globalvar_get Unexecuted instantiation: eth.c:globalvar_get Unexecuted instantiation: net.c:globalvar_get Unexecuted instantiation: dhcp.c:globalvar_get Unexecuted instantiation: ifup.c:globalvar_get Unexecuted instantiation: tftp.c:globalvar_get Unexecuted instantiation: nfs.c:globalvar_get |
19 | | |
20 | | int globalvar_add_simple(const char *name, const char *value); |
21 | | |
22 | | void globalvar_remove(const char *name); |
23 | | char *globalvar_get_match(const char *match, const char *separator); |
24 | | void globalvar_set_match(const char *match, const char *val); |
25 | | void globalvar_set(const char *name, const char *val); |
26 | | |
27 | | int globalvar_add_simple_string(const char *name, char **value); |
28 | | int globalvar_add_simple_int(const char *name, int *value, |
29 | | const char *format); |
30 | | int globalvar_add_simple_uint64(const char *name, u64 *value, |
31 | | const char *format); |
32 | | int globalvar_add_bool(const char *name, |
33 | | int (*set)(struct param_d *, void *), |
34 | | int *value, void *priv); |
35 | | int globalvar_add_simple_enum(const char *name, int *value, |
36 | | const char * const *names, int max); |
37 | | int globalvar_add_simple_bitmask(const char *name, unsigned long *value, |
38 | | const char * const *names, int max); |
39 | | int globalvar_add_simple_ip(const char *name, IPaddr_t *ip); |
40 | | int globalvar_add_simple_uuid(const char *name, uuid_t *uuid); |
41 | | int globalvar_add_simple_guid(const char *name, guid_t *guid); |
42 | | |
43 | | int nvvar_load(void); |
44 | | void nvvar_print(void); |
45 | | int nvvar_add(const char *name, const char *value); |
46 | | int nvvar_remove(const char *name); |
47 | | void globalvar_print(void); |
48 | | |
49 | | void dev_param_init_from_nv(struct device *dev, const char *name); |
50 | | void globalvar_alias_deprecated(const char *oldname, const char *newname); |
51 | | |
52 | | #else |
53 | | static inline const char *globalvar_get(const char *name) |
54 | | { |
55 | | return NULL; |
56 | | } |
57 | | |
58 | | static inline int globalvar_add_simple(const char *name, const char *value) |
59 | | { |
60 | | return 0; |
61 | | } |
62 | | |
63 | | static inline int globalvar_add_simple_string(const char *name, char **value) |
64 | | { |
65 | | return 0; |
66 | | } |
67 | | |
68 | | static inline int globalvar_add_simple_int(const char *name, |
69 | | int *value, const char *format) |
70 | | { |
71 | | return 0; |
72 | | } |
73 | | |
74 | | static inline int globalvar_add_simple_uint64(const char *name, |
75 | | u64 *value, const char *format) |
76 | | { |
77 | | return 0; |
78 | | } |
79 | | |
80 | | static inline int globalvar_add_bool(const char *name, |
81 | | int (*set)(struct param_d *, void *), |
82 | | int *value, void *priv) |
83 | | { |
84 | | return 0; |
85 | | } |
86 | | |
87 | | static inline int globalvar_add_simple_enum(const char *name, |
88 | | int *value, const char * const *names, int max) |
89 | | { |
90 | | return 0; |
91 | | } |
92 | | |
93 | | static inline int globalvar_add_simple_bitmask(const char *name, |
94 | | unsigned long *value, |
95 | | const char * const *names, |
96 | | int max) |
97 | | { |
98 | | return 0; |
99 | | } |
100 | | |
101 | | static inline int globalvar_add_simple_ip(const char *name, |
102 | | IPaddr_t *ip) |
103 | | { |
104 | | return 0; |
105 | | } |
106 | | |
107 | | static inline int globalvar_add_simple_uuid(const char *name, uuid_t *uuid) |
108 | | { |
109 | | return 0; |
110 | | } |
111 | | static inline int globalvar_add_simple_guid(const char *name, guid_t *guid) |
112 | | { |
113 | | return 0; |
114 | | } |
115 | | |
116 | | static inline void globalvar_remove(const char *name) {} |
117 | | |
118 | | static inline void globalvar_print(void) {} |
119 | | |
120 | | static inline char *globalvar_get_match(const char *match, const char *separator) |
121 | | { |
122 | | return NULL; |
123 | | } |
124 | | |
125 | | static inline void globalvar_set_match(const char *match, const char *val) {} |
126 | | |
127 | | static inline void globalvar_set(const char *name, const char *val) {} |
128 | | |
129 | | static inline int nvvar_load(void) |
130 | | { |
131 | | return 0; |
132 | | } |
133 | | |
134 | | static inline void nvvar_print(void) {} |
135 | | |
136 | | static inline int nvvar_add(const char *name, const char *value) |
137 | | { |
138 | | return 0; |
139 | | } |
140 | | |
141 | | static inline int nvvar_remove(const char *name) |
142 | | { |
143 | | return 0; |
144 | | } |
145 | | |
146 | | static inline int nvvar_save(void) |
147 | | { |
148 | | return 0; |
149 | | } |
150 | | |
151 | | static inline void dev_param_init_from_nv(struct device *dev, |
152 | | const char *name) |
153 | | { |
154 | | } |
155 | | |
156 | | static inline void globalvar_alias_deprecated(const char *newname, const char *oldname) |
157 | | { |
158 | | } |
159 | | |
160 | | #endif |
161 | | |
162 | | void nv_var_set_clean(void); |
163 | | void nv_var_set_persistable(void); |
164 | | int nvvar_save(void); |
165 | | int nv_complete(struct string_list *sl, char *instr); |
166 | | int global_complete(struct string_list *sl, char *instr); |
167 | | |
168 | | static inline int globalvar_add_simple_bool(const char *name, int *value) |
169 | 260 | { |
170 | 260 | return globalvar_add_bool(name, NULL, value, NULL); |
171 | 260 | } console_common.c:globalvar_add_simple_bool Line | Count | Source | 169 | 26 | { | 170 | 26 | return globalvar_add_bool(name, NULL, value, NULL); | 171 | 26 | } |
Unexecuted instantiation: startup.c:globalvar_add_simple_bool Unexecuted instantiation: misc.c:globalvar_add_simple_bool bootm.c:globalvar_add_simple_bool Line | Count | Source | 169 | 130 | { | 170 | 130 | return globalvar_add_bool(name, NULL, value, NULL); | 171 | 130 | } |
Unexecuted instantiation: console.c:globalvar_add_simple_bool console_ctrlc.c:globalvar_add_simple_bool Line | Count | Source | 169 | 26 | { | 170 | 26 | return globalvar_add_bool(name, NULL, value, NULL); | 171 | 26 | } |
Unexecuted instantiation: environment.c:globalvar_add_simple_bool Unexecuted instantiation: bootargs.c:globalvar_add_simple_bool Unexecuted instantiation: globalvar.c:globalvar_add_simple_bool oftree.c:globalvar_add_simple_bool Line | Count | Source | 169 | 26 | { | 170 | 26 | return globalvar_add_bool(name, NULL, value, NULL); | 171 | 26 | } |
Unexecuted instantiation: partitions.c:globalvar_add_simple_bool Unexecuted instantiation: efi.c:globalvar_add_simple_bool Unexecuted instantiation: reset_source.c:globalvar_add_simple_bool Unexecuted instantiation: firmware.c:globalvar_add_simple_bool Unexecuted instantiation: boot.c:globalvar_add_simple_bool fastboot.c:globalvar_add_simple_bool Line | Count | Source | 169 | 26 | { | 170 | 26 | return globalvar_add_bool(name, NULL, value, NULL); | 171 | 26 | } |
Unexecuted instantiation: peb.c:globalvar_add_simple_bool Unexecuted instantiation: partition.c:globalvar_add_simple_bool Unexecuted instantiation: overlay.c:globalvar_add_simple_bool Unexecuted instantiation: reboot-mode.c:globalvar_add_simple_bool Unexecuted instantiation: loadenv.c:globalvar_add_simple_bool Unexecuted instantiation: bfetch.c:globalvar_add_simple_bool Unexecuted instantiation: global.c:globalvar_add_simple_bool Unexecuted instantiation: dmesg.c:globalvar_add_simple_bool Unexecuted instantiation: nv.c:globalvar_add_simple_bool Unexecuted instantiation: defaultenv.c:globalvar_add_simple_bool Unexecuted instantiation: tutorial.c:globalvar_add_simple_bool Unexecuted instantiation: parameter.c:globalvar_add_simple_bool Unexecuted instantiation: process_escape_sequence.c:globalvar_add_simple_bool Unexecuted instantiation: password.c:globalvar_add_simple_bool Unexecuted instantiation: eth.c:globalvar_add_simple_bool Unexecuted instantiation: net.c:globalvar_add_simple_bool Unexecuted instantiation: dhcp.c:globalvar_add_simple_bool ifup.c:globalvar_add_simple_bool Line | Count | Source | 169 | 26 | { | 170 | 26 | return globalvar_add_bool(name, NULL, value, NULL); | 171 | 26 | } |
Unexecuted instantiation: tftp.c:globalvar_add_simple_bool Unexecuted instantiation: nfs.c:globalvar_add_simple_bool |
172 | | |
173 | | static inline struct param_d *globalvar_add_param_string(const char *name, |
174 | | int (*set)(struct param_d *p, void *priv), |
175 | | int (*get)(struct param_d *p, void *priv), |
176 | | char **value, void *priv) |
177 | 26 | { |
178 | 26 | return IS_ENABLED(CONFIG_GLOBALVAR) ? |
179 | 26 | dev_add_param_string(&global_device, name, set, get, value, priv) : |
180 | 26 | NULL; |
181 | 26 | } Unexecuted instantiation: console_common.c:globalvar_add_param_string startup.c:globalvar_add_param_string Line | Count | Source | 177 | 26 | { | 178 | 26 | return IS_ENABLED(CONFIG_GLOBALVAR) ? | 179 | 26 | dev_add_param_string(&global_device, name, set, get, value, priv) : | 180 | 26 | NULL; | 181 | 26 | } |
Unexecuted instantiation: misc.c:globalvar_add_param_string Unexecuted instantiation: bootm.c:globalvar_add_param_string Unexecuted instantiation: console.c:globalvar_add_param_string Unexecuted instantiation: console_ctrlc.c:globalvar_add_param_string Unexecuted instantiation: environment.c:globalvar_add_param_string Unexecuted instantiation: bootargs.c:globalvar_add_param_string Unexecuted instantiation: globalvar.c:globalvar_add_param_string Unexecuted instantiation: oftree.c:globalvar_add_param_string Unexecuted instantiation: partitions.c:globalvar_add_param_string Unexecuted instantiation: efi.c:globalvar_add_param_string Unexecuted instantiation: reset_source.c:globalvar_add_param_string Unexecuted instantiation: firmware.c:globalvar_add_param_string Unexecuted instantiation: boot.c:globalvar_add_param_string Unexecuted instantiation: fastboot.c:globalvar_add_param_string Unexecuted instantiation: peb.c:globalvar_add_param_string Unexecuted instantiation: partition.c:globalvar_add_param_string Unexecuted instantiation: overlay.c:globalvar_add_param_string Unexecuted instantiation: reboot-mode.c:globalvar_add_param_string Unexecuted instantiation: loadenv.c:globalvar_add_param_string Unexecuted instantiation: bfetch.c:globalvar_add_param_string Unexecuted instantiation: global.c:globalvar_add_param_string Unexecuted instantiation: dmesg.c:globalvar_add_param_string Unexecuted instantiation: nv.c:globalvar_add_param_string Unexecuted instantiation: defaultenv.c:globalvar_add_param_string Unexecuted instantiation: tutorial.c:globalvar_add_param_string Unexecuted instantiation: parameter.c:globalvar_add_param_string Unexecuted instantiation: process_escape_sequence.c:globalvar_add_param_string Unexecuted instantiation: password.c:globalvar_add_param_string Unexecuted instantiation: eth.c:globalvar_add_param_string Unexecuted instantiation: net.c:globalvar_add_param_string Unexecuted instantiation: dhcp.c:globalvar_add_param_string Unexecuted instantiation: ifup.c:globalvar_add_param_string Unexecuted instantiation: tftp.c:globalvar_add_param_string Unexecuted instantiation: nfs.c:globalvar_add_param_string |
182 | | |
183 | | #endif /* __GLOBALVAR_H */ |