[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/6] file_ram_alloc: change length argument to size_
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 4/6] file_ram_alloc: change length argument to size_t (v2) |
Date: |
Mon, 2 Jul 2012 15:06:36 -0300 |
While we are at it, rename it to "length", as "memory" doesn't mean
anything.
Changes v1 -> v2:
- Rebase after coding style changes
Signed-off-by: Eduardo Habkost <address@hidden>
---
exec.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/exec.c b/exec.c
index d856325..1e98244 100644
--- a/exec.c
+++ b/exec.c
@@ -2357,7 +2357,7 @@ static long gethugepagesize(const char *path)
}
static void *file_ram_alloc(RAMBlock *block,
- ram_addr_t memory,
+ size_t length,
const char *path)
{
gchar *filename;
@@ -2373,7 +2373,7 @@ static void *file_ram_alloc(RAMBlock *block,
return NULL;
}
- if (memory < hpagesize) {
+ if (length < hpagesize) {
return NULL;
}
@@ -2392,7 +2392,7 @@ static void *file_ram_alloc(RAMBlock *block,
unlink(filename);
g_free(filename);
- memory = (memory + hpagesize - 1) & ~(hpagesize - 1);
+ length = (length + hpagesize - 1) & ~(hpagesize - 1);
/*
* ftruncate is not supported by hugetlbfs in older
@@ -2400,7 +2400,7 @@ 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, length)) {
perror("ftruncate");
}
@@ -2410,9 +2410,9 @@ static void *file_ram_alloc(RAMBlock *block,
* to sidestep this quirk.
*/
flags = mem_prealloc ? MAP_POPULATE | MAP_SHARED : MAP_PRIVATE;
- area = mmap(0, memory, PROT_READ | PROT_WRITE, flags, fd, 0);
+ area = mmap(0, length, PROT_READ | PROT_WRITE, flags, fd, 0);
#else
- area = mmap(0, memory, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
+ area = mmap(0, length, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
#endif
if (area == MAP_FAILED) {
perror("file_ram_alloc: can't mmap RAM pages");
--
1.7.10.4
- [Qemu-devel] [RFC PATCH 0/6] option to not remove files inside -mem-path dir (v2), Eduardo Habkost, 2012/07/02
- [Qemu-devel] [PATCH 1/6] file_ram_alloc(): coding style fixes, Eduardo Habkost, 2012/07/02
- [Qemu-devel] [PATCH 4/6] file_ram_alloc: change length argument to size_t (v2),
Eduardo Habkost <=
- [Qemu-devel] [RFC PATCH 6/6] add -keep-mem-path-files option (v2), Eduardo Habkost, 2012/07/02
- [Qemu-devel] [PATCH 2/6] file_ram_alloc(): use g_strdup_printf() instead of asprintf(), Eduardo Habkost, 2012/07/02
- [Qemu-devel] [PATCH 3/6] vl.c: change mem_prealloc to bool (v2), Eduardo Habkost, 2012/07/02
- [Qemu-devel] [PATCH 5/6] file_ram_alloc(): extract temporary-file creation code to separate function (v2), Eduardo Habkost, 2012/07/02
- Re: [Qemu-devel] [RFC PATCH 0/6] option to not remove files inside -mem-path dir (v2), Daniel P. Berrange, 2012/07/02