当前位置: 技术问答>linux和unix
linux gcc编程中如何得到某个文件对应的inode结构!
来源: 互联网 发布时间:2017-04-17
本文导语: RT?编程中对文件这块很吃力,求解答! | struct file *filp = filp_open(path, O_RDONLY, 0); if (!IS_ERR(filp)) { struct dentry *dentry = dget(filp->f_dentry); if (dentry) { struct in...
RT?编程中对文件这块很吃力,求解答!
|
struct file *filp = filp_open(path, O_RDONLY, 0);
if (!IS_ERR(filp))
{
struct dentry *dentry = dget(filp->f_dentry);
if (dentry)
{
struct inode *inode = dentry->d_inode;
dput(dentry);
}
filp_close(filp, NULL);
}