aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-28 15:29:42 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:02 -0400
commit788f20eb5affef584e75ea84bb80a4c3352a2c0e (patch)
tree8d803c865e8f0dd7fa14bdd1f2157b4c8649baa9 /fs/btrfs/inode.c
parent8e7bf94fd5f44fa585e29fbe6a1bfabc04aea7cf (diff)
Btrfs: Add new ioctl to add devices
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ab707c0930df..1a74b5018699 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3070,6 +3070,27 @@ static int btrfs_ioctl_defrag(struct file *file)
3070 return 0; 3070 return 0;
3071} 3071}
3072 3072
3073long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg)
3074{
3075 struct btrfs_ioctl_vol_args *vol_args;
3076 int ret;
3077
3078 vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
3079
3080 if (!vol_args)
3081 return -ENOMEM;
3082
3083 if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
3084 ret = -EFAULT;
3085 goto out;
3086 }
3087 ret = btrfs_init_new_device(root, vol_args->name);
3088
3089out:
3090 kfree(vol_args);
3091 return ret;
3092}
3093
3073long btrfs_ioctl(struct file *file, unsigned int 3094long btrfs_ioctl(struct file *file, unsigned int
3074 cmd, unsigned long arg) 3095 cmd, unsigned long arg)
3075{ 3096{
@@ -3082,6 +3103,8 @@ long btrfs_ioctl(struct file *file, unsigned int
3082 return btrfs_ioctl_defrag(file); 3103 return btrfs_ioctl_defrag(file);
3083 case BTRFS_IOC_RESIZE: 3104 case BTRFS_IOC_RESIZE:
3084 return btrfs_ioctl_resize(root, (void __user *)arg); 3105 return btrfs_ioctl_resize(root, (void __user *)arg);
3106 case BTRFS_IOC_ADD_DEV:
3107 return btrfs_ioctl_add_dev(root, (void __user *)arg);
3085 } 3108 }
3086 3109
3087 return -ENOTTY; 3110 return -ENOTTY;