Patchwork [1/6] file_ram_alloc(): coding style fixes

login
register
mail settings
Submitter Eduardo Habkost
Date July 2, 2012, 6:06 p.m.
Message ID <1341252398-12268-2-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/168621/
State New
Headers show

Comments

Eduardo Habkost - July 2, 2012, 6:06 p.m.
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 exec.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Blue Swirl - July 3, 2012, 7:16 p.m.
On Mon, Jul 2, 2012 at 6:06 PM, Eduardo Habkost <ehabkost@redhat.com> wrote:
> Cc: Blue Swirl <blauwirbel@gmail.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Acked-by: Blue Swirl <blauwirbel@gmail.com>

> ---
>  exec.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index 8244d54..c8bfd27 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2392,7 +2392,7 @@ static void *file_ram_alloc(RAMBlock *block,
>      unlink(filename);
>      free(filename);
>
> -    memory = (memory+hpagesize-1) & ~(hpagesize-1);
> +    memory = (memory + hpagesize - 1) & ~(hpagesize - 1);
>
>      /*
>       * ftruncate is not supported by hugetlbfs in older
> @@ -2400,8 +2400,9 @@ static void *file_ram_alloc(RAMBlock *block,
>       * If anything goes wrong with it under other filesystems,
>       * mmap will fail.
>       */
> -    if (ftruncate(fd, memory))
> +    if (ftruncate(fd, memory)) {
>          perror("ftruncate");
> +    }
>
>  #ifdef MAP_POPULATE
>      /* NB: MAP_POPULATE won't exhaustively alloc all phys pages in the case
> --
> 1.7.10.4
>

Patch

diff --git a/exec.c b/exec.c
index 8244d54..c8bfd27 100644
--- a/exec.c
+++ b/exec.c
@@ -2392,7 +2392,7 @@  static void *file_ram_alloc(RAMBlock *block,
     unlink(filename);
     free(filename);
 
-    memory = (memory+hpagesize-1) & ~(hpagesize-1);
+    memory = (memory + hpagesize - 1) & ~(hpagesize - 1);
 
     /*
      * ftruncate is not supported by hugetlbfs in older
@@ -2400,8 +2400,9 @@  static void *file_ram_alloc(RAMBlock *block,
      * If anything goes wrong with it under other filesystems,
      * mmap will fail.
      */
-    if (ftruncate(fd, memory))
+    if (ftruncate(fd, memory)) {
         perror("ftruncate");
+    }
 
 #ifdef MAP_POPULATE
     /* NB: MAP_POPULATE won't exhaustively alloc all phys pages in the case