I'm making a kernel module which writes to a file every 100 msecs. Using arch linux and kernel 6.4. timer from kernel/timer.h doesn't seem to work. Is it deprecated? What should I use?
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
static int freq_sec;
static char *filepath;
static struct timer_list my_timer;
void timer_callback(struct timer_list * data) {
printk("Hallo, Kernel %d! %s\n", freq_sec, filepath);
file_write(filepath, "Hello from kernel module\n", 25);
}
static int __init my_init(void) {
timer_setup(&my_timer, timer_callback, 0);
mod_timer(&my_timer, jiffies + msecs_to_jiffies(100));
return 0;
}