From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CD83C43331 for ; Tue, 12 Nov 2019 16:39:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D185621872 for ; Tue, 12 Nov 2019 16:39:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbfKLQi7 (ORCPT ); Tue, 12 Nov 2019 11:38:59 -0500 Received: from mx2.suse.de ([195.135.220.15]:53190 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726008AbfKLQi7 (ORCPT ); Tue, 12 Nov 2019 11:38:59 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B6C7CACFE; Tue, 12 Nov 2019 16:38:57 +0000 (UTC) Date: Tue, 12 Nov 2019 17:38:57 +0100 Message-ID: From: Takashi Iwai To: Arnd Bergmann Cc: alsa-devel@alsa-project.org, Takashi Iwai , Baolin Wang , y2038@lists.linaro.org, linux-kernel@vger.kernel.org, Mark Brown , Baolin Wang Subject: Re: [alsa-devel] [PATCH v6 5/8] ALSA: Avoid using timespec for struct snd_rawmidi_status In-Reply-To: <20191112151642.680072-6-arnd@arndb.de> References: <20191112151642.680072-1-arnd@arndb.de> <20191112151642.680072-6-arnd@arndb.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Nov 2019 16:16:39 +0100, Arnd Bergmann wrote: > > From: Baolin Wang > > The struct snd_rawmidi_status will use 'timespec' type variables to record > timestamp, which is not year 2038 safe on 32bits system. > > Thus we introduced 'struct snd_rawmidi_status32' and 'struct snd_rawmidi_status64' > to handle 32bit time_t and 64bit time_t in native mode, which replace > timespec with s64 type. > > In compat mode, we renamed or introduced new structures to handle 32bit/64bit > time_t in compatible mode. The 'struct snd_rawmidi_status32' and > snd_rawmidi_ioctl_status32() are used to handle 32bit time_t in compat mode. > 'struct compat_snd_rawmidi_status64' is used to handle 64bit time_t. > > 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 > Signed-off-by: Arnd Bergmann > --- > include/uapi/sound/asound.h | 3 + > sound/core/rawmidi.c | 132 ++++++++++++++++++++++++++++-------- > sound/core/rawmidi_compat.c | 87 ++++++------------------ > 3 files changed, 128 insertions(+), 94 deletions(-) > > diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h > index 7b74524f9406..cb830813da5d 100644 > --- a/include/uapi/sound/asound.h > +++ b/include/uapi/sound/asound.h > @@ -651,13 +651,16 @@ struct snd_rawmidi_params { > unsigned char reserved[16]; /* reserved for future use */ > }; > > +#ifndef __KERNEL__ > struct snd_rawmidi_status { > int stream; > + unsigned char pad1[sizeof(time_t) - sizeof(int)]; > struct timespec tstamp; /* Timestamp */ > size_t avail; /* available bytes */ > size_t xruns; /* count of overruns since last status (in bytes) */ > unsigned char reserved[16]; /* reserved for future use */ > }; Can we use union instead of padding? Something like: struct snd_rawmidi_status { union { int stream; time_t stream_alignment; }; struct timespec tstamp; /* Timestamp */ .... thanks, Takashi