Learning Linux Kernel series 1 - Buffer Head
Thursday, May 28, 2009, 08:53 AM
First I read:
A nasty file corruption bug - fixed
http://lwn.net/Articles/215868/The header for buffer head is include/linux/buffer_head.h
defines maxmum disk sectores/blocks as 8 per page, PAGE_CACHE_SIZE normally is the same size of PAGE_SIZE as 4k
#define MAX_BUF_PER_PAGE (PAGE_CACHE_SIZE / 512)
The function definition for buffer head is fs/buffer.c
[ add comment ] permalink ( 3 / 25 )
Use vim and cscope to read large C source code project
Wednesday, February 25, 2009, 07:28 PM
Vim is my favourite editor, I often use vim to read open source C code, Later, I found cscope is quite good tool to jump back and forth between different C source files to better understand how those C sources connect together in a large open source C code project.
cscopes_maps.vim can be downloaded from
http://cscope.sourceforge.net/cscope_maps.vim, put this file under ~/.vim/plugin and run cscope -b -R -k under the folder of open source project, for example cd /usr/src/linux-2.28.x;cscope -b -R -k. then open a C source file, move cursor under a function name, press ctrl + ] will jump to the function declaration/definition of .c/.h file. use ctrl + t, ctrl + ^, etc to jump back and forth.
type :help cscope to get more help info about cscope at vim command mode, also vim folding can be helpful to get a broad picture of C source file, type :help folding to get more info about vim folding.
[ add comment ] permalink ( 2.7 / 6 )
Asterisk App DISA usage and programing control
Thursday, January 29, 2009, 01:30 PM
DISA: Direct Inward System Access, application allows someone from outside the telephone switch (PBX) to obtain an <emphasis>internal</emphasis> system dialtone and to place calls from it as if they were placing a call from within the switch.
Sampel Extension Usage:
exten => 123,1,DISA(111,disa-context,,123@default,np)
or
exten => 123,1,DISA(/etc/asterisk/passcode.txt)
passcode.txt is like this:
111,disa-context,,123@default
222,disa-context,,123@default
In the for loop, when k is either 00, or 10, the loop would be in password state, entered digit saved in f->subclass and assigned to j, later saved in array exten[i++]=j. when password end with #, k would be set to k|=1 to 3(11), i reset to 0, the password state test k&1 would be all false,so skips all the password state instruction, and do the exten[i++]=j to save entered extension number to array exten, when # entered, break the loop and go to check if k==3.
[ add comment ] permalink ( 3 / 5 )