* the file, if we need it. In our case we
* do, because we need a write function. */
NULL
/* The read function for the file.
* Irrelevant, because we put it
* in the inode structure above */
};
/* Module initialization and cleanup **************** */
/* Initialize the module - register the proc file */
int init_module() {
/* Success if proc_register_dynamic is a success,
* failure otherwise */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
return proc_register(&proc_root, &Our_Proc_File);
#else
return proc_register_dynamic(&proc_root, &Our_Proc_File);
#endif
/* proc_root is the root directory for the proc
* fs (/proc). This is where we want our file to be
* located. */
}
/* Cleanup - unregister our file from /proc. This could
* get dangerous if there are still processes waiting in
* WaitQ, because they are inside our open function,
* which will get unloaded. I'll explain how to avoid
* removal of a kernel module in such a case in chapter 10. */
void cleanup_module() {
proc_unregister(&proc_root, Our_Proc_File.low_ino);
}
Замена для printk