<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>KernelAnalysis-HOWTO: Syntax used</TITLE> <LINK HREF="KernelAnalysis-HOWTO-3.html" REL=next> <LINK HREF="KernelAnalysis-HOWTO-1.html" REL=previous> <LINK HREF="KernelAnalysis-HOWTO.html#toc2" REL=contents> </HEAD> <BODY> <A HREF="KernelAnalysis-HOWTO-3.html">Next</A> <A HREF="KernelAnalysis-HOWTO-1.html">Previous</A> <A HREF="KernelAnalysis-HOWTO.html#toc2">Contents</A> <HR> <H2><A NAME="s2">2. Syntax used</A></H2> <H2><A NAME="ss2.1">2.1 Function Syntax</A> </H2> <P>When speaking about a function, we write: <P> <P> <PRE> "function_name [ file location . extension ]" </PRE> <P>For example: <P> <P> <PRE> "schedule [kernel/sched.c]" </PRE> <P>tells us that we talk about <P> <P>"schedule" <P> <P>function retrievable from file <P> <P>[ kernel/sched.c ] <P> <P>Note: We also assume /usr/src/linux as the starting directory. <P> <H2><A NAME="ss2.2">2.2 Indentation</A> </H2> <P>Indentation in source code is 3 blank characters. <P> <H2><A NAME="ss2.3">2.3 InterCallings Analysis</A> </H2> <H3>Overview</H3> <P>We use the"InterCallings Analysis "(ICA) to see (in an indented fashion) how kernel functions call each other. <P> <P>For example, the sleep_on command is described in ICA below: <P> <P> <PRE> |sleep_on |init_waitqueue_entry -- |__add_wait_queue | enqueuing request |list_add | |__list_add -- |schedule --- waiting for request to be executed |__remove_wait_queue -- |list_del | dequeuing request |__list_del -- sleep_on ICA </PRE> <P>The indented ICA is followed by functions' locations: <P> <P> <UL> <LI>sleep_on [kernel/sched.c]</LI> <LI>init_waitqueue_entry [include/linux/wait.h]</LI> <LI>__add_wait_queue</LI> <LI>list_add [include/linux/list.h]</LI> <LI>__list_add</LI> <LI>schedule [kernel/sched.c]</LI> <LI>__remove_wait_queue [include/linux/wait.h]</LI> <LI>list_del [include/linux/list.h]</LI> <LI>__list_del </LI> </UL> <P>Note: We don't specify anymore file location, if specified just before. <P> <H3>Details</H3> <P>In an ICA a line like looks like the following <P> <P> <PRE> function1 -> function2 </PRE> <P>means that < function1 > is a generic pointer to another function. In this case < function1 > points to < function2 >. <P> <P>When we write: <P> <P> <PRE> function: </PRE> <P>it means that < function > is not a real function. It is a label (typically assembler label). <P> <P>In many sections we may report a ''C'' code or a ''pseudo-code''. In real source files, you could use ''assembler'' or ''not structured'' code. This difference is for learning purposes. <P> <H3>PROs of using ICA</H3> <P>The advantages of using ICA (InterCallings Analysis) are many: <P> <P> <UL> <LI>You get an overview of what happens when you call a kernel function </LI> <LI>Function locations are indicated after the function, so ICA could also be considered as a little ''function reference''</LI> <LI>InterCallings Analysis (ICA) is useful in sleep/awake mechanisms, where we can view what we do before sleeping, the proper sleeping action, and what we'll do after waking up (after schedule). </LI> </UL> <H3>CONTROs of using ICA</H3> <P> <UL> <LI>Some of the disadvantages of using ICA are listed below: </LI> </UL> <P>As all theoretical models, we simplify reality avoiding many details, such as real source code and special conditions. <P> <P> <UL> <LI>Additional diagrams should be added to better represent stack conditions, data values, and so on. </LI> </UL> <HR> <A HREF="KernelAnalysis-HOWTO-3.html">Next</A> <A HREF="KernelAnalysis-HOWTO-1.html">Previous</A> <A HREF="KernelAnalysis-HOWTO.html#toc2">Contents</A> </BODY> </HTML>