int xenstore_domain_init1(const char *kernel, const char *ramdisk,

                          const char *cmdline)

{

    char *dom, uuid_string[42], vm[256], path[256];

    int i;



    snprintf(uuid_string, sizeof(uuid_string), UUID_FMT,

             qemu_uuid[0], qemu_uuid[1], qemu_uuid[2], qemu_uuid[3],

             qemu_uuid[4], qemu_uuid[5], qemu_uuid[6], qemu_uuid[7],

             qemu_uuid[8], qemu_uuid[9], qemu_uuid[10], qemu_uuid[11],

             qemu_uuid[12], qemu_uuid[13], qemu_uuid[14], qemu_uuid[15]);

    dom = xs_get_domain_path(xenstore, xen_domid);

    snprintf(vm,  sizeof(vm),  "/vm/%s", uuid_string);



    xenstore_domain_mkdir(dom);



    xenstore_write_str(vm, "image/ostype",  "linux");

    if (kernel)

        xenstore_write_str(vm, "image/kernel",  kernel);

    if (ramdisk)

        xenstore_write_str(vm, "image/ramdisk", ramdisk);

    if (cmdline)

        xenstore_write_str(vm, "image/cmdline", cmdline);



    /* name + id */

    xenstore_write_str(vm,  "name",   qemu_name ? qemu_name : "no-name");

    xenstore_write_str(vm,  "uuid",   uuid_string);

    xenstore_write_str(dom, "name",   qemu_name ? qemu_name : "no-name");

    xenstore_write_int(dom, "domid",  xen_domid);

    xenstore_write_str(dom, "vm",     vm);



    /* memory */

    xenstore_write_int(dom, "memory/target", ram_size >> 10);  // kB

    xenstore_write_int(vm, "memory",         ram_size >> 20);  // MB

    xenstore_write_int(vm, "maxmem",         ram_size >> 20);  // MB



    /* cpus */

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

	snprintf(path, sizeof(path), "cpu/%d/availability",i);

	xenstore_write_str(dom, path, "online");

    }

    xenstore_write_int(vm, "vcpu_avail",  smp_cpus);

    xenstore_write_int(vm, "vcpus",       smp_cpus);



    /* vnc password */

    xenstore_write_str(vm, "vncpassword", "" /* FIXME */);



    free(dom);

    return 0;

}

int xenstore_domain_init1(const char *kernel, const char *ramdisk,

                          const char *cmdline)

{

    char *dom, uuid_string[42], vm[256], path[256];

    int i;



    snprintf(uuid_string, sizeof(uuid_string), UUID_FMT,

             qemu_uuid[0], qemu_uuid[1], qemu_uuid[2], qemu_uuid[3],

             qemu_uuid[4], qemu_uuid[5], qemu_uuid[6], qemu_uuid[7],

             qemu_uuid[8], qemu_uuid[9], qemu_uuid[10], qemu_uuid[11],

             qemu_uuid[12], qemu_uuid[13], qemu_uuid[14], qemu_uuid[15]);

    dom = xs_get_domain_path(xenstore, xen_domid);

    snprintf(vm,  sizeof(vm),  "/vm/%s", uuid_string);



    xenstore_domain_mkdir(dom);



    xenstore_write_str(vm, "image/ostype",  "linux");

    if (kernel)

        xenstore_write_str(vm, "image/kernel",  kernel);

    if (ramdisk)

        xenstore_write_str(vm, "image/ramdisk", ramdisk);

    if (cmdline)

        xenstore_write_str(vm, "image/cmdline", cmdline);



    

    xenstore_write_str(vm,  "name",   qemu_name ? qemu_name : "no-name");

    xenstore_write_str(vm,  "uuid",   uuid_string);

    xenstore_write_str(dom, "name",   qemu_name ? qemu_name : "no-name");

    xenstore_write_int(dom, "domid",  xen_domid);

    xenstore_write_str(dom, "vm",     vm);



    

    xenstore_write_int(dom, "memory/target", ram_size >> 10);  

    xenstore_write_int(vm, "memory",         ram_size >> 20);  

    xenstore_write_int(vm, "maxmem",         ram_size >> 20);  



    

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

	snprintf(path, sizeof(path), "cpu/%d/availability",i);

	xenstore_write_str(dom, path, "online");

    }

    xenstore_write_int(vm, "vcpu_avail",  smp_cpus);

    xenstore_write_int(vm, "vcpus",       smp_cpus);



    

    xenstore_write_str(vm, "vncpassword", "" );



    free(dom);

    return 0;

}

int FUNC_0(const char *VAR_0, const char *VAR_1,

                          const char *VAR_2)

