Lines Matching refs:opts
515 QemuOpts *opts;
527 static QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name)
531 QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) {
539 const char *qemu_opt_get(QemuOpts *opts, const char *name)
541 QemuOpt *opt = qemu_opt_find(opts, name);
545 int qemu_opt_get_bool(QemuOpts *opts, const char *name, int defval)
547 QemuOpt *opt = qemu_opt_find(opts, name);
555 uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t defval)
557 QemuOpt *opt = qemu_opt_find(opts, name);
565 uint64_t qemu_opt_get_size(QemuOpts *opts, const char *name, uint64_t defval)
567 QemuOpt *opt = qemu_opt_find(opts, name);
596 QTAILQ_REMOVE(&opt->opts->head, opt, next);
602 int qemu_opt_set(QemuOpts *opts, const char *name, const char *value)
605 const QemuOptDesc *desc = opts->list->desc;
624 opt->opts = opts;
625 QTAILQ_INSERT_TAIL(&opts->head, opt, next);
639 int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
645 QTAILQ_FOREACH(opt, &opts->head, next) {
655 QemuOpts *opts;
657 QTAILQ_FOREACH(opts, &list->head, next) {
658 if (!opts->id) {
661 if (strcmp(opts->id, id) != 0) {
664 return opts;
686 QemuOpts *opts = NULL;
694 opts = qemu_opts_find(list, id);
695 if (opts != NULL) {
700 return opts;
704 opts = qemu_mallocz(sizeof(*opts));
706 opts->id = qemu_strdup(id);
708 opts->list = list;
709 loc_save(&opts->loc);
710 QTAILQ_INIT(&opts->head);
711 QTAILQ_INSERT_TAIL(&list->head, opts, next);
712 return opts;
717 QemuOpts *opts, *next_opts;
719 QTAILQ_FOREACH_SAFE(opts, &list->head, next, next_opts) {
720 qemu_opts_del(opts);
724 void qemu_opts_loc_restore(QemuOpts *opts)
726 loc_restore(&opts->loc);
732 QemuOpts *opts;
734 opts = qemu_opts_create(list, id, 1);
735 if (opts == NULL) {
738 return qemu_opt_set(opts, name, value);
741 const char *qemu_opts_id(QemuOpts *opts)
743 return opts->id;
746 void qemu_opts_del(QemuOpts *opts)
751 opt = QTAILQ_FIRST(&opts->head);
756 QTAILQ_REMOVE(&opts->list->head, opts, next);
757 qemu_free(opts->id);
758 qemu_free(opts);
761 int qemu_opts_print(QemuOpts *opts, void *dummy)
765 fprintf(stderr, "%s: %s:", opts->list->name,
766 opts->id ? opts->id : "<noid>");
767 QTAILQ_FOREACH(opt, &opts->head, next) {
774 int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname)
809 if (qemu_opt_set(opts, option, value) == -1) {
826 QemuOpts *opts;
838 opts = qemu_opts_create(list, id, 1);
839 if (opts == NULL)
842 if (qemu_opts_do_parse(opts, params, firstname) != 0) {
843 qemu_opts_del(opts);
847 return opts;
895 QemuOpts *opts;
897 opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1);
898 if (opts == NULL)
901 qdict_iter(qdict, qemu_opts_from_qdict_1, opts);
902 return opts;
911 QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict)
919 if (opts->id) {
920 qdict_put(qdict, "id", qstring_from_str(opts->id));
922 QTAILQ_FOREACH(opt, &opts->head, next) {
929 /* Validate parsed opts against descriptions where no
932 int qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc)
936 assert(opts->list->desc[0].name == NULL);
938 QTAILQ_FOREACH(opt, &opts->head, next) {
965 QemuOpts *opts;
969 QTAILQ_FOREACH(opts, &list->head, next) {
970 loc_restore(&opts->loc);
971 rc |= func(opts, opaque);