I'm looking for a way to get a file's inode on Linux and a file identity on Windows, or any other unique file identity as cross-platform as possible and more efficient than hashing file contents. Platforms are Linux,Windows,Mac.
The purpose of this is to be able track files as efficiently as possible so the program can locate them after the user has renamed or moved them. If I have a file path + file ID and the file is not at the path, I need a way to find the new file path on all mounted volumes (or fail if it has been deleted). Hashing all files is prohibitively expensive and creates a whole bunch of new error possibilities since files are going to be updated and renamed regularly.
I'm hoping there is an existing library but haven't found anything cross-platform yet. If there is none, I'd be very grateful for help on how to use syscalls in x/sys, and to hear about any limitations inodes and file identities have.