Lines Matching refs:list

156  * Searches an option list for an option with the given name
158 QEMUOptionParameter *get_option_parameter(QEMUOptionParameter *list,
161 while (list && list->name) {
162 if (!strcmp(list->name, name)) {
163 return list;
165 list++;
242 * Sets the value of a parameter in a given option list. The parsing of the
258 int set_option_parameter(QEMUOptionParameter *list, const char *name,
264 list = get_option_parameter(list, name);
265 if (list == NULL) {
271 switch (list->type) {
275 list->value.n = flag;
280 list->value.s = qemu_strdup(value);
288 if (parse_option_size(name, value, &list->value.n) == -1)
306 int set_option_parameter_int(QEMUOptionParameter *list, const char *name,
310 list = get_option_parameter(list, name);
311 if (list == NULL) {
317 switch (list->type) {
321 list->value.n = value;
332 * Frees a option list. If it contains strings, the strings are freed as well.
334 void free_option_parameters(QEMUOptionParameter *list)
336 QEMUOptionParameter *cur = list;
345 qemu_free(list);
349 * Count valid options in list
351 static size_t count_option_parameters(QEMUOptionParameter *list)
355 while (list && list->name) {
357 list++;
364 * Append an option list (list) to an option list (dest).
366 * If dest is NULL, a new copy of list is created.
371 QEMUOptionParameter *list)
378 num_options += count_option_parameters(list);
383 while (list && list->name) {
384 if (get_option_parameter(dest, list->name) == NULL) {
385 dest[num_dest_options++] = *list;
388 list++;
395 * Parses a parameter string (param) into an option list (dest).
397 * list is the template option list. If dest is NULL, a new copy of list is
398 * created. If list is NULL, this function fails.
412 QEMUOptionParameter *list, QEMUOptionParameter *dest)
420 if (list == NULL) {
425 dest = allocated = append_option_parameters(NULL, list);
458 // Only free the list if it was newly allocated
464 * Prints all options of a list that have a value to stdout
466 void print_option_parameters(QEMUOptionParameter *list)
468 while (list && list->name) {
469 switch (list->type) {
471 if (list->value.s != NULL) {
472 printf("%s='%s' ", list->name, list->value.s);
476 printf("%s=%s ", list->name, list->value.n ? "on" : "off");
480 printf("%s=%" PRId64 " ", list->name, list->value.n);
483 printf("%s=(unkown type) ", list->name);
486 list++;
493 void print_option_help(QEMUOptionParameter *list)
496 while (list && list->name) {
497 printf("%-16s %s\n", list->name,
498 list->help ? list->help : "No description available");
499 list++;
521 QemuOptsList *list;
605 const QemuOptDesc *desc = opts->list->desc;
615 /* empty list -> allow any */;
653 QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id)
657 QTAILQ_FOREACH(opts, &list->head, next) {
684 QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists)
694 opts = qemu_opts_find(list, id);
697 qerror_report(QERR_DUPLICATE_ID, id, list->name);
708 opts->list = list;
711 QTAILQ_INSERT_TAIL(&list->head, opts, next);
715 void qemu_opts_reset(QemuOptsList *list)
719 QTAILQ_FOREACH_SAFE(opts, &list->head, next, next_opts) {
729 int qemu_opts_set(QemuOptsList *list, const char *id,
734 opts = qemu_opts_create(list, id, 1);
756 QTAILQ_REMOVE(&opts->list->head, opts, next);
765 fprintf(stderr, "%s: %s:", opts->list->name,
820 QemuOpts *qemu_opts_parse(QemuOptsList *list, const char *params,
828 assert(!permit_abbrev || list->implied_opt_name);
829 firstname = permit_abbrev ? list->implied_opt_name : NULL;
838 opts = qemu_opts_create(list, id, 1);
893 QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict)
897 opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1);
936 assert(opts->list->desc[0].name == NULL);
961 int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque,
969 QTAILQ_FOREACH(opts, &list->head, next) {