æ¯å¦è¯´ln a bä¹åï¼dentry aådentry bçd_inodeé½æ¯ç¸åçï¼èè¿ä¸¤ä¸ªdentryï¼éè¿d_aliaså段æå¨inodeçi_dentryå表ä¸ã
æ以说ï¼ä»ä¸ä¸ªinodeåºåï¼å¾å°çå
¨è·¯å¾ä¸æ¢ä¸ä¸ªï¼æ¯ä¸ªlinkæä¸ä¸ªï¼ã
ä»dentryæ¾å
¨è·¯å¾çè¿ç¨ï¼å¯ä»¥åèsys_getcwdçå®ç°ã
举个å®é
çä¾åï¼
[~]# touch linka
[~]# ln linka linkb
[~]# ls -i linka linkb
68834 linka 68834 linkb <------- 两个æ件å
±äº«ä¸ä¸ªinode
#éè¿å
¶å®æ段å¾ç¥ï¼å¯¹åºçindoeä½äºffff810035dc7110
#æ¥çinodeçdentryä¿¡æ¯
crash> inode.i_dentry,i_ino ffff810035dc7110
i_dentry = {
next = 0xffff810028a3ed90, <------ next!=prevï¼è¯´æé空ï¼å¹¶ä¸ä¸åªä¸ä¸ªå
ç´
prev = 0xffff81002bb6cbe0
}
i_ino = 68834 <------- çç¡®æ¯è¿ä¸ªinode
#éåinode.i_dentryé¾è¡¨
#ç±äºinode.i_dentryçå移æ¯0x30ï¼æ以i_dentryçå°åæ¯0xffff810035dc7110 + 0x30
crash> list -o dentry.d_alias -s dentry.d_name,d_inode -H ffff810035dc7140
#第ä¸ä¸ªnodeï¼ä¹å°±æ¯next
ffff810028a3ed20 <----- dentry.d_aliasçå移æ¯0x70, 0xffff810028a3ed90 - 0x70
d_name = {
hash = 306522898,
len = 5,
name = 0xffff810028a3edd4 "linkb"
}
d_inode = 0xffff810035dc7110 <---- linkbçinodeå°±æ¯#68834
#第äºä¸ªnodeï¼ä¹å°±æ¯prev
ffff81002bb6cb70 <------ 0xffff81002bb6cbe0 - 0x70
d_name = {
hash = 306522722,
len = 5,
name = 0xffff81002bb6cc24 "linka"
}
d_inode = 0xffff810035dc7110 <---- linkaçinodeä¹æ¯#68834
温馨提示:答案为网友推荐,仅供参考