module_info.c 554 B

1234567891011121314151617181920212223
  1. /* https://github.com/cirosantilli/linux-kernel-module-cheat#module_info */
  2. #include <linux/module.h>
  3. #include <linux/kernel.h>
  4. static int myinit(void)
  5. {
  6. /* Set by default based on the module file name. */
  7. pr_info("name = %s\n", THIS_MODULE->name);
  8. pr_info("version = %s\n", THIS_MODULE->version);
  9. /* ERROR: nope, not part of struct module. */
  10. /*pr_info("asdf = %s\n", THIS_MODULE->asdf);*/
  11. return 0;
  12. }
  13. static void myexit(void) {}
  14. module_init(myinit)
  15. module_exit(myexit)
  16. MODULE_INFO(asdf, "qwer");
  17. MODULE_VERSION("1.0");
  18. MODULE_LICENSE("GPL");