From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759041AbbGHVew (ORCPT ); Wed, 8 Jul 2015 17:34:52 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:64000 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755843AbbGHVep (ORCPT ); Wed, 8 Jul 2015 17:34:45 -0400 From: Arnd Bergmann To: Bamvor Zhang Jian Cc: john.stultz@linaro.org, tglx@linutronix.de, y2039@lists.linaro.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 4/4] y2038: convert ppdev to 2038 safe Date: Wed, 08 Jul 2015 23:34:34 +0200 Message-ID: <1911380.GBF7uac6mY@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1435587807-10008-5-git-send-email-bamvor.zhangjian@linaro.org> References: <1435587807-10008-1-git-send-email-bamvor.zhangjian@linaro.org> <1435587807-10008-5-git-send-email-bamvor.zhangjian@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:IfB1rmGXxdpLQY8W8cwhzSQJ2gwtyfo4A8ntTpYtQQhDN83wjMQ UWaJ0fqkNteG9PgdxB4kXydxT1kliNgn+TVxBbdd96scJwJHC/pCv8VRPvUX9XMMsGBacBe EExrFtE76uX5BSYEycUBrGROHQIe5Yv8ei6weLi7Fxqw+nVpA6zsDNdF/F5mFba50QdnHpN Ye74PEMctdQs5gcSg40GQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:3PzXQ+LU0qg=:dTER6/vshhsZTvq1UEZ33s VkBwUdLs2N8BZnCvLrAl2tGeq/x8OYTV5c04Hl5npv3Z5GTLt0qyeH1N9vdLABRV9OKLyICiw xSyOMuO6tspbrTg26jgxvcSjdTaPqihp83ymxzPP/ekwBxdiWFFtskZlASfaM1wBF1QjJbnIq tZj9fF+8GMgs9+7VWL5JOpkgeMChDlqLoFzomavqQC3bqhothHmnKiuWxvyeJdCvC8vkUXIj6 /XrpF67ZpK2jIOz3YY39joTlv0xvHbiW9U21aA4PBqbT2h4BidIqkLgO24qalmkwiKU3Q/OJT dyh/X0chTnraAWlHhcFic8cgDNN6H2rmR9VqVFuX9azlp7eK1BkO1b/yYNar0ZKMzn4m5mQlH FCiaPm3D41kmL6BzctJJfSW5RJ3ZRS8v+57lIB23RfPZz9RRF/TBtXYdW+KsgN/7MUMkbnkCC tD8Wnby6qsaYp+X/tULoyavh98MJx3jzr8MD5PSr/j94v25+rqguPtdALmXSPEnfaRvusPJKA LgLnCUiRNIR/yo21mDd+PXXk5E598zkcPhqOoXxy0gxACYTYn1ydTWzO3+OSimJ+FWqYJEYwn R2CNI1Y1bSTmKdXEnmU5+2h69+kfSPY4RGA+Lal0O2VMJRxslvMB+esWW+HnqNxYsu2K94Kqu RG9bY0jHZPHuoYQGOaR0LDL3+8PdkgcuAsNjDAnxuJwXnTQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 29 June 2015 22:23:27 Bamvor Zhang Jian wrote: > diff --git a/include/uapi/linux/ppdev.h b/include/uapi/linux/ppdev.h > index dc18c5d..d62a47d 100644 > --- a/include/uapi/linux/ppdev.h > +++ b/include/uapi/linux/ppdev.h > @@ -74,8 +74,18 @@ struct ppdev_frob_struct { > #define PPSETPHASE _IOW(PP_IOCTL, 0x94, int) > > /* Set and get port timeout (struct timeval's) */ > -#define PPGETTIME _IOR(PP_IOCTL, 0x95, struct timeval) > -#define PPSETTIME _IOW(PP_IOCTL, 0x96, struct timeval) > +/* Force application use 64 time_t ioctl */ > +/* TODO: It is an open question about we should use a __xxx_timeval or an > + * implicit array. > + * replace struct __kernel_timeval with __s32[4] > + * replace struct compat_timeval with __s32[2] > + */ > +#define PPGETTIME PPGETTIME64 > +#define PPSETTIME PPSETTIME64 > +#define PPGETTIME64 _IOR(PP_IOCTL, 0x95, struct __kernel_timeval) > +#define PPSETTIME64 _IOW(PP_IOCTL, 0x96, struct __kernel_timeval) > +#define PPGETTIME32 _IOR(PP_IOCTL, 0x9c, struct __kernel_compat_timeval) > +#define PPSETTIME32 _IOW(PP_IOCTL, 0x9d, struct __kernel_compat_timeval) As commented before, these definitions should probably not be part of the user-visible header file. The main reason for using an __s64[2] array instead of struct __kernel_timeval is to avoid adding __kernel_timeval: 'timeval' is thoroughly deprecated and we don't want to establish new interfaces with that. In case of this driver, nobody would ever want to change their user space to use a 64-bit __kernel_timeval instead of timeval and explicitly call PPGETTIME64 instead of PPGETTIME, because we are only dealing with an interval here, and a 32-bit second value is sufficient to represent that. Instead, the purpose of your patch is to make the kernel cope with user space that happens to use a 64-bit time_t based definition of 'struct timeval' and passes that to the ioctl. Arnd