Kathy KN (HK) wrote: > On Apr 6, 2005 1:53 AM, Bryan Henderson <[EMAIL PROTECTED]> wrote: >>>How do I access/read the content of the files via using inodes >>>or blocks that belong to the inode, at sys_link and vfs_link layer? >>This is tricky because many interfaces that one would expect to use an >>inode as a file handle use a dentry instead. To read the contents of a >>file via the VFS interface, you need a file pointer (struct file), and the >>file pointer identifies the file by dentry. So you need to create a dummy >>dentry, which you can do with d_alloc_root(), and then create the file >>pointer with dentry_open(), then read the file with vfs_read(). >> >>That's for "via inodes." I don't know what "via blocks" means. > > Bryan, > > Thanks for the description on how to read the contents of a file via > the VFS interface. I got to try to see if I can write it in codes, and make > sure that I can read the file via the vfs_read() routine. What I meant by > via blocks is to gain knowledge of the physical blocks used by the inodes > and retrieve the content from it directly, by accessing b_data.
The problem with that approach is that some filesystems may store part of the file outside of a complete block. For example, reiserfs "tails" will respond with -ENOENT on ->bmap. For files smaller than 16k, they are quite common. -Jeff -- Jeff Mahoney SuSE Labs - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
