Rich Freeman on 7 Aug 2012 08:39:20 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] UNIX File Equivalence


On Tue, Aug 7, 2012 at 11:32 AM,  <gary@duzan.org> wrote:
>    In C, check out the stat() family of system calls. It returns a "struct
> stat", and if the st_dev and st_ino values are the same, the file is
> the same.

That is a good solution.  In fact, I need to dig into it but I might
be getting a file descriptor for the file in which case the fstat
function should work well.  I could even create an index of the device
ids and inode numbers to use for my searches, which should be very
fast.

I just tested it on my system and it does work for bind mounts too.
Are there any filesystems that don't have inode numbers, or at least
which don't consistently make them up?  I don't think I'll need to
support this running on FAT32, but it does have to be fairly robust on
anything you could run a POSIX system off of.

Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug