Re: [PATCH v6 2/8] ALSA: Avoid using timespec for struct snd_timer_status
From: Takashi Iwai
Date: Tue Nov 12 2019 - 10:42:21 EST
On Tue, 12 Nov 2019 16:16:36 +0100,
Arnd Bergmann wrote:
>
> From: Baolin Wang <baolin.wang@xxxxxxxxxx>
>
> 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@xxxxxxxxxx>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> 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