如何在vfs层的linux内核中检查文件对象是用于目录还是文件 [英] How to check in linux kernel at vfs layer whether the file object is for a directory or a file
问题描述
我发现有一个叫做$的函数
如何在vfs层的linux内核中检查文件对象是用于目录还是文件? c $ c> is_dx(dir)它检查了这个,但它存在于 检查与名字匹配的条目以获取 对应的inode。 检查得到相应的inode的 。 q对于包含在路径中的每个名称重复此过程。 dentry缓存大大加快了程序的速度。 文件系统操作主要在dcache级别完成,所以他们都在内核锁。 How to check in linux kernel at vfs layer whether the file object is for a directory or a file? I have found that there is a function called Having in hand the inode of the initial directory, the code examines the entry matching the first name to get the corresponding inode. q Then the directory file having that node is read from disk and the entry matching the second name is examined to derive the corresponding inode. q This procedure is repeated for each name included in the path. The dentry cache considerably speeds up the procedure File system operations are mostly done at the dcache level , so they are all under kernel lock. 这篇关于如何在vfs层的linux内核中检查文件对象是用于目录还是文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! ext3中
namei.c
code>或 ext4
。我需要在 vfs层中独立于文件系统来执行此操作。 手中的初始目录的inode,代码
然后,从磁盘读取具有该节点的目录文件,并且匹配第二个名字的条目是
is_dx(dir)
which checks for this but it is present in namei.c
in ext3
or ext4
. I need to do this at vfs layer that is independent of the file system.