19.02.2013 Views

Module I-7410 Advanced Linux Kernel Data Structures

Module I-7410 Advanced Linux Kernel Data Structures

Module I-7410 Advanced Linux Kernel Data Structures

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Berne University of Applied Sciences<br />

School of Information Technology HTI<br />

Course: <strong>Advanced</strong> <strong>Linux</strong><br />

FS-2012<br />

Example: <strong>Module</strong> Representation in the <strong>Kernel</strong> (5)<br />

Code that produces module dependency: a uses b<br />

<strong>Module</strong> a is the source and module b is the target<br />

int add_module_usage(struct module *a, *b)<br />

{<br />

struct module_use *use;<br />

use = kmalloc(sizeof(struct module_use),GFP_ATOMIC);<br />

if (!use)<br />

return ­ENOMEM;<br />

use­>source = a; use­>target = b;<br />

list_add(&use­>source_list, &b­>source_list);<br />

list_add(&use­>target_list, &a­>target_list);<br />

return 0;<br />

}<br />

Introduction to <strong>Module</strong>s<br />

V1.5 © 2012 by franz.meyer@bfh.ch Slide-16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!