Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+28 -11
+2 -9
fs/pstore/inode.c
··· 482 482 .kill_sb = pstore_kill_sb, 483 483 }; 484 484 485 - static int __init init_pstore_fs(void) 485 + int __init pstore_init_fs(void) 486 486 { 487 487 int err; 488 - 489 - pstore_choose_compression(); 490 488 491 489 /* Create a convenient mount point for people to access pstore */ 492 490 err = sysfs_create_mount_point(fs_kobj, "pstore"); ··· 498 500 out: 499 501 return err; 500 502 } 501 - module_init(init_pstore_fs) 502 503 503 - static void __exit exit_pstore_fs(void) 504 + void __exit pstore_exit_fs(void) 504 505 { 505 506 unregister_filesystem(&pstore_fs_type); 506 507 sysfs_remove_mount_point(fs_kobj, "pstore"); 507 508 } 508 - module_exit(exit_pstore_fs) 509 - 510 - MODULE_AUTHOR("Tony Luck <tony.luck@intel.com>"); 511 - MODULE_LICENSE("GPL");
+3 -2
fs/pstore/internal.h
··· 37 37 extern void pstore_record_init(struct pstore_record *record, 38 38 struct pstore_info *psi); 39 39 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); 42 43 43 44 #endif
+23
fs/pstore/platform.c
··· 780 780 } 781 781 } 782 782 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 + 783 803 module_param(compress, charp, 0444); 784 804 MODULE_PARM_DESC(compress, "Pstore compression to use"); 785 805 786 806 module_param(backend, charp, 0444); 787 807 MODULE_PARM_DESC(backend, "Pstore backend to use"); 808 + 809 + MODULE_AUTHOR("Tony Luck <tony.luck@intel.com>"); 810 + MODULE_LICENSE("GPL");