Guest User

Untitled

a guest
Jun 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <linux/kernel.h>
  2. #include <linux/module.h>
  3. #include <linux/errno.h>
  4. //#include <linux/init.h>
  5.  
  6. // パラメータ変数宣言
  7. int num=0;
  8. char *msg="def msg";
  9.  
  10. // 引数にとる変数型と変数を宣言
  11. module_param(num, int, S_IRUGO);
  12. module_param(msg, charp, S_IRUGO);
  13.  
  14. // 初期化関数
  15. static int __init hello_init2(void) {
  16. printk("hello!! \n");
  17. printk("num=%d, msg:%s\n", num, msg);
  18. return 0;
  19. }
  20.  
  21. // 終了関数
  22. static void __exit hello_exit2(void)
  23. {
  24. printk("Goodby!!\n");
  25. }
  26. // ライセンス情報を宣言(GPLとする)
  27. MODULE_LICENSE("GPL");
  28. // 初期化関数宣言
  29. module_init(hello_init2);
  30. // 終了関数宣言
  31. module_exit(hello_exit2);
Add Comment
Please, Sign In to add comment