qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/3] linux-user: implement FS_IOC_GETFLAGS ioctl


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 1/3] linux-user: implement FS_IOC_GETFLAGS ioctl
Date: Tue, 21 Aug 2012 14:47:44 +0100

On 21 August 2012 13:43, Alexander Graf <address@hidden> wrote:
> Signed-off-by: Alexander Graf <address@hidden>
> ---
>  linux-user/ioctls.h       |    1 +
>  linux-user/syscall_defs.h |    2 ++
>  2 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index bb76c56..1b798b3 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -86,6 +86,7 @@
>       IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
>                     MK_PTR(MK_STRUCT(STRUCT_fiemap)))
>  #endif
> +  IOCTL(FS_IOC_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
>
>    IOCTL(SIOCATMARK, 0, TYPE_NULL)
>    IOCTL(SIOCADDRT, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rtentry)))
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 3b7b1c3..67fbcab 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2344,6 +2344,8 @@ struct target_eabi_flock64 {
>  #define TARGET_MTIOCGET        TARGET_IOR('m', 2, struct mtget)
>  #define TARGET_MTIOCPOS        TARGET_IOR('m', 3, struct mtpos)
>
> +#define TARGET_FS_IOC_GETFLAGS TARGET_IORU('f', 1)

This and the SETFLAGS one in the next patch fail the consistency
check that an x86_64-on-x86_64 linux-user binary performs:

cam-vm-266:precise:qemu$ ./x86_64-linux-user/qemu-x86_64 /bin/echo hello
ERROR: ioctl(FS_IOC_GETFLAGS): target=0x80046601 host=0x80086601
ERROR: ioctl(FS_IOC_SETFLAGS): target=0x40046602 host=0x40086602
hello

This is indicating that your ioctl definition is wrong:
> +  IOCTL(FS_IOC_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))

...it should be TYPE_LONG.

Incidentally you could also set the target ioctl at compile
time rather than making syscall_init patch the size field
at runtime. I don't know whether one or the other is better
style... There's an argument for the 'automatic' one as
it enforces consistency and catches errors like the one above.
Anyway, the compile-time option woud be:

#define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long)

(You could also squash patches 1 and 2 together IMHO.)

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]