lkml.org 
[lkml]   [2007]   [Aug]   [8]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 8 Aug 2007 13:58:07 -0400
FromJosef Sipek <>
SubjectRe: [RFC 04/10] Temporary struct vfs_lookup in file_permission
On Wed, Aug 08, 2007 at 07:16:26PM +0200, Andreas Gruenbacher wrote:
> Create a temporary struct vfs_lookup in file_permission() instead of
> passing a NULL value.
> 
> Signed-off-by: Andreas Gruenbacher <ag@bestbits.at>
> 
> ---
>  fs/namei.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -292,14 +292,15 @@ int vfs_permission(struct vfs_lookup *lo
>   *
>   * Used to check for read/write/execute permissions on an already opened
>   * file.
> - *
> - * Note:
> - *	Do not use this function in new code.  All access checks should
> - *	be done using vfs_permission().

Should this comment be removed?

>   */
>  int file_permission(struct file *file, int mask)
>  {
> -	return permission(file->f_path.dentry->d_inode, mask, NULL);
> +	struct vfs_lookup lookup;
> +
> +	lookup.path = file->f_path;
> +	lookup.flags = 0;

I tend to find this little bit cleaner:

struct vfs_lookup lookup = {
	.path	= file->f_path,
	.flags	= 0,
};
> +
> +	return permission(file->f_path.dentry->d_inode, mask, &lookup);
>  }
> 
>  /*

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

\
 
 \ /
  Last update: 2007-08-08 20:01    [from the cache]
©2003-2008