[alsa-devel] [PATCH v6 2/8] ALSA: Avoid using timespec for struct snd_timer_status

Takashi Iwai tiwai at suse.de
Tue Nov 12 16:42:17 CET 2019


On Tue, 12 Nov 2019 16:16:36 +0100,
Arnd Bergmann wrote:
> 
> From: Baolin Wang <baolin.wang at linaro.org>
> 
> struct snd_timer_status uses 'timespec' type variables to record
> timestamp, which will be changed to an incompatible layout with
> updated user space using 64-bit time_t.
> 
> To handle both the old and the new layout on 32-bit architectures,
> this patch introduces 'struct snd_timer_status32' and 'struct snd_timer_status64'
> to handle 32bit time_t and 64bit time_t in native mode and compat mode,
> which replaces timespec with s64 type.
> 
> When glibc changes time_t to 64-bit, any recompiled program will issue
> ioctl commands that the kernel does not understand without this patch.
> 
> Signed-off-by: Baolin Wang <baolin.wang at linaro.org>
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>
> ---
>  include/uapi/sound/asound.h |  2 ++
>  sound/core/timer.c          | 62 +++++++++++++++++++++++++++++++++----
>  sound/core/timer_compat.c   | 57 ++++------------------------------
>  3 files changed, 64 insertions(+), 57 deletions(-)
> 
> diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
> index df1153cea0b7..930854f67fd3 100644
> --- a/include/uapi/sound/asound.h
> +++ b/include/uapi/sound/asound.h
> @@ -761,6 +761,7 @@ struct snd_timer_params {
>  	unsigned char reserved[60];	/* reserved */
>  };
>  
> +#ifndef __KERNEL__
>  struct snd_timer_status {
>  	struct timespec tstamp;		/* Timestamp - last update */
>  	unsigned int resolution;	/* current period resolution in ns */

Do we need this ifndef?  Is it for stopping the reference of struct
snd_timer_status from the kernel code but only 32 and 64 variants?


thanks,

Takashi


More information about the Alsa-devel mailing list