45 lines
890 B
C
45 lines
890 B
C
#include <linux/init.h>
|
|
#include <linux/module.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/uaccess.h>
|
|
#include <linux/jiffies.h>
|
|
#include <linux/debugfs.h>
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_DESCRIPTION("hello world module");
|
|
|
|
#define FILENAME "id"
|
|
|
|
int init_id(void);
|
|
int init_foo(void);
|
|
|
|
struct dentry *module_dir;
|
|
|
|
static int __init fortytwo_debug_init(void)
|
|
{
|
|
int err = 0;
|
|
|
|
pr_info("creating fortytwo debug dir\n");
|
|
module_dir = debugfs_create_dir("fortytwo", NULL);
|
|
if (IS_ERR(module_dir))
|
|
return PTR_ERR(module_dir);
|
|
|
|
debugfs_create_u64("jiffies", 0444, module_dir, (uint64_t *)(&jiffies));
|
|
|
|
err = init_id();
|
|
if (err) return err;
|
|
err = init_foo();
|
|
if(err) return err;
|
|
return 0;
|
|
}
|
|
|
|
static void __exit fortytwo_debug_exit(void)
|
|
{
|
|
pr_info("removing forytwo debug dir\n");
|
|
debugfs_remove(module_dir);
|
|
}
|
|
|
|
module_init(fortytwo_debug_init);
|
|
module_exit(fortytwo_debug_exit);
|
|
|