Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1736379 > unrolled thread

[RFC PATCH 6/7] uapi: sound: Avoid using timespec for struct snd_ctl_elem_value

Started byBaolin Wang <baolin.wang@linaro.org>
First post2017-09-21 08:20 +0200
Last post2017-09-21 15:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC PATCH 6/7] uapi: sound: Avoid using timespec for struct snd_ctl_elem_value Baolin Wang <baolin.wang@linaro.org> - 2017-09-21 08:20 +0200
    Re: [RFC PATCH 6/7] uapi: sound: Avoid using timespec for struct snd_ctl_elem_value Arnd Bergmann <arnd@arndb.de> - 2017-09-21 15:00 +0200

#1736379 — [RFC PATCH 6/7] uapi: sound: Avoid using timespec for struct snd_ctl_elem_value

FromBaolin Wang <baolin.wang@linaro.org>
Date2017-09-21 08:20 +0200
Subject[RFC PATCH 6/7] uapi: sound: Avoid using timespec for struct snd_ctl_elem_value
Message-ID<us305-5ww-9@gated-at.bofh.it>
The struct snd_ctl_elem_value will use 'timespec' type variables to record
timestamp, which is not year 2038 safe on 32bits system.

Since there are no drivers will implemented the tstamp member of the
struct snd_ctl_elem_value, and also the stucture size will not be changed
if we change timespec to s64 for tstamp member of struct snd_ctl_elem_value.

Thus we can simply change timespec to s64 for tstamp member to avoid
using the type which is not year 2038 safe on 32bits system.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 include/uapi/sound/asound.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 1949923..71bce52 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -943,8 +943,8 @@ struct snd_ctl_elem_value {
 		} bytes;
 		struct snd_aes_iec958 iec958;
 	} value;		/* RO */
-	struct timespec tstamp;
-	unsigned char reserved[128-sizeof(struct timespec)];
+	struct { s64 tv_sec; s64 tv_nsec; } tstamp;
+	unsigned char reserved[128-sizeof(struct { s64 tv_sec; s64 tv_nsec; })];
 };
 
 struct snd_ctl_tlv {
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1736641

FromArnd Bergmann <arnd@arndb.de>
Date2017-09-21 15:00 +0200
Message-ID<us9fc-16W-5@gated-at.bofh.it>
In reply to#1736379
On Thu, Sep 21, 2017 at 8:18 AM, Baolin Wang <baolin.wang@linaro.org> wrote:
> The struct snd_ctl_elem_value will use 'timespec' type variables to record
> timestamp, which is not year 2038 safe on 32bits system.
>
> Since there are no drivers will implemented the tstamp member of the
> struct snd_ctl_elem_value, and also the stucture size will not be changed
> if we change timespec to s64 for tstamp member of struct snd_ctl_elem_value.
>
> Thus we can simply change timespec to s64 for tstamp member to avoid
> using the type which is not year 2038 safe on 32bits system.
>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> ---
>  include/uapi/sound/asound.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
> index 1949923..71bce52 100644
> --- a/include/uapi/sound/asound.h
> +++ b/include/uapi/sound/asound.h
> @@ -943,8 +943,8 @@ struct snd_ctl_elem_value {
>                 } bytes;
>                 struct snd_aes_iec958 iec958;
>         } value;                /* RO */
> -       struct timespec tstamp;
> -       unsigned char reserved[128-sizeof(struct timespec)];
> +       struct { s64 tv_sec; s64 tv_nsec; } tstamp;
> +       unsigned char reserved[128-sizeof(struct { s64 tv_sec; s64 tv_nsec; })];
>  };

Maybe we should enforce that nobody uses the timespec field, by
enclosing it in #ifdef __KERNEL__ (with a matching length below it);

       Arnd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web