split kernel module api docs to README

This commit is contained in:
Ciro Santilli
2018-07-01 23:37:37 +01:00
parent 8f37cd0d22
commit 6c241279a6
18 changed files with 490 additions and 296 deletions

View File

@@ -1,17 +1,4 @@
/*
- https://stackoverflow.com/questions/4839024/how-to-find-the-version-of-a-compiled-kernel-module/42556565#42556565
- https://stackoverflow.com/questions/19467150/significance-of-this-module-in-linux-driver/49812248#49812248
Usage:
insmod /module_info.ko
# dmesg => name = module_info
# dmesg => version = 1.0
cat /sys/module/module_info/version
# => module_info
modinfo /module_info.ko | grep -E '^version:'
# => version: 1.0
*/
/* https://github.com/cirosantilli/linux-kernel-module-cheat#module_info */
#include <linux/module.h>
#include <linux/kernel.h>
@@ -19,8 +6,10 @@ Usage:
static int myinit(void)
{
/* Set by default based on the module file name. */
pr_info("name = %s\n", THIS_MODULE->name);
pr_info("name = %s\n", THIS_MODULE->name);
pr_info("version = %s\n", THIS_MODULE->version);
/* ERROR: nope, not part of struct module. */
/*pr_info("asdf = %s\n", THIS_MODULE->asdf);*/
return 0;
}
@@ -28,5 +17,6 @@ static void myexit(void) {}
module_init(myinit)
module_exit(myexit)
MODULE_INFO(asdf, "qwer");
MODULE_VERSION("1.0");
MODULE_LICENSE("GPL");