qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 7/7] RTC:Allow to migrate from old version


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH v4 7/7] RTC:Allow to migrate from old version
Date: Mon, 19 Mar 2012 12:56:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

On 03/19/2012 08:14 AM, Zhang, Yang Z wrote:
> The new logic is compatible with old. So it should not block migrate from old 
> version. But new version cannot migrate to old.
>
> +static int rtc_load_old(QEMUFile *f, void *opaque, int version_id)
> +{
> +    RTCState *s = opaque;
> +
> +    if (version_id > 2) {
> +        return -EINVAL;
> +    }
> +
> +    qemu_get_buffer(f, s->cmos_data, sizeof(s->cmos_data));
> +    /* dummy load for compatibility */
> +    qemu_get_byte(f); /* cmos_index */
> +    qemu_get_be32(f); /* tm_sec */
> +    qemu_get_be32(f); /* tm_min */
> +    qemu_get_be32(f); /* tm_hour */
> +    qemu_get_be32(f); /* tm_wday */
> +    qemu_get_be32(f); /* tm_mday */
> +    qemu_get_be32(f); /* tm_mon */
> +    qemu_get_be32(f); /* tm_year */
> +    qemu_get_be64(f); /* periodic_timer */
> +    qemu_get_be64(f); /* next_periodic_time */
> +    qemu_get_be64(f); /* next_second_time */
> +    qemu_get_be64(f); /* second_timer */
> +    qemu_get_be64(f); /* second_timer2 */
> +    qemu_get_be32(f); /* irq_coalesced */
> +    qemu_get_be32(f); /* period */
> +

Why don't you just convert the data to the new in-memory format?  Then
you don't need a version update.

> +
> +    rtc_set_date_from_host(&s->dev);

If the guest is intentionally running with an incorrect date, this breaks.


-- 
error compiling committee.c: too many arguments to function




reply via email to

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