Skip to content

Commit c5a3962

Browse files
Ye Binaalexandrovich
authored andcommitted
fs/ntfs3: Factor out ntfs_{create/remove}_proc_root()
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>
1 parent e2d74c4 commit c5a3962

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

fs/ntfs3/super.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,24 @@ static void ntfs_remove_procdir(struct super_block *sb)
586586
remove_proc_entry(sb->s_id, proc_info_root);
587587
sbi->procdir = NULL;
588588
}
589+
590+
static void ntfs_create_proc_root(void)
591+
{
592+
proc_info_root = proc_mkdir("fs/ntfs3", NULL);
593+
}
594+
595+
static void ntfs_remove_proc_root(void)
596+
{
597+
if (proc_info_root) {
598+
remove_proc_entry("fs/ntfs3", NULL);
599+
proc_info_root = NULL;
600+
}
601+
}
589602
#else
590603
static void ntfs_create_procdir(struct super_block *sb) {}
591604
static void ntfs_remove_procdir(struct super_block *sb) {}
605+
static void ntfs_create_proc_root(void) {}
606+
static void ntfs_remove_proc_root(void) {}
592607
#endif
593608

594609
static struct kmem_cache *ntfs_inode_cachep;
@@ -1866,10 +1881,7 @@ static int __init init_ntfs_fs(void)
18661881
if (IS_ENABLED(CONFIG_NTFS3_LZX_XPRESS))
18671882
pr_info("ntfs3: Read-only LZX/Xpress compression included\n");
18681883

1869-
#ifdef CONFIG_PROC_FS
1870-
/* Create "/proc/fs/ntfs3" */
1871-
proc_info_root = proc_mkdir("fs/ntfs3", NULL);
1872-
#endif
1884+
ntfs_create_proc_root();
18731885

18741886
err = ntfs3_init_bitmap();
18751887
if (err)
@@ -1903,11 +1915,7 @@ static void __exit exit_ntfs_fs(void)
19031915
unregister_filesystem(&ntfs_fs_type);
19041916
unregister_as_ntfs_legacy();
19051917
ntfs3_exit_bitmap();
1906-
1907-
#ifdef CONFIG_PROC_FS
1908-
if (proc_info_root)
1909-
remove_proc_entry("fs/ntfs3", NULL);
1910-
#endif
1918+
ntfs_remove_proc_root();
19111919
}
19121920

19131921
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)