Search code examples
iphoneobjective-cios4attributesnsfilemanager

will NSFileSystemFileNumber in iOS always be unique?


When using attributesOfItemAtPath:error:, is NSFileSystemFileNumber always guaranteed to be unique for the device?

For example, I have a file with a certain NSFileSystemFileNumber, but a few days later I delete this file. If I create another file later on, is it possible that this new file can ever re-use the other file's NSFileSystemFileNumber, or will the NSFileSystemFileNumber always be unique?

Thanks!


Solution

  • NSFileManager Class Reference

    NSFileSystemFileNumber

    The key in a file attribute dictionary whose value indicates the file's filesystem file number. The corresponding value is an NSNumber object containing an unsigned long. The value corresponds to the value of st_ino, as returned by stat(2).

    man 2 stat
    

    ino_t st_ino; /* inode's number */

    So this is an inode number. I believe inode can be reused by filesystem after original file is deleted.