網頁

2010年5月26日 星期三

Virtual File System (VFS)

File System Category
Disk-based file system
journal file system: provide backup file system, more security
FAT -> NTFS
Network file system
NFS, SMB(CIFS), Samba(Unix-based SMB), AFS...
Special file system
/proc, /dev, devfs...


File System Abstraction Layer
/tmp (in-memory file system - RAM disk)

Unix file system
Filesystem are mounted at a specific mount point in a global hierarchy known as a namespace.
mount point(nfs, \tmp)

Each component of a path is called a directory entry(dentry)

inode - file's metadata
superblock - filesystm metadata

Non-Unix filesystem still work in Linux(FAT, NTFS)
special processing done on the fly


VFS Objects

superblock, inode, dentry, file
[              static              ]


sync_fs() best effort
link() - create a inode
dentry cache (d-cache)
inode cache (i-cache)

fs_struct (Process decriptor's fs field)

Nothing is trivial

研究不是一件容易的事
比起coding 研究需要花費更多的心思
除了要設想每個可能被擊破論點
還要小心翼翼地花費時間闡述出來

只不過如果研究方向就是錯誤的話
研究出來的結果就是不可行
那要怎麼去扭轉這樣的結論

真的是不容易......

2010年5月24日 星期一

[OpenCV] Camera Capture

Programmer can extract webcam image throuhg OpenCV easily. 
Following is the example code.

[code]  
    CvCapture *capture;
    IplImage *frame;
    capture =cvCaptureFromCAM(0) ;           //camera init
    cvNamedWindow("Webcam",0);               //highgui window init
    while(TRUE)
    {
        frame = cvQueryFrame(capture);       //extract from CvCapture struct
        cvShowImage("Webcam",frame);         //show frame
        if(cvWaitKey(10)>=0)              //wait for key in
        {
            break;
        }
    }
    cvReleaseCapture(&capture);
    cvDestroyWindow("Webcam");

pkg-config

pkg-config is a useful tool for compiling.
It helps to insert correct compiler options on the command line for gcc/g++ compiler.
example:

            `pkg-config gtk+-2.0 --cflags`                      //include gtk+2.0 lib
            `pkg-config opencv --libs --cflags opencv`    //include opencv lib



[Reference]
pkg-config wiki - http://pkg-config.freedesktop.org/wiki/

[NSLAB] Fun Time



[Reference]
1. wiki
2. youtube

[本報告僅供學術參考]

2010年5月20日 星期四

Ubuntu - ADSL Access

對象: 需帳密的ADSL (浮動IP)
方法:
sudo pppoeconf
進入PPPOE設定程式。
  1. 偵測你哪一張網路卡連接到ISP。他會列出所有偵測到的網路介面並詢問你他是否已找到所有網路介面
  2. 問你是否想用「noauth」、「defaultroute」選項,沒有特殊需求的話,直接答「yes」即可。
  3. 鍵入ADSL用戶名稱
  4. 鍵入ADSL密碼
  5. 問你是否使用 ISP 提供的 DNS 伺服器,沒有特殊需求的話,直接答「yes」即可。
  6. 是否要把 MSS 限制不大於1452位元組,沒有特殊需求的話,直接答「yes」即可。
  7. 問你是否想每次啟動 Ubuntu 時自動連線網路
  8. 最後會問你是否想現在即時連線上網


CSMA - Carrier Sense Multiple Access

It is difficult to detect collision in the wireless environment.
The wireless nodes must detect actively.


Therefore there are two methods to prevent collisions:

1. Before sending data, wait a period of time to listen medium state if no one exploit and then wait a random time to send data (still no one use). Because different random time, it will decrease collision possibility.

2. Before sending data, send RTS(request to send) to target and wait for CTS(clear to send). If receiving CTS, start to send data. (RTS and CTS will clear the channel)
RTS and CTS are small frame and won't cause high transfer cost. (ex. IEEE 802.11)

In other word, RTS/CTS exploit the signals to notify other nodes that there are someone sending data, so others need to wait a second.