Inode Operations

David Schultz das at FreeBSD.ORG
Sat Aug 23 22:03:45 PDT 2003


On Sat, Aug 23, 2003, Tim Kientzle wrote:
> Right now, I'm storing the full pathname of each such
> file, but that is taking up a lot of memory, so I'm looking
> for a more compact approach.  It occurred to me that
> the device number/inode (as returned by stat(2)) is another
> way to uniquely identify a file.  As it turns out, I need to
> stat() everything anyway, so collecting such identifiers is easy.
> But, I can't find any system calls that actually use this information.
> 
> Question: Are there any system calls that allow you to
> access/modify a file based only on the device number/inode number?

You can't do that, and if you could, you would be able to subvert
access permissions on directories that otherwise prevented you
from accessing a file.  Also keep in mind that it is possible to
have a virtually limitless number of hard links to a file, so this
isn't something that can be easily changed.

Have you considered a more compact representation for your massive
list of files?  With a clever data structure, you should only need
to store a given pathname component once.


More information about the freebsd-hackers mailing list