do_last

Last updated on 7 months ago

前言

书接上回!

内核中文件路径已经介绍了,一个字符路径是怎么解析的?

路径解析主要是 link_path_walk 函数, 而 do_last 函数是做什么的?

1
2
3
4
5
6
7
8

static struct file *path_openat(struct nameidata *nd,
const struct open_flags *op, unsigned flags)
{
//......
while (!(error = link_path_walk(s, nd)) &&
(error = do_last(nd, file, op)) > 0)
}
1
2
3
4
5
6
7
#0  ext4_file_open (inode=0xffff88801e7215b0, filp=0xffff88801dc14400) at fs/ext4/file.c:446
#1 0xffffffff811b3274 in do_dentry_open (f=0xffff88801dc14400, inode=0xffff88801e7215b0,
open=0xffffffff81249628 <ext4_file_open>) at fs/open.c:797
#2 0xffffffff811b42d8 in vfs_open (path=<optimized out>, file=<optimized out>) at fs/open.c:911
#3 0xffffffff811c7105 in do_last (op=<optimized out>, file=<optimized out>, nd=<optimized out>)
at fs/namei.c:3411