Lines Matching refs:opts
90 struct dp_option *opts;
93 opts = talloc_zero_array(memctx, struct dp_option, num_opts);
94 if (!opts) return ENOMEM;
99 opts[i].opt_name = def_opts[i].opt_name;
100 opts[i].type = def_opts[i].type;
101 opts[i].def_val = def_opts[i].def_val;
105 ret = confdb_get_string(cdb, opts, conf_path,
106 opts[i].opt_name,
107 opts[i].def_val.cstring,
108 &opts[i].val.string);
110 ((opts[i].def_val.string != NULL) &&
111 (opts[i].val.string == NULL))) {
114 opts[i].opt_name);
119 opts[i].opt_name,
120 opts[i].val.cstring ? "" : " no",
121 opts[i].val.cstring ? opts[i].val.cstring : "");
125 ret = confdb_get_string(cdb, opts, conf_path,
126 opts[i].opt_name,
131 opts[i].opt_name);
136 opts[i].val.blob.data = (uint8_t *)tmp;
137 opts[i].val.blob.length = strlen(tmp);
138 } else if (opts[i].def_val.blob.data != NULL) {
139 opts[i].val.blob.data = opts[i].def_val.blob.data;
140 opts[i].val.blob.length = opts[i].def_val.blob.length;
142 opts[i].val.blob.data = NULL;
143 opts[i].val.blob.length = 0;
147 opts[i].opt_name, opts[i].val.blob.length?"a":"no");
152 opts[i].opt_name,
153 opts[i].def_val.number,
154 &opts[i].val.number);
158 opts[i].opt_name);
162 opts[i].opt_name, opts[i].val.number);
167 opts[i].opt_name,
168 opts[i].def_val.boolean,
169 &opts[i].val.boolean);
173 opts[i].opt_name);
177 opts[i].opt_name, opts[i].val.boolean?"TRUE":"FALSE");
183 *_opts = opts;
186 if (ret != EOK) talloc_zfree(opts);
197 struct dp_option *opts;
200 opts = talloc_zero_array(memctx, struct dp_option, num_opts);
201 if (!opts) return ENOMEM;
204 opts[i].opt_name = src_opts[i].opt_name;
205 opts[i].type = src_opts[i].type;
206 opts[i].def_val = src_opts[i].def_val;
212 ret = dp_opt_set_string(opts, i, src_opts[i].val.string);
214 ret = dp_opt_set_string(opts, i, src_opts[i].def_val.string);
219 opts[i].opt_name);
223 opts[i].opt_name,
224 opts[i].val.cstring ? "" : " no",
225 opts[i].val.cstring ? opts[i].val.cstring : "");
230 ret = dp_opt_set_blob(opts, i, src_opts[i].val.blob);
232 ret = dp_opt_set_blob(opts, i, src_opts[i].def_val.blob);
237 opts[i].opt_name);
241 opts[i].opt_name, opts[i].val.blob.length?"a":"no");
246 ret = dp_opt_set_int(opts, i, src_opts[i].val.number);
248 ret = dp_opt_set_int(opts, i, src_opts[i].def_val.number);
253 opts[i].opt_name);
257 opts[i].opt_name, opts[i].val.number);
262 ret = dp_opt_set_bool(opts, i, src_opts[i].val.boolean);
264 ret = dp_opt_set_bool(opts, i, src_opts[i].def_val.boolean);
269 opts[i].opt_name);
273 opts[i].opt_name, opts[i].val.boolean?"TRUE":"FALSE");
278 *_opts = opts;
281 if (ret != EOK) talloc_zfree(opts);
317 const char *_dp_opt_get_cstring(struct dp_option *opts,
320 if (opts[id].type != DP_OPT_STRING) {
324 location, opts[id].opt_name,
325 dp_opt_type_to_string(opts[id].type));
328 return opts[id].val.cstring;
331 char *_dp_opt_get_string(struct dp_option *opts,
334 if (opts[id].type != DP_OPT_STRING) {
338 location, opts[id].opt_name,
339 dp_opt_type_to_string(opts[id].type));
342 return opts[id].val.string;
345 struct dp_opt_blob _dp_opt_get_blob(struct dp_option *opts,
349 if (opts[id].type != DP_OPT_BLOB) {
352 location, opts[id].opt_name,
353 dp_opt_type_to_string(opts[id].type));
356 return opts[id].val.blob;
359 int _dp_opt_get_int(struct dp_option *opts,
362 if (opts[id].type != DP_OPT_NUMBER) {
366 location, opts[id].opt_name,
367 dp_opt_type_to_string(opts[id].type));
370 return opts[id].val.number;
373 bool _dp_opt_get_bool(struct dp_option *opts,
376 if (opts[id].type != DP_OPT_BOOL) {
380 location, opts[id].opt_name,
381 dp_opt_type_to_string(opts[id].type));
384 return opts[id].val.boolean;
388 int _dp_opt_set_string(struct dp_option *opts, int id,
391 if (opts[id].type != DP_OPT_STRING) {
395 location, opts[id].opt_name,
396 dp_opt_type_to_string(opts[id].type));
400 if (opts[id].val.string) {
401 talloc_zfree(opts[id].val.string);
404 opts[id].val.string = talloc_strdup(opts, s);
405 if (!opts[id].val.string) {
414 int _dp_opt_set_blob(struct dp_option *opts, int id,
417 if (opts[id].type != DP_OPT_BLOB) {
420 location, opts[id].opt_name,
421 dp_opt_type_to_string(opts[id].type));
425 if (opts[id].val.blob.data) {
426 talloc_zfree(opts[id].val.blob.data);
427 opts[id].val.blob.length = 0;
430 opts[id].val.blob.data = talloc_memdup(opts, b.data, b.length);
431 if (!opts[id].val.blob.data) {
436 opts[id].val.blob.length = b.length;
441 int _dp_opt_set_int(struct dp_option *opts, int id,
444 if (opts[id].type != DP_OPT_NUMBER) {
448 location, opts[id].opt_name,
449 dp_opt_type_to_string(opts[id].type));
453 opts[id].val.number = i;
458 int _dp_opt_set_bool(struct dp_option *opts, int id,
461 if (opts[id].type != DP_OPT_BOOL) {
465 location, opts[id].opt_name,
466 dp_opt_type_to_string(opts[id].type));
470 opts[id].val.boolean = b;