Re: Can i rely on inode numbers?
Re: Can i rely on inode numbers?
- Subject: Re: Can i rely on inode numbers?
- From: Jim Luther <email@hidden>
- Date: Fri, 11 Apr 2008 14:48:00 -0700
On Apr 11, 2008, at 2:47 AM, Quinn wrote:
At 11:25 +0200 11/4/08, Lutz Helwing wrote:
my question is if i can be sure that inode numbers definitely don't
change. Background is i want to keep a list of files but instead of
storing paths just keeping the inode numbers and to reference to
these files with the stored numbers.
Do you care if the inode numbers persist across unmount/remount? If
not, it's reasonable to assumes that the numbers persist; if a VFS
plug-in didn't maintain that invariant, all sorts of things would go
wrong.
OTOH, if you care about unmount/remount case, things get more
complex (-:
Actually, not all file systems guarantee that inodes don't change even
when a volume is mounted. For example, the smb file system generates
inode numbers with a hash function which uses the name and the parent
directory's inode number (which is based on a hash function which uses
its name and its parent directory's inode number, etc). So, name
changes cause inode number changes on smb volumes.
So, the best thing you can get with existing APIs are File Manager
nodeID. On file system volumes that support persistent nodeIDs, you
get support from the file system. On file system volumes that do not
support persistent nodeIDs, the File Manager create a nodeID and keeps
track of a file or directory's location as much as it can (files can
be moved, renamed, and replaced on remote servers and the File Manager
cannot detect that). So, at least these nodeID are good for while the
file system volume is mounted.
See FSGetCatalogInfo for getting a nodeID and FSResolveNodeID for
finding the current location of a nodeID in Files.h.
- Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden