LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   how to access Inode structure of file (https://www.linuxquestions.org/questions/linux-kernel-70/how-to-access-inode-structure-of-file-839500/)

Pratik dhamdhere 10-21-2010 04:45 AM

how to access Inode structure of file
 
can i access the Inode structure?
want to know how to access process table?

Aquarius_Girl 10-22-2010 12:01 AM

https://www.redhat.com/mirrors/LDP/L...s/vfstour.html
and
http://webcache.googleusercontent.co...&ct=clnk&gl=in

tthtlc 10-22-2010 12:47 AM

"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?

swap_chau 11-18-2010 11:50 PM

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.