3

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

我想使用dentry_path内核函数转换struct dentry *为路径名。当我插入模块时,它是有线的,我得到一个错误

未知符号 dentry_path

我的内核版本是 2.6.32,应该可以导出。我想不出原因。有其他选择吗?

4

1 回答 1

6

使用dentry_path_rawdentry_path不出口。

来自 linux-fsdevel档案

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.
于 2013-06-20T15:09:17.990 回答