summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe Bin <yebin10@huawei.com>2024-10-11 10:40:24 +0300
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2025-02-05 17:48:39 +0300
commitc5a396295370fa99ddc0c4c4d25f8a3ee4f013d8 (patch)
treee194693f3bc1a4fcc5d36e3ff0fb50f1eafb7cd7
parente2d74c47a3d3d84a5fa444f380c126328b44f4db (diff)
downloadlinux-c5a396295370fa99ddc0c4c4d25f8a3ee4f013d8.tar.xz
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>
-rw-r--r--fs/ntfs3/super.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 415492fc655a..66047cf0e6e8 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -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");