FAT | XFS

getfileno()

PROTOTYPE

#include <posix.h>

uint32_t getfileno(const char *path);

DESCRIPTION

getfileno() is a non-standard routine that gets the File System User ID (FSUID) of the file specified by path. Paths starting with ‘/’ are absolute. Otherwise they are relative to the CWD. The FSUID can be used by getfname() or getpath() to retrieve either 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 it is unlikely the FSUID of a deleted file will be reused soon afterward. Files on different volumes can never have the same FSUID.

If successful, getfileno() returns a value between 0 and 0x0FFFFFFF. Otherwise, it sets errno and returns (uint32_t)-1.

ERROR CODES

EACCES No execute access to a directory in the path prefix.
EFAULT path equals NULL.
ENAMETOOLONG A name in path exceeds the effective maximum file name length.
ENOENT path is the empty string or includes a file that was not found.
ENOTDIR One of the non-leaf path components is not a directory.

EXAMPLE

/*---------------------------------------------------------------*/
/* Get handle to file's control information or meta data.        */
/*---------------------------------------------------------------*/
fileno = getfileno("flash/pictures/beach.jpg");
if (fileno == (uint32_t)-1)
{
  perror("getfileno() failed");
  return -1;
}