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


Groups > linux.kernel > #1658747

Re: [PATCH v3 1/2] tty: add compat_ioctl callbacks

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH v3 1/2] tty: add compat_ioctl callbacks
Date 2017-06-06 14:50 +0200
Message-ID <tPm5R-qi-31@gated-at.bofh.it> (permalink)
References <tOhKV-7ID-3@gated-at.bofh.it> <tOhKW-7ID-15@gated-at.bofh.it> <tPkx3-7Uz-1@gated-at.bofh.it> <tPkx4-7Uz-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jun 6, 2017 at 1:05 PM, Aleksa Sarai <asarai@suse.de> wrote:
>>> diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
>>> index 65799575c666..2a6bd9ae3f8b 100644
>>> --- a/drivers/tty/pty.c
>>> +++ b/drivers/tty/pty.c
>>> @@ -481,6 +481,16 @@ static int pty_bsd_ioctl(struct tty_struct *tty,
>>>          return -ENOIOCTLCMD;
>>>   }
>>>
>>> +static long pty_bsd_compat_ioctl(struct tty_struct *tty,
>>> +                                unsigned int cmd, unsigned long arg)
>>> +{
>>> +       /*
>>> +        * PTY ioctls don't require any special translation between
>>> 32-bit and
>>> +        * 64-bit userspace, they are already compatible.
>>> +        */
>>> +       return pty_bsd_ioctl(tty, cmd, arg);
>>> +}
>>> +
>>
>>
>> This looks correct but unnecessary, you can simply point both
>> function pointers to the same function:
>
>
> They have different types, since they have different return types:
>
> int  (*ioctl)(struct tty_struct *tty,
>             unsigned int cmd, unsigned long arg);
> long (*compat_ioctl)(struct tty_struct *tty,
>                      unsigned int cmd, unsigned long arg);
>
> If you like, I can change (*ioctl) to return longs as well, and then change
> all of the call-sites (since unlocked_ioctl also returns long).

Ah, my mistake. In most other data structures that have a compat_ioctl
callback pointer, the prototypes are the same, and I had not realized
that tty_operations is an exception.

        Arnd

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/2] tty: add TIOCGPTPEER ioctl Aleksa Sarai <asarai@suse.de> - 2017-06-03 16:00 +0200
  [PATCH v3 2/2] tty: add TIOCGPTPEER ioctl Aleksa Sarai <asarai@suse.de> - 2017-06-03 16:00 +0200
  [PATCH v3 1/2] tty: add compat_ioctl callbacks Aleksa Sarai <asarai@suse.de> - 2017-06-03 16:00 +0200
    Re: [PATCH v3 1/2] tty: add compat_ioctl callbacks Aleksa Sarai <asarai@suse.de> - 2017-06-03 16:20 +0200
    Re: [PATCH v3 1/2] tty: add compat_ioctl callbacks kbuild test robot <lkp@intel.com> - 2017-06-03 16:40 +0200
    Re: [PATCH v3 1/2] tty: add compat_ioctl callbacks Arnd Bergmann <arnd@arndb.de> - 2017-06-06 13:10 +0200
      Re: [PATCH v3 1/2] tty: add compat_ioctl callbacks Aleksa Sarai <asarai@suse.de> - 2017-06-06 13:10 +0200
        Re: [PATCH v3 1/2] tty: add compat_ioctl callbacks Arnd Bergmann <arnd@arndb.de> - 2017-06-06 14:50 +0200

csiph-web