Re: [PATCH v2] anonfd: Make file read-only if fops->write is notset

From: Davide Libenzi
Date: Fri Dec 18 2009 - 13:59:13 EST


On Fri, 18 Dec 2009, Roland Dreier wrote:

> It seems a couple places such as arch/ia64/kernel/perfmon.c and
> drivers/infiniband/core/uverbs_main.c could use anon_inode_getfile()
> instead of a private pseudo-fs + alloc_file(), if only there were a way
> to get a read-only file. So provide this by having anon_inode_getfile()
> create a read-only file if the fops->write passed in is NULL.
>
> Signed-off-by: Roland Dreier <rolandd@xxxxxxxxx>
> ---
> > Good grief, what for? We are already passing O_NDELAY in flags argument,
> > why not add O_RDWR/O_RDONLY to it? It's not as if we had that many
> > callers, after all...
>
> fair enough, I wasn't sure if I really liked changing the meaning of the
> flags argument without any indication of that in the function signature,
> but definitely the code is nicer.
>
> so would something like this make sense? if so I'll send follow-ups
> converting ia64 / perfmon and infiniband / uverbs to anon_inodes.

Looks OK to me.


- Davide


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/