Question: Write code (C) to identify the youngest student by year ( you can define 6 students born in 6 different years.) and remove that student

Write code (C) to identify the youngest student by year ( you can define 6 students born in 6 different years.) and remove that student from the list. After removing the youngest student, output the updated linked list content to the kernel log buff ```

#include #include #include #include #include

struct birthday { int day; int month; int year; struct list_head list; };

struct birthday *person, *tmp, *ptr1, *ptr2, *ptr3, *ptr4, *ptr5; static LIST_HEAD(birthday_list); struct list_head *pos;

/* This function is called when the module is loaded. */ int simple_init(void) {

person = kmalloc(sizeof(*person),GFP_KERNEL); person->day = 1; person->month = 9; person->year = 1999;

int jeremiah_day = 8; int jeremiah_month = 3; int jeremiah_year = 1978;

int jeff_day = 9; int jeff_month = 12; int jeff_year = 1958;

int ahmid_day = 9; int ahmid_month = 6; int ahmid_year = 2003;

int nicole_day = 8; int nicole_month = 3; int nicole_year = 1978;

///set to head INIT_LIST_HEAD(&person->list); printk(KERN_INFO "Loading Module ");

ptr1 = kmalloc(sizeof(*ptr1), GFP_KERNEL); ptr1->day = jeremiah_day; ptr1->month = jeremiah_month; ptr1->year = jeremiah_year; list_add(&(ptr1->list), &(person->list));

ptr2 = kmalloc(sizeof(*ptr2), GFP_KERNEL); ptr2->day = jeff_day; ptr2->month = jeff_month; ptr2->year = jeff_year; list_add(&(ptr2->list), &(person->list));

ptr3 = kmalloc(sizeof(*ptr3), GFP_KERNEL); ptr3->day = ahmid_day; ptr3->month = ahmid_month; ptr3->year = ahmid_year; list_add(&(ptr3->list), &(person->list));

ptr4 = kmalloc(sizeof(*ptr4), GFP_KERNEL); ptr4->day = nicole_day; ptr4->month = nicole_month; ptr4->year = nicole_year; list_add(&(ptr4->list), &(person->list));

list_for_each(pos, &(person->list)){ tmp = list_entry(pos, struct birthday, list); printk("day = %d month = %d year = %d ", tmp->day, tmp->month, tmp->year); }

return 0; }

/* This function is called when the module is removed. */ void simple_exit(void) { printk(KERN_INFO "Removing Module "); }

/* 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");

```

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!