* [Qemu-devel] [PATCH] linux-user: fix fallocate
@ 2012-02-06 21:15 Alexander Graf
0 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2012-02-06 21:15 UTC (permalink / raw)
To: qemu-devel@nongnu.org Developers; +Cc: Peter Maydell, Riku Voipio
Fallocate gets off_t parameters passed in, so we should also read them out
accordingly.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
v1 -> v2:
- unbreak 64-bit guests
---
linux-user/syscall.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ee8899e..2b7ebbd 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8237,7 +8237,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#endif /* CONFIG_EVENTFD */
#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate)
case TARGET_NR_fallocate:
+#if TARGET_ABI_BITS == 32
+ ret = get_errno(fallocate(arg1, arg2, target_offset64(arg3, arg4),
+ target_offset64(arg5, arg6)));
+#else
ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
+#endif
break;
#endif
#if defined(CONFIG_SYNC_FILE_RANGE)
--
1.6.0.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH] linux-user: fix fallocate
@ 2012-02-06 20:45 Alexander Graf
2012-02-06 21:03 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2012-02-06 20:45 UTC (permalink / raw)
To: qemu-devel@nongnu.org Developers; +Cc: Peter Maydell, Riku Voipio
Fallocate gets off_t parameters passed in, so we should also read them out
accordingly.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ee8899e..ca63594 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8237,7 +8237,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#endif /* CONFIG_EVENTFD */
#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate)
case TARGET_NR_fallocate:
- ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
+ ret = get_errno(fallocate(arg1, arg2, target_offset64(arg3, arg4),
+ target_offset64(arg5, arg6)));
break;
#endif
#if defined(CONFIG_SYNC_FILE_RANGE)
--
1.6.0.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: fix fallocate
2012-02-06 20:45 Alexander Graf
@ 2012-02-06 21:03 ` Peter Maydell
2012-02-06 21:04 ` Alexander Graf
0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2012-02-06 21:03 UTC (permalink / raw)
To: Alexander Graf; +Cc: Riku Voipio, qemu-devel@nongnu.org Developers
On 6 February 2012 20:45, Alexander Graf <agraf@suse.de> wrote:
> Fallocate gets off_t parameters passed in, so we should also read them out
> accordingly.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
> linux-user/syscall.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index ee8899e..ca63594 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -8237,7 +8237,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> #endif /* CONFIG_EVENTFD */
> #if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate)
> case TARGET_NR_fallocate:
> - ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
> + ret = get_errno(fallocate(arg1, arg2, target_offset64(arg3, arg4),
> + target_offset64(arg5, arg6)));
> break;
> #endif
> #if defined(CONFIG_SYNC_FILE_RANGE)
This needs to be guarded with a TARGET_ABI_BITS == 32 conditional:
64 bit guests want the original version.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: fix fallocate
2012-02-06 21:03 ` Peter Maydell
@ 2012-02-06 21:04 ` Alexander Graf
0 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2012-02-06 21:04 UTC (permalink / raw)
To: Peter Maydell; +Cc: Riku Voipio, qemu-devel@nongnu.org Developers
On 06.02.2012, at 22:03, Peter Maydell wrote:
> On 6 February 2012 20:45, Alexander Graf <agraf@suse.de> wrote:
>> Fallocate gets off_t parameters passed in, so we should also read them out
>> accordingly.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> linux-user/syscall.c | 3 ++-
>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
>> index ee8899e..ca63594 100644
>> --- a/linux-user/syscall.c
>> +++ b/linux-user/syscall.c
>> @@ -8237,7 +8237,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
>> #endif /* CONFIG_EVENTFD */
>> #if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate)
>> case TARGET_NR_fallocate:
>> - ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
>> + ret = get_errno(fallocate(arg1, arg2, target_offset64(arg3, arg4),
>> + target_offset64(arg5, arg6)));
>> break;
>> #endif
>> #if defined(CONFIG_SYNC_FILE_RANGE)
>
> This needs to be guarded with a TARGET_ABI_BITS == 32 conditional:
> 64 bit guests want the original version.
Good point. Thanks!
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-02-06 21:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-06 21:15 [Qemu-devel] [PATCH] linux-user: fix fallocate Alexander Graf
-- strict thread matches above, loose matches on Subject: below --
2012-02-06 20:45 Alexander Graf
2012-02-06 21:03 ` Peter Maydell
2012-02-06 21:04 ` Alexander Graf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).