diff mbox

[3/7] linux-user: Implement FS_IOC_FIEMAP ioctl

Message ID 4D29F4A0.1050500@iki.fi
State New
Headers show

Commit Message

Riku Voipio Jan. 9, 2011, 5:47 p.m. UTC
On 01/09/2011 04:47 PM, Blue Swirl wrote:
> This fails if the file doesn't exist:
>    CC    i386-linux-user/syscall.o
> /src/qemu/linux-user/syscall.c:86:26: error: linux/fiemap.h: No such
> file or directory

> The fix is to introduce a feature check in configure.

Perhaps we can do without configure check, since FS_IOC_FIEMAP is 
defined in fs.h if fiemap.h is available. See the attached patch.

Comments

Blue Swirl Jan. 9, 2011, 7:08 p.m. UTC | #1
On Sun, Jan 9, 2011 at 5:47 PM, riku voipio <riku.voipio@iki.fi> wrote:
> On 01/09/2011 04:47 PM, Blue Swirl wrote:
>>
>> This fails if the file doesn't exist:
>>   CC    i386-linux-user/syscall.o
>> /src/qemu/linux-user/syscall.c:86:26: error: linux/fiemap.h: No such
>> file or directory
>
>> The fix is to introduce a feature check in configure.
>
> Perhaps we can do without configure check, since FS_IOC_FIEMAP is defined in
> fs.h if fiemap.h is available. See the attached patch.

It's a bit fragile compared to a configure check, but I confirm it works.
Acked-by: Blue Swirl <blauwirbel@gmail.com>
Martin Mohring Jan. 9, 2011, 8:06 p.m. UTC | #2
On 01/09/2011 06:47 PM, riku voipio wrote:
> On 01/09/2011 04:47 PM, Blue Swirl wrote:
>> This fails if the file doesn't exist:
>>    CC    i386-linux-user/syscall.o
>> /src/qemu/linux-user/syscall.c:86:26: error: linux/fiemap.h: No such
>> file or directory
>
>> The fix is to introduce a feature check in configure.
>
> Perhaps we can do without configure check, since FS_IOC_FIEMAP is
> defined in fs.h if fiemap.h is available. See the attached patch.


I have cross checked building on any Debian, Fedora, Ubuntu and openSUSE
hosts I could try for x86 32bit and 64bit hosts and can confirm this
variant works of course on these.


I would also be very interested if you could apply my 2 line linux-user
change for loop mount ioctl I sent to the ml (yesterday).
Peter Maydell Jan. 10, 2011, 4:01 a.m. UTC | #3
On 9 January 2011 19:08, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Sun, Jan 9, 2011 at 5:47 PM, riku voipio <riku.voipio@iki.fi> wrote:
>> On 01/09/2011 04:47 PM, Blue Swirl wrote:
>>> This fails if the file doesn't exist:
>>>   CC    i386-linux-user/syscall.o
>>> /src/qemu/linux-user/syscall.c:86:26: error: linux/fiemap.h: No such
>>> file or directory

Argh, sorry.

>> Perhaps we can do without configure check, since FS_IOC_FIEMAP is defined in
>> fs.h if fiemap.h is available. See the attached patch.
>
> It's a bit fragile compared to a configure check, but I confirm it works.
> Acked-by: Blue Swirl <blauwirbel@gmail.com>

I can do you a patch to do a configure check tomorrow if you'd
rather have that than the FS_IOC_FIEMAP ifdef.

-- PMM
diff mbox

Patch

From 8c186f5698ce2fa0a3f6faf11122ee0b69d388c8 Mon Sep 17 00:00:00 2001
From: Riku Voipio <riku.voipio@iki.fi>
Date: Sun, 9 Jan 2011 19:37:10 +0200
Subject: [PATCH] linux-user: guard fiemap with FS_IOC_FIEMAP

Compilation of linux-user fails if the file doesn't exist:
  CC    i386-linux-user/syscall.o
/src/qemu/linux-user/syscall.c:86:26: error: linux/fiemap.h: No such
file or directory

Since FS_IOC_FIEMAP is defined in fs.h, we can use it #ifdef fiemap
support out

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
---
 linux-user/syscall.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f10e17a..c1f506c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -83,7 +83,9 @@  int __clone2(int (*fn)(void *), void *child_stack_base,
 #include <linux/kd.h>
 #include <linux/mtio.h>
 #include <linux/fs.h>
+#if defined(FS_IOC_FIEMAP)
 #include <linux/fiemap.h>
+#endif
 #include <linux/fb.h>
 #include <linux/vt.h>
 #include "linux_loop.h"
@@ -2986,6 +2988,7 @@  struct IOCTLEntry {
 
 #define MAX_STRUCT_SIZE 4096
 
+#ifdef FS_IOC_FIEMAP
 /* So fiemap access checks don't overflow on 32 bit systems.
  * This is very slightly smaller than the limit imposed by
  * the underlying kernel.
@@ -3072,6 +3075,7 @@  static abi_long do_ioctl_fs_ioc_fiemap(const IOCTLEntry *ie, uint8_t *buf_temp,
     }
     return ret;
 }
+#endif /* FS_IOC_FIEMAP */
 
 static IOCTLEntry ioctl_entries[] = {
 #define IOCTL(cmd, access, ...) \
-- 
1.7.1