Skip to content

Commit cb095af

Browse files
committed
pstore: Centralize init/exit routines
In preparation for having additional actions during init/exit, this moves the init/exit into platform.c, centralizing the logic to make call outs to the fs init/exit. Signed-off-by: Kees Cook <keescook@chromium.org> Tested-by: Guenter Roeck <groeck@chromium.org>
1 parent 5736184 commit cb095af

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

fs/pstore/inode.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,10 @@ static struct file_system_type pstore_fs_type = {
482482
.kill_sb = pstore_kill_sb,
483483
};
484484

485-
static int __init init_pstore_fs(void)
485+
int __init pstore_init_fs(void)
486486
{
487487
int err;
488488

489-
pstore_choose_compression();
490-
491489
/* Create a convenient mount point for people to access pstore */
492490
err = sysfs_create_mount_point(fs_kobj, "pstore");
493491
if (err)
@@ -500,14 +498,9 @@ static int __init init_pstore_fs(void)
500498
out:
501499
return err;
502500
}
503-
module_init(init_pstore_fs)
504501

505-
static void __exit exit_pstore_fs(void)
502+
void __exit pstore_exit_fs(void)
506503
{
507504
unregister_filesystem(&pstore_fs_type);
508505
sysfs_remove_mount_point(fs_kobj, "pstore");
509506
}
510-
module_exit(exit_pstore_fs)
511-
512-
MODULE_AUTHOR("Tony Luck <tony.luck@intel.com>");
513-
MODULE_LICENSE("GPL");

fs/pstore/internal.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ extern bool pstore_is_mounted(void);
3737
extern void pstore_record_init(struct pstore_record *record,
3838
struct pstore_info *psi);
3939

40-
/* Called during module_init() */
41-
extern void __init pstore_choose_compression(void);
40+
/* Called during pstore init/exit. */
41+
int __init pstore_init_fs(void);
42+
void __exit pstore_exit_fs(void);
4243

4344
#endif

fs/pstore/platform.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,31 @@ void __init pstore_choose_compression(void)
780780
}
781781
}
782782

783+
static int __init pstore_init(void)
784+
{
785+
int ret;
786+
787+
pstore_choose_compression();
788+
789+
ret = pstore_init_fs();
790+
if (ret)
791+
return ret;
792+
793+
return 0;
794+
}
795+
module_init(pstore_init)
796+
797+
static void __exit pstore_exit(void)
798+
{
799+
pstore_exit_fs();
800+
}
801+
module_exit(pstore_exit)
802+
783803
module_param(compress, charp, 0444);
784804
MODULE_PARM_DESC(compress, "Pstore compression to use");
785805

786806
module_param(backend, charp, 0444);
787807
MODULE_PARM_DESC(backend, "Pstore backend to use");
808+
809+
MODULE_AUTHOR("Tony Luck <tony.luck@intel.com>");
810+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)