qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 2/3] hostmem-file: add readonly=on|off option


From: Stefan Hajnoczi
Subject: Re: [PATCH v2 2/3] hostmem-file: add readonly=on|off option
Date: Mon, 4 Jan 2021 15:42:23 +0000

On Mon, Dec 14, 2020 at 12:10:15PM +0100, Igor Mammedov wrote:
> On Wed, 16 Sep 2020 10:51:49 +0100
> Stefan Hajnoczi <stefanha@redhat.com> wrote:
> 
> > Let -object memory-backend-file work on read-only files when the
> > readonly=on option is given. This can be used to share the contents of a
> > file between multiple guests while preventing them from consuming
> > Copy-on-Write memory if guests dirty the pages, for example.
> > 
> > Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> cosmetic/style nits only
> 
> s/Object *o/Object *obj/
> 
> for consistency with the rest of the code in file.

Will fix.

> > @@ -153,6 +154,26 @@ static void file_memory_backend_set_pmem(Object *o, 
> > bool value, Error **errp)
> >      fb->is_pmem = value;
> >  }
> >  
> > +static bool file_memory_backend_get_readonly(Object *o, Error **errp)
> > +{
> > +    return MEMORY_BACKEND_FILE(o)->readonly;
> 
> I thought using macro this way not acceptable and one should use
> 
> HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
> 
> return fb->readonly;

I'm not sure where this is forbidden or why? I've updated the patch as
suggested anyway.

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

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