Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Aug 2003 22:03:51 -0700
From:      David Schultz <das@FreeBSD.ORG>
To:        Tim Kientzle <kientzle@acm.org>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Inode Operations
Message-ID:  <20030824050351.GA13726@HAL9000.homeunix.com>
In-Reply-To: <3F4828F5.8090207@acm.org>
References:  <3F4828F5.8090207@acm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030824050351.GA13726>