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
|