Le 09/01/2020 à 13:59, Filip Bozuta a écrit :
> This patch implements functionality of following ioctl:
>
> SNDRV_TIMER_IOCTL_SELECT - Selecting timer
>
> Selects the timer which id is specified. The timer id is specified in the
> following strcuture:
>
> struct snd_timer_select {
> struct snd_timer_id id; /* timer ID */
> unsigned char reserved[32]; /* reserved */
> };
>
> A pointer to this structure should be passed as the third ioctl's argument.
> Before calling the ioctl, the field "tid" should be initialized with the id
> information for the timer which is to be selected. If there is no timer
> device with the specified id, the error ENODEV ("No such device") is
> returned.
>
> Implementation notes:
>
> Ioctl implemented in this patch has a pointer to a
> 'struct snd_timer_select' as its third argument.
> That is the reason why a corresponding definition
> was added in 'linux-user/syscall_types.h'. The rest
> of the implementation was straightforward.
>
> Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
> ---
> linux-user/ioctls.h | 2 ++
> linux-user/syscall_defs.h | 7 +++++++
> linux-user/syscall_types.h | 4 ++++
> 3 files changed, 13 insertions(+)
>
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 989eb9b..7652117 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -459,6 +459,8 @@
> MK_PTR(MK_STRUCT(STRUCT_snd_timer_gparams)))
> IOCTL(SNDRV_TIMER_IOCTL_GSTATUS, IOC_RW,
> MK_PTR(MK_STRUCT(STRUCT_snd_timer_gstatus)))
> + IOCTL(SNDRV_TIMER_IOCTL_SELECT, IOC_W,
> + MK_PTR(MK_STRUCT(STRUCT_snd_timer_select)))
>
> IOCTL(HDIO_GETGEO, IOC_R, MK_PTR(MK_STRUCT(STRUCT_hd_geometry)))
> IOCTL(HDIO_GET_UNMASKINTR, IOC_R, MK_PTR(TYPE_INT))
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 4d4dad3..9a33b71 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2462,6 +2462,11 @@ struct target_snd_timer_gstatus {
> unsigned char reserved[32];
> };
>
> +struct target_snd_timer_select {
> + struct target_snd_timer_id id;
> + unsigned char reserved[32];
> +};
> +
> /* alsa timer ioctls */
> #define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int)
> #define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \
> @@ -2473,6 +2478,8 @@ struct target_snd_timer_gstatus {
> struct target_snd_timer_gparams)
> #define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \
> struct target_snd_timer_gstatus)
> +#define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \
> + struct target_snd_timer_select)
>
> /* vfat ioctls */
> #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
> diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
> index 4e90716..767632d 100644
> --- a/linux-user/syscall_types.h
> +++ b/linux-user/syscall_types.h
> @@ -116,6 +116,10 @@ STRUCT(snd_timer_gstatus,
> TYPE_ULONG, /* resolution_den */
> MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
>
> +STRUCT(snd_timer_select,
> + MK_STRUCT(STRUCT_snd_timer_id), /* id */
> + MK_ARRAY(TYPE_CHAR, 32)) /* reserved */
> +
> /* loop device ioctls */
> STRUCT(loop_info,
> TYPE_INT, /* lo_number */
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>