rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Defines | Typedefs | Enumerations | Functions | Variables
tools/rpmdigest.c File Reference
`#include "system.h"`
`#include <rpmiotypes.h>`
`#include <rpmio_internal.h>`
`#include <poptIO.h>`
`#include "debug.h"`
Include dependency graph for rpmdigest.c:

Go to the source code of this file.

## Data Structures

struct | rpmdc_s

## Defines

#define | _RPMIOB_INTERNAL
#define | _KFB(n) (1U << (n))
#define | _DFB(n) (_KFB(n) | 0x40000000)
#define | F_ISSET(_dc, _FLAG) ((_dc)->flags & ((RPMDC_FLAGS_##_FLAG) & ~0x40000000))

## Typedefs

typedef struct rpmdc_s * | rpmdc

## Enumerations

enum | dcFlags_e { RPMDC_FLAGS_NONE = 0, RPMDC_FLAGS_WARN = ((1U << ( 1 )) | 0x40000000), RPMDC_FLAGS_CREATE = ((1U << ( 2 )) | 0x40000000), RPMDC_FLAGS_DIRSONLY = ((1U << ( 3 )) | 0x40000000), RPMDC_FLAGS_BINARY = ((1U << ( 14 )) | 0x40000000), RPMDC_FLAGS_STATUS = ((1U << ( 15 )) | 0x40000000), RPMDC_FLAGS_0INSTALL = ((1U << ( 16 )) | 0x40000000) }
| Bit field enum for rpmdigest CLI options. More...

## Functions

static uint32_t | rpmdcName2Algo (const char *dname)
static const char * | rpmdcAlgo2Name (uint32_t dalgo)
static int | rpmdcParseCoreutils (rpmdc dc)
static const char * | rpmdcPrintCoreutils (rpmdc dc, int rc)
static int | rpmdcParseZeroInstall (rpmdc dc)
static const char * | rpmdcPrintZeroInstall (rpmdc dc, int rc)
static int | rpmdcPrintFile (rpmdc dc)
static int | rpmdcFiniFile (rpmdc dc)
static int | rpmdcCalcFile (rpmdc dc)
static int | rpmdcInitFile (rpmdc dc)
static int | rpmdcVisitF (rpmdc dc)
static int | rpmdcSortLexical (const FTSENT **a, const FTSENT **b)
static int | rpmdcSortDirsLast (const FTSENT **a, const FTSENT **b)
static int | rpmdcCWalk (rpmdc dc)
static int | rpmdcLoadManifests (rpmdc dc)
static int | _poptSaveString (const char ***argvp, unsigned int argInfo, const char *val)
static void | rpmdcArgCallback (poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, const char *arg, void *data)
int | main (int argc, char *argv[])

## Variables

const char * | __progname
static int | _rpmdc_debug = 0
static int | _old_0install = 0
static struct rpmdc_s | _dc
static rpmdc | dc = &_dc
static struct poptOption | _optionsTable []
static struct poptOption * | optionsTable = &_optionsTable[0]

## Define Documentation

#define _DFB | ( |  | n | ) | (_KFB(n) | 0x40000000)

Definition at line 17 of file rpmdigest.c.

#define _KFB | ( |  | n | ) | (1U << (n))

Definition at line 16 of file rpmdigest.c.

#define _RPMIOB_INTERNAL

Definition at line 5 of file rpmdigest.c.

