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

Re: [Xen-devel] [PATCH v3 2/2] libxl: save/restore qemu's physmap



On Mon, 30 Jan 2012, Shriram Rajagopalan wrote:
> On Mon, Jan 30, 2012 at 8:54 AM, Stefano Stabellini 
> <stefano.stabellini@xxxxxxxxxxxxx> wrote:
>       +
>       +static int libxl__toolstack_restore(uint32_t domid, uint8_t *buf,
>       +        uint32_t size, void *data)
>       +{
>       +    libxl__gc *gc = (libxl__gc *) data;
>       +    int i, ret;
>       +    uint8_t *ptr = buf;
>       +    uint32_t count = 0, version = 0;
>       +    struct libxl__physmap_info* pi;
>       +
>       +    if (size < sizeof(version) + sizeof(count))
>       +        return -1;
>       +
>       +    memcpy(&version, ptr, sizeof(version));
>       +    ptr += sizeof(version);
>       +
>       +    if (version != TOOLSTACK_SAVE_VERSION)
>       +        return -1;
>       +
>       +    memcpy(&count, ptr, sizeof(count));
>       +    ptr += sizeof(count);
>       +
>       +    if (size < sizeof(version) + sizeof(count) +
>       +            count * (sizeof(struct libxl__physmap_info)))
>       +        return -1;
>       +
>       +    for (i = 0; i < count; i++) {
>       +        pi = (struct libxl__physmap_info*) ptr;
>       +        ptr += sizeof(struct libxl__physmap_info) + pi->namelen;
>       +
>       +        ret = libxl__xs_write(gc, 0, libxl__sprintf(gc,
>       +                   
>  "/local/domain/0/device-model/%d/physmap/%"PRIx64"/start_addr",
>       +                    domid, pi->phys_offset), "%"PRIx64, 
> pi->start_addr);
>       +        if (ret)
>       +            return -1;
>       +        ret = libxl__xs_write(gc, 0, libxl__sprintf(gc,
>       +                   
>  "/local/domain/0/device-model/%d/physmap/%"PRIx64"/size",
>       +                    domid, pi->phys_offset), "%"PRIx64, 
> pi->size);
>       +        if (ret)
>       +            return -1;
>       +        if (pi->namelen > 0) {
>       +            ret = libxl__xs_write(gc, 0, libxl__sprintf(gc,
>       +                       
>  "/local/domain/0/device-model/%d/physmap/%"PRIx64"/name",
>       +                        domid, pi->phys_offset), "%s", 
> pi->name);
>       +            if (ret)
>       +                return -1;
>       +        }
>       +    }
>       +    return 0;
>       +}
>       +
> 
> 
> 
> Sorry if this sounds silly. Is the save/restore of Qemu Physmap equivalent to
> save/restore of the Qemu Device Model ?

Nope, it is in addition to the save/restore of the QEMU device state.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.