On 30.10.2015 08:56, Xiao Guangrong wrote:
Currently, file_ram_alloc() only works on directory - it creates a file
under @path and do mmap on it
This patch tries to allow it to work on file directly, if @path is a
directory it works as before, otherwise it treats @path as the target
file then directly allocate memory from it
Signed-off-by: Xiao Guangrong <address@hidden>
---
exec.c | 80 ++++++++++++++++++++++++++++++++++++++++++------------------------
1 file changed, 51 insertions(+), 29 deletions(-)
diff --git a/exec.c b/exec.c
index 3ca7e50..f219010 100644
--- a/exec.c
+++ b/exec.c
@@ -1174,14 +1174,60 @@ void qemu_mutex_unlock_ramlist(void)
}
#ifdef __linux__
+static bool path_is_dir(const char *path)
+{
+ struct stat fs;
+
+ return stat(path, &fs) == 0 && S_ISDIR(fs.st_mode);
+}
+
+static int open_file_path(RAMBlock *block, const char *path, size_t size)
I think the name should be more descriptive, as it is very special function in
common exec.c and it
doesn't "just open file path'.. May be open_ram_file_path