首页 > 其他 > 详细

vfs_path_lookup

时间:2014-01-28 21:12:24      阅读:416      评论:0      收藏:0      [点我收藏+]
   1: void lookupInode()
   2: {
   3:     struct dentry* root_dentry;
   4:     struct vfsmount* root_mnt;
   5:     const char* filename;
   6:     struct nameidata data;
   7:     int err = 0;
   8:  
   9:     root_dentry = current->fs->root.dentry;
  10:     root_mnt = current->fs->root.mnt;
  11:     filename = "/mod/case/superblock/tmp";
  12:     //filename = "/boot/vmlinuz-3.0.0-12-generic";
  13:     //filename = "/";
  14:     filename = "/home/danie/filelist.c";
  15:     //filename = "/home/daniel";
  16:     //filename = "/mod/case/superblock/tmp";
  17:     err = vfs_path_lookup(root_dentry,root_mnt,filename,LOOKUP_EXCL,&data);
  18:     printk("lookup %s\n", filename);
  19:     if (err==0)
  20:     {
  21:         struct inode* nodei = data.inode;
  22:         struct address_space* mapping = nodei->i_mapping;
  23:         printk("mapping 0x%08x\n", mapping);
  24:         printk("nr_pages: %d\n", mapping->nrpages);
  25:         
  26:         //printk("Showing:\n");
  27:         printRawData(sizeof(struct inode),nodei);
  28:         
  29:     }
  30:     else
  31:         printk("err: %d\n", err);
  32:  
  33: }

vfs_path_lookup为什么读不到文件,但是能够读到目录?

vfs_path_lookup

原文:http://www.cnblogs.com/long123king/p/3535664.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!