How to access inode information


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to access inode information
# 1  
Old 01-21-2009
Question How to access inode information

Hi Friends,
I am new to this forum.
Can any one tell me, how to access an inode using c program.
What are all the header files, functions(APIs) and libraries etc required to do that.?Smilie
Any help on this is appreciated.
Thanks in advance.
# 2  
Old 01-27-2009
Normally, you just open the raw device and parse the information that is specific to the filesystem. Opening the raw device is OS specific, and parsing the inode information is filesystem specific. So there's no general answer to your question.
# 3  
Old 01-27-2009
Usually UNIX systems are picky about using an inode to reference a file for reading or writing -specifically because it bypasses security. If that is what you want it may be a problem.

You will have to use direct I/O - in other words, write a driver or (what Otheus is telling you) to do physical (sometimes called direct) I/O to a disk to retrieve the inode object.
This means you will have to understand filesystem internals.

What exact data are you after in the inode?

Last edited by otheus; 01-27-2009 at 12:04 PM.. Reason: inserted meaningful conjunction
# 4  
Old 01-27-2009
This question falls under the category "if you have to ask, you cannot afford it".
# 5  
Old 01-27-2009
Thanks for the reply... Friends.

Actually i tried to dig how find command works in unix. In that i come to that i traverses all the inode for the directory. I also downloaded one inode accessing 'c' program too. But for that i need some Linux source code and libraries too. So, i am not sure how and where i can get the one.
So, Can any one guide me to get library for compling linux source code.
Or suggest me good links to compile a linux source code. I think that could solve the problem.


Thanks in advance.
# 6  
Old 01-27-2009
Oh. You probably want to look into opendir(), readdir(), -- look at dirent.h also.
This gives you the inode number. stat() gives you what find uses to select files.
See /usr/include/sys/stat.h
# 7  
Old 02-06-2009
Thanks a lot for the reply Smilie !!
Actually i saw the Linux kernel source code for how the inode is handled.
I want to dig more on that. I am really interested in digging that code.
Can any one pls, suggest me the good tutorials for how to compile and partially (i mean taking only inode.c file alone and compile it). Also good tutorials for inode too.

Any help is appreciated...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do you find max filesize with inode information ?

How do you find the maximum file size with the following information -: A unix filesystem has 1024 bytes block size with 32-bit address. The i-node has 12 direct and 1 indirect, 1 double indirect, and 1 triple indirect addresses. What is the maximum file size it can access ? What is the... (1 Reply)
Discussion started by: sreyan32
1 Replies

2. Solaris

inode in solaris

Dear, How can i check inode information in my Solaris box? With Regards, Mjoshi (4 Replies)
Discussion started by: mjoshi87
4 Replies

3. UNIX for Dummies Questions & Answers

inode filename

can someone please tell me why is the filename not inlcuded in the inode of the file? (2 Replies)
Discussion started by: wowman
2 Replies

4. Programming

C++ application: how to access AIX process and cpu information?

Hi, may be this is an AIX noob question: my current C++ application runs on Linux and is quite memory consuming. Therefore, the application writes a logfile after it has finished containing memory information, CPU information, information on the running other processes besides my application... (0 Replies)
Discussion started by: DarthVader77
0 Replies

5. AIX

FS inode 58%

Hi Guys, I have this filesystem got big with inode: /dev/hd4 3670016 183664 95% 63705 58% /var I don't know why the system doesn't give alerts on this FS although it's 95% and why the inode is 58%. Any comments will be highly appreciated. Thanks, itik (1 Reply)
Discussion started by: itik
1 Replies

6. Solaris

about inode

how can i see inode table information of a perticler inode.anybody knows pls tell me. Than.Q (3 Replies)
Discussion started by: nag.mi2000
3 Replies

7. Red Hat

inode no and fd path

hi, can anyone please tell me where i can extract inode numbers and path associated with all file descriptors. i want these informations only. is there any system call or functions to get these things? i hav a RHEL 4. also /proc/pid/fd shows some file descriptor list. is that the proper path to... (1 Reply)
Discussion started by: sanjaykhuntia
1 Replies

8. Filesystems, Disks and Memory

Inode number

as kernel keeps track of user activities on a file by its INODE number and I node table . what is the structure of Inode table. and where does this Inode table mapped into?user space or kernel space? is the Inode Number is fixed for a file till its deletion? thanks (1 Reply)
Discussion started by: compbug
1 Replies

9. Shell Programming and Scripting

INode

hi i am nitin... jus a new kid on the block... my query is... does the concept of region invovle sharin of inodes wen the sticky it is set... eg... if two process share two text regions... wat actually happens thank u (1 Reply)
Discussion started by: nitinsharma_ssn
1 Replies

10. UNIX for Dummies Questions & Answers

file access inode update

When is a file "accessed" according to UNIX? For example: gzipping a file will not change the access time. (1 Reply)
Discussion started by: dangral
1 Replies
Login or Register to Ask a Question