xfs
[Top] [All Lists]

Re: [PATCH] stop using uio in the readlink code

To: Christoph Hellwig <hch@xxxxxx>
Subject: Re: [PATCH] stop using uio in the readlink code
From: David Chinner <dgc@xxxxxxx>
Date: Wed, 1 Aug 2007 15:41:42 +1000
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20070729211354.GB12824@lst.de>
References: <20070729211354.GB12824@lst.de>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
On Sun, Jul 29, 2007 at 11:13:54PM +0200, Christoph Hellwig wrote:
> Simplify the readlink code to get rid of the last user of uio.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
.....
> --- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_ioctl.c   2007-07-14 
> 16:07:19.000000000 +0200
> +++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl.c        2007-07-29 
> 14:28:29.000000000 +0200
> @@ -349,19 +349,44 @@ xfs_open_by_handle(
>       return new_fd;
>  }
>  
> +/*
> + * This is a copy from fs/namei.c:vfs_readlink(), except for removing it's
> + * unused first argument.
> + */
> +STATIC int
> +do_readlink(
> +     char __user             *buffer,
> +     int                     buflen,
> +     const char              *link)
> +{
> +        int len;
> +
> +     len = PTR_ERR(link);
> +     if (IS_ERR(link))
> +             goto out;
> +
> +     len = strlen(link);
> +     if (len > (unsigned) buflen)
> +             len = buflen;
> +     if (copy_to_user(buffer, link, len))
> +             len = -EFAULT;
> + out:
> +     return len;
> +}

Do we really need to copy this code? I guess it doesn't really
matter that much but it would be nice not to have to copy an
exported vfs function just because we don't have a dentry...

Cheers,

Dave.
-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group


<Prev in Thread] Current Thread [Next in Thread>