lkml.org 
[lkml]   [2009]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 11/31] Constify struct file_operations for 2.6.32 v1
On 12/05/2009 01:02 AM, Emese Revfy wrote:
> diff --git a/drivers/char/pty.c b/drivers/char/pty.c
> index 62f282e..d39c67b 100644
> --- a/drivers/char/pty.c
> +++ b/drivers/char/pty.c
> @@ -682,7 +682,18 @@ static int ptmx_open(struct inode *inode, struct file *filp)
> return ret;
> }
>
> -static struct file_operations ptmx_fops;
> +static const struct file_operations ptmx_fops = {
> + .llseek = no_llseek,
> + .read = tty_read,
> + .write = tty_write,
> + .poll = tty_poll,
> + .unlocked_ioctl = tty_ioctl,
> + .compat_ioctl = tty_compat_ioctl,
> + .open = ptmx_open,
> + .release = tty_release,
> + .fasync = tty_fasync,
> +};
> +
>
> static void __init unix98_pty_init(void)
> {
> @@ -736,9 +747,6 @@ static void __init unix98_pty_init(void)
> register_sysctl_table(pty_root_table);
>
> /* Now create the /dev/ptmx special device */
> - tty_default_fops(&ptmx_fops);
> - ptmx_fops.open = ptmx_open;
> -

Apart you CCed hundreds of people and mixed thousand things together
into one patch, this makes no sense.

I think the purpose was to not have the fops on multiple places. When
one changes tty_fops, he has to change even ptmx_fops from now on. Not
that I would say the current approach is clean, but this makes it worse IMO.

And as Greg pointed out, you made many functions global for no real income.


\
 
 \ /
  Last update: 2009-12-05 15:19    [W:0.092 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site