* [Qemu-devel] [PATCH] linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP
@ 2011-01-10 13:11 Peter Maydell
2011-01-10 21:53 ` [Qemu-devel] " Blue Swirl
2011-01-11 23:12 ` [Qemu-devel] " Aurelien Jarno
0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2011-01-10 13:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Blue Swirl, riku voipio
Add a configure check for the existence of linux/fiemap.h and the
IOC_FS_FIEMAP ioctl. This fixes a compilation failure on Linux
systems which don't have that header file.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
configure | 20 ++++++++++++++++++++
linux-user/ioctls.h | 2 +-
linux-user/syscall.c | 4 ++++
3 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/configure b/configure
index 831a741..438219b 100755
--- a/configure
+++ b/configure
@@ -2090,6 +2090,23 @@ if compile_prog "$ARCH_CFLAGS" "" ; then
sync_file_range=yes
fi
+# check for linux/fiemap.h and FS_IOC_FIEMAP
+fiemap=no
+cat > $TMPC << EOF
+#include <sys/ioctl.h>
+#include <linux/fs.h>
+#include <linux/fiemap.h>
+
+int main(void)
+{
+ ioctl(0, FS_IOC_FIEMAP, 0);
+ return 0;
+}
+EOF
+if compile_prog "$ARCH_CFLAGS" "" ; then
+ fiemap=yes
+fi
+
# check for dup3
dup3=no
cat > $TMPC << EOF
@@ -2631,6 +2648,9 @@ fi
if test "$sync_file_range" = "yes" ; then
echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
fi
+if test "$fiemap" = "yes" ; then
+ echo "CONFIG_FIEMAP=y" >> $config_host_mak
+fi
if test "$dup3" = "yes" ; then
echo "CONFIG_DUP3=y" >> $config_host_mak
fi
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 538e257..acff781 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -76,7 +76,7 @@
#ifdef FIGETBSZ
IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
#endif
-#ifdef FS_IOC_FIEMAP
+#ifdef CONFIG_FIEMAP
IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
MK_PTR(MK_STRUCT(STRUCT_fiemap)))
#endif
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f10e17a..499c4d7 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(CONFIG_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 CONFIG_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
static IOCTLEntry ioctl_entries[] = {
#define IOCTL(cmd, access, ...) \
--
1.6.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH] linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP
2011-01-10 13:11 [Qemu-devel] [PATCH] linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP Peter Maydell
@ 2011-01-10 21:53 ` Blue Swirl
2011-01-11 23:12 ` [Qemu-devel] " Aurelien Jarno
1 sibling, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2011-01-10 21:53 UTC (permalink / raw)
To: Peter Maydell; +Cc: riku voipio, qemu-devel
On Mon, Jan 10, 2011 at 1:11 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Add a configure check for the existence of linux/fiemap.h and the
> IOC_FS_FIEMAP ioctl. This fixes a compilation failure on Linux
> systems which don't have that header file.
Looks OK.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP
2011-01-10 13:11 [Qemu-devel] [PATCH] linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP Peter Maydell
2011-01-10 21:53 ` [Qemu-devel] " Blue Swirl
@ 2011-01-11 23:12 ` Aurelien Jarno
1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2011-01-11 23:12 UTC (permalink / raw)
To: Peter Maydell; +Cc: Blue Swirl, riku voipio, qemu-devel
On Mon, Jan 10, 2011 at 01:11:24PM +0000, Peter Maydell wrote:
> Add a configure check for the existence of linux/fiemap.h and the
> IOC_FS_FIEMAP ioctl. This fixes a compilation failure on Linux
> systems which don't have that header file.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> configure | 20 ++++++++++++++++++++
> linux-user/ioctls.h | 2 +-
> linux-user/syscall.c | 4 ++++
> 3 files changed, 25 insertions(+), 1 deletions(-)
Thanks, applied.
> diff --git a/configure b/configure
> index 831a741..438219b 100755
> --- a/configure
> +++ b/configure
> @@ -2090,6 +2090,23 @@ if compile_prog "$ARCH_CFLAGS" "" ; then
> sync_file_range=yes
> fi
>
> +# check for linux/fiemap.h and FS_IOC_FIEMAP
> +fiemap=no
> +cat > $TMPC << EOF
> +#include <sys/ioctl.h>
> +#include <linux/fs.h>
> +#include <linux/fiemap.h>
> +
> +int main(void)
> +{
> + ioctl(0, FS_IOC_FIEMAP, 0);
> + return 0;
> +}
> +EOF
> +if compile_prog "$ARCH_CFLAGS" "" ; then
> + fiemap=yes
> +fi
> +
> # check for dup3
> dup3=no
> cat > $TMPC << EOF
> @@ -2631,6 +2648,9 @@ fi
> if test "$sync_file_range" = "yes" ; then
> echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
> fi
> +if test "$fiemap" = "yes" ; then
> + echo "CONFIG_FIEMAP=y" >> $config_host_mak
> +fi
> if test "$dup3" = "yes" ; then
> echo "CONFIG_DUP3=y" >> $config_host_mak
> fi
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 538e257..acff781 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -76,7 +76,7 @@
> #ifdef FIGETBSZ
> IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
> #endif
> -#ifdef FS_IOC_FIEMAP
> +#ifdef CONFIG_FIEMAP
> IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
> MK_PTR(MK_STRUCT(STRUCT_fiemap)))
> #endif
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index f10e17a..499c4d7 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(CONFIG_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 CONFIG_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
>
> static IOCTLEntry ioctl_entries[] = {
> #define IOCTL(cmd, access, ...) \
> --
> 1.6.3.3
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-01-11 23:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-10 13:11 [Qemu-devel] [PATCH] linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP Peter Maydell
2011-01-10 21:53 ` [Qemu-devel] " Blue Swirl
2011-01-11 23:12 ` [Qemu-devel] " Aurelien Jarno
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).