]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ntfs3: add FS_IOC_GETFSLABEL ioctl
authorEthan Ferguson <ethan.ferguson@zetier.com>
Thu, 28 Aug 2025 20:37:15 +0000 (16:37 -0400)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Wed, 10 Sep 2025 09:01:37 +0000 (11:01 +0200)
Add support for the FS_IOC_GETFSLABEL ioctl.

Signed-off-by: Ethan Ferguson <ethan.ferguson@zetier.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/file.c

index c1ece707b19511aad66fb3fd4695c29572c88736..0a1e9f16ffaf0092937c85243c874f047f061be5 100644 (file)
@@ -49,6 +49,14 @@ static int ntfs_ioctl_fitrim(struct ntfs_sb_info *sbi, unsigned long arg)
        return 0;
 }
 
+static int ntfs_ioctl_get_volume_label(struct ntfs_sb_info *sbi, u8 __user *buf)
+{
+       if (copy_to_user(buf, sbi->volume.label, FSLABEL_MAX))
+               return -EFAULT;
+
+       return 0;
+}
+
 /*
  * ntfs_ioctl - file_operations::unlocked_ioctl
  */
@@ -64,6 +72,8 @@ long ntfs_ioctl(struct file *filp, u32 cmd, unsigned long arg)
        switch (cmd) {
        case FITRIM:
                return ntfs_ioctl_fitrim(sbi, arg);
+       case FS_IOC_GETFSLABEL:
+               return ntfs_ioctl_get_volume_label(sbi, (u8 __user *)arg);
        }
        return -ENOTTY; /* Inappropriate ioctl for device. */
 }