{

    char *VAR_3, VAR_4[42], VAR_5[256], VAR_6[256];

    int VAR_7;



    snprintf(VAR_4, sizeof(VAR_4), UUID_FMT,

             qemu_uuid[0], qemu_uuid[1], qemu_uuid[2], qemu_uuid[3],

             qemu_uuid[4], qemu_uuid[5], qemu_uuid[6], qemu_uuid[7],

             qemu_uuid[8], qemu_uuid[9], qemu_uuid[10], qemu_uuid[11],

             qemu_uuid[12], qemu_uuid[13], qemu_uuid[14], qemu_uuid[15]);

    VAR_3 = xs_get_domain_path(xenstore, xen_domid);

    snprintf(VAR_5,  sizeof(VAR_5),  "/VAR_5/%s", VAR_4);



    xenstore_domain_mkdir(VAR_3);



    xenstore_write_str(VAR_5, "image/ostype",  "linux");

    if (VAR_0)

        xenstore_write_str(VAR_5, "image/VAR_0",  VAR_0);

    if (VAR_1)

        xenstore_write_str(VAR_5, "image/VAR_1", VAR_1);

    if (VAR_2)

        xenstore_write_str(VAR_5, "image/VAR_2", VAR_2);



    

    xenstore_write_str(VAR_5,  "name",   qemu_name ? qemu_name : "no-name");

    xenstore_write_str(VAR_5,  "uuid",   VAR_4);

    xenstore_write_str(VAR_3, "name",   qemu_name ? qemu_name : "no-name");

    xenstore_write_int(VAR_3, "domid",  xen_domid);

    xenstore_write_str(VAR_3, "VAR_5",     VAR_5);



    

    xenstore_write_int(VAR_3, "memory/target", ram_size >> 10);  

    xenstore_write_int(VAR_5, "memory",         ram_size >> 20);  

    xenstore_write_int(VAR_5, "maxmem",         ram_size >> 20);  



    

    for (VAR_7 = 0; VAR_7 < smp_cpus; VAR_7++) {

	snprintf(VAR_6, sizeof(VAR_6), "cpu/%d/availability",VAR_7);

	xenstore_write_str(VAR_3, VAR_6, "online");

    }

    xenstore_write_int(VAR_5, "vcpu_avail",  smp_cpus);

    xenstore_write_int(VAR_5, "vcpus",       smp_cpus);



    

    xenstore_write_str(VAR_5, "vncpassword", "" );



    free(VAR_3);

    return 0;

}

int FUNC_0(const char *VAR_0, const char *VAR_1,
const char *VAR_2)
{ char *VAR_3, VAR_4[42], VAR_5[256], VAR_6[256]; int VAR_7; snprintf(VAR_4, sizeof(VAR_4), UUID_FMT,
qemu_uuid[0], qemu_uuid[1], qemu_uuid[2], qemu_uuid[3],
qemu_uuid[4], qemu_uuid[5], qemu_uuid[6], qemu_uuid[7],
qemu_uuid[8], qemu_uuid[9], qemu_uuid[10], qemu_uuid[11],
qemu_uuid[12], qemu_uuid[13], qemu_uuid[14], qemu_uuid[15]); VAR_3 = xs_get_domain_path(xenstore, xen_domid); snprintf(VAR_5,  sizeof(VAR_5),  "/VAR_5/%s", VAR_4); xenstore_domain_mkdir(VAR_3); xenstore_write_str(VAR_5, "image/ostype",  "linux"); if (VAR_0)
xenstore_write_str(VAR_5, "image/VAR_0",  VAR_0); if (VAR_1)
xenstore_write_str(VAR_5, "image/VAR_1", VAR_1); if (VAR_2)
xenstore_write_str(VAR_5, "image/VAR_2", VAR_2); xenstore_write_str(VAR_5,  "name",   qemu_name ? qemu_name : "no-name"); xenstore_write_str(VAR_5,  "uuid",   VAR_4); xenstore_write_str(VAR_3, "name",   qemu_name ? qemu_name : "no-name"); xenstore_write_int(VAR_3, "domid",  xen_domid); xenstore_write_str(VAR_3, "VAR_5",     VAR_5); xenstore_write_int(VAR_3, "memory/target", ram_size >> 10); xenstore_write_int(VAR_5, "memory",         ram_size >> 20); xenstore_write_int(VAR_5, "maxmem",         ram_size >> 20); for (VAR_7 = 0; VAR_7 < smp_cpus; VAR_7++) { snprintf(VAR_6, sizeof(VAR_6), "cpu/%d/availability",VAR_7); xenstore_write_str(VAR_3, VAR_6, "online"); } xenstore_write_int(VAR_5, "vcpu_avail",  smp_cpus); xenstore_write_int(VAR_5, "vcpus",       smp_cpus); xenstore_write_str(VAR_5, "vncpassword", "" ); free(VAR_3); return 0; }