# lib/rpmfc.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines

#define | RPMFC_ELF (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFMIPSN32)
#define | rpmfcUnlink(_fc) ((rpmfc)rpmioUnlinkPoolItem((rpmioItem)(_fc), __FUNCTION__, __FILE__, __LINE__))
#define | rpmfcLink(_fc) ((rpmfc)rpmioLinkPoolItem((rpmioItem)(_fc), __FUNCTION__, __FILE__, __LINE__))
#define | rpmfcFree(_fc) ((rpmfc)rpmioFreePoolItem((rpmioItem)(_fc), __FUNCTION__, __FILE__, __LINE__))

## Typedefs

typedef struct rpmfc_s * | rpmfc
typedef enum FCOLOR_e | FCOLOR_t
typedef struct rpmfcTokens_s * | rpmfcToken

## Enumerations

enum | FCOLOR_e { RPMFC_BLACK = 0, RPMFC_ELF32 = (1 << 0), RPMFC_ELF64 = (1 << 1), RPMFC_ELFMIPSN32 = (1 << 2) }

## Functions

int | rpmfcExec (const char **av, rpmiob iob_stdin, rpmiob *iob_stdoutp, int failnonzero)
| Return helper output.
int | rpmfcColoring (const char *fmstr)
| Return file color given file(1) string.
void | rpmfcPrint (const char *msg, rpmfc fc, FILE *fp)
| Print results of file classification.
rpmRC | rpmfcClassify (rpmfc fc, const char **argv, rpmuint16_t *fmode)
| Build file class dictionary and mappings.
rpmRC | rpmfcApply (rpmfc fc)
| Build file/package dependency dictionary and mappings.
rpmRC | rpmfcGenerateDepends (void *specp, void *pkgp)
| Generate package dependencies.
rpmfc | rpmfcUnlink (rpmfc fc)
| Unreference a file classifier instance.
rpmfc | rpmfcLink (rpmfc fc)
| Reference a file classifier instance.
rpmfc | rpmfcFree (rpmfc fc)
| Destroy a file classifier.
rpmfc | rpmfcNew (void)
| Create a file classifier.

## Variables

int | _rpmfc_debug

## Define Documentation

#define RPMFC_ELF (RPMFC_ELF32|RPMFC_ELF64|RPMFC_ELFMIPSN32)

Definition at line 28 of file rpmfc.h.

#define rpmfcFree | ( |  | _fc | ) | ((rpmfc)rpmioFreePoolItem((rpmioItem)(_fc), __FUNCTION__, __FILE__, __LINE__))

Definition at line 231 of file rpmfc.h.

#define rpmfcLink | ( |  | _fc | ) | ((rpmfc)rpmioLinkPoolItem((rpmioItem)(_fc), __FUNCTION__, __FILE__, __LINE__))

Definition at line 220 of file rpmfc.h.

#define rpmfcUnlink | ( |  | _fc | ) | ((rpmfc)rpmioUnlinkPoolItem((rpmioItem)(_fc), __FUNCTION__, __FILE__, __LINE__))

Definition at line 209 of file rpmfc.h.

## Typedef Documentation

typedef enum FCOLOR_e FCOLOR_t

Definition at line 15 of file rpmfc.h.

typedef struct rpmfc_s* rpmfc

Definition at line 11 of file rpmfc.h.

typedef struct rpmfcTokens_s* rpmfcToken

Definition at line 19 of file rpmfc.h.

## Enumeration Type Documentation

enum FCOLOR_e

Enumerator:

  RPMFC_BLACK |
  RPMFC_ELF32 |
  RPMFC_ELF64 |
  RPMFC_ELFMIPSN32 |

Definition at line 23 of file rpmfc.h.

## Function Documentation

rpmRC rpmfcApply | ( | rpmfc | fc | ) |

Build file/package dependency dictionary and mappings.

Parameters:

  fc | file classifier

Returns:
  RPMRC_OK on success

Definition at line 950 of file rpmfc.c.

References _, _filter_execs, argiAdd(), argiCount(), argvCount(), rpmfcApplyTbl_s::colormask, D_, rpmfcApplyTbl_s::func, mireRegexec(), rpmdsFind(), rpmdsFree(), rpmdsSingle(), rpmfcExpandRegexps(), rpmfcFreeRegexps(), rpmlog(), RPMLOG_DEBUG, RPMLOG_NOTICE, and RPMRC_OK.

Referenced by main(), and rpmfcGenerateDepends().

rpmRC rpmfcClassify | ( | rpmfc | fc,
|  | const char ** | argv,
|  | rpmuint16_t * | fmode
| ) |  |

Build file class dictionary and mappings.

Parameters:

  fc | file classifier
  argv | files to classify
  fmode | files mode_t array (or NULL)

Returns:
  RPMRC_OK on success

int rpmfcColoring | ( | const char * | fmstr | ) |

Return file color given file(1) string.

Parameters:

  fmstr | file(1) string

Returns:
  file color

Definition at line 633 of file rpmfc.c.

References RPMFC_BLACK, and rpmfcTokens.

Referenced by rpmfcClassify().

int rpmfcExec | ( | const char ** | av,
|  | rpmiob | iob_stdin,
|  | rpmiob * | iob_stdoutp,
|  | int | failnonzero
| ) |  |

Return helper output.

Parameters:

  av | helper argv (with possible macros)
  iob_stdin | helper input

Return values:

  *iob_stdoutp | helper output

Parameters:

  failnonzero | Is non-zero helper exit status a failure?

rpmfc rpmfcFree | ( | rpmfc | fc | ) |

Destroy a file classifier.

Parameters:

  fc | file classifier

Returns:
  NULL if free'd

Referenced by main(), and rpmfcGenerateDepends().

rpmRC rpmfcGenerateDepends | ( | void * | specp,
|  | void * | pkgp
| ) |  |

Generate package dependencies.

Parameters:

  specp | spec file control
  pkgp | package control

Returns:
  RPMRC_OK on success

Definition at line 1550 of file rpmfc.c.

References _free(), _rpmfc_debug, alloca(), argiCount(), argiData(), rpmDataType_u::argv, argvCount(), argvData(), argvFree(), Package_s::autoProv, Package_s::autoReq, _HE_s::c, Package_s::cpioList, Package_s::ds, Package_s::header, headerDel(), headerPut(), DepMsg_s::msg, _HE_s::p, printDeps(), rpmDataType_u::ptr, Spec_s::rootURL, RPM_STRING_ARRAY_TYPE, RPM_UINT32_TYPE, rpmdsCount(), rpmdsEVR(), rpmdsFree(), rpmdsMerge(), rpmdsN(), rpmdsNew(), rpmdsSingle(), rpmExpandNumeric(), rpmfcApply(), rpmfcClassify(), rpmfcFree(), rpmfcGenerateDependsHelper(), rpmfcGenerateScriptletDeps(), rpmfcNew(), rpmfcPrint(), rpmfiFC(), rpmfiFFlags(), rpmfiFMode(), rpmfiFN(), rpmfiInit(), RPMFILE_CONFIG, rpmfiNext(), rpmGenPath(), RPMRC_OK, RPMSENSE_EQUAL, _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, urlPath(), xcalloc(), and xstrdup().

Referenced by processBinaryFiles().

rpmfc rpmfcLink | ( | rpmfc | fc | ) |

Reference a file classifier instance.

Parameters:

  ds | file classifier

Returns:
  new file classifier reference

Referenced by rpmfcNew().

rpmfc rpmfcNew | ( | void |  | ) |

Create a file classifier.

Returns:
  new file classifier

Definition at line 1860 of file rpmfc.c.

References rpmfcGetPool(), and rpmfcLink().

Referenced by main(), and rpmfcGenerateDepends().

void rpmfcPrint | ( | const char * | msg,
|  | rpmfc | fc,
|  | FILE * | fp
| ) |  |

Print results of file classification.

Todo:
  Remove debugging routine.

Parameters:

  msg | message prefix (NULL for none)
  fc | file classifier
  fp | output file handle (NULL for stderr)

Definition at line 648 of file rpmfc.c.

References rpmdsCount(), rpmdsDNEVR(), rpmdsNext(), rpmdsSetIx(), and RPMFC_BLACK.

Referenced by main(), and rpmfcGenerateDepends().

rpmfc rpmfcUnlink | ( | rpmfc | fc | ) |

Unreference a file classifier instance.

Parameters:

  ds | dependency set

Returns:
  NULL if free'd

## Variable Documentation

int _rpmfc_debug

Definition at line 98 of file poptALL.c.

Referenced by main(), rpmdepPrint(), rpmfcClassify(), rpmfcGenerateDepends(), rpmfcGetPool(), and rpmfcMergePR().