]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fs/ntfs3: Factor out ntfs_{create/remove}_proc_root()
authorYe Bin <yebin10@huawei.com>
Fri, 11 Oct 2024 07:40:24 +0000 (15:40 +0800)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Wed, 5 Feb 2025 14:48:39 +0000 (17:48 +0300)
Introduce ntfs_create_proc_root()/ntfs_remove_proc_root() for
create/remove "/proc/fs/ntfs3".

Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
fs/ntfs3/super.c

index 415492fc655acc15c6a38332450866fb2e3d4ac4..66047cf0e6e816d9f17c3421cb5de69b92ef0a60 100644 (file)
@@ -586,9 +586,24 @@ static void ntfs_remove_procdir(struct super_block *sb)
        remove_proc_entry(sb->s_id, proc_info_root);
        sbi->procdir = NULL;
 }
+
+static void ntfs_create_proc_root(void)
+{
+       proc_info_root = proc_mkdir("fs/ntfs3", NULL);
+}
+
+static void ntfs_remove_proc_root(void)
+{
+       if (proc_info_root) {
+               remove_proc_entry("fs/ntfs3", NULL);
+               proc_info_root = NULL;
+       }
+}
 #else
 static void ntfs_create_procdir(struct super_block *sb) {}
 static void ntfs_remove_procdir(struct super_block *sb) {}
+static void ntfs_create_proc_root(void) {}
+static void ntfs_remove_proc_root(void) {}
 #endif
 
 static struct kmem_cache *ntfs_inode_cachep;
@@ -1866,10 +1881,7 @@ static int __init init_ntfs_fs(void)
        if (IS_ENABLED(CONFIG_NTFS3_LZX_XPRESS))
                pr_info("ntfs3: Read-only LZX/Xpress compression included\n");
 
-#ifdef CONFIG_PROC_FS
-       /* Create "/proc/fs/ntfs3" */
-       proc_info_root = proc_mkdir("fs/ntfs3", NULL);
-#endif
+       ntfs_create_proc_root();
 
        err = ntfs3_init_bitmap();
        if (err)
@@ -1903,11 +1915,7 @@ static void __exit exit_ntfs_fs(void)
        unregister_filesystem(&ntfs_fs_type);
        unregister_as_ntfs_legacy();
        ntfs3_exit_bitmap();
-
-#ifdef CONFIG_PROC_FS
-       if (proc_info_root)
-               remove_proc_entry("fs/ntfs3", NULL);
-#endif
+       ntfs_remove_proc_root();
 }
 
 MODULE_LICENSE("GPL");