Linux内核dentry和inode [英] Linux Kernel dentry and inode

查看:275
本文介绍了Linux内核dentry和inode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从给定的dentry和inode构造绝对路径?

Is it possible to construct absolute path from the given dentry and inode?

谢谢

推荐答案

是的,只需一个dentry就足够了,可以遍历dentry-> parent. 遇到挂载点时请多加注意,因为linux支持一个dentry挂载多个设备" ...好吧,编写代码很容易,只需切换到vfsmnt-> mnt_parent即可.

yes, just one dentry is enough, back traversing through dentry->parent. take care when you meet a mountpoint, for linux support "one dentry mounts multiple devices" ... well, it's easy to code,just switch to vfsmnt->mnt_parent .

顺便说一句:我经常感到困惑,为什么linux用一个字段"mnt_parent"而不是"mnt_child"来构建mountpoint-linklist,在写这个答案时,我似乎猜出了什么.

BTW: i was often confused why linux builds the mountpoint-linklist with a field "mnt_parent" rather than "mnt_child", when writing this answer, i seemed to guess out somthing.

这篇关于Linux内核dentry和inode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