linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Bamvor Zhang Jian <bamvor.zhangjian@linaro.org>
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	[thread overview]
Message-ID: <1911380.GBF7uac6mY@wuerfel> (raw)
In-Reply-To: <1435587807-10008-5-git-send-email-bamvor.zhangjian@linaro.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

  reply	other threads:[~2015-07-08 21:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29 14:23 [RFC PATCH v2 0/4] Convert ppdev to y2038 safe Bamvor Zhang Jian
2015-06-29 14:23 ` [RFC PATCH v2 1/4] y2038: add 64bit time_t support in timeval for 32bit architecture Bamvor Zhang Jian
2015-07-08 20:09   ` John Stultz
2015-07-09  9:02     ` Bamvor Zhang Jian
2015-07-09 10:26       ` Arnd Bergmann
2015-07-15  3:18         ` Bamvor Zhang Jian
2015-07-15  9:33           ` Arnd Bergmann
2015-06-29 14:23 ` [RFC PATCH v2 2/4] time64: add timeval64 helper for compat syscalls Bamvor Zhang Jian
2015-06-29 14:23 ` [RFC PATCH v2 3/4] ppdev: add compat ioctl Bamvor Zhang Jian
2015-07-08 20:17   ` John Stultz
2015-07-08 21:28     ` [Y2038] " Arnd Bergmann
2015-06-29 14:23 ` [RFC PATCH v2 4/4] y2038: convert ppdev to 2038 safe Bamvor Zhang Jian
2015-07-08 21:34   ` Arnd Bergmann [this message]
2015-07-08 21:36   ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1911380.GBF7uac6mY@wuerfel \
    --to=arnd@arndb.de \
    --cc=bamvor.zhangjian@linaro.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=y2039@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).