# File Info API.

## Typedefs
typedef enum rpmFileTypes_e | rpmFileTypes
| File types.
typedef enum rpmFileAction_e | rpmFileAction
| File disposition(s) during package install/erase transaction.
## Enumerations
enum | rpmFileTypes_e { PIPE = 1, CDEV = 2, XDIR = 4, BDEV = 6, REG = 8, LINK = 10, SOCK = 12 }
| File types. More...
enum | rpmFileAction_e { FA_UNKNOWN = 0, FA_CREATE, FA_COPYIN, FA_COPYOUT, FA_BACKUP, FA_SAVE, FA_SKIP, FA_ALTNAME, FA_ERASE, FA_SKIPNSTATE, FA_SKIPNETSHARED, FA_SKIPCOLOR }
| File disposition(s) during package install/erase transaction. More...
## Functions
rpmfi | rpmfiUnlink (rpmfi fi, const char *msg)
| Unreference a file info set instance.
rpmfi | rpmfiLink (rpmfi fi, const char *msg)
| Reference a file info set instance.
rpm_count_t | rpmfiFC (rpmfi fi)
| Return file count from file info set.
int | rpmfiFX (rpmfi fi)
| Return current file index from file info set.
int | rpmfiSetFX (rpmfi fi, int fx)
| Set current file index in file info set.
rpm_count_t | rpmfiDC (rpmfi fi)
| Return directory count from file info set.
int | rpmfiDX (rpmfi fi)
| Return current directory index from file info set.
int | rpmfiSetDX (rpmfi fi, int dx)
| Set current directory index in file info set.
const char * | rpmfiBN (rpmfi fi)
| Return current base name from file info set.
const char * | rpmfiDN (rpmfi fi)
| Return current directory name from file info set.
const char * | rpmfiFN (rpmfi fi)
| Return current file name from file info set.
rpmfileAttrs | rpmfiFFlags (rpmfi fi)
| Return current file flags from file info set.
rpmVerifyAttrs | rpmfiVFlags (rpmfi fi)
| Return current file verify flags from file info set.
rpm_mode_t | rpmfiFMode (rpmfi fi)
| Return current file mode from file info set.
rpmfileState | rpmfiFState (rpmfi fi)
| Return current file state from file info set.
pgpHashAlgo | rpmfiDigestAlgo (rpmfi fi)
| Return digest algorithm of a file info set.
const unsigned char * | rpmfiFDigest (rpmfi fi, pgpHashAlgo *algo, size_t *diglen)
| Return current file (binary) digest of file info set.
char * | rpmfiFDigestHex (rpmfi fi, pgpHashAlgo *algo)
| Return current file (hex) digest of file info set.
const unsigned char * | rpmfiMD5 (rpmfi fi)
| Return current file (binary) md5 digest from file info set.
const char * | rpmfiFLink (rpmfi fi)
| Return current file linkto (i.e.
rpm_loff_t | rpmfiFSize (rpmfi fi)
| Return current file size from file info set.
rpm_rdev_t | rpmfiFRdev (rpmfi fi)
| Return current file rdev from file info set.
rpm_ino_t | rpmfiFInode (rpmfi fi)
| Return current file inode from file info set.
rpm_color_t | rpmfiColor (rpmfi fi)
| Return union of all file color bits from file info set.
rpm_color_t | rpmfiFColor (rpmfi fi)
| Return current file color bits from file info set.
const char * | rpmfiFClass (rpmfi fi)
| Return current file class from file info set.
uint32_t | rpmfiFDepends (rpmfi fi, const uint32_t **fddictp)
| Return current file depends dictionary from file info set.
uint32_t | rpmfiFNlink (rpmfi fi)
| Return (calculated) current file nlink count from file info set.
rpm_time_t | rpmfiFMtime (rpmfi fi)
| Return current file modify time from file info set.
const char * | rpmfiFUser (rpmfi fi)
| Return current file owner from file info set.
const char * | rpmfiFGroup (rpmfi fi)
| Return current file group from file info set.
const char * | rpmfiFCaps (rpmfi fi)
| Return textual representation of current file capabilities from file info set.
const char * | rpmfiFLangs (rpmfi fi)
| Return current file language(s) from file info set.
int | rpmfiNext (rpmfi fi)
| Return next file iterator index.
rpmfi | rpmfiInit (rpmfi fi, int fx)
| Initialize file iterator index.
int | rpmfiNextD (rpmfi fi)
| Return next directory iterator index.
rpmfi | rpmfiInitD (rpmfi fi, int dx)
| Initialize directory iterator index.
rpmfi | rpmfiFree (rpmfi fi)
| Destroy a file info set.
rpmfi | rpmfiNew (const rpmts ts, Header h, rpmTag tagN, rpmfiFlags flags)
| Create and load a file info set.
rpmFileTypes | rpmfiWhatis (rpm_mode_t mode)
| Return file type from mode_t.
int | rpmfiCompare (const rpmfi afi, const rpmfi bfi)
| Return file info comparison.
rpmFileAction | rpmfiDecideFate (const rpmfi ofi, rpmfi nfi, int skipMissing)
| Return file disposition.
int | rpmfiConfigConflict (const rpmfi fi)
| Return whether file is conflicting config.

## Typedef Documentation

typedef enum rpmFileAction_e rpmFileAction

File disposition(s) during package install/erase transaction.

typedef enum rpmFileTypes_e rpmFileTypes

File types.

These are the file types used internally by rpm. The file type is determined by applying stat(2) macros like S_ISDIR to the file mode tag from a header. The values are arbitrary, but are identical to the linux stat(2) file types.

## Enumeration Type Documentation

enum rpmFileAction_e

File disposition(s) during package install/erase transaction.

Enumerator:

  FA_UNKNOWN | initial action for file ...
  FA_CREATE | ... copy in from payload.
  FA_COPYIN | ... copy in from payload.
  FA_COPYOUT | ... copy out to payload.
  FA_BACKUP | ... renamed with ".rpmorig" extension.
  FA_SAVE | ... renamed with ".rpmsave" extension.
  FA_SKIP | ... already replaced, don't remove.
  FA_ALTNAME | ... create with ".rpmnew" extension.
  FA_ERASE | ... to be removed.
  FA_SKIPNSTATE | ... untouched, state "not installed".
  FA_SKIPNETSHARED | ... untouched, state "netshared".
  FA_SKIPCOLOR | ... untouched, state "wrong color".

Definition at line 73 of file rpmfi.h.

enum rpmFileTypes_e

File types.

These are the file types used internally by rpm. The file type is determined by applying stat(2) macros like S_ISDIR to the file mode tag from a header. The values are arbitrary, but are identical to the linux stat(2) file types.

Enumerator:

  PIPE | pipe/fifo
  CDEV | character device
  XDIR | directory
  BDEV | block device
  REG | regular file
  LINK | hard link
  SOCK | socket

Definition at line 26 of file rpmfi.h.

## Function Documentation

const char* rpmfiBN | ( | rpmfi | fi | ) |

Return current base name from file info set.

Parameters:

  | fi | file info set

Returns:
  current base name, NULL on invalid

rpm_color_t rpmfiColor | ( | rpmfi | fi | ) |

Return union of all file color bits from file info set.

Parameters:

  | fi | file info set

Returns:
  current color

int rpmfiCompare | ( | const rpmfi | afi,
|  | const rpmfi | bfi |
| ) |  |  |

Return file info comparison.

Parameters:

  | afi | 1st file info
  | bfi | 2nd file info

Returns:
  0 if identical

int rpmfiConfigConflict | ( | const rpmfi | fi | ) |

Return whether file is conflicting config.

Parameters:

  | fi | file info

Returns:
  1 if config file and file on disk conflicts

rpm_count_t rpmfiDC | ( | rpmfi | fi | ) |

Return directory count from file info set.

Parameters:

  | fi | file info set

Returns:
  current directory count

rpmFileAction rpmfiDecideFate | ( | const rpmfi | ofi,
|  | rpmfi | nfi,
|  | int | skipMissing |
| ) |  |  |

Return file disposition.

Parameters:

  | ofi | old file info
  | nfi | new file info
  | skipMissing | OK to skip missing files?

Returns:
  file dispostion

pgpHashAlgo rpmfiDigestAlgo | ( | rpmfi | fi | ) |

Return digest algorithm of a file info set.

Parameters:

  | fi | file info set

Returns:
  digest algorithm of file info set, 0 on invalid

const char* rpmfiDN | ( | rpmfi | fi | ) |

Return current directory name from file info set.

Parameters:

  | fi | file info set

Returns:
  current directory, NULL on invalid

int rpmfiDX | ( | rpmfi | fi | ) |

Return current directory index from file info set.

Parameters:

  | fi | file info set

Returns:
  current directory index

rpm_count_t rpmfiFC | ( | rpmfi | fi | ) |

Return file count from file info set.

Parameters:

  | fi | file info set

Returns:
  current file count

const char* rpmfiFCaps | ( | rpmfi | fi | ) |

Return textual representation of current file capabilities from file info set.

See cap_from_text(3) for details.

Parameters:

  | fi | file info set

Returns:
  file capability description, "" for no capabilities and NULL on invalid

const char* rpmfiFClass | ( | rpmfi | fi | ) |

Return current file class from file info set.

Parameters:

  | fi | file info set

Returns:
  current file class, 0 on invalid

rpm_color_t rpmfiFColor | ( | rpmfi | fi | ) |

Return current file color bits from file info set.

Parameters:

  | fi | file info set

Returns:
  current file color

uint32_t rpmfiFDepends | ( | rpmfi | fi,
|  | const uint32_t ** | fddictp |
| ) |  |  |

Return current file depends dictionary from file info set.

Parameters:

  | fi | file info set

Return values:

  | *fddictp | file depends dictionary array (or NULL)

Returns:
  no. of file depends entries, 0 on invalid

const unsigned char* rpmfiFDigest | ( | rpmfi | fi,
|  | pgpHashAlgo * | algo,
|  | size_t * | diglen |
| ) |  |  |

Return current file (binary) digest of file info set.

Parameters:

  | fi | file info set

Return values:

  | algo | digest hash algoritm used (pass NULL to ignore)
  | diglen | digest hash length (pass NULL to ignore)

Returns:
  current file digest, NULL on invalid

char* rpmfiFDigestHex | ( | rpmfi | fi,
|  | pgpHashAlgo * | algo |
| ) |  |  |

Return current file (hex) digest of file info set.

The file info set stores file digests in binary format to conserve memory, this converts the binary data back to hex presentation used in headers.

Parameters:

  | fi | file info set

Return values:

  | algo | digest hash algoritm used (pass NULL to ignore)

Returns:
  current file digest (malloc'ed), NULL on invalid

rpmfileAttrs rpmfiFFlags | ( | rpmfi | fi | ) |

Return current file flags from file info set.

Parameters:

  | fi | file info set

Returns:
  current file flags, 0 on invalid

const char* rpmfiFGroup | ( | rpmfi | fi | ) |

Return current file group from file info set.

Parameters:

  | fi | file info set

Returns:
  current file group, NULL on invalid

rpm_ino_t rpmfiFInode | ( | rpmfi | fi | ) |

Return current file inode from file info set.

Parameters:

  | fi | file info set

Returns:
  current file inode, 0 on invalid

const char* rpmfiFLangs | ( | rpmfi | fi | ) |

Return current file language(s) from file info set.

Parameters:

  | fi | file info set

Returns:
  current file language(s), NULL on invalid

const char* rpmfiFLink | ( | rpmfi | fi | ) |

Return current file linkto (i.e.

symlink(2) target) from file info set.

Parameters:

  | fi | file info set

Returns:
  current file linkto, NULL on invalid

rpm_mode_t rpmfiFMode | ( | rpmfi | fi | ) |

Return current file mode from file info set.

Parameters:

  | fi | file info set

Returns:
  current file mode, 0 on invalid

rpm_time_t rpmfiFMtime | ( | rpmfi | fi | ) |

Return current file modify time from file info set.

Parameters:

  | fi | file info set

Returns:
  current file modify time, 0 on invalid

const char* rpmfiFN | ( | rpmfi | fi | ) |

Return current file name from file info set.

Parameters:

  | fi | file info set

Returns:
  current file name

uint32_t rpmfiFNlink | ( | rpmfi | fi | ) |

Return (calculated) current file nlink count from file info set.

Parameters:

  | fi | file info set

Returns:
  current file nlink count, 0 on invalid

rpm_rdev_t rpmfiFRdev | ( | rpmfi | fi | ) |

Return current file rdev from file info set.

Parameters:

  | fi | file info set

Returns:
  current file rdev, 0 on invalid

rpmfi rpmfiFree | ( | rpmfi | fi | ) |

Destroy a file info set.

Parameters:

  | fi | file info set

Returns:
  NULL always

rpm_loff_t rpmfiFSize | ( | rpmfi | fi | ) |

Return current file size from file info set.

Parameters:

  | fi | file info set

Returns:
  current file size, 0 on invalid

rpmfileState rpmfiFState | ( | rpmfi | fi | ) |

Return current file state from file info set.

Parameters:

  | fi | file info set

Returns:
  current file state, 0 on invalid

const char* rpmfiFUser | ( | rpmfi | fi | ) |

Return current file owner from file info set.

Parameters:

  | fi | file info set

Returns:
  current file owner, NULL on invalid

int rpmfiFX | ( | rpmfi | fi | ) |

Return current file index from file info set.

Parameters:

  | fi | file info set

Returns:
  current file index

rpmfi rpmfiInit | ( | rpmfi | fi,
|  | int | fx |
| ) |  |  |

Initialize file iterator index.

Parameters:

  | fi | file info set
  | fx | file iterator index

Returns:
  file info set

rpmfi rpmfiInitD | ( | rpmfi | fi,
|  | int | dx |
| ) |  |  |

Initialize directory iterator index.

Parameters:

  | fi | file info set
  | dx | directory iterator index

Returns:
  file info set, NULL if dx is out of range

rpmfi rpmfiLink | ( | rpmfi | fi,
|  | const char * | msg |
| ) |  |  |

Reference a file info set instance.

Parameters:

  | fi | file info set
  | msg |

Returns:
  new file info set reference

const unsigned char* rpmfiMD5 | ( | rpmfi | fi | ) |

Return current file (binary) md5 digest from file info set.

Deprecated:
  Use rpmfiFDigest() instead

Parameters:

  | fi | file info set

Returns:
  current file md5 digest, NULL on invalid

rpmfi rpmfiNew | ( | const rpmts | ts,
|  | Header | h,
|  | rpmTag | tagN,
|  | rpmfiFlags | flags |
| ) |  |  |

Create and load a file info set.

Parameters:

  | ts | unused
  | h | header
  | tagN | unused
  | flags | Flags to control what information is loaded.

Returns:
  new file info set

int rpmfiNext | ( | rpmfi | fi | ) |

Return next file iterator index.

Parameters:

  | fi | file info set

Returns:
  file iterator index, -1 on termination

int rpmfiNextD | ( | rpmfi | fi | ) |

Return next directory iterator index.

Parameters:

  | fi | file info set

Returns:
  directory iterator index, -1 on termination

int rpmfiSetDX | ( | rpmfi | fi,
|  | int | dx |
| ) |  |  |

Set current directory index in file info set.

Parameters:

  | fi | file info set
  | dx | new directory index

Returns:
  current directory index

int rpmfiSetFX | ( | rpmfi | fi,
|  | int | fx |
| ) |  |  |

Set current file index in file info set.

Parameters:

  | fi | file info set
  | fx | new file index

Returns:
  current file index

rpmfi rpmfiUnlink | ( | rpmfi | fi,
|  | const char * | msg |
| ) |  |  |

Unreference a file info set instance.

Parameters:

  | fi | file info set
  | msg |

Returns:
  NULL always

rpmVerifyAttrs rpmfiVFlags | ( | rpmfi | fi | ) |

Return current file verify flags from file info set.

Parameters:

  | fi | file info set

Returns:
  current file verify flags, 0 on invalid

rpmFileTypes rpmfiWhatis | ( | rpm_mode_t | mode | ) |

Return file type from mode_t.

Parameters:

  | mode | file mode bits (from header)

Returns:
  file type