C in Linux Kernel Code for Deep First Search (DFS)

Download Solution: Click to Download Solution
Solution File Name: CinLinuxKernelCodeforDeepFirstSearch.docx
Unzip Password: prestobear.com

Problem:
In this sample, we will write a code for Deep First Search (DFS).


1.parttwolist.c
#include < linux/init.h >
#include < linux/kernel.h >
#include < linux/module.h >
#include < linux/sched.h >

void dfs(struct task_struct *task) {

}

int parttwo_list_dfs_init(void) {

}

void parttwo_list_dfs_exit(void) {
  printk(KERN_INFO "Module removed.\n");
}

module_init(parttwo_list_dfs_init);
module_exit(parttwo_list_dfs_exit);

2.Makefile
obj-m += parttwolist.o

KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

all:
	$(MAKE) -C $(KERNELDIR) M=$(PWD)
clean:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) clean

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.