ulyssesjason
ulyssesjason

Reputation: 21

How to get inode structure when knowing the "inode number"

I read the API of minix but still confused and failed to get the 'real' inode structure just with the inode number

We could only get "inode number" with "stat" structure, right? but after getting that number, is there any way to get corresponding inode structure?

Upvotes: 2

Views: 2228

Answers (1)

user149341
user149341

Reputation:

No, there is not. There is no way in most UNIX-based operating systems to look up any aspect of a file using only its inode number, and there is also no way to get the actual inode structure from the disk. (The latter is because the internal representation of an inode isn't guaranteed to be in any specific form. On some operating systems, like procfs on Linux, an inode may not even exist at all.)

The only thing that you're guaranteed to be able to use an inode number for on a UNIX-based OS is to determine that two files or hard links are identical.

Upvotes: 3

Related Questions