linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP
PATCH 1/1 linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP
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 <[email protected]>
--- configure | 20 ++++++++++++++++++++ linux-user/ioctls.h | 2 +- linux-user/syscall.c | 4 ++++ 3 files changed, 25 insertions(+), 1 deletions(-)
configure +20 -0
@@ -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
linux-user/ioctls.h +1 -1
@@ -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
linux-user/syscall.c +4 -0
@@ -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, ...) \
Signature · 1 line
1.6.3.3
Quoted 3 lines · Peter Maydell
Add a configure check for the existence of
linux/fiemap.hand theIOC_FS_FIEMAPioctl. This fixes a compilation failure on Linux systems which don't have that header file.
Looks OK.
Aurelien Jarno
AppliedQuoted 10 lines · Peter Maydell
Add a configure check for the existence of
linux/fiemap.hand theIOC_FS_FIEMAPioctl. This fixes a compilation failure on Linux systems which don't have that header file.Signed-off-by Peter Maydell <[email protected]>--- configure | 20 ++++++++++++++++++++ linux-user/ioctls.h | 2 +- linux-user/syscall.c | 4 ++++ 3 files changed, 25 insertions(+), 1 deletions(-)
Thanks, applied.
Quoted 86 lines
configure +20
-0@@ -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 filinux-user/ioctls.h +1
-1@@ -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 linux-user/syscall.c +4
-0@@ -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, ...) \Signature · 1 line
1.6.3.3
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net