Linux ÐéÄâÎļþϵͳ¸Å¹Û
Linux ÐéÄâÎļþϵͳ¸Å¹Û
×÷Õß Richard Gooch <rgooch@atnf.cs.iro.au>
·Òë albcamus <albcamus@gmail.com>
×îºó¸üÐÂ:2007 Äê 6 Ô 24 ÈÕ
°æȨ:1999, Richard Gooch
°æȨ:2005, Pekka Enberg
±¾ÎļþÒÔ GPLv2 Ðí¿É·¢·Å
[·Òë˵Ã÷:Richard Gooch µÄÕâ·Ý Overview of the Linux Virtual File System λÓÚÄÚºË
Ô´´úÂëµÄ Documentation/filesystems/ÏÂ, ÎļþÃûÊÇ vfs.txt¡£ ¸ÃÎĵµÔÚ Understanding
the Linux Kernel Öб»ÍƼö, ÎÒÊÇ´Ó 2.6.16 ¹Ù·½ÄÚºËÖп½±´³öÀ´·ÒëµÄ¡£ ×Ô¼ºÖªµÀˮƽ
²î, Àí½âºÍ±í´ï¶¼²»µ½Î», ËùÒÔ»¹Êǽ¨Òé¿´ÔÎÄ:( ]
½éÉÜ
====
ÐéÄâÎļþϵͳ(Ò²±»³Æ×öÐéÄâÎļþϵͳÇл»)ÊÇÄÚºËÖÐΪӦÓóÌÐòÌṩÎļþϵͳ½Ó¿ÚµÄÒ»¸öÈí¼þ²ã¡£
ͬʱ, ËüҲΪ²»Í¬µÄÎļþϵͳ¹²´æ, ÌṩÁËÒ»ÖÖ³éÏó¡£
open(2),stat(2),read(2),write(2),chmod(2)µÈVFSϵͳµ÷ÓÃ, ÊÇÔÚ½ø³ÌÉÏÏÂÎÄÖб»
µ÷Óõġ£ ÎļþËøµÄÃèÊöÔÚ Documnetation/filesystems/LockingÖС£
Ŀ¼Ï´æ(dcache)
-----------------
VFSʵÏÖÁËÖîÈç open(2),stat(2),chmod(2)µÈϵͳµ÷Óᣠ·¾¶Ãû×÷Ϊ²ÎÊý´«µÝ¸øÕâЩϵͳ
µ÷ÓÃ, È»ºóVFSʹÓ÷¾¶Ãû, ÔÚĿ¼Ï´æ(Ò²½Ð dentry cache »ò dcache)ÖвéÕÒÏàÓ¦µÄÄ¿
¼Ïî(dentry)¡£ ͨ¹ýĿ¼Ï´æ, ·¾¶Ãû(ÎļþÃû)ÄÜѸËÙµÃת»»³ÉÏàÓ¦µÄĿ¼Ïî¡£ Ŀ¼ÏîÖ»´æ
ÔÚÓÚÄÚ´æÖÐ, ²»»á±£´æµ½´ÅÅÌÉÏ:ËüÃÇ´æÔÚµÄÒâÒåÔÚÓÚÐÔÄÜ¡£
Ŀ¼Ï´æ(dcache)Ö¼ÔÚά»¤Õû¸öÎļþ¿Õ¼äµÄÒ»¸öÊÓͼ¡£ µ«´ó¶àÊý¼ÆËã»úÎÞ·¨½«ÎļþϵͳµÄÕû
¸öĿ¼½á¹¹»º´æÔÚÄÚ´æÖÐ, Òò´ËÓÐЩÎļþûÓб»»º´æ¡£ ΪÁË°Ñ·¾¶Ãû½âÎö³ÉÏàӦĿ¼Ïî(dentry),
VFSµÃÒ»²½²½µÄ½«Â·¾¶Ãû·Ö½â£¬´´½¨Ä¿Â¼Ïî(dentry)£¬¶ÁÈ¡ÏàÓ¦µÄInode¡£ Õâ¸ö¹ý³ÌÊÇͨ¹ý
InodeÖеIJéÕÒ·½·¨×öµ½µÄ¡£
Inode ¶ÔÏó
---------
Ò»¸öĿ¼Ïî £¨dentry£© ͨ³£°üº¬Ö¸Ïò inode µÄÖ¸Õë¡£ InodeÊÇÎļþϵͳÖеĶÔÏó, ÖîÈç³£¹æÎļþ,
Ŀ¼£¬ ¹ÜµÀ(FIFO) ºÍÆäËûµÄÎļþϵͳ¶ÔÏó¡£ ËüÃÇҪô±£´æÔÚÓÚ´ÅÅÌÉÏ(¿éÉ豸ÉϵÄÎļþϵͳ), Ҫô
´æÔÚÓÚÄÚ´æÖÐ(αÎļþϵͳ)¡£ µ±ÐèҪʱ, ÔÚ´ÅÅÌÉ쵀 inode»á±»¶ÁÈ¡µ½ÄÚ´æÖÐ; ¶ÔinodeµÄÐÞ¸ÄÒ²»á
д»Øµ½´ÅÅÌÉÏ¡£ Ò»¸ö Inode¿ÉÒÔ±»¶à¸öĿ¼Ïî(dentry)Ö¸Ïò(ÀýÈçÓ²Á´½Ó¾ÍÊÇÕâÑù)¡£
²éÕÒÒ»¸öÎļþµÄInode, VFSÐèÒªµ÷ÓÃËüµÄ¸¸Ä¿Â¼¶ÔÓ¦InodeµÄlookup()·½·¨¡£ ¸Ã·½·¨ÓÉInodeËùÔÚ
µÄÎļþϵͳʵÏÖÀ´¶¨Òå¡£ Ò»µ© VFSÕÒµ½ÁËdentry(Òò´ËÒ²¾ÍÖªµÀÁËinode
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
linuxÃüÁîÊÇÔÚbash»·¾³ÏÂÔËÐУ¬×î³£ÓõÄShellºÍÃüÁîÏÂÃæ×öÏÂ×ܽá
1.ls ÏÔʾµ±Ç°Ä¿Â¼ÏµÄÎļþºÍĿ¼
ͨ³£´îÅä²ÎÊýL £¬ÍêÕûÏÔʾÎļþºÍĿ¼£¬È¨ÏÞ£¬Ê±¼ä¡¢¹éÊô
´îÅäA£¬ÏÔʾ “.” µÄĿ¼ºÍÎļþ
2. cat ²é¿´ÎļþÄÚÈÝ
ͨ³£´îÅäÖض¨Ïò·ûºÅ> £¬> ÊÇ°ÑÒ»¸öÎļþµÄÄÚÈݼÓÔص½ÁíÍâÒ»¸öÎļþÄÚÈÝÀïÈ¥ Àý£º cat 1.tx ......
LINUXÏÂͼÐνçÃæÇл»µ½Îı¾Ä£Ê½
http://blog.chinaunix.net/u/3995/showart_115072.html
1.¿ª»ú½øÈëÎı¾Ä£Ê½
Èç¹ûÏëÈÿª»ú×Ô¶¯½ø´¿Îı¾Ä£Ê½,
ÐÞ¸Ä/etc/inittab
ÕÒµ½ÆäÖеÄ
id:5:initdefault:
ÕâÐÐָʾÆô¶¯Ê±µÄÔËÐм¶ÊÇ5,Ò²¾ÍÊÇͼÐÎģʽ
¸Ä³É3¾ÍÊÇÎı¾Ä£Ê½ÁË
id:3:initdefault:
ÕâÊÇÒòΪLinux²Ù×÷ϵͳÓÐÁùÖÖ ......
mountÊÇÓÃÀ´¹ÒÔØÎļþϵͳµÄ£¬¿ÉÒÔÔÚÆô¶¯µÄʱºò¹ÒÔØÒ²¿ÉÒÔÔÚÆô¶¯ºó¹ÒÔØ¡£ÔÚÆô¶¯ºó¹ÒÔØ¿ÉÒÔʹÓÃmountÃüÁîʵÏÖ£¬ÒªÊµÏÖÆô¶¯Ê±×Ô¶¯¹ÒÔØÉ豸ÔòÐèÆô¶¯autofs·þÎñ¾ÍÌṩÕâÖÖ¹¦ÄÜ¡£¸Ã¹¦ÄܾÍÏñwindowsÖеĹâÇý×Ô¶¯´ò¿ª¹¦ÄÜ£¬Äܹ»¼°Ê±¹ÒÔض¯Ì¬¼ÓÔصÄÎļþϵͳ¡£ÃâÈ¥ÎÒÃÇÊÖ¶¯¹ÒÔÚÂé·³¡£ÒªÊµÏÖ¹âÇý£¬ÈíÅ̵ȵĶ¯Ì¬×Ô¶¯¹ÒÔØ£¬ÐèÒª½øÐÐÏà¹Øµ ......
ÐéÄ⻯¼¼ÊõµÄ·½·¨, ¼Ü¹¹ºÍʵÏÖ¸ÅÀÀ
¼¶±ð: Öм¶
M. Tim Jones [mtj@mtjones.com], ¹ËÎʹ¤³Ìʦ, Emulex
ÔÎÄ: Virtual Linux
Òë: ÕÔçæ cn.zhaoke.com
http://blog.zhaoke.com/45.html
2006Äê12ÔÂ29ÈÕ
ÐéÄ⻯¼¼ÊõµÄÓ¦ÓÃÊ®·Ö¹ã·º. µ±Ç°ÐéÄ⻯¼¼ÊõÖ÷Òª¹Ø×¢ÓÚ·þÎñÆ÷µÄÐéÄ⻯, »òÔÚµ¥¸öÖ÷»úÉϼĴæ¶à¸ö¶ÀÁ¢µÄ²Ù×÷ϵͳ. ±¾Î ......