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=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 335B1C43331 for ; Tue, 12 Nov 2019 16:39:57 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ABAD821E6F for ; Tue, 12 Nov 2019 16:39:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="YtKOQdjw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABAD821E6F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E14F9886; Tue, 12 Nov 2019 17:39:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E14F9886 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1573576795; bh=NYe3F/O2JAnCleS8xPu3fY0BT1nkjGI9e0EAt9Aypt8=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YtKOQdjw1mNcoatuhggLsstQ9hxCZ+aRMF/CqIfGdHZrWXwraoaxvojvVHBoDdSNO 1bxWMLeaiL1SRSPjoRzxrdUIQWvHXJfaxgkRp1YJQ+vaf99m1+n5j8jeSu/c/GoYdw zTrHxMzgQzseNBKA1kRWyBgVgQXVBcG/z45Z8tsA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A0741F8044C; Tue, 12 Nov 2019 17:39:03 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 83138F80483; Tue, 12 Nov 2019 17:39:01 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0BB9AF80144 for ; Tue, 12 Nov 2019 17:38:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0BB9AF80144 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 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") Cc: alsa-devel@alsa-project.org, Baolin Wang , y2038@lists.linaro.org, linux-kernel@vger.kernel.org, Takashi Iwai , Mark Brown , Baolin Wang Subject: Re: [alsa-devel] [PATCH v6 5/8] ALSA: Avoid using timespec for struct snd_rawmidi_status X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel