rpmfi.h File Reference

File info set iterator API. More...

`#include <rpm/rpmtypes.h>`
`#include <rpm/rpmfiles.h>`
`#include <rpm/rpmarchive.h>`
Include dependency graph for rpmfi.h:

Go to the source code of this file.

## Functions

rpmfi | rpmfiLink (rpmfi fi)
| Reference a file info set iterator instance. More...
rpm_count_t | rpmfiFC (rpmfi fi)
| Return file count from file info set iterator. More...
int | rpmfiFX (rpmfi fi)
| Return current file index from file info set iterator. More...
int | rpmfiSetFX (rpmfi fi, int fx)
| Set current file index in file info set iterator. More...
rpm_count_t | rpmfiDC (rpmfi fi)
| Return directory count from file info set iterator. More...
int | rpmfiDX (rpmfi fi)
| Return current directory index from file info set iterator. More...
int | rpmfiSetDX (rpmfi fi, int dx)
| Set current directory index in file info set iterator. More...
const char * | rpmfiBN (rpmfi fi)
| Return current base name from file info set iterator. More...
const char * | rpmfiDN (rpmfi fi)
| Return current directory name from file info set iterator. More...
const char * | rpmfiFN (rpmfi fi)
| Return current file name from file info set iterator. More...
int | rpmfiFindFN (rpmfi fi, const char *fn)
| Return file index of the given file name or -1 if file is not in the rpmfi. More...
const char * | rpmfiOBN (rpmfi fi)
| Return current original base name from file info set iterator. More...
const char * | rpmfiODN (rpmfi fi)
| Return current original directory name from file info set iterator. More...
const char * | rpmfiOFN (rpmfi fi)
| Return current original file name from file info set iterator. More...
int | rpmfiFindOFN (rpmfi fi, const char *fn)
| Return file index of the given original file name or -1 if file is not in the rpmfi. More...
rpmfileAttrs | rpmfiFFlags (rpmfi fi)
| Return current file flags from file info set iterator. More...
rpmVerifyAttrs | rpmfiVFlags (rpmfi fi)
| Return current file verify flags from file info set iterator. More...
rpm_mode_t | rpmfiFMode (rpmfi fi)
| Return current file mode from file info set iterator. More...
rpmfileState | rpmfiFState (rpmfi fi)
| Return current file state from file info set iterator. More...
int | rpmfiDigestAlgo (rpmfi fi)
| Return digest algorithm of a file info set iterator. More...
const unsigned char * | rpmfiFDigest (rpmfi fi, int *algo, size_t *diglen)
| Return current file (binary) digest of file info set iterator. More...
char * | rpmfiFDigestHex (rpmfi fi, int *algo)
| Return current file (hex) digest of file info set iterator. More...
const unsigned char * | rpmfiFSignature (rpmfi fi, size_t *siglen)
| Return current file (binary) signature of file info set iterator. More...
const unsigned char * | rpmfiMD5 (rpmfi fi) RPM_GNUC_DEPRECATED
| Return current file (binary) md5 digest from file info set iterator. More...
const char * | rpmfiFLink (rpmfi fi)
| Return current file linkto (i.e. More...
rpm_loff_t | rpmfiFSize (rpmfi fi)
| Return current file size from file info set iterator. More...
rpm_rdev_t | rpmfiFRdev (rpmfi fi)
| Return current file rdev from file info set iterator. More...
rpm_ino_t | rpmfiFInode (rpmfi fi)
| Return current file inode from file info set iterator. More...
rpm_color_t | rpmfiColor (rpmfi fi)
| Return union of all file color bits from file info set iterator. More...
rpm_color_t | rpmfiFColor (rpmfi fi)
| Return current file color bits from file info set iterator. More...
const char * | rpmfiFClass (rpmfi fi)
| Return current file class from file info set iterator. More...
uint32_t | rpmfiFDepends (rpmfi fi, const uint32_t **fddictp)
| Return current file depends dictionary from file info set iterator. More...
uint32_t | rpmfiFNlink (rpmfi fi)
| Return (calculated) current file nlink count from file info set iterator. More...
uint32_t | rpmfiFLinks (rpmfi fi, const int **files)
| Return (calculated) current file nlink count from file info set iterator. More...
rpm_time_t | rpmfiFMtime (rpmfi fi)
| Return current file modify time from file info set iterator. More...
const char * | rpmfiFUser (rpmfi fi)
| Return current file owner from file info set iterator. More...
const char * | rpmfiFGroup (rpmfi fi)
| Return current file group from file info set iterator. More...
const char * | rpmfiFCaps (rpmfi fi)
| Return textual representation of current file capabilities from file info set iterator. More...
const char * | rpmfiFLangs (rpmfi fi)
| Return current file language(s) from file info set iterator. More...
int | rpmfiStat (rpmfi fi, int flags, struct stat *sb)
| Map file stat(2) info. More...
int | rpmfiNext (rpmfi fi)
| Return next file iterator index. More...
rpmfi | rpmfiInit (rpmfi fi, int fx)
| Initialize file iterator index. More...
int | rpmfiNextD (rpmfi fi)
| Return next directory iterator index. More...
rpmfi | rpmfiInitD (rpmfi fi, int dx)
| Initialize directory iterator index. More...
rpmfi | rpmfiFree (rpmfi fi)
| Destroy a file info set iterator. More...
rpmfi | rpmfiNewPool (rpmstrPool pool, Header h, rpmTagVal tagN, rpmfiFlags flags)
| Create and load a file info set iterator. More...
rpmfi | rpmfiNew (const rpmts ts, Header h, rpmTagVal tagN, rpmfiFlags flags)
| Create and load a file info set iterator. More...
rpmFileTypes | rpmfiWhatis (rpm_mode_t mode)
| Return file type from mode_t. More...
int | rpmfiCompare (const rpmfi afi, const rpmfi bfi)
| Return file info comparison. More...
RPM_GNUC_DEPRECATED rpmFileAction | rpmfiDecideFate (const rpmfi ofi, rpmfi nfi, int skipMissing)
| Return file disposition. More...
RPM_GNUC_DEPRECATED int | rpmfiConfigConflict (const rpmfi fi)
| Return whether file is conflicting config. More...

## Detailed Description

File info set iterator API.

Definition in file rpmfi.h.

## Function Documentation

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

Return current base name from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current base name, NULL on invalid

Referenced by fill_archive_entry().

rpm_color_t rpmfiColor | ( | rpmfi | fi | ) |

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

Parameters

  fi | file info set iterator

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

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

Return whether file is conflicting config.

Deprecated:

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 iterator.

Parameters

  fi | file info set iterator

Returns
  current directory count

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

Return file disposition.

Deprecated:

Parameters

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

Returns
  file disposition

int rpmfiDigestAlgo | ( | rpmfi | fi | ) |

Return digest algorithm of a file info set iterator.

Parameters

  fi | file info set iterator

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

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

Return current directory name from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current directory, NULL on invalid

Referenced by fill_archive_entry().

int rpmfiDX | ( | rpmfi | fi | ) |

Return current directory index from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current directory index

rpm_count_t rpmfiFC | ( | rpmfi | fi | ) |

Return file count from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file count

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

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

See cap_from_text(3) for details.

Parameters

  fi | file info set iterator

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

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

Return current file class from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file class, 0 on invalid

rpm_color_t rpmfiFColor | ( | rpmfi | fi | ) |

Return current file color bits from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file color

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

Return current file depends dictionary from file info set iterator.

Parameters

  fi | file info set iterator

Return values

  *fddictp | file depends dictionary array (or NULL)

Returns
  no. of file depends entries, 0 on invalid

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

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

Parameters

  fi | file info set iterator

Return values

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

Returns
  current file digest, NULL on invalid

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

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

The file info set iterator 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 iterator

Return values

  algo | digest hash algorithm 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 iterator.

Parameters

  fi | file info set iterator

Returns
  current file flags, 0 on invalid

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

Return current file group from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file group, NULL on invalid

Referenced by fill_archive_entry().

int rpmfiFindFN | ( | rpmfi | fi,
|  | const char * | fn
| ) |  |

Return file index of the given file name or -1 if file is not in the rpmfi.

The file name may have "." prefixed but is then interpreted as a global path without the prefixing "."

Parameters

  fi | file info set iterator
  fn | file name

Returns
  file index or -1

int rpmfiFindOFN | ( | rpmfi | fi,
|  | const char * | fn
| ) |  |

Return file index of the given original file name or -1 if file is not in the rpmfi.

The file name may have "." prefixed but is then interpreted as a global path without the prefixing "."

Parameters

  fi | file info set iterator
  fn | file name

Returns
  file index or -1

rpm_ino_t rpmfiFInode | ( | rpmfi | fi | ) |

Return current file inode from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file inode, 0 on invalid

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

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

Parameters

  fi | file info set iterator

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 iterator.

Parameters

  fi | file info set iterator

Returns
  current file linkto, NULL on invalid

Referenced by fill_archive_entry().

uint32_t rpmfiFLinks | ( | rpmfi | fi,
|  | const int ** | files
| ) |  |

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

Parameters

  fi | file info set iterator
  files | returns array of file ids hardlinked including ix, NULL for nlink count == 1

Returns
  current file nlink count, 0 on invalid

rpm_mode_t rpmfiFMode | ( | rpmfi | fi | ) |

Return current file mode from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file mode, 0 on invalid

Referenced by fill_archive_entry(), and process_package().

rpm_time_t rpmfiFMtime | ( | rpmfi | fi | ) |

Return current file modify time from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file modify time, 0 on invalid

Referenced by fill_archive_entry().

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

Return current file name from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file name

Referenced by process_package().

uint32_t rpmfiFNlink | ( | rpmfi | fi | ) |

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

Parameters

  fi | file info set iterator

Returns
  current file nlink count, 0 on invalid

Referenced by process_package().

rpm_rdev_t rpmfiFRdev | ( | rpmfi | fi | ) |

Return current file rdev from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file rdev, 0 on invalid

Referenced by fill_archive_entry().

rpmfi rpmfiFree | ( | rpmfi | fi | ) |

Destroy a file info set iterator.

Parameters

  fi | file info set iterator

Returns
  NULL always

Referenced by process_package().

const unsigned char* rpmfiFSignature | ( | rpmfi | fi,
|  | size_t * | siglen
| ) |  |

Return current file (binary) signature of file info set iterator.

Parameters

  fi | file info set iterator

Return values

  siglen | signature length (pass NULL to ignore)

Returns
  current file signature, NULL on invalid

rpm_loff_t rpmfiFSize | ( | rpmfi | fi | ) |

Return current file size from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file size, 0 on invalid

Referenced by fill_archive_entry(), and write_file_content().

rpmfileState rpmfiFState | ( | rpmfi | fi | ) |

Return current file state from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file state, 0 on invalid

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

Return current file owner from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file owner, NULL on invalid

Referenced by fill_archive_entry().

int rpmfiFX | ( | rpmfi | fi | ) |

Return current file index from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file index

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

Initialize file iterator index.

Parameters

  fi | file info set iterator
  fx | file iterator index

Returns
  file info set iterator

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

Initialize directory iterator index.

Parameters

  fi | file info set iterator
  dx | directory iterator index

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

rpmfi rpmfiLink | ( | rpmfi | fi | ) |

Reference a file info set iterator instance.

Parameters

  fi | file info set iterator

Returns
  new file info set iterator reference

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

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

Deprecated:
  Use rpmfiFDigest() instead

Parameters

  fi | file info set iterator

Returns
  current file md5 digest, NULL on invalid

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

Create and load a file info set iterator.

Parameters

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

Returns
  new file info set iterator

rpmfi rpmfiNewPool | ( | rpmstrPool | pool,
|  | Header | h,
|  | rpmTagVal | tagN,
|  | rpmfiFlags | flags
| ) |  |

Create and load a file info set iterator.

Parameters

  pool | shared string pool (or NULL for private pool)
  h | header
  tagN | unused
  flags | Flags to control what information is loaded.

Returns
  new file info set iterator

int rpmfiNext | ( | rpmfi | fi | ) |

Return next file iterator index.

Parameters

  fi | file info set iterator

Returns
  file iterator index, -1 on termination

Referenced by process_package().

int rpmfiNextD | ( | rpmfi | fi | ) |

Return next directory iterator index.

Parameters

  fi | file info set iterator

Returns
  directory iterator index, -1 on termination

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

Return current original base name from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current base name, NULL on invalid

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

Return current original directory name from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current directory, NULL on invalid

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

Return current original file name from file info set iterator.

Parameters

  fi | file info set iterator

Returns
  current file name

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

Set current directory index in file info set iterator.

Parameters

  fi | file info set iterator
  dx | new directory index

Returns
  current directory index

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

Set current file index in file info set iterator.

Parameters

  fi | file info set iterator
  fx | new file index

Returns
  current file index

int rpmfiStat | ( | rpmfi | fi,
|  | int | flags,
|  | struct stat * | sb
| ) |  |

Map file stat(2) info.

Parameters

  fi | file info iterator
  flags | flags

Return values

  sb | mapped stat(2) data

rpmVerifyAttrs rpmfiVFlags | ( | rpmfi | fi | ) |

Return current file verify flags from file info set iterator.

Parameters

  fi | file info set iterator

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