30
30
*
31
31
* See Documentation/fault-injection/provoke-crashes.txt for instructions
32
32
*/
33
+ #define pr_fmt (fmt ) KBUILD_MODNAME ": " fmt
33
34
34
35
#include <linux/kernel.h>
35
36
#include <linux/fs.h>
@@ -493,8 +494,8 @@ static void lkdtm_handler(void)
493
494
494
495
spin_lock_irqsave (& count_lock , flags );
495
496
count -- ;
496
- printk ( KERN_INFO "lkdtm: Crash point %s of type %s hit, trigger in %d rounds\n" ,
497
- cp_name_to_str (cpoint ), cp_type_to_str (cptype ), count );
497
+ pr_info ( " Crash point %s of type %s hit, trigger in %d rounds\n" ,
498
+ cp_name_to_str (cpoint ), cp_type_to_str (cptype ), count );
498
499
499
500
if (count == 0 ) {
500
501
do_it = true;
@@ -551,18 +552,18 @@ static int lkdtm_register_cpoint(enum cname which)
551
552
lkdtm .kp .symbol_name = "generic_ide_ioctl" ;
552
553
lkdtm .entry = (kprobe_opcode_t * ) jp_generic_ide_ioctl ;
553
554
#else
554
- printk ( KERN_INFO "lkdtm: Crash point not available\n" );
555
+ pr_info ( " Crash point not available\n" );
555
556
return - EINVAL ;
556
557
#endif
557
558
break ;
558
559
default :
559
- printk ( KERN_INFO "lkdtm: Invalid Crash Point\n" );
560
+ pr_info ( " Invalid Crash Point\n" );
560
561
return - EINVAL ;
561
562
}
562
563
563
564
cpoint = which ;
564
565
if ((ret = register_jprobe (& lkdtm )) < 0 ) {
565
- printk ( KERN_INFO "lkdtm: Couldn't register jprobe\n" );
566
+ pr_info ( " Couldn't register jprobe\n" );
566
567
cpoint = CN_INVALID ;
567
568
}
568
569
@@ -709,8 +710,7 @@ static ssize_t direct_entry(struct file *f, const char __user *user_buf,
709
710
if (type == CT_NONE )
710
711
return - EINVAL ;
711
712
712
- printk (KERN_INFO "lkdtm: Performing direct entry %s\n" ,
713
- cp_type_to_str (type ));
713
+ pr_info ("Performing direct entry %s\n" , cp_type_to_str (type ));
714
714
lkdtm_do_action (type );
715
715
* off += count ;
716
716
@@ -772,7 +772,7 @@ static int __init lkdtm_module_init(void)
772
772
/* Register debugfs interface */
773
773
lkdtm_debugfs_root = debugfs_create_dir ("provoke-crash" , NULL );
774
774
if (!lkdtm_debugfs_root ) {
775
- printk ( KERN_ERR "lkdtm: creating root dir failed\n" );
775
+ pr_err ( " creating root dir failed\n" );
776
776
return - ENODEV ;
777
777
}
778
778
@@ -787,28 +787,26 @@ static int __init lkdtm_module_init(void)
787
787
de = debugfs_create_file (cur -> name , 0644 , lkdtm_debugfs_root ,
788
788
NULL , & cur -> fops );
789
789
if (de == NULL ) {
790
- printk (KERN_ERR "lkdtm: could not create %s\n" ,
791
- cur -> name );
790
+ pr_err ("could not create %s\n" , cur -> name );
792
791
goto out_err ;
793
792
}
794
793
}
795
794
796
795
if (lkdtm_parse_commandline () == - EINVAL ) {
797
- printk ( KERN_INFO "lkdtm: Invalid command\n" );
796
+ pr_info ( " Invalid command\n" );
798
797
goto out_err ;
799
798
}
800
799
801
800
if (cpoint != CN_INVALID && cptype != CT_NONE ) {
802
801
ret = lkdtm_register_cpoint (cpoint );
803
802
if (ret < 0 ) {
804
- printk (KERN_INFO "lkdtm: Invalid crash point %d\n" ,
805
- cpoint );
803
+ pr_info ("Invalid crash point %d\n" , cpoint );
806
804
goto out_err ;
807
805
}
808
- printk ( KERN_INFO "lkdtm: Crash point %s of type %s registered\n" ,
809
- cpoint_name , cpoint_type );
806
+ pr_info ( " Crash point %s of type %s registered\n" ,
807
+ cpoint_name , cpoint_type );
810
808
} else {
811
- printk ( KERN_INFO "lkdtm: No crash points registered, enable through debugfs\n" );
809
+ pr_info ( " No crash points registered, enable through debugfs\n" );
812
810
}
813
811
814
812
return 0 ;
@@ -823,7 +821,7 @@ static void __exit lkdtm_module_exit(void)
823
821
debugfs_remove_recursive (lkdtm_debugfs_root );
824
822
825
823
unregister_jprobe (& lkdtm );
826
- printk ( KERN_INFO "lkdtm: Crash point unregistered\n" );
824
+ pr_info ( " Crash point unregistered\n" );
827
825
}
828
826
829
827
module_init (lkdtm_module_init );
0 commit comments