Answer:
The code is appropriately given below with comments for better understanding
Explanation:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/hash.h>
#include <linux/gcd.h>
#include <asm/param.h>
#include <linux/jiffies.h>
/* This function is called when the module is loaded. */
static int simple_init(void)
{
printk(KERN_INFO "Loading Module\n");
printk(KERN_INFO "These are the HZ: %d\n", HZ);
printk(KERN_INFO "These are the jiffies: %lu\n", jiffies);
printk(KERN_INFO "Golden Ratio is: %lu\n", GOLDEN_RATIO_PRIME);
return 0;
}
/* This function is called when the module is removed. */
static void simple_exit(void) {
printk(KERN_INFO "Removing Module");
unsigned long a = gcd(3300, 24);
printk(KERN_INFO "Greatest Common Denominator between 3,300 and 24 is: %lu\n", a);
printk(KERN_INFO "These are the jiffies: %lu\n", jiffies);
}
/* Macros for registering module entry and exit points. */
module_init( simple_init );
module_exit( simple_exit );
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Simple Module");
MODULE_AUTHOR("SGG");