int register_savevm_live(DeviceState *dev,

                         const char *idstr,

                         int instance_id,

                         int version_id,

                         SaveVMHandlers *ops,

                         void *opaque)

{

    SaveStateEntry *se;



    se = g_malloc0(sizeof(SaveStateEntry));

    se->version_id = version_id;

    se->section_id = savevm_state.global_section_id++;

    se->ops = ops;

    se->opaque = opaque;

    se->vmsd = NULL;

    /* if this is a live_savem then set is_ram */

    if (ops->save_live_setup != NULL) {

        se->is_ram = 1;

    }



    if (dev) {

        char *id = qdev_get_dev_path(dev);

        if (id) {

            pstrcpy(se->idstr, sizeof(se->idstr), id);

            pstrcat(se->idstr, sizeof(se->idstr), "/");

            g_free(id);



            se->compat = g_malloc0(sizeof(CompatEntry));

            pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), idstr);

            se->compat->instance_id = instance_id == -1 ?

                         calculate_compat_instance_id(idstr) : instance_id;

            instance_id = -1;

        }

    }

    pstrcat(se->idstr, sizeof(se->idstr), idstr);



    if (instance_id == -1) {

        se->instance_id = calculate_new_instance_id(se->idstr);

    } else {

        se->instance_id = instance_id;

    }

    assert(!se->compat || se->instance_id == 0);

    /* add at the end of list */

    QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry);

    return 0;

}

int register_savevm_live(DeviceState *dev,

                         const char *idstr,

                         int instance_id,

                         int version_id,

                         SaveVMHandlers *ops,

                         void *opaque)

{

    SaveStateEntry *se;



    se = g_malloc0(sizeof(SaveStateEntry));

    se->version_id = version_id;

    se->section_id = savevm_state.global_section_id++;

    se->ops = ops;

    se->opaque = opaque;

    se->vmsd = NULL;

    

    if (ops->save_live_setup != NULL) {

        se->is_ram = 1;

    }



    if (dev) {

        char *id = qdev_get_dev_path(dev);

        if (id) {

            pstrcpy(se->idstr, sizeof(se->idstr), id);

            pstrcat(se->idstr, sizeof(se->idstr), "/");

            g_free(id);



            se->compat = g_malloc0(sizeof(CompatEntry));

            pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), idstr);

            se->compat->instance_id = instance_id == -1 ?

                         calculate_compat_instance_id(idstr) : instance_id;

            instance_id = -1;

        }

    }

    pstrcat(se->idstr, sizeof(se->idstr), idstr);



    if (instance_id == -1) {

        se->instance_id = calculate_new_instance_id(se->idstr);

    } else {

        se->instance_id = instance_id;

    }

    assert(!se->compat || se->instance_id == 0);

    

    QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry);

    return 0;

}

    se = g_malloc0(sizeof(SaveStateEntry));             se->compat = g_malloc0(sizeof(CompatEntry));     se = g_malloc0(sizeof(SaveStateEntry));             se->compat = g_malloc0(sizeof(CompatEntry));
int FUNC_0(DeviceState *VAR_0,

                         const char *VAR_1,

                         int VAR_2,

                         int VAR_3,

                         SaveVMHandlers *VAR_4,

                         void *VAR_5)

{

    SaveStateEntry *se;



    se = g_malloc0(sizeof(SaveStateEntry));

    se->VAR_3 = VAR_3;

    se->section_id = savevm_state.global_section_id++;

    se->VAR_4 = VAR_4;

    se->VAR_5 = VAR_5;

    se->vmsd = NULL;

    

    if (VAR_4->save_live_setup != NULL) {

        se->is_ram = 1;

    }



    if (VAR_0) {

        char *VAR_6 = qdev_get_dev_path(VAR_0);

        if (VAR_6) {

            pstrcpy(se->VAR_1, sizeof(se->VAR_1), VAR_6);

            pstrcat(se->VAR_1, sizeof(se->VAR_1), "/");

            g_free(VAR_6);



            se->compat = g_malloc0(sizeof(CompatEntry));

            pstrcpy(se->compat->VAR_1, sizeof(se->compat->VAR_1), VAR_1);

            se->compat->VAR_2 = VAR_2 == -1 ?

                         calculate_compat_instance_id(VAR_1) : VAR_2;

            VAR_2 = -1;

        }

    }

    pstrcat(se->VAR_1, sizeof(se->VAR_1), VAR_1);



    if (VAR_2 == -1) {

        se->VAR_2 = calculate_new_instance_id(se->VAR_1);

    } else {

        se->VAR_2 = VAR_2;

    }

    assert(!se->compat || se->VAR_2 == 0);

    

    QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry);

    return 0;

}

int FUNC_0(DeviceState *VAR_0,
const char *VAR_1,
int VAR_2,
int VAR_3,
SaveVMHandlers *VAR_4,
void *VAR_5)
{ SaveStateEntry *se; se = g_malloc0(sizeof(SaveStateEntry)); se->VAR_3 = VAR_3; se->section_id = savevm_state.global_section_id++; se->VAR_4 = VAR_4; se->VAR_5 = VAR_5; se->vmsd = NULL; if (VAR_4->save_live_setup != NULL) { se->is_ram = 1; } if (VAR_0) { char *VAR_6 = qdev_get_dev_path(VAR_0); if (VAR_6) { pstrcpy(se->VAR_1, sizeof(se->VAR_1), VAR_6); pstrcat(se->VAR_1, sizeof(se->VAR_1), "/"); g_free(VAR_6); se->compat = g_malloc0(sizeof(CompatEntry)); pstrcpy(se->compat->VAR_1, sizeof(se->compat->VAR_1), VAR_1); se->compat->VAR_2 = VAR_2 == -1 ?
calculate_compat_instance_id(VAR_1) : VAR_2; VAR_2 = -1; } } pstrcat(se->VAR_1, sizeof(se->VAR_1), VAR_1); if (VAR_2 == -1) { se->VAR_2 = calculate_new_instance_id(se->VAR_1); } else { se->VAR_2 = VAR_2; } assert(!se->compat || se->VAR_2 == 0); QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry); return 0; }