linux如何获取raw中的文件路径,如何从Linux内核中的struct dentry获取完整路径名

我正在编写自己的内核模块,它捕获vfs_mkdir(struct inode *,struct dentry *,int)内核函数调用,并尝试记录发生此调用的磁盘上路径名.

我想使用dentry_path内核函数将struct dentry *转换为路径名.

当我插入模块时,我发现了一个错误

Unknown symbol dentry_path

我的内核版本是2.6.32,它应该被导出.

我无法弄清楚原因.

还有其他选择吗?

解决方法:

使用dentry_path_raw.不导出dentry_path.

来自linux-fsdevel archives:

On Fri, Apr 20, 2012 at 02:08:37PM -0400, Theodore Ts'o wrote:

> I wonder if we would be better off simply exporting dentry_path(),

> perhaps as EXPORT_SYMBOL_GPL, with a warning that it should only be used

> for debugging purposes, or some such. I suspect it's not worth changing

> all of the inode_ops interfaces to pass in a struct path intead of a

> struct dentry if it's only to be used for debugging. Or maybe I should

> just keep on doing these ugly things and justify them because it's only

> for debugging (yelch).

>

> What do you think?

Just use dentry_path_raw() - it _is_ exported and the only difference is

the lack of //deleted for unlinked ones.

标签:linux,linux-kernel,filesystems

来源: https://codeday.me/bug/20190831/1778414.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值