[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190529153337.3e8fcd2b6b54e11e5ef23d04@linux-foundation.org>
Date: Wed, 29 May 2019 15:33:37 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] proc: use typeof_member() macro
On Wed, 29 May 2019 22:11:10 +0300 Alexey Dobriyan <adobriyan@...il.com> wrote:
> Don't repeat function signatures twice.
>
> This is a kind-of-precursor for "struct proc_ops".
>
> Note:
>
> typeof(pde->proc_fops->...) ...;
>
> can't be used because ->proc_fops is "const struct file_operations *".
> "const" prevents assignment down the code and it can't be deleted
> in the type system.
>
> ...
>
> --- a/fs/proc/inode.c
> +++ b/fs/proc/inode.c
> @@ -200,7 +200,8 @@ static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence)
> struct proc_dir_entry *pde = PDE(file_inode(file));
> loff_t rv = -EINVAL;
> if (use_pde(pde)) {
> - loff_t (*llseek)(struct file *, loff_t, int);
> + typeof_member(struct file_operations, llseek) llseek;
ooh. That's pretty nifty.
Powered by blists - more mailing lists