how to access Inode structure of file
can i access the Inode structure?
want to know how to access process table? |
|
"Process Table".....what do u mean and from userspace or kernel?
From userspace, just "cd /proc/" and all those numbers are belonging to each process. From kernel, u can enumerate by walking through the PID hash table. Check kernel/pid.c, for example this line: hlist_for_each_entry_rcu(pnr, elem, &pid_hash[pid_hashfn(nr, ns)], pid_chain) For inode, what u mean by "access inode structure"? if u want to know the structure, it is in the header file. If u want to know where are all the blocks stored for EACH inode (one INODE One FILE) u can use "ils" from sleuthkit (apt-get install sleuthkit or tct). If u want to do do in the kernel....it depends on what information needed.....but it will very filesystem-specific....so which FS is that? |
If you want to access inode for some particular file you can modify the code in read_write.c in kernelSrc/fs/. You can modify vfs_read function and retrieve inode using file->f_dentry->d_inode. It is the pointer to structure containing inode.
|
All times are GMT -5. The time now is 07:20 AM. |