Patchwork linux-user: Fix SNDCTL_DSP_MAP{IN, OUT}BUF ioctl definitions

login
register
mail settings
Submitter Peter Maydell
Date July 23, 2012, 6:06 p.m.
Message ID <1343066775-21877-1-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/172731/
State New
Headers show

Comments

Peter Maydell - July 23, 2012, 6:06 p.m.
Fix the SNDCTL_DSP_MAP{IN,OUT}BUF ioctl definitions so that they
refer to a suitably defined target struct layout rather than hardcoding
the ioctl number. This fixes complaints from the syscall_init()
consistency check when running an x86_64-to-x86_64 linux-user qemu.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/ioctls.h        |    4 ++--
 linux-user/syscall_defs.h  |    4 ++--
 linux-user/syscall_types.h |    3 +++
 3 files changed, 7 insertions(+), 4 deletions(-)
Peter Maydell - Aug. 6, 2012, 12:57 p.m.
Ping? Patchwork url: http://patchwork.ozlabs.org/patch/172731/

-- PMM

On 23 July 2012 19:06, Peter Maydell <peter.maydell@linaro.org> wrote:
> Fix the SNDCTL_DSP_MAP{IN,OUT}BUF ioctl definitions so that they
> refer to a suitably defined target struct layout rather than hardcoding
> the ioctl number. This fixes complaints from the syscall_init()
> consistency check when running an x86_64-to-x86_64 linux-user qemu.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  linux-user/ioctls.h        |    4 ++--
>  linux-user/syscall_defs.h  |    4 ++--
>  linux-user/syscall_types.h |    3 +++
>  3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index eb96a08..8a47767 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -186,8 +186,8 @@
>    IOCTL(SNDCTL_DSP_GETISPACE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_audio_buf_info)))
>    IOCTL(SNDCTL_DSP_GETOSPACE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_audio_buf_info)))
>    IOCTL(SNDCTL_DSP_GETTRIGGER, IOC_R, MK_PTR(TYPE_INT))
> -  IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(TYPE_INT))
> -  IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(TYPE_INT))
> +  IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
> +  IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
>    IOCTL(SNDCTL_DSP_NONBLOCK, 0, TYPE_NULL)
>    IOCTL(SNDCTL_DSP_POST, 0, TYPE_NULL)
>    IOCTL(SNDCTL_DSP_RESET, 0, TYPE_NULL)
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 0b239c4..ed829e9 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2163,8 +2163,8 @@ struct target_eabi_flock64 {
>  #define TARGET_SNDCTL_DSP_GETTRIGGER      TARGET_IOR('P',16, int)
>  #define TARGET_SNDCTL_DSP_GETIPTR         TARGET_IORU('P',17)
>  #define TARGET_SNDCTL_DSP_GETOPTR         TARGET_IORU('P',18)
> -#define TARGET_SNDCTL_DSP_MAPINBUF        0x80085013
> -#define TARGET_SNDCTL_DSP_MAPOUTBUF       0x80085014
> +#define TARGET_SNDCTL_DSP_MAPINBUF        TARGET_IORU('P', 19)
> +#define TARGET_SNDCTL_DSP_MAPOUTBUF       TARGET_IORU('P', 20)
>  #define TARGET_SNDCTL_DSP_NONBLOCK        0x0000500e
>  #define TARGET_SNDCTL_DSP_SAMPLESIZE      0xc0045005
>  #define TARGET_SNDCTL_DSP_SETDUPLEX       0x00005016
> diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
> index 601618d..44b6a58 100644
> --- a/linux-user/syscall_types.h
> +++ b/linux-user/syscall_types.h
> @@ -77,6 +77,9 @@ STRUCT(audio_buf_info,
>  STRUCT(count_info,
>         TYPE_INT, TYPE_INT, TYPE_INT)
>
> +STRUCT(buffmem_desc,
> +       TYPE_PTRVOID, TYPE_INT)
> +
>  STRUCT(mixer_info,
>         MK_ARRAY(TYPE_CHAR, 16), MK_ARRAY(TYPE_CHAR, 32), TYPE_INT, MK_ARRAY(TYPE_INT, 10))
>
> --
> 1.7.5.4
>

Patch

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index eb96a08..8a47767 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -186,8 +186,8 @@ 
   IOCTL(SNDCTL_DSP_GETISPACE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_audio_buf_info)))
   IOCTL(SNDCTL_DSP_GETOSPACE, IOC_R, MK_PTR(MK_STRUCT(STRUCT_audio_buf_info)))
   IOCTL(SNDCTL_DSP_GETTRIGGER, IOC_R, MK_PTR(TYPE_INT))
-  IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(TYPE_INT))
-  IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(TYPE_INT))
+  IOCTL(SNDCTL_DSP_MAPINBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
+  IOCTL(SNDCTL_DSP_MAPOUTBUF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_buffmem_desc)))
   IOCTL(SNDCTL_DSP_NONBLOCK, 0, TYPE_NULL)
   IOCTL(SNDCTL_DSP_POST, 0, TYPE_NULL)
   IOCTL(SNDCTL_DSP_RESET, 0, TYPE_NULL)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 0b239c4..ed829e9 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2163,8 +2163,8 @@  struct target_eabi_flock64 {
 #define TARGET_SNDCTL_DSP_GETTRIGGER      TARGET_IOR('P',16, int)
 #define TARGET_SNDCTL_DSP_GETIPTR         TARGET_IORU('P',17)
 #define TARGET_SNDCTL_DSP_GETOPTR         TARGET_IORU('P',18)
-#define TARGET_SNDCTL_DSP_MAPINBUF        0x80085013
-#define TARGET_SNDCTL_DSP_MAPOUTBUF       0x80085014
+#define TARGET_SNDCTL_DSP_MAPINBUF        TARGET_IORU('P', 19)
+#define TARGET_SNDCTL_DSP_MAPOUTBUF       TARGET_IORU('P', 20)
 #define TARGET_SNDCTL_DSP_NONBLOCK        0x0000500e
 #define TARGET_SNDCTL_DSP_SAMPLESIZE      0xc0045005
 #define TARGET_SNDCTL_DSP_SETDUPLEX       0x00005016
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index 601618d..44b6a58 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -77,6 +77,9 @@  STRUCT(audio_buf_info,
 STRUCT(count_info,
        TYPE_INT, TYPE_INT, TYPE_INT)
 
+STRUCT(buffmem_desc,
+       TYPE_PTRVOID, TYPE_INT)
+
 STRUCT(mixer_info,
        MK_ARRAY(TYPE_CHAR, 16), MK_ARRAY(TYPE_CHAR, 32), TYPE_INT, MK_ARRAY(TYPE_INT, 10))