qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v5 2/7] util/mmap-alloc: switch qemu_ram_mmap()


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v5 2/7] util/mmap-alloc: switch qemu_ram_mmap() to 'flags' parameter
Date: Wed, 5 Dec 2018 09:20:10 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

On Mon, Nov 05, 2018 at 04:08:12PM +0800, Zhang Yi wrote:
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index fbd0dc8..c28869d 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -203,7 +203,9 @@ void *qemu_memalign(size_t alignment, size_t size)
>  void *qemu_anon_ram_alloc(size_t size, uint64_t *alignment, bool shared)
>  {
>      size_t align = QEMU_VMALLOC_ALIGN;
> -    void *ptr = qemu_ram_mmap(-1, size, align, shared);
> +    uint32_t flags = 0;
> +    flags |= shared;

O_o .o(???)

shared is bool, what is going on here?  Did you mean:

  uint32_t flags = 0;
  void *ptr;

  if (shared) {
      flags |= MAP_SHARED;
  }

  ptr = qemu_ram_mmap(-1, size, align, flags);

Attachment: signature.asc
Description: PGP signature


reply via email to

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