# lib/formats.c File Reference

`#include "system.h"`
`#include <rpmio.h>`
`#include <rpmcb.h>`
`#include <rpmmacro.h>`
`#include <rpmtag.h>`
`#include <rpmlib.h>`
`#include <rpmds.h>`
`#include <rpmfi.h>`
`#include "legacy.h"`
`#include "manifest.h"`
`#include "argv.h"`
`#include "debug.h"`
Include dependency graph for formats.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines

#define | _RPMTAG_INTERNAL
#define | _RPMEVR_INTERNAL

## Functions

static int | fsnamesTag (Header h, HE_t he)
| Retrieve mounted file system paths.
static int | fssizesTag (Header h, HE_t he)
| Retrieve mounted file system space.
static int | fileclassTag (Header h, HE_t he)
| Retrieve file classes.
static int | filecontextsTag (Header h, HE_t he)
| Retrieve file contexts from header.
static int | fscontextsTag (Header h, HE_t he)
| Retrieve file contexts from file system.
static int | recontextsTag (Header h, HE_t he)
| Retrieve file contexts from policy RE's.
static int | fileprovideTag (Header h, HE_t he)
| Retrieve file provides.
static int | filerequireTag (Header h, HE_t he)
| Retrieve file requires.
static int | missingokTag (Header h, HE_t he)
| Retrieve Requires(missingok): array for Suggests: or Enhances:.

## Variables

static struct headerSprintfExtension_s | _rpmHeaderFormats []
headerSprintfExtension | rpmHeaderFormats = &_rpmHeaderFormats[0]
| Table of query format extensions.

## Detailed Description

Definition in file formats.c.

## Define Documentation

#define _RPMEVR_INTERNAL

Definition at line 15 of file formats.c.

#define _RPMTAG_INTERNAL

Definition at line 11 of file formats.c.

## Function Documentation

static int fileclassTag | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Retrieve file classes.

Parameters:

  | h | header

Return values:

  | *he | tag container

Returns:
  0 on success

Definition at line 113 of file formats.c.

References rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, _HE_s::p, RPM_STRING_ARRAY_TYPE, rpmfiBuildFClasses(), and _HE_s::t.

static int filecontextsTag | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Retrieve file contexts from header.

Parameters:

  | h | header

Return values:

  | *he | tag container

Returns:
  0 on success

Definition at line 130 of file formats.c.

References rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, _HE_s::p, RPM_STRING_ARRAY_TYPE, rpmfiBuildFContexts(), and _HE_s::t.

static int fileprovideTag | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Retrieve file provides.

Parameters:

  | h | header

Return values:

  | *he | tag container

Returns:
  0 on success

Definition at line 181 of file formats.c.

References rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, _HE_s::p, RPM_STRING_ARRAY_TYPE, rpmfiBuildFDeps(), and _HE_s::t.

static int filerequireTag | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Retrieve file requires.

Parameters:

  | h | header

Return values:

  | *he | tag container

Returns:
  0 on success

Definition at line 198 of file formats.c.

References rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, _HE_s::p, RPM_STRING_ARRAY_TYPE, rpmfiBuildFDeps(), and _HE_s::t.

static int fscontextsTag | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Retrieve file contexts from file system.

Parameters:

  | h | header

Return values:

  | *he | tag container

Returns:
  0 on success

Definition at line 147 of file formats.c.

References rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, _HE_s::p, RPM_STRING_ARRAY_TYPE, rpmfiBuildFSContexts(), and _HE_s::t.

static int fsnamesTag | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Retrieve mounted file system paths.

Parameters:

  | h | header

Return values:

  | *he | tag container

Returns:
  0 on success

Definition at line 34 of file formats.c.

References rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, _HE_s::p, RPM_STRING_ARRAY_TYPE, rpmGetFilesystemList(), and _HE_s::t.

static int fssizesTag | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Retrieve mounted file system space.

Parameters:

  | h | header

Return values:

  | *he | tag container

Returns:
  0 on success

Definition at line 56 of file formats.c.

References _free(), rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, headerGet(), _HE_s::p, rpmDataType_u::ptr, RPM_UINT64_TYPE, rpmGetFilesystemList(), rpmGetFilesystemUsage(), _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, rpmDataType_u::ui64p, and xcalloc().

static int missingokTag | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Retrieve Requires(missingok): array for Suggests: or Enhances:.

Parameters:

  | h | header

Return values:

  | *he | tag container

Returns:
  0 on success

Definition at line 215 of file formats.c.

References rpmDataType_u::argv, argvAdd(), argvFree(), _HE_s::c, _HE_s::freeData, _HE_s::p, RPM_STRING_ARRAY_TYPE, rpmdsDNEVR(), rpmdsFlags(), rpmdsFree(), rpmdsInit(), rpmdsNew(), rpmdsNext(), stpcpy(), _HE_s::t, and xcalloc().

static int recontextsTag | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Retrieve file contexts from policy RE's.

Parameters:

  | h | header

Return values:

  | *he | tag container

Returns:
  0 on success

Definition at line 164 of file formats.c.

References rpmDataType_u::argv, _HE_s::c, _HE_s::freeData, _HE_s::p, RPM_STRING_ARRAY_TYPE, rpmfiBuildREContexts(), and _HE_s::t.

## Variable Documentation

struct headerSprintfExtension_s _rpmHeaderFormats[]`[static]`

Initial value:

     {
        { HEADER_EXT_TAG, "RPMTAG_ENHANCES",
            { .tagFunction = missingokTag } },
        { HEADER_EXT_TAG, "RPMTAG_FILECLASS",
            { .tagFunction = fileclassTag } },
        { HEADER_EXT_TAG, "RPMTAG_FILECONTEXTS",
            { .tagFunction = filecontextsTag } },
        { HEADER_EXT_TAG, "RPMTAG_FILEPROVIDE",
            { .tagFunction = fileprovideTag } },
        { HEADER_EXT_TAG, "RPMTAG_FILEREQUIRE",
            { .tagFunction = filerequireTag } },
        { HEADER_EXT_TAG, "RPMTAG_FSCONTEXTS",
            { .tagFunction = fscontextsTag } },
        { HEADER_EXT_TAG, "RPMTAG_FSNAMES",
            { .tagFunction = fsnamesTag } },
        { HEADER_EXT_TAG, "RPMTAG_FSSIZES",
            { .tagFunction = fssizesTag } },
        { HEADER_EXT_TAG, "RPMTAG_RECONTEXTS",
            { .tagFunction = recontextsTag } },
        { HEADER_EXT_TAG, "RPMTAG_SUGGESTS",
            { .tagFunction = missingokTag } },
        { HEADER_EXT_MORE, NULL,            { (void *) &headerCompoundFormats } }
    }

Definition at line 267 of file formats.c.

headerSprintfExtension rpmHeaderFormats = &_rpmHeaderFormats[0]

Table of query format extensions.

Note:
  Chains *headerCompoundFormats -> *headerDefaultFormats.

Definition at line 292 of file formats.c.

Referenced by hdr_subscript(), hdrSprintf(), init_rpm(), packageBinaries(), parseForSimple(), printNewSpecfile(), queryHeader(), rpmcliImportPubkey(), rpmfiNew(), rpmpsmStage(), rpmShowProgress(), rpmtsImportPubkey(), and rpmtsSolve().