Linux 准确查找结构体定义位置

例如:查找文件操作结构体 struct file_operations,

使用转移符 "\" 

$ grep struct\ file_operations\ { kernel/include/ -rn

使用双引号

$ grep "struct file_operations {" kernel/include/ -rn

 

下面这种方式,会查找到所有含有 file_operations 的结构体,包括定义,声明,使用。

$ grep file_operations kernel/include/ -rn

下面这种方式,只会匹配struct,所以含有struct的都会显示。

$ grep struct file_operations { kernel/include/ -rn

 

posted @ 2018-03-28 14:36  LeeAaron  阅读(893)  评论(0编辑  收藏  举报