qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] qcow2: Add snapshot inherantance and uuid identi


From: Miguel Di Ciurcio Filho
Subject: Re: [Qemu-devel] [RFC] qcow2: Add snapshot inherantance and uuid identification
Date: Wed, 4 Aug 2010 09:56:18 -0300

On Tue, Aug 3, 2010 at 5:55 PM, Blue Swirl <address@hidden> wrote:
>> +    if (strlen(current_snapshot_id) > 0) {
>> +        pstrcpy(sn->parent_id_str, sizeof(sn->parent_id_str), 
>> current_snapshot_id);
>> +    } else {
>> +        pstrcpy(sn->parent_id_str, sizeof(sn->parent_id_str), 
>> "00000000-0000-0000-0000-000000000000");
>> +    }
>> +
>> +    uuid_generate(uuid_buf);
>> +    uuid_unparse(uuid_buf, sn->id_str);
>
> We have qemu_uuid which is defined with command line switch, can you use that?
>

Didn't know that. It does the job, but there is some code inside
qemu_uuid_parse() that I'm not familiar with:

int qemu_uuid_parse(const char *str, uint8_t *uuid)
{
...
#ifdef TARGET_I386
    smbios_add_field(1, offsetof(struct smbios_type_1, uuid), 16, uuid);
#endif
    return 0;
}

I see that there are more uuid functions and spread in the code:

- block/vdi.c:
typedef unsigned char uuid_t[16];
void uuid_generate(uuid_t out);
int uuid_is_null(const uuid_t uu);
void uuid_unparse(const uuid_t uu, char *out);
- monitor.c:
do_info_uuid() does the conversion manually too, instead of using unparse/parse.

I think it would be better to cleanup this stuff and have a common code shaded.

Regards,

Miguel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]