[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/5] linux-user: do_openat wrapper added
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PATCH 5/5] linux-user: do_openat wrapper added |
Date: |
Fri, 12 Oct 2012 21:24:42 +0300 |
From: Riku Voipio <address@hidden>
In preparations for for refactoring the main switch/case out
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/syscall.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index eebf219..61030f2 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5092,6 +5092,19 @@ cleanup:
unlock_user(pathname, arg1, 0);
return ret;
}
+
+static int do_openat(void *cpu_env, abi_long arg1, abi_long arg2, abi_long
arg3, abi_long arg4)
+{
+ void *p;
+ int ret;
+ if (!(p = lock_user_string(arg2)))
+ return -EFAULT;
+ ret = sys_openat(arg1, path(p),
+ target_to_host_bitmask(arg3, fcntl_flags_tbl), arg4);
+ unlock_user(p, arg2, 0);
+ return ret;
+}
+
static void do_exit(void *, abi_long) __attribute__ ((noreturn));
static void do_exit(void *cpu_env, abi_long arg1)
{
@@ -5199,13 +5212,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
break;
#if defined(TARGET_NR_openat) && defined(__NR_openat)
case TARGET_NR_openat:
- if (!(p = lock_user_string(arg2)))
- goto efault;
- ret = get_errno(sys_openat(arg1,
- path(p),
- target_to_host_bitmask(arg3,
fcntl_flags_tbl),
- arg4));
- unlock_user(p, arg2, 0);
+ ret = get_errno(do_openat(cpu_env, arg1, arg2, arg3, arg4));
break;
#endif
case TARGET_NR_close:
--
1.7.9.5
- [Qemu-devel] [RFC] [PATCH 0/5] linux-user: refactor do_syscall(), riku . voipio, 2012/10/12
- [Qemu-devel] [PATCH 4/5] linux-user: complete do_open function isolation, riku . voipio, 2012/10/12
- [Qemu-devel] [PATCH 5/5] linux-user: do_openat wrapper added,
riku . voipio <=
- [Qemu-devel] [PATCH 1/5] linux-user: move exit to own function, riku . voipio, 2012/10/12
- [Qemu-devel] [PATCH 2/5] linux-user: move read to own function, riku . voipio, 2012/10/12
- [Qemu-devel] [PATCH 3/5] linux-user: move write to own function, riku . voipio, 2012/10/12
- Re: [Qemu-devel] [RFC] [PATCH 0/5] linux-user: refactor do_syscall(), Richard Henderson, 2012/10/12
- Re: [Qemu-devel] [RFC] [PATCH 0/5] linux-user: refactor do_syscall(), Blue Swirl, 2012/10/13