mirror of https://github.com/torvalds/linux.git
ntfs3: add FS_IOC_SETFSLABEL ioctl
Add support for the FS_IOC_SETFSLABEL ioctl. Signed-off-by: Ethan Ferguson <ethan.ferguson@zetier.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
e4dff97009
commit
21dc07ac9c
|
|
@ -57,6 +57,22 @@ static int ntfs_ioctl_get_volume_label(struct ntfs_sb_info *sbi, u8 __user *buf)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ntfs_ioctl_set_volume_label(struct ntfs_sb_info *sbi, u8 __user *buf)
|
||||||
|
{
|
||||||
|
u8 user[FSLABEL_MAX] = {0};
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if (!capable(CAP_SYS_ADMIN))
|
||||||
|
return -EPERM;
|
||||||
|
|
||||||
|
if (copy_from_user(user, buf, FSLABEL_MAX))
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
len = strnlen(user, FSLABEL_MAX);
|
||||||
|
|
||||||
|
return ntfs_set_label(sbi, user, len);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ntfs_ioctl - file_operations::unlocked_ioctl
|
* ntfs_ioctl - file_operations::unlocked_ioctl
|
||||||
*/
|
*/
|
||||||
|
|
@ -74,6 +90,8 @@ long ntfs_ioctl(struct file *filp, u32 cmd, unsigned long arg)
|
||||||
return ntfs_ioctl_fitrim(sbi, arg);
|
return ntfs_ioctl_fitrim(sbi, arg);
|
||||||
case FS_IOC_GETFSLABEL:
|
case FS_IOC_GETFSLABEL:
|
||||||
return ntfs_ioctl_get_volume_label(sbi, (u8 __user *)arg);
|
return ntfs_ioctl_get_volume_label(sbi, (u8 __user *)arg);
|
||||||
|
case FS_IOC_SETFSLABEL:
|
||||||
|
return ntfs_ioctl_set_volume_label(sbi, (u8 __user *)arg);
|
||||||
}
|
}
|
||||||
return -ENOTTY; /* Inappropriate ioctl for device. */
|
return -ENOTTY; /* Inappropriate ioctl for device. */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue