FAT | XFS

fid2fileno()

PROTOTYPE

#include <posix.h>

uint32_t fid2fileno(int fid);

DESCRIPTION

fid2fileno() is a non-standard routine that returns the File System User ID (FSUID) of the open file specified by fid. The FSUID can be used by getfname() or getpath() to retrieve the file’s leaf or full path name, respectively.

FSUIDs are assigned at file creation and unchanged thereafter. No two existing files will have the same FSUID and the FSUID of a deleted file is unlikely to be reused soon afterward. Files on different fixed volumes can never have the same FSUID. Files on removable volumes are very unlikely to have the same FSUIDs as a past removed volume.

If successful, fid2fileno() returns an FSUID, whose value between 0 and 0x0FFFFFFF. Otherwise, it sets errno and returns (uint32_t).

ERROR CODES

EBADF fid is not the descriptor of an open file.

EXAMPLE

/*---------------------------------------------------------------*/
/* Get handle to file's control information or meta data.        */
/*---------------------------------------------------------------*/
fileno = fid2fileno(fid);
if (fileno == (uint32_t)-1)
{
  perror("error trying to read file's FSUID");
  return -1;
}