|
Linux 内核文件系统与设备操作流程分析(15) // // 通过路径名查询 inode, dentry 并返回 nameidata 结构。 //
error = path_lookup_open(dfd, pathname, lookup_flags(flag), nd, flag); if (error) return error; goto ok; }
/* * Create - we need to know the parent. */
// // 如果是建立标志则使用 path_lookup_create() // error = path_lookup_create(dfd,pathname,LOOKUP_PARENT,nd,flag,mode); if (error) return error;
...... }
上面的 path_lookup_open() 与 path_lookup_create() 都是一个很简单的封状 无条件的调用了 __path_lookup_intent_open() 函数,只不过是传输标志不同 而已。此函数在预先填充一些 struct nameidata 结构后继续调用 do_path_lookup() 完成查找。
static int __path_lookup_intent_open(int dfd, const char *name, unsigned int lookup_flags, struct nameidata *nd, int open_flags, int create_mode) {
// // 获得一个空的 struct file 结构
|