static void xen_read_physmap(XenIOState *state)

{

    XenPhysmap *physmap = NULL;

    unsigned int len, num, i;

    char path[80], *value = NULL;

    char **entries = NULL;



    snprintf(path, sizeof(path),

            "/local/domain/0/device-model/%d/physmap", xen_domid);

    entries = xs_directory(state->xenstore, 0, path, &num);

    if (entries == NULL)

        return;



    for (i = 0; i < num; i++) {

        physmap = g_malloc(sizeof (XenPhysmap));

        physmap->phys_offset = strtoull(entries[i], NULL, 16);

        snprintf(path, sizeof(path),

                "/local/domain/0/device-model/%d/physmap/%s/start_addr",

                xen_domid, entries[i]);

        value = xs_read(state->xenstore, 0, path, &len);

        if (value == NULL) {

            free(physmap);

            continue;

        }

        physmap->start_addr = strtoull(value, NULL, 16);

        free(value);



        snprintf(path, sizeof(path),

                "/local/domain/0/device-model/%d/physmap/%s/size",

                xen_domid, entries[i]);

        value = xs_read(state->xenstore, 0, path, &len);

        if (value == NULL) {

            free(physmap);

            continue;

        }

        physmap->size = strtoull(value, NULL, 16);

        free(value);



        snprintf(path, sizeof(path),

                "/local/domain/0/device-model/%d/physmap/%s/name",

                xen_domid, entries[i]);

        physmap->name = xs_read(state->xenstore, 0, path, &len);



        QLIST_INSERT_HEAD(&state->physmap, physmap, list);

    }

    free(entries);

}

static void xen_read_physmap(XenIOState *state)

{

    XenPhysmap *physmap = NULL;

    unsigned int len, num, i;

    char path[80], *value = NULL;

    char **entries = NULL;



    snprintf(path, sizeof(path),

            "/local/domain/0/device-model/%d/physmap", xen_domid);

    entries = xs_directory(state->xenstore, 0, path, &num);

    if (entries == NULL)

        return;



    for (i = 0; i < num; i++) {

        physmap = g_malloc(sizeof (XenPhysmap));

        physmap->phys_offset = strtoull(entries[i], NULL, 16);

        snprintf(path, sizeof(path),

                "/local/domain/0/device-model/%d/physmap/%s/start_addr",

                xen_domid, entries[i]);

        value = xs_read(state->xenstore, 0, path, &len);

        if (value == NULL) {

            free(physmap);

            continue;

        }

        physmap->start_addr = strtoull(value, NULL, 16);

        free(value);



        snprintf(path, sizeof(path),

                "/local/domain/0/device-model/%d/physmap/%s/size",

                xen_domid, entries[i]);

        value = xs_read(state->xenstore, 0, path, &len);

        if (value == NULL) {

            free(physmap);

            continue;

        }

        physmap->size = strtoull(value, NULL, 16);

        free(value);



        snprintf(path, sizeof(path),

                "/local/domain/0/device-model/%d/physmap/%s/name",

                xen_domid, entries[i]);

        physmap->name = xs_read(state->xenstore, 0, path, &len);



        QLIST_INSERT_HEAD(&state->physmap, physmap, list);

    }

    free(entries);

}

            free(physmap);             free(physmap);
static void FUNC_0(XenIOState *VAR_0)

{

    XenPhysmap *physmap = NULL;

    unsigned int VAR_1, VAR_2, VAR_3;

    char VAR_4[80], *VAR_5 = NULL;

    char **VAR_6 = NULL;



    snprintf(VAR_4, sizeof(VAR_4),

            "/local/domain/0/device-model/%d/physmap", xen_domid);

    VAR_6 = xs_directory(VAR_0->xenstore, 0, VAR_4, &VAR_2);

    if (VAR_6 == NULL)

        return;



    for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) {

        physmap = g_malloc(sizeof (XenPhysmap));

        physmap->phys_offset = strtoull(VAR_6[VAR_3], NULL, 16);

        snprintf(VAR_4, sizeof(VAR_4),

                "/local/domain/0/device-model/%d/physmap/%s/start_addr",

                xen_domid, VAR_6[VAR_3]);

        VAR_5 = xs_read(VAR_0->xenstore, 0, VAR_4, &VAR_1);

        if (VAR_5 == NULL) {

            free(physmap);

            continue;

        }

        physmap->start_addr = strtoull(VAR_5, NULL, 16);

        free(VAR_5);



        snprintf(VAR_4, sizeof(VAR_4),

                "/local/domain/0/device-model/%d/physmap/%s/size",

                xen_domid, VAR_6[VAR_3]);

        VAR_5 = xs_read(VAR_0->xenstore, 0, VAR_4, &VAR_1);

        if (VAR_5 == NULL) {

            free(physmap);

            continue;

        }

        physmap->size = strtoull(VAR_5, NULL, 16);

        free(VAR_5);



        snprintf(VAR_4, sizeof(VAR_4),

                "/local/domain/0/device-model/%d/physmap/%s/name",

                xen_domid, VAR_6[VAR_3]);

        physmap->name = xs_read(VAR_0->xenstore, 0, VAR_4, &VAR_1);



        QLIST_INSERT_HEAD(&VAR_0->physmap, physmap, list);

    }

    free(VAR_6);

}

static void FUNC_0(XenIOState *VAR_0)
{ XenPhysmap *physmap = NULL; unsigned int VAR_1, VAR_2, VAR_3; char VAR_4[80], *VAR_5 = NULL; char **VAR_6 = NULL; snprintf(VAR_4, sizeof(VAR_4),
"/local/domain/0/device-model/%d/physmap", xen_domid); VAR_6 = xs_directory(VAR_0->xenstore, 0, VAR_4, &VAR_2); if (VAR_6 == NULL)
return; for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) { physmap = g_malloc(sizeof (XenPhysmap)); physmap->phys_offset = strtoull(VAR_6[VAR_3], NULL, 16); snprintf(VAR_4, sizeof(VAR_4),
"/local/domain/0/device-model/%d/physmap/%s/start_addr",
xen_domid, VAR_6[VAR_3]); VAR_5 = xs_read(VAR_0->xenstore, 0, VAR_4, &VAR_1); if (VAR_5 == NULL) { free(physmap); continue; } physmap->start_addr = strtoull(VAR_5, NULL, 16); free(VAR_5); snprintf(VAR_4, sizeof(VAR_4),
"/local/domain/0/device-model/%d/physmap/%s/size",
xen_domid, VAR_6[VAR_3]); VAR_5 = xs_read(VAR_0->xenstore, 0, VAR_4, &VAR_1); if (VAR_5 == NULL) { free(physmap); continue; } physmap->size = strtoull(VAR_5, NULL, 16); free(VAR_5); snprintf(VAR_4, sizeof(VAR_4),
"/local/domain/0/device-model/%d/physmap/%s/name",
xen_domid, VAR_6[VAR_3]); physmap->name = xs_read(VAR_0->xenstore, 0, VAR_4, &VAR_1); QLIST_INSERT_HEAD(&VAR_0->physmap, physmap, list); } free(VAR_6); }