Ole
Ole

Reputation: 406

Howto access file system-dependant data from a lkm

I'm developing a LKM for Linux kernel, and I want it to get some specific information that is file system related. In fact this information is the field i_crtime (creation time) of a inode structure of a ext4 file system.

My question is, How could I access this field from a lkm? Right now I know how to get the inode of a specific file:

kern_path(<path to file>, LOOKUP_FOLLOW, &path)

So after this I have the inode via:

path.dentry->d_inode

But this inode (d_inode) is the generic VFS inode structure, not the ext4_inode previously shown (nor ext4_inode_info neither).

Anybody knows how to do that? I'm trying to study the VFS code, the stat (coreutil) code, stracing it and I'm still stucked :-S

TIA.

Upvotes: 1

Views: 672

Answers (1)

itisravi
itisravi

Reputation: 3561

The EXT4_I() function gets you ext4_inode_info from the VFS inode. But the VFS inode's ctime is exactly the same as that of the EXT4 inode. So you might as well access inode->i_ctime.

Upvotes: 2

Related Questions