/* AUTOMATICALLY GENERATED by qapi-gen.py DO NOT MODIFY */

/*
 * Schema-defined QAPI visitors
 *
 * Copyright IBM, Corp. 2011
 * Copyright (C) 2014-2018 Red Hat, Inc.
 *
 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
 * See the COPYING.LIB file in the top-level directory.
 */

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qapi-visit-machine-s390x.h"
#include "qapi-features.h"

bool visit_type_S390CpuPolarization(Visitor *v, const char *name,
                 S390CpuPolarization *obj, Error **errp)
{
    int value = *obj;
    bool ok = visit_type_enum(v, name, &value, &S390CpuPolarization_lookup, errp);
    *obj = value;
    return ok;
}

bool visit_type_q_obj_set_cpu_topology_arg_members(Visitor *v, q_obj_set_cpu_topology_arg *obj, Error **errp)
{
    if (!visit_type_uint16(v, "core-id", &obj->core_id, errp)) {
        return false;
    }
    if (visit_optional(v, "socket-id", &obj->has_socket_id)) {
        if (!visit_type_uint16(v, "socket-id", &obj->socket_id, errp)) {
            return false;
        }
    }
    if (visit_optional(v, "book-id", &obj->has_book_id)) {
        if (!visit_type_uint16(v, "book-id", &obj->book_id, errp)) {
            return false;
        }
    }
    if (visit_optional(v, "drawer-id", &obj->has_drawer_id)) {
        if (!visit_type_uint16(v, "drawer-id", &obj->drawer_id, errp)) {
            return false;
        }
    }
    if (visit_optional(v, "entitlement", &obj->has_entitlement)) {
        if (!visit_type_S390CpuEntitlement(v, "entitlement", &obj->entitlement, errp)) {
            return false;
        }
    }
    if (visit_optional(v, "dedicated", &obj->has_dedicated)) {
        if (!visit_type_bool(v, "dedicated", &obj->dedicated, errp)) {
            return false;
        }
    }
    return true;
}

bool visit_type_q_obj_CPU_POLARIZATION_CHANGE_arg_members(Visitor *v, q_obj_CPU_POLARIZATION_CHANGE_arg *obj, Error **errp)
{
    if (!visit_type_S390CpuPolarization(v, "polarization", &obj->polarization, errp)) {
        return false;
    }
    return true;
}

bool visit_type_CpuPolarizationInfo_members(Visitor *v, CpuPolarizationInfo *obj, Error **errp)
{
    if (!visit_type_S390CpuPolarization(v, "polarization", &obj->polarization, errp)) {
        return false;
    }
    return true;
}

bool visit_type_CpuPolarizationInfo(Visitor *v, const char *name,
                 CpuPolarizationInfo **obj, Error **errp)
{
    bool ok = false;

    if (!visit_start_struct(v, name, (void **)obj, sizeof(CpuPolarizationInfo), errp)) {
        return false;
    }
    if (!*obj) {
        /* incomplete */
        assert(visit_is_dealloc(v));
        ok = true;
        goto out_obj;
    }
    if (!visit_type_CpuPolarizationInfo_members(v, *obj, errp)) {
        goto out_obj;
    }
    ok = visit_check_struct(v, errp);
out_obj:
    visit_end_struct(v, (void **)obj);
    if (!ok && visit_is_input(v)) {
        qapi_free_CpuPolarizationInfo(*obj);
        *obj = NULL;
    }
    return ok;
}

/* Dummy declaration to prevent empty .o file */
char qapi_dummy_qapi_visit_machine_s390x_c;
