On Fri, Jan 7, 2011 at 8:52 PM, Riku Voipio <riku.voi...@iki.fi> wrote: > From: Peter Maydell <peter.mayd...@linaro.org> > > Implement the FS_IOC_FIEMAP ioctl using the new support for > custom handling of ioctls; this is needed because the struct > that is passed includes a variable-length array. > > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> > Signed-off-by: Riku Voipio <riku.voi...@iki.fi> > --- > linux-user/ioctls.h | 4 ++ > linux-user/syscall.c | 88 > ++++++++++++++++++++++++++++++++++++++++++++ > linux-user/syscall_defs.h | 1 + > linux-user/syscall_types.h | 16 ++++++++ > 4 files changed, 109 insertions(+), 0 deletions(-) > > diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h > index 769e1bc..538e257 100644 > --- a/linux-user/ioctls.h > +++ b/linux-user/ioctls.h > @@ -76,6 +76,10 @@ > #ifdef FIGETBSZ > IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG)) > #endif > +#ifdef FS_IOC_FIEMAP > + IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap, > + MK_PTR(MK_STRUCT(STRUCT_fiemap))) > +#endif > > IOCTL(SIOCATMARK, 0, TYPE_NULL) > IOCTL(SIOCADDRT, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtentry))) > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 970efe3..f10e17a 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -83,6 +83,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base, > #include <linux/kd.h> > #include <linux/mtio.h> > #include <linux/fs.h> > +#include <linux/fiemap.h>
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 /src/qemu/linux-user/syscall.c: In function 'do_ioctl_fs_ioc_fiemap': /src/qemu/linux-user/syscall.c:3025: error: dereferencing pointer to incomplete type /src/qemu/linux-user/syscall.c:3025: error: invalid application of 'sizeof' to incomplete type 'struct fiemap' /src/qemu/linux-user/syscall.c:3025: error: invalid application of 'sizeof' to incomplete type 'struct fiemap_extent' cc1: warnings being treated as errors /src/qemu/linux-user/syscall.c:3025: error: division by zero /src/qemu/linux-user/syscall.c:3029: error: dereferencing pointer to incomplete type /src/qemu/linux-user/syscall.c:3030: error: invalid application of 'sizeof' to incomplete type 'struct fiemap_extent' /src/qemu/linux-user/syscall.c:3030: error: dereferencing pointer to incomplete type /src/qemu/linux-user/syscall.c:3040: error: invalid application of 'sizeof' to incomplete type 'struct fiemap' /src/qemu/linux-user/syscall.c:3049: error: dereferencing pointer to incomplete type /src/qemu/linux-user/syscall.c:3050: error: dereferencing pointer to incomplete type /src/qemu/linux-user/syscall.c:3058: error: dereferencing pointer to incomplete type /src/qemu/linux-user/syscall.c:3061: error: dereferencing pointer to incomplete type /src/qemu/linux-user/syscall.c:3062: error: dereferencing pointer to incomplete type The fix is to introduce a feature check in configure.