rpm  4.14.0
Typedefs | Enumerations | Functions
File Info Set API.

File Info Set API. More...

Typedefs

typedef enum rpmFileTypes_e rpmFileTypes
 File types. More...
 
typedef enum rpmFileAction_e rpmFileAction
 File disposition(s) during package install/erase transaction. More...
 

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 = 1, FA_COPYIN = 2, FA_COPYOUT = 3,
  FA_BACKUP = 4, FA_SAVE = 5, FA_SKIP = 6, FA_ALTNAME = 7,
  FA_ERASE = 8, FA_SKIPNSTATE = 9, FA_SKIPNETSHARED = 10, FA_SKIPCOLOR = 11,
  FA_TOUCH = 12
}
 File disposition(s) during package install/erase transaction. More...
 

Functions

rpmfiles rpmfilesNew (rpmstrPool pool, Header h, rpmTagVal tagN, rpmfiFlags flags)
 Create and load a file info set. More...
 
rpmfiles rpmfilesLink (rpmfiles fi)
 Reference a file info set instance. More...
 
rpmfiles rpmfilesFree (rpmfiles fi)
 Destroy a file info set. More...
 
rpm_count_t rpmfilesFC (rpmfiles fi)
 Return file count from file info set. More...
 
rpm_count_t rpmfilesDC (rpmfiles fi)
 Return directory count from file info set. More...
 
int rpmfilesFindFN (rpmfiles files, const char *fn)
 Return file index of the given file name or -1 if file is not in the rpmfi. More...
 
int rpmfilesFindOFN (rpmfiles files, const char *fn)
 Return file index of the given original file name or -1 if file is not in the rpmfi. More...
 
int rpmfilesDigestAlgo (rpmfiles fi)
 Return digest algorithm of a file info set. More...
 
rpm_color_t rpmfilesColor (rpmfiles files)
 Return union of all file color bits from file info set. More...
 
int rpmfilesCompare (rpmfiles afi, int aix, rpmfiles bfi, int bix)
 Return file info comparison. More...
 
const char * rpmfilesBN (rpmfiles fi, int ix)
 Return base name from file info set. More...
 
const char * rpmfilesDN (rpmfiles fi, int jx)
 Return directory name from file info set. More...
 
int rpmfilesDI (rpmfiles fi, int ix)
 Return directory index from file info set. More...
 
char * rpmfilesFN (rpmfiles fi, int ix)
 Return file name from file info set. More...
 
int rpmfilesODI (rpmfiles fi, int ix)
 Return original directory index from file info set. More...
 
const char * rpmfilesOBN (rpmfiles fi, int ix)
 Return original base name from file info set. More...
 
const char * rpmfilesODN (rpmfiles fi, int jx)
 Return original directory name from file info set. More...
 
char * rpmfilesOFN (rpmfiles fi, int ix)
 Return original file name from file info set. More...
 
rpmVerifyAttrs rpmfilesVFlags (rpmfiles fi, int ix)
 Return file verify flags from file info set. More...
 
rpmfileState rpmfilesFState (rpmfiles fi, int ix)
 Return file state from file info set. More...
 
const char * rpmfilesFLink (rpmfiles fi, int ix)
 Return file linkto (i.e. More...
 
rpm_loff_t rpmfilesFSize (rpmfiles fi, int ix)
 Return file size from file info set. More...
 
rpm_color_t rpmfilesFColor (rpmfiles fi, int ix)
 Return file color bits from file info set. More...
 
const char * rpmfilesFClass (rpmfiles fi, int ix)
 Return file class from file info set. More...
 
uint32_t rpmfilesFDepends (rpmfiles fi, int ix, const uint32_t **fddictp)
 Return file depends dictionary from file info set. More...
 
uint32_t rpmfilesFNlink (rpmfiles fi, int ix)
 Return (calculated) file nlink count from file info set. More...
 
uint32_t rpmfilesFLinks (rpmfiles fi, int ix, const int **files)
 Return (calculated) file nlink count from file info set. More...
 
const char * rpmfilesFLangs (rpmfiles fi, int ix)
 Return file language(s) from file info set. More...
 
rpmfileAttrs rpmfilesFFlags (rpmfiles fi, int ix)
 Return file flags from file info set. More...
 
rpm_mode_t rpmfilesFMode (rpmfiles fi, int ix)
 Return file mode from file info set. More...
 
const unsigned char * rpmfilesFDigest (rpmfiles fi, int ix, int *algo, size_t *len)
 Return file (binary) digest of file info set. More...
 
const unsigned char * rpmfilesFSignature (rpmfiles fi, int ix, size_t *len)
 Return file (binary) digest of file info set. More...
 
rpm_rdev_t rpmfilesFRdev (rpmfiles fi, int ix)
 Return file rdev from file info set. More...
 
rpm_ino_t rpmfilesFInode (rpmfiles fi, int ix)
 Return file inode from file info set. More...
 
rpm_time_t rpmfilesFMtime (rpmfiles fi, int ix)
 Return file modify time from file info set. More...
 
const char * rpmfilesFUser (rpmfiles fi, int ix)
 Return file owner from file info set. More...
 
const char * rpmfilesFGroup (rpmfiles fi, int ix)
 Return file group from file info set. More...
 
const char * rpmfilesFCaps (rpmfiles fi, int ix)
 Return textual representation of file capabilities from file info set. More...
 
rpmVerifyAttrs rpmfilesVerify (rpmfiles fi, int ix, rpmVerifyAttrs omitMask)
 Verify file attributes (including digest). More...
 

Detailed Description

File Info Set API.

Typedef Documentation

◆ rpmFileAction

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

◆ 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

◆ rpmFileAction_e

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

Enumerator
FA_UNKNOWN 

initial action for file ...

FA_CREATE 

... create from payload.

FA_COPYIN 

obsolete, unused.

FA_COPYOUT 

obsolete, unused.

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

FA_TOUCH 

... change metadata only.

Definition at line 72 of file rpmfiles.h.

◆ 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 23 of file rpmfiles.h.

Function Documentation

◆ rpmfilesBN()

const char* rpmfilesBN ( rpmfiles  fi,
int  ix 
)

Return base name from file info set.

Parameters
fifile info set
ixfile index
Returns
base name, NULL on invalid

◆ rpmfilesColor()

rpm_color_t rpmfilesColor ( rpmfiles  files)

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

Parameters
filesfile info set
Returns
color

◆ rpmfilesCompare()

int rpmfilesCompare ( rpmfiles  afi,
int  aix,
rpmfiles  bfi,
int  bix 
)

Return file info comparison.

Parameters
afi1st file info
aixindex of the 1st file
bfi2nd file info
bixindex of the 2nd file
Returns
0 if identical

◆ rpmfilesDC()

rpm_count_t rpmfilesDC ( rpmfiles  fi)

Return directory count from file info set.

Parameters
fifile info set
Returns
directory count

◆ rpmfilesDI()

int rpmfilesDI ( rpmfiles  fi,
int  ix 
)

Return directory index from file info set.

Parameters
fifile info set
ixfile index
Returns
directory index, -1 on invalid

◆ rpmfilesDigestAlgo()

int rpmfilesDigestAlgo ( rpmfiles  fi)

Return digest algorithm of a file info set.

Parameters
fifile info set
Returns
digest algorithm of file info set, 0 on invalid

◆ rpmfilesDN()

const char* rpmfilesDN ( rpmfiles  fi,
int  jx 
)

Return directory name from file info set.

Note the index is on distinct directories within the file set, not a file index. The directory index associated with a given file index can be retrieved with rpmfilesDI(). Ie to constuct the full path of file index X you'd catenate the results of rpmfilesDN(f, rpmfilesDI(f, X)) and rpmfilesBN(f, X).

Parameters
fifile info set
jxdirectory index
Returns
directory, NULL on invalid

◆ rpmfilesFC()

rpm_count_t rpmfilesFC ( rpmfiles  fi)

Return file count from file info set.

Parameters
fifile info set
Returns
file count

◆ rpmfilesFCaps()

const char* rpmfilesFCaps ( rpmfiles  fi,
int  ix 
)

Return textual representation of file capabilities from file info set.

See cap_from_text(3) for details.

Parameters
fifile info set
ixfile index
Returns
file capability description, "" for no capabilities and NULL on invalid

◆ rpmfilesFClass()

const char* rpmfilesFClass ( rpmfiles  fi,
int  ix 
)

Return file class from file info set.

Parameters
fifile info set
ixfile index
Returns
file class, 0 on invalid

◆ rpmfilesFColor()

rpm_color_t rpmfilesFColor ( rpmfiles  fi,
int  ix 
)

Return file color bits from file info set.

Parameters
fifile info set
ixfile index
Returns
file color

◆ rpmfilesFDepends()

uint32_t rpmfilesFDepends ( rpmfiles  fi,
int  ix,
const uint32_t **  fddictp 
)

Return file depends dictionary from file info set.

Parameters
fifile info set
ixfile index
Return values
*fddictpfile depends dictionary array (or NULL)
Returns
no. of file depends entries, 0 on invalid

◆ rpmfilesFDigest()

const unsigned char* rpmfilesFDigest ( rpmfiles  fi,
int  ix,
int *  algo,
size_t *  len 
)

Return file (binary) digest of file info set.

Parameters
fifile info set
ixfile index
Return values
algodigest hash algorithm used (pass NULL to ignore)
lendigest hash length (pass NULL to ignore)
Returns
file digest, NULL on invalid

◆ rpmfilesFFlags()

rpmfileAttrs rpmfilesFFlags ( rpmfiles  fi,
int  ix 
)

Return file flags from file info set.

Parameters
fifile info set
ixfile index
Returns
file flags, 0 on invalid

◆ rpmfilesFGroup()

const char* rpmfilesFGroup ( rpmfiles  fi,
int  ix 
)

Return file group from file info set.

Parameters
fifile info set
ixfile index
Returns
file group, NULL on invalid

◆ rpmfilesFindFN()

int rpmfilesFindFN ( rpmfiles  files,
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
filesfile info set
fnfile name
Returns
file index or -1

◆ rpmfilesFindOFN()

int rpmfilesFindOFN ( rpmfiles  files,
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
filesfile info set
fnfile name
Returns
file index or -1

◆ rpmfilesFInode()

rpm_ino_t rpmfilesFInode ( rpmfiles  fi,
int  ix 
)

Return file inode from file info set.

Parameters
fifile info set
ixfile index
Returns
file inode, 0 on invalid

◆ rpmfilesFLangs()

const char* rpmfilesFLangs ( rpmfiles  fi,
int  ix 
)

Return file language(s) from file info set.

Parameters
fifile info set
ixfile index
Returns
file language(s), NULL on invalid

◆ rpmfilesFLink()

const char* rpmfilesFLink ( rpmfiles  fi,
int  ix 
)

Return file linkto (i.e.

symlink(2) target) from file info set.

Parameters
fifile info set
ixfile index
Returns
file linkto, NULL on invalid

◆ rpmfilesFLinks()

uint32_t rpmfilesFLinks ( rpmfiles  fi,
int  ix,
const int **  files 
)

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

Parameters
fifile info set
ixfile index
filesreturns array of file ids hardlinked including ix, NULL for nlink count == 1
Returns
file nlink count, 0 on invalid

◆ rpmfilesFMode()

rpm_mode_t rpmfilesFMode ( rpmfiles  fi,
int  ix 
)

Return file mode from file info set.

Parameters
fifile info set
ixfile index
Returns
file mode, 0 on invalid

◆ rpmfilesFMtime()

rpm_time_t rpmfilesFMtime ( rpmfiles  fi,
int  ix 
)

Return file modify time from file info set.

Parameters
fifile info set
ixfile index
Returns
file modify time, 0 on invalid

◆ rpmfilesFN()

char* rpmfilesFN ( rpmfiles  fi,
int  ix 
)

Return file name from file info set.

Parameters
fifile info set
ixfile index
Returns
file name (malloced)

◆ rpmfilesFNlink()

uint32_t rpmfilesFNlink ( rpmfiles  fi,
int  ix 
)

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

Parameters
fifile info set
ixfile index
Returns
file nlink count, 0 on invalid

◆ rpmfilesFRdev()

rpm_rdev_t rpmfilesFRdev ( rpmfiles  fi,
int  ix 
)

Return file rdev from file info set.

Parameters
fifile info set
ixfile index
Returns
file rdev, 0 on invalid

◆ rpmfilesFree()

rpmfiles rpmfilesFree ( rpmfiles  fi)

Destroy a file info set.

Parameters
fifile info set
Returns
NULL always

◆ rpmfilesFSignature()

const unsigned char* rpmfilesFSignature ( rpmfiles  fi,
int  ix,
size_t *  len 
)

Return file (binary) digest of file info set.

Parameters
fifile info set
ixfile index
Return values
lensignature length (pass NULL to ignore)
Returns
file signature, NULL on invalid

◆ rpmfilesFSize()

rpm_loff_t rpmfilesFSize ( rpmfiles  fi,
int  ix 
)

Return file size from file info set.

Parameters
fifile info set
ixfile index
Returns
file size, 0 on invalid

◆ rpmfilesFState()

rpmfileState rpmfilesFState ( rpmfiles  fi,
int  ix 
)

Return file state from file info set.

Parameters
fifile info set
ixfile index
Returns
file state, 0 on invalid

◆ rpmfilesFUser()

const char* rpmfilesFUser ( rpmfiles  fi,
int  ix 
)

Return file owner from file info set.

Parameters
fifile info set
ixfile index
Returns
file owner, NULL on invalid

◆ rpmfilesLink()

rpmfiles rpmfilesLink ( rpmfiles  fi)

Reference a file info set instance.

Parameters
fifile info set
Returns
new file info set reference

◆ rpmfilesNew()

rpmfiles rpmfilesNew ( rpmstrPool  pool,
Header  h,
rpmTagVal  tagN,
rpmfiFlags  flags 
)

Create and load a file info set.

Parameters
poolshared string pool (or NULL for private pool)
hheader
tagNunused
flagsFlags to control what information is loaded.
Returns
new file info set

◆ rpmfilesOBN()

const char* rpmfilesOBN ( rpmfiles  fi,
int  ix 
)

Return original base name from file info set.

Parameters
fifile info set
ixfile index
Returns
base name, NULL on invalid

◆ rpmfilesODI()

int rpmfilesODI ( rpmfiles  fi,
int  ix 
)

Return original directory index from file info set.

Parameters
fifile info set
ixfile index
Returns
directory index, -1 on invalid

◆ rpmfilesODN()

const char* rpmfilesODN ( rpmfiles  fi,
int  jx 
)

Return original directory name from file info set.

Note the index is on distinct directories within the file set, not a file index. The directory index associated with a given file index can be retrieved with rpmfilesODI(). Ie to constuct the full path of file index X you'd catenate the results of rpmfilesODN(f, rpmfilesODI(f, X)) and rpmfilesOBN(f, X).

Parameters
fifile info set
jxdirectory index
Returns
directory, NULL on invalid

◆ rpmfilesOFN()

char* rpmfilesOFN ( rpmfiles  fi,
int  ix 
)

Return original file name from file info set.

Parameters
fifile info set
ixfile index
Returns
file name

◆ rpmfilesVerify()

rpmVerifyAttrs rpmfilesVerify ( rpmfiles  fi,
int  ix,
rpmVerifyAttrs  omitMask 
)

Verify file attributes (including digest).

Parameters
fifile info set
ixfile index
omitMaskbit(s) to disable verify checks
Returns
bit(s) to indicate failure (ie 0 for passed verify)

◆ rpmfilesVFlags()

rpmVerifyAttrs rpmfilesVFlags ( rpmfiles  fi,
int  ix 
)

Return file verify flags from file info set.

Parameters
fifile info set
ixfile index
Returns
file verify flags, 0 on invalid