diff options
author | Peng Tao <tao.peng@primarydata.com> | 2015-09-26 02:24:39 +0800 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-10-15 16:08:33 -0400 |
commit | a340abcf4173461f688292a6879b4d5bc781c2b1 (patch) | |
tree | 30dc469f9535e3bd5c1882119212f1c06036cef8 /fs/nfs/nfs4file.c | |
parent | 811b7b85d6641df580a6c43184cf13d6fcc7498d (diff) |
nfs42: add NFS_IOC_CLONE_RANGE ioctl
It follows btrfs BTRFS_IOC_CLONE_RANGE lead on ioctl number and
arguments.
Signed-off-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/nfs4file.c')
-rw-r--r-- | fs/nfs/nfs4file.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 4f463dd8bae3..4384a1d00ceb 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -288,14 +288,28 @@ out_drop_write: mnt_drop_write_file(dst_file); return ret; } + +static long nfs42_ioctl_clone_range(struct file *dst_file, void __user *argp) +{ + struct nfs_ioctl_clone_range_args args; + + if (copy_from_user(&args, argp, sizeof(args))) + return -EFAULT; + + return nfs42_ioctl_clone(dst_file, args.src_fd, args.src_off, args.dst_off, args.count); +} #endif /* CONFIG_NFS_V4_2 */ long nfs4_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + switch (cmd) { #ifdef CONFIG_NFS_V4_2 case NFS_IOC_CLONE: return nfs42_ioctl_clone(file, arg, 0, 0, 0); + case NFS_IOC_CLONE_RANGE: + return nfs42_ioctl_clone_range(file, argp); #endif } |