diff options
author | 2024-10-11 15:40:24 +0800 | |
---|---|---|
committer | 2025-02-05 17:48:39 +0300 | |
commit | c5a396295370fa99ddc0c4c4d25f8a3ee4f013d8 (patch) | |
tree | e194693f3bc1a4fcc5d36e3ff0fb50f1eafb7cd7 | |
parent | fs/ntfs3: Factor out ntfs_{create/remove}_procdir() (diff) | |
download | wireguard-linux-c5a396295370fa99ddc0c4c4d25f8a3ee4f013d8.tar.xz wireguard-linux-c5a396295370fa99ddc0c4c4d25f8a3ee4f013d8.zip |
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>
Diffstat (limited to '')
-rw-r--r-- | fs/ntfs3/super.c | 26 |
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"); |