#define F_ISSET | ( |  | _dc,
|  |  | _FLAG
| ) |  | ((_dc)->flags & ((RPMDC_FLAGS_##_FLAG) & ~0x40000000))

Definition at line 19 of file rpmdigest.c.

Referenced by main(), rpmdcCWalk(), rpmdcPrintCoreutils(), and rpmdcPrintZeroInstall().

## Typedef Documentation

typedef struct rpmdc_s* rpmdc

Definition at line 39 of file rpmdigest.c.

## Enumeration Type Documentation

enum dcFlags_e

Bit field enum for rpmdigest CLI options.

Enumerator:

  RPMDC_FLAGS_NONE |
  RPMDC_FLAGS_WARN | -w,--warn ...
  RPMDC_FLAGS_CREATE | -c,--create ...
  RPMDC_FLAGS_DIRSONLY | -d,--dirs ...
  RPMDC_FLAGS_BINARY | -b,--binary ...
  RPMDC_FLAGS_STATUS | --status ...
  RPMDC_FLAGS_0INSTALL | -0 --0install ...

Definition at line 24 of file rpmdigest.c.

## Function Documentation

static int _poptSaveString | ( | const char *** | argvp,
|  | unsigned int | argInfo,
|  | const char * | val
| ) |  | `[static]`

Definition at line 785 of file rpmdigest.c.

References xrealloc(), and xstrdup().

Referenced by rpmdcArgCallback().

int main | ( | int | argc,
|  | char * | argv[]
| ) |  |

Definition at line 898 of file rpmdigest.c.

References __progname, _free(), _rpmsw_stats, rpmdc_s::algo, rpmdc_s::algos, argiFree(), argvAdd(), argvCount(), argvFree(), rpmdc_s::digest, rpmdc_s::digestlen, rpmdc_s::digestops, rpmdc_s::digests, F_ISSET, Fclose(), fdFiniDigest(), fdInitDigest(), rpmdc_s::fn, Fopen(), FTS_LOGICAL, FTS_NOCHDIR, FTS_PHYSICAL, rpmdc_s::ftsoptions, Fwrite(), rpmdc_s::ix, Lstat(), rpmdc_s::manifests, rpmdc_s::ncomputed, rpmdc_s::nfailed, rpmdc_s::oalgo, rpmdc_s::oalgoName, rpmdc_s::ofd, rpmdc_s::ofn, optionsTable, rpmdc_s::parse, rpmdc_s::paths, PGPHASHALGO_MD5, PGPHASHALGO_SHA1, rpmdc_s::print, rpmdc_s::readops, rpmdcAlgo2Name(), rpmdcCWalk(), rpmdcLoadManifests(), rpmdcParseCoreutils(), rpmdcParseZeroInstall(), rpmdcPrintCoreutils(), rpmdcPrintZeroInstall(), rpmdcVisitF(), rpmExpand(), rpmioDigestHashAlgo, rpmioFini(), rpmioFtsOpts, rpmioInit(), rpmswEnter(), rpmswExit(), rpmswPrint(), rpmdc_s::sb, and rpmdc_s::totalops.

static const char* rpmdcAlgo2Name | ( | uint32_t | dalgo | ) | `[static]`

Definition at line 119 of file rpmdigest.c.

References rpmioDigestPoptTable.

Referenced by main().

static void rpmdcArgCallback | ( | poptContext | con,
|  | enum poptCallbackReason | reason,
|  | const struct poptOption * | opt,
|  | const char * | arg,
|  | void * | data
| ) |  | `[static]`

Definition at line 805 of file rpmdigest.c.

References _, __progname, _poptSaveString(), and rpmdc_s::manifests.

static int rpmdcCalcFile | ( | rpmdc | dc | ) | `[static]`

Definition at line 604 of file rpmdigest.c.

References _rpmdc_debug, rpmdc_s::buf, rpmdc_s::fd, Ferror(), rpmdc_s::fn, Fread(), and rpmdc_s::nb.

Referenced by rpmdcVisitF().

static int rpmdcCWalk | ( | rpmdc | dc | ) | `[static]`

Definition at line 710 of file rpmdigest.c.

References __progname, _old_0install, errno, F_ISSET, rpmdc_s::fn, Fts_close(), FTS_D, FTS_DNR, FTS_DP, FTS_ERR, _ftsent::fts_errno, _ftsent::fts_info, _ftsent::fts_level, _ftsent::fts_name, FTS_NS, Fts_open(), _ftsent::fts_path, Fts_read(), Fts_set(), FTS_SKIP, _ftsent::fts_statp, rpmdc_s::ftsoptions, indent, rpmdc_s::p, rpmdc_s::paths, rpmdcSortDirsLast(), rpmdcSortLexical(), rpmdcVisitF(), rpmdc_s::sb, and rpmdc_s::t.

Referenced by main().

static int rpmdcFiniFile | ( | rpmdc | dc | ) | `[static]`

Definition at line 560 of file rpmdigest.c.

References _rpmdc_debug, rpmdc_s::algo, rpmdc_s::algos, rpmdc_s::dalgo, rpmdc_s::dalgoName, rpmdc_s::digestops, Fclose(), rpmdc_s::fd, FDSTAT_DIGEST, fdstat_op(), FDSTAT_READ, rpmdc_s::fn, rpmdc_s::ix, rpmdc_s::manifests, rpmdc_s::readops, rpmdcPrintFile(), rpmioDigestHashAlgo, rpmioDigestPoptTable, rpmswAdd(), and ARGI_s::vals.

Referenced by rpmdcVisitF().

static int rpmdcInitFile | ( | rpmdc | dc | ) | `[static]`

Definition at line 623 of file rpmdigest.c.

References _, _rpmdc_debug, rpmdc_s::algo, rpmdc_s::dalgo, rpmdc_s::dalgoName, Fclose(), rpmdc_s::fd, fdInitDigest(), Ferror(), rpmdc_s::fn, Fopen(), Fstrerror(), rpmioDigestPoptTable, and rpmdc_s::sb.

Referenced by rpmdcVisitF().

static int rpmdcLoadManifests | ( | rpmdc | dc | ) | `[static]`

Definition at line 777 of file rpmdigest.c.

References rpmdc_s::manifests, and rpmdc_s::parse.

Referenced by main().

static uint32_t rpmdcName2Algo | ( | const char * | dname | ) | `[static]`

Definition at line 93 of file rpmdigest.c.

References rpmioDigestPoptTable.

Referenced by rpmdcParseCoreutils(), and rpmdcParseZeroInstall().

static int rpmdcParseCoreutils | ( | rpmdc | dc | ) | `[static]`

Definition at line 142 of file rpmdigest.c.

References _, __progname, rpmdc_s::algo, rpmdc_s::algos, argiAdd(), argvAdd(), rpmdc_s::dalgo, rpmdc_s::dalgoName, rpmdc_s::digests, Fclose(), rpmdc_s::fd, fdGetFILE, Ferror(), rpmdc_s::fn, Fopen(), Fstrerror(), rpmdc_s::manifests, rpmdc_s::paths, rpmdcName2Algo(), xisspace(), and xstrdup().

Referenced by main().

static int rpmdcParseZeroInstall | ( | rpmdc | dc | ) | `[static]`

Definition at line 291 of file rpmdigest.c.

References _, __progname, _free(), rpmdc_s::algos, argiAdd(), argvAdd(), rpmdc_s::dalgo, rpmdc_s::digest, rpmdc_s::digests, rpmdc_s::fn, rpmdc_s::manifests, rpmdc_s::paths, rpmdcName2Algo(), rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), rpmExpand(), rpmiobFree(), rpmiobSlurp(), xisdigit(), and xstrdup().

Referenced by main().

static const char* rpmdcPrintCoreutils | ( | rpmdc | dc,
|  | int | rc
| ) |  | `[static]`

Definition at line 242 of file rpmdigest.c.

References rpmdc_s::dalgoName, rpmdc_s::digest, rpmdc_s::digestlen, F_ISSET, rpmdc_s::fn, rpmdc_s::manifests, stpcpy(), and xmalloc().

Referenced by main().

static int rpmdcPrintFile | ( | rpmdc | dc | ) | `[static]`

Definition at line 525 of file rpmdigest.c.

References _free(), _rpmdc_debug, rpmdc_s::dalgo, rpmdc_s::digest, rpmdc_s::digestlen, rpmdc_s::digests, rpmdc_s::fd, fdFiniDigest(), Fflush(), rpmdc_s::fn, Fwrite(), rpmdc_s::ix, rpmdc_s::manifests, rpmdc_s::nchecked, rpmdc_s::ncomputed, rpmdc_s::nfailed, rpmdc_s::nmatched, rpmdc_s::ofd, and rpmdc_s::print.

Referenced by rpmdcFiniFile().

static const char* rpmdcPrintZeroInstall | ( | rpmdc | dc,
|  | int | rc
| ) |  | `[static]`

Definition at line 446 of file rpmdigest.c.

References _old_0install, rpmdc_s::digest, rpmdc_s::digestlen, F_ISSET, rpmdc_s::fn, rpmdc_s::manifests, S_ISLNK, rpmdc_s::sb, snprintf(), stpcpy(), and xmalloc().

Referenced by main().

static int rpmdcSortDirsLast | ( | const FTSENT ** | a,
|  | const FTSENT ** | b
| ) |  | `[static]`

Definition at line 698 of file rpmdigest.c.

Referenced by rpmdcCWalk().

static int rpmdcSortLexical | ( | const FTSENT ** | a,
|  | const FTSENT ** | b
| ) |  | `[static]`

Definition at line 691 of file rpmdigest.c.

Referenced by rpmdcCWalk().

static int rpmdcVisitF | ( | rpmdc | dc | ) | `[static]`

Definition at line 671 of file rpmdigest.c.

References _rpmdc_debug, rpmdc_s::fn, rpmdcCalcFile(), rpmdcFiniFile(), and rpmdcInitFile().

Referenced by main(), and rpmdcCWalk().

## Variable Documentation

const char* __progname

Definition at line 37 of file poptIO.c.

struct rpmdc_s _dc `[static]`

Initial value:

     {
            .ftsoptions = FTS_PHYSICAL,
            .flags = RPMDC_FLAGS_CREATE
    }

Definition at line 83 of file rpmdigest.c.

int _old_0install = 0`[static]`

Definition at line 14 of file rpmdigest.c.

Referenced by rpmdcCWalk(), and rpmdcPrintZeroInstall().

struct poptOption _optionsTable[]`[static]`

Definition at line 832 of file rpmdigest.c.

int _rpmdc_debug = 0`[static]`

Definition at line 11 of file rpmdigest.c.

Referenced by rpmdcCalcFile(), rpmdcFiniFile(), rpmdcInitFile(), rpmdcPrintFile(), and rpmdcVisitF().

rpmdc dc = &_dc `[static]`

Definition at line 90 of file rpmdigest.c.

Referenced by fsmMkdirs(), fsmRmdirs(), iosmMkdirs(), iosmRmdirs(), rpmalAdd(), and skipFiles().

struct poptOption* optionsTable = &_optionsTable[0]`[static]`

Definition at line 895 of file rpmdigest.c.

Referenced by main().