rpm 5.2.1

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

- File List
- Globals

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
rpmmtree.c File Reference
`#include "system.h"`
`#include <fnmatch.h>`
`#include <signal.h>`
`#include <stdarg.h>`
`#include "asprintf.h"`
`#include <rpmio_internal.h>`
`#include <fts.h>`
`#include <ugid.h>`
`#include <poptIO.h>`
`#include "debug.h"`
Include dependency graph for rpmmtree.c:

Go to the source code of this file.

## Data Structures
struct | _node
struct | rpmfts_s
struct | exclude
struct | _key

## Macros
#define | RPM_LIST_HEAD(name, type) struct name { struct type *lh_first; }
#define | RPM_LIST_ENTRY(type) struct { struct type *le_next;struct type **le_prev; }
#define | RPM_LIST_EMPTY(head) ((head)->lh_first == NULL)
#define | RPM_LIST_FIRST(head) ((head)->lh_first)
#define | RPM_LIST_NEXT(elm, field) ((elm)->field.le_next)
#define | RPM_LIST_INIT(head) do { RPM_LIST_FIRST((head)) = NULL; } while (0)
#define | RPM_LIST_INSERT_HEAD(head, elm, field)
#define | RPM_LIST_FOREACH(var, head, field) for ((var) = RPM_LIST_FIRST((head)); (var); (var) = RPM_LIST_NEXT((var), field))
#define | _MTREE_INTERNAL
#define | _KFB(n) (1U << (n))
#define | _MFB(n) (_KFB(n) | 0x40000000)
#define | F_BLOCK 0x001
#define | F_CHAR 0x002
#define | F_DIR 0x004
#define | F_FIFO 0x008
#define | F_FILE 0x010
#define | F_LINK 0x020
#define | F_SOCK 0x040
#define | MF_ISSET(_FLAG) ((mtreeFlags & ((MTREE_FLAGS_##_FLAG) & ~0x40000000)) != MTREE_FLAGS_NONE)
#define | KEYDEFAULT
#define | MISMATCHEXIT 2
#define | MBITS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
#define | NEEDVALUE 0xffffffff
#define | COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)]
#define | VIS_OCTAL 0x01 /* use octal \ddd format */
#define | VIS_CSTYLE 0x02 /* use \[nrft0..] where appropriate */
#define | VIS_SP 0x04 /* also encode space */
#define | VIS_TAB 0x08 /* also encode tab */
#define | VIS_NL 0x10 /* also encode newline */
#define | VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL)
#define | VIS_SAFE 0x20 /* only encode "unsafe" characters */
#define | VIS_NOSLASH 0x40 /* inhibit printing '\' */
#define | UNVIS_VALID 1 /* character valid */
#define | UNVIS_VALIDPUSH 2 /* character valid, push back passed char */
#define | UNVIS_NOCHAR 3 /* valid sequence, no character produced */
#define | UNVIS_SYNBAD -1 /* unrecognized escape sequence */
#define | UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */
#define | UNVIS_END 1 /* no more characters */
#define | isoctal(c) (((unsigned char)(c)) >= '0' && ((unsigned char)(c)) <= '7')
#define | isvisible(c)
#define | S_GROUND 0 /* haven't seen escape char */
#define | S_START 1 /* start decoding special sequence */
#define | S_META 2 /* metachar started (M) */
#define | S_META1 3 /* metachar more, regular char (-) */
#define | S_CTRL 4 /* control char started (^) */
#define | S_OCTAL2 5 /* octal digit 2 */
#define | S_OCTAL3 6 /* octal digit 3 */
#define | KF_ISSET(_keys, _KEY) ((_keys) & (MTREE_KEYS_##_KEY))
#define | MAGIC "?*["
#define | FF(a, b, c, d) (((a)->flags & (c)) && ((b)->flags & (c)) && ((a)->d) != ((b)->d))
#define | FS(a, b, c, d) (((a)->flags & (c)) && ((b)->flags & (c)) && strcmp((a)->d,(b)->d))
#define | FM(a, b, c, d) (((a)->flags & (c)) && ((b)->flags & (c)) && memcmp(&(a)->d,&(b)->d, sizeof (a)->d))
#define | SKIPDOTSLASH(_f) ((_f)[0] == '.' && (_f)[1] == '/' ? (_f) + 2 : (_f))
#define | COMPAREINDENTNAMELEN 8
#define | LABEL
#define | _FTSCALLOC(_p, _n)
#define | CWALKINDENTNAMELEN 15
#define | MAXLINELEN 80
#define | MATCH(g, n) (fnmatch((g), (n), FNM_PATHNAME) == 0)
#define | __getlogin getlogin

## Typedefs
typedef struct rpmfts_s * | rpmfts
typedef struct _node | NODE
typedef struct _key | KEY

## Enumerations
enum | mtreeFlags_e { MTREE_FLAGS_NONE = 0, MTREE_FLAGS_QUIET = ((1U << ( 0 )) | 0x40000000), MTREE_FLAGS_WARN = ((1U << ( 1 )) | 0x40000000), MTREE_FLAGS_CREATE = ((1U << ( 2 )) | 0x40000000), MTREE_FLAGS_DIRSONLY = ((1U << ( 3 )) | 0x40000000), MTREE_FLAGS_IGNORE = ((1U << ( 4 )) | 0x40000000), MTREE_FLAGS_INDENT = ((1U << ( 5 )) | 0x40000000), MTREE_FLAGS_LOOSE = ((1U << ( 6 )) | 0x40000000), MTREE_FLAGS_NOCOMMENT = ((1U << ( 7 )) | 0x40000000), MTREE_FLAGS_REMOVE = ((1U << ( 8 )) | 0x40000000), MTREE_FLAGS_SEEDED = ((1U << ( 9 )) | 0x40000000), MTREE_FLAGS_TOUCH = ((1U << ( 10 )) | 0x40000000), MTREE_FLAGS_UPDATE = ((1U << ( 11 )) | 0x40000000), MTREE_FLAGS_MISMATCHOK = ((1U << ( 12 )) | 0x40000000) }
| Bit field enum for mtree CLI options. More...
enum | mtreeKeys_e { MTREE_KEYS_NONE = 0, MTREE_KEYS_CKSUM = (1U << ( 0 )), MTREE_KEYS_DONE = (1U << ( 1 )), MTREE_KEYS_GID = (1U << ( 2 )), MTREE_KEYS_GNAME = (1U << ( 3 )), MTREE_KEYS_IGN = (1U << ( 4 )), MTREE_KEYS_MAGIC = (1U << ( 5 )), MTREE_KEYS_MODE = (1U << ( 6 )), MTREE_KEYS_NLINK = (1U << ( 7 )), MTREE_KEYS_SIZE = (1U << ( 8 )), MTREE_KEYS_SLINK = (1U << ( 9 )), MTREE_KEYS_TIME = (1U << ( 10 )), MTREE_KEYS_TYPE = (1U << ( 11 )), MTREE_KEYS_UID = (1U << ( 12 )), MTREE_KEYS_UNAME = (1U << ( 13 )), MTREE_KEYS_VISIT = (1U << ( 14 )), MTREE_KEYS_FLAGS = (1U << ( 15 )), MTREE_KEYS_NOCHANGE = (1U << ( 16 )), MTREE_KEYS_OPT = (1U << ( 17 )), MTREE_KEYS_DIGEST = (1U << ( 18 )) }
| Bit field enum for mtree keys. More...

## Functions
static NODE * | mtreeSpec (rpmfts fts, FILE *fp)
static int | mtreeVSpec (rpmfts fts)
static int | mtreeCWalk (rpmfts fts)
static int | mtreeVWalk (rpmfts fts)
static void | mtreeMiss (rpmfts fts, NODE *p, char *tail)
static void | mtree_error (const char *fmt,...)
static int | keycompare (const void *a, const void *b)
static unsigned | parsekey (char *name, uint32_t *needvaluep)
static const char * | algo2tagname (uint32_t algo)
static int | crc (FD_t fd, uint32_t *cval, uint32_t *clen)
static char * | vis (char *dst, int c, int flag, int nextc)
static int | strvis (char *dst, const char *src, int flag)
static int | strunvis (char *dst, const char *src)
static int | unvis (char *cp, char c, int *astate, int flag)
static void | set (char *t, NODE *ip)
static void | unset (char *t, NODE *ip)
static const char * | ftype (unsigned type)
static const char * | inotype (mode_t mode)
static void | shownode (NODE *n, enum mtreeKeys_e keys, const char *path)
static int | mismatch (NODE *n1, NODE *n2, enum mtreeKeys_e differ, const char *path)
static int | compare_nodes (NODE *n1, NODE *n2, const char *path)
static int | mtreeSWalk (NODE *t1, NODE *t2, const char *path)
static const char * | rlink (const char *name)
static const char * | algo2name (uint32_t algo)
static int | compare (rpmfts fts, NODE *const s)
static int | mtreeVisitD (rpmfts fts)
static void | output (int indent, int *offset, const char *fmt,...)
static void | mtreeVisitF (rpmfts fts)
static void | mtreeReadExcludes (const char *fn)
static int | mtreeCheckExcludes (const char *fname, const char *path)
static int | dsort (const FTSENT **a, const FTSENT **b)
static void | mtreeArgCallback (poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, const char *arg, void *data)
int | main (int argc, char *argv[])

## Variables
static const char | copyright []
static struct rpmfts_s | __rpmfts
static rpmfts | _rpmfts = &__rpmfts
static enum mtreeFlags_e | mtreeFlags = MTREE_FLAGS_NONE
struct {
struct exclude * lh_first
} | excludes
static struct rpmop_s | dc_totalops
static struct rpmop_s | dc_readops
static struct rpmop_s | dc_digestops
static KEY | keylist []
static const uint32_t | crctab []
static struct poptOption | optionsTable []

## Macro Definition Documentation

#define __getlogin getlogin

Definition at line 3656 of file rpmmtree.c.

Referenced by main().

#define _FTSCALLOC | ( |  | _p,
|  |  | _n
| ) |  |

Value:
if ((_n) > 0) { \
(_p) = _free(_p); (_p) = xcalloc((_n), sizeof(*(_p))); \
}

Definition at line 2359 of file rpmmtree.c.

Referenced by mtreeVisitD().

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

Definition at line 103 of file rpmmtree.c.

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

Definition at line 104 of file rpmmtree.c.

#define _MTREE_INTERNAL

Definition at line 100 of file rpmmtree.c.

#define COMPAREINDENTNAMELEN 8

Definition at line 2050 of file rpmmtree.c.

#define COMPUTE | ( |  | var,
|  |  | ch
| ) |  | (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)]

Referenced by crc().

#define CWALKINDENTNAMELEN 15

Definition at line 2500 of file rpmmtree.c.

Referenced by mtreeVisitF(), and output().

#define F_BLOCK 0x001

block special

Definition at line 172 of file rpmmtree.c.

Referenced by compare(), ftype(), and set().

#define F_CHAR 0x002

char special

Definition at line 173 of file rpmmtree.c.

Referenced by compare(), ftype(), and set().

#define F_DIR 0x004

directory

Definition at line 174 of file rpmmtree.c.

Referenced by compare(), ftype(), mtreeMiss(), mtreeSpec(), mtreeSWalk(), mtreeVWalk(), and set().

#define F_FIFO 0x008

fifo

Definition at line 175 of file rpmmtree.c.

Referenced by compare(), ftype(), and set().

#define F_FILE 0x010

regular file

Definition at line 176 of file rpmmtree.c.

Referenced by compare(), ftype(), and set().

#define F_LINK 0x020

symbolic link

Definition at line 177 of file rpmmtree.c.

Referenced by compare(), compare_nodes(), ftype(), mtreeMiss(), and set().

#define F_SOCK 0x040

socket

Definition at line 178 of file rpmmtree.c.

Referenced by compare(), ftype(), and set().

#define FF | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | (((a)->flags & (c)) && ((b)->flags & (c)) && ((a)->d) != ((b)->d))

Definition at line 1779 of file rpmmtree.c.

Referenced by compare_nodes().

#define FM | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | (((a)->flags & (c)) && ((b)->flags & (c)) && memcmp(&(a)->d,&(b)->d, sizeof (a)->d))

Definition at line 1783 of file rpmmtree.c.

Referenced by compare_nodes().

#define FS | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d
| ) |  | (((a)->flags & (c)) && ((b)->flags & (c)) && strcmp((a)->d,(b)->d))

Definition at line 1781 of file rpmmtree.c.

Referenced by compare_nodes().

#define isoctal | ( |  | c | ) | (((unsigned char)(c)) >= '0' && ((unsigned char)(c)) <= '7')

Definition at line 621 of file rpmmtree.c.

Referenced by unvis(), and vis().

#define isvisible | ( |  | c | ) |

Value:
(((unsigned)(c) <= (unsigned)UCHAR_MAX && isascii((unsigned char)(c)) && \
isgraph((unsigned char)(c))) \
|| ((flag & VIS_SP) == 0 && (c) == (int)' ') \
|| ((flag & VIS_TAB) == 0 && (c) == (int)'\t') \
|| ((flag & VIS_NL) == 0 && (c) == (int)'\n') \
|| ((flag & VIS_SAFE) \
&& ((c) == (int)'\b' || (c) == (int)'\007' || (c) == (int)'\r')))

Definition at line 622 of file rpmmtree.c.

Referenced by vis().

#define KEYDEFAULT

Value:
(MTREE_KEYS_GID | MTREE_KEYS_MODE | MTREE_KEYS_NLINK | MTREE_KEYS_SIZE | \
MTREE_KEYS_SLINK | MTREE_KEYS_TIME | MTREE_KEYS_UID)

Definition at line 276 of file rpmmtree.c.

Referenced by main().

#define KF_ISSET | ( |  | _keys,
|  |  | _KEY
| ) |  | ((_keys) & (MTREE_KEYS_##_KEY))

Definition at line 1586 of file rpmmtree.c.

Referenced by compare(), compare_nodes(), main(), mtreeArgCallback(), mtreeMiss(), mtreeSpec(), mtreeVisitD(), mtreeVisitF(), mtreeVWalk(), and shownode().

#define LABEL

Value:
if (!label++) { \
(void) printf(_("%s changed\n"), SKIPDOTSLASH(p->fts_path)); \
tab = "\t"; \
}

Definition at line 2051 of file rpmmtree.c.

Referenced by compare().

#define MAGIC "?*["

Referenced by mtreeSpec(), and mtreeVWalk().

#define MATCH | ( |  | g,
|  |  | n
| ) |  | (fnmatch((g), (n), FNM_PATHNAME) == 0)

Referenced by mtreeCheckExcludes().

#define MAXLINELEN 80

Definition at line 2501 of file rpmmtree.c.

Referenced by mtreeVisitF(), and output().

#define MBITS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)

Definition at line 285 of file rpmmtree.c.

Referenced by compare(), main(), mtreeVisitD(), and mtreeVisitF().

#define MF_ISSET | ( |  | _FLAG | ) | ((mtreeFlags & ((MTREE_FLAGS_##_FLAG) & ~0x40000000)) != MTREE_FLAGS_NONE)

Definition at line 274 of file rpmmtree.c.

Referenced by compare(), main(), mtreeCWalk(), mtreeMiss(), mtreeVisitD(), mtreeVisitF(), and mtreeVWalk().

#define MISMATCHEXIT 2

Definition at line 280 of file rpmmtree.c.

Referenced by main(), mtreeVSpec(), and mtreeVWalk().

#define NEEDVALUE 0xffffffff

Definition at line 347 of file rpmmtree.c.

#define RPM_LIST_EMPTY | ( |  | head | ) | ((head)->lh_first == NULL)

Definition at line 84 of file rpmmtree.c.

#define RPM_LIST_ENTRY | ( |  | type | ) | struct { struct type *le_next;struct type **le_prev; }

Definition at line 82 of file rpmmtree.c.

#define RPM_LIST_FIRST | ( |  | head | ) | ((head)->lh_first)

Definition at line 86 of file rpmmtree.c.

#define RPM_LIST_FOREACH | ( |  | var,
|  |  | head,
|  |  | field
| ) |  | for ((var) = RPM_LIST_FIRST((head)); (var); (var) = RPM_LIST_NEXT((var), field))

Definition at line 97 of file rpmmtree.c.

Referenced by mtreeCheckExcludes().

#define RPM_LIST_HEAD | ( |  | name,
|  |  | type
| ) |  | struct name { struct type *lh_first; }

Definition at line 80 of file rpmmtree.c.

#define RPM_LIST_INIT | ( |  | head | ) | do { RPM_LIST_FIRST((head)) = NULL; } while (0)

Definition at line 90 of file rpmmtree.c.

Referenced by main().

#define RPM_LIST_INSERT_HEAD | ( |  | head,
|  |  | elm,
|  |  | field
| ) |  |

Value:
do { if ((RPM_LIST_NEXT((elm), field) = RPM_LIST_FIRST((head))) != NULL) \
RPM_LIST_FIRST((head))->field.le_prev = &RPM_LIST_NEXT((elm), field);\
RPM_LIST_FIRST((head)) = (elm); \
(elm)->field.le_prev = &RPM_LIST_FIRST((head)); } while (0)

Definition at line 92 of file rpmmtree.c.

Referenced by mtreeReadExcludes().

#define RPM_LIST_NEXT | ( |  | elm,
|  |  | field
| ) |  | ((elm)->field.le_next)

Definition at line 88 of file rpmmtree.c.

#define S_CTRL 4 /* control char started (^) */

Definition at line 808 of file rpmmtree.c.

Referenced by unvis().

#define S_GROUND 0 /* haven't seen escape char */

Definition at line 804 of file rpmmtree.c.

Referenced by unvis().

#define S_META 2 /* metachar started (M) */

Definition at line 806 of file rpmmtree.c.

Referenced by unvis().

#define S_META1 3 /* metachar more, regular char (-) */

Definition at line 807 of file rpmmtree.c.

Referenced by unvis().

#define S_OCTAL2 5 /* octal digit 2 */

Definition at line 809 of file rpmmtree.c.

Referenced by unvis().

#define S_OCTAL3 6 /* octal digit 3 */

Definition at line 810 of file rpmmtree.c.

Referenced by unvis().

#define S_START 1 /* start decoding special sequence */

Definition at line 805 of file rpmmtree.c.

Referenced by unvis().

#define SKIPDOTSLASH | ( |  | _f | ) | ((_f)[0] == '.' && (_f)[1] == '/' ? (_f) + 2 : (_f))

Definition at line 2048 of file rpmmtree.c.

Referenced by mtreeVisitD(), and mtreeVWalk().

#define UNVIS_END 1 /* no more characters */

Definition at line 604 of file rpmmtree.c.

Referenced by strunvis(), and unvis().

#define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */

Definition at line 599 of file rpmmtree.c.

#define UNVIS_NOCHAR 3 /* valid sequence, no character produced */

Definition at line 597 of file rpmmtree.c.

Referenced by strunvis(), and unvis().

#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */

Definition at line 598 of file rpmmtree.c.

Referenced by unvis().

#define UNVIS_VALID 1 /* character valid */

Definition at line 595 of file rpmmtree.c.

Referenced by strunvis(), and unvis().

#define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */

Definition at line 596 of file rpmmtree.c.

Referenced by strunvis(), and unvis().

#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropriate */

Definition at line 575 of file rpmmtree.c.

Referenced by vis().

#define VIS_NL 0x10 /* also encode newline */

Definition at line 583 of file rpmmtree.c.

#define VIS_NOSLASH 0x40 /* inhibit printing '\' */

Definition at line 590 of file rpmmtree.c.

Referenced by vis().

#define VIS_OCTAL 0x01 /* use octal \ddd format */

Definition at line 574 of file rpmmtree.c.

Referenced by mtreeVisitF(), and vis().

#define VIS_SAFE 0x20 /* only encode "unsafe" characters */

Definition at line 585 of file rpmmtree.c.

#define VIS_SP 0x04 /* also encode space */

Definition at line 581 of file rpmmtree.c.

#define VIS_TAB 0x08 /* also encode tab */

Definition at line 582 of file rpmmtree.c.

#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL)

Definition at line 584 of file rpmmtree.c.

Referenced by mtreeVisitF().

## Typedef Documentation

typedef struct _key KEY

typedef struct _node NODE

typedef struct rpmfts_s* rpmfts

Definition at line 129 of file rpmmtree.c.

## Enumeration Type Documentation

enum mtreeFlags_e

Bit field enum for mtree CLI options.

Enumerator
MTREE_FLAGS_NONE |
MTREE_FLAGS_QUIET | -q,–quiet ...
MTREE_FLAGS_WARN | -w,–warn ...
MTREE_FLAGS_CREATE | -c,–create ...
MTREE_FLAGS_DIRSONLY | -d,–dirs ...
MTREE_FLAGS_IGNORE | -e,–ignore ...
MTREE_FLAGS_INDENT | -i,–indent ...
MTREE_FLAGS_LOOSE | -l,–loose ...
MTREE_FLAGS_NOCOMMENT | -n,–nocomment ...
MTREE_FLAGS_REMOVE | -r,–remove ...
MTREE_FLAGS_SEEDED | -s,–seed ...
MTREE_FLAGS_TOUCH | -t,–touch ...
MTREE_FLAGS_UPDATE | -u,–update ...
MTREE_FLAGS_MISMATCHOK | -U,–mismatch ...

Definition at line 109 of file rpmmtree.c.

enum mtreeKeys_e

Bit field enum for mtree keys.

Enumerator
MTREE_KEYS_NONE |
MTREE_KEYS_CKSUM | checksum
MTREE_KEYS_DONE | directory done
MTREE_KEYS_GID | gid
MTREE_KEYS_GNAME | group name
MTREE_KEYS_IGN | ignore
MTREE_KEYS_MAGIC | name has magic chars
MTREE_KEYS_MODE | mode
MTREE_KEYS_NLINK | number of links
MTREE_KEYS_SIZE | size
MTREE_KEYS_SLINK | link count
MTREE_KEYS_TIME | modification time
MTREE_KEYS_TYPE | file type
MTREE_KEYS_UID | uid
MTREE_KEYS_UNAME | user name
MTREE_KEYS_VISIT | file visited
MTREE_KEYS_FLAGS | file flags
MTREE_KEYS_NOCHANGE | do not change owner/mode
MTREE_KEYS_OPT | existence optional
MTREE_KEYS_DIGEST | digest

Definition at line 135 of file rpmmtree.c.

## Function Documentation

static const char* algo2name | ( | uint32_t | algo | ) |
| static

Definition at line 2058 of file rpmmtree.c.

References PGPHASHALGO_ADLER32, PGPHASHALGO_CRC32, PGPHASHALGO_CRC64, PGPHASHALGO_HAVAL_5_160, PGPHASHALGO_JLU32, PGPHASHALGO_MD2, PGPHASHALGO_MD4, PGPHASHALGO_MD5, PGPHASHALGO_RIPEMD128, PGPHASHALGO_RIPEMD160, PGPHASHALGO_RIPEMD256, PGPHASHALGO_RIPEMD320, PGPHASHALGO_SALSA10, PGPHASHALGO_SALSA20, PGPHASHALGO_SHA1, PGPHASHALGO_SHA224, PGPHASHALGO_SHA256, PGPHASHALGO_SHA384, PGPHASHALGO_SHA512, and PGPHASHALGO_TIGER192.

Referenced by compare().

static const char* algo2tagname | ( | uint32_t | algo | ) |
| static

Definition at line 422 of file rpmmtree.c.

References PGPHASHALGO_ADLER32, PGPHASHALGO_CRC32, PGPHASHALGO_CRC64, PGPHASHALGO_HAVAL_5_160, PGPHASHALGO_JLU32, PGPHASHALGO_MD2, PGPHASHALGO_MD4, PGPHASHALGO_MD5, PGPHASHALGO_RIPEMD128, PGPHASHALGO_RIPEMD160, PGPHASHALGO_RIPEMD256, PGPHASHALGO_RIPEMD320, PGPHASHALGO_SALSA10, PGPHASHALGO_SALSA20, PGPHASHALGO_SHA1, PGPHASHALGO_SHA224, PGPHASHALGO_SHA256, PGPHASHALGO_SHA384, PGPHASHALGO_SHA512, and PGPHASHALGO_TIGER192.

Referenced by mtreeVisitF(), and shownode().

static int compare | ( | rpmfts | fts,
|  | NODE *const | s
| ) |  |
| static

< block special

< char special

< directory

< fifo

< regular file

< symbolic link

< socket

< directory

Definition at line 2090 of file rpmmtree.c.

References _, _free(), algo2name(), _node::algos, Chmod(), Chown(), _node::cksum, crc(), _node::digests, errno, F_BLOCK, F_CHAR, F_DIR, F_FIFO, F_FILE, F_LINK, F_SOCK, Fclose(), fdFiniDigest(), fdInitDigest(), FDSTAT_DIGEST, fdstat_op(), FDSTAT_READ, Ferror(), _node::flags, Fopen(), Fread(), Fstrerror(), _ftsent::fts_accpath, _ftsent::fts_statp, ftype(), inotype(), KF_ISSET, L, LABEL, MBITS, MF_ISSET, _node::name, ARGI_s::nvals, rpmfts_s::p, rlink(), rpmswAdd(), S_ISLNK, S_ISSOCK, _node::sb, _node::slink, _node::type, Utimes(), and ARGI_s::vals.

Referenced by mtreeVWalk().

static int compare_nodes | ( | NODE * | n1,
|  | NODE * | n2,
|  | const char * | path
| ) |  |
| static

< symbolic link

< symbolic link

Definition at line 1867 of file rpmmtree.c.

References _node::algos, _node::digests, F_LINK, FF, _node::flags, FM, FS, KF_ISSET, mismatch(), MTREE_KEYS_CKSUM, MTREE_KEYS_DIGEST, MTREE_KEYS_FLAGS, MTREE_KEYS_GID, MTREE_KEYS_GNAME, MTREE_KEYS_MODE, MTREE_KEYS_NLINK, MTREE_KEYS_NONE, MTREE_KEYS_SIZE, MTREE_KEYS_SLINK, MTREE_KEYS_TIME, MTREE_KEYS_UID, MTREE_KEYS_UNAME, ARGI_s::nvals, _node::type, and ARGI_s::vals.

Referenced by mtreeSWalk(), and mtreeVSpec().

static int crc | ( | FD_t | fd,
|  | uint32_t * | cval,
|  | uint32_t * | clen
| ) |  |
| static

Definition at line 532 of file rpmmtree.c.

References COMPUTE, rpmfts_s::crc_total, Ferror(), and Fread().

Referenced by __crc32(), __crc64(), compare(), mtreeVisitF(), pgpCRC(), and pgpReadPkts().

static int dsort | ( | const FTSENT ** | a,
|  | const FTSENT ** | b
| ) |  |
| static

Definition at line 2824 of file rpmmtree.c.

Referenced by mtreeCWalk().

static const char* ftype | ( | unsigned | type | ) |
| static

< block special

< char special

< directory

< fifo

< regular file

< symbolic link

< socket

Definition at line 1717 of file rpmmtree.c.

References F_BLOCK, F_CHAR, F_DIR, F_FIFO, F_FILE, F_LINK, and F_SOCK.

Referenced by compare(), rpmfcClassify(), and shownode().

static const char* inotype | ( | mode_t | mode | ) |
| static

Definition at line 1735 of file rpmmtree.c.

References S_IFSOCK.

Referenced by compare(), and mtreeVisitF().

static int keycompare | ( | const void * | a,
|  | const void * | b
| ) |  |
| static

Definition at line 392 of file rpmmtree.c.

Referenced by parsekey().

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

Definition at line 3660 of file rpmmtree.c.

References _, __getlogin, __progname, _free(), _rpmfts, _rpmsw_stats, argvFree(), rpmfts_s::crc_total, errno, FTS_LOGICAL, FTS_PHYSICAL, rpmfts_s::ftsoptions, rpmfts_s::fullpath, rpmfts_s::g, KEYDEFAULT, rpmfts_s::keys, KF_ISSET, rpmfts_s::m, rpmfts_s::maxg, rpmfts_s::maxm, MAXPATHLEN, rpmfts_s::maxu, MBITS, MF_ISSET, MISMATCHEXIT, mtree_error(), MTREE_FLAGS_SEEDED, mtreeCWalk(), mtreeFlags, mtreeMiss(), mtreeSpec(), mtreeVSpec(), mtreeVWalk(), optionsTable, rpmfts_s::path, rpmfts_s::paths, Realpath(), rpmfts_s::root, RPM_LIST_INIT, rpmExpand(), rpmfiFree(), rpmGenPath(), rpmGetPath(), rpmioFini(), rpmioFtsOpts, rpmioInit(), rpmswEnter(), rpmswExit(), rpmswPrint(), rpmtsFree(), rpmfts_s::sb, rpmfts_s::spec1, rpmfts_s::spec2, Stat(), tagClean(), rpmfts_s::u, URL_IS_DASH, URL_IS_UNKNOWN, urlPath(), xcalloc(), xmalloc(), and xstrdup().

static int mismatch | ( | NODE * | n1,
|  | NODE * | n2,
|  | enum mtreeKeys_e | differ,
|  | const char * | path
| ) |  |
| static

Definition at line 1842 of file rpmmtree.c.

References rpmfts_s::keys, and shownode().

Referenced by compare_nodes().

void mtree_error | ( | const char * | fmt,
|  |  | ...
| ) |  |
| static

Definition at line 326 of file rpmmtree.c.

References _, __progname, EXIT_FAILURE, and rpmfts_s::lineno.

Referenced by main(), mtreeArgCallback(), mtreeCWalk(), mtreeSpec(), mtreeVisitD(), mtreeVisitF(), mtreeVWalk(), parsekey(), rlink(), and set().

static void mtreeArgCallback | ( | poptContext | con,
|  | enum poptCallbackReason | reason,
|  | const struct poptOption * | opt,
|  | const char * | arg,
|  | void * | data
| ) |  |
| static

Definition at line 3478 of file rpmmtree.c.

References _, __progname, rpmfts_s::algos, argiAdd(), errno, EXIT_FAILURE, FTS_LOGICAL, FTS_PHYSICAL, rpmfts_s::keys, KF_ISSET, mtree_error(), MTREE_KEYS_TYPE, mtreeReadExcludes(), parsekey(), rpmioFtsOpts, rpmfts_s::spec1, and rpmfts_s::spec2.

static int mtreeCheckExcludes | ( | const char * | fname,
|  | const char * | path
| ) |  |
| static

Definition at line 2804 of file rpmmtree.c.

References exclude::glob, MATCH, exclude::pathname, and RPM_LIST_FOREACH.

Referenced by mtreeCWalk(), and mtreeVWalk().

int mtreeCWalk | ( | rpmfts | fts | ) |
| static

Definition at line 3181 of file rpmmtree.c.

References __progname, chkSuffix(), dsort(), errno, Fts_close(), FTS_COMFOLLOW, FTS_D, FTS_DNR, FTS_DP, FTS_ERR, _ftsent::fts_errno, _ftsent::fts_info, _ftsent::fts_level, _ftsent::fts_name, FTS_NOCHDIR, FTS_NS, Fts_open(), _ftsent::fts_path, Fts_read(), Fts_set(), FTS_SKIP, rpmfts_s::ftsoptions, indent, rpmfts_s::keys, MF_ISSET, mtree_error(), MTREE_KEYS_SLINK, mtreeCheckExcludes(), mtreeVisitD(), mtreeVisitF(), rpmfts_s::p, rpmfts_s::paths, and rpmfts_s::t.

Referenced by main().

void mtreeMiss | ( | rpmfts | fts,
|  | NODE * | p,
|  | char * | tail
| ) |  |
| static

< directory

< directory

< symbolic link

< symbolic link

< symbolic link

Definition at line 3249 of file rpmmtree.c.

References _, _node::child, Chmod(), Chown(), errno, F_DIR, F_LINK, _node::flags, KF_ISSET, lchown, MF_ISSET, Mkdir(), MTREE_KEYS_VISIT, _node::name, _node::next, rpmfts_s::path, _node::sb, _node::slink, Stat(), Symlink(), and _node::type.

Referenced by main().

static void mtreeReadExcludes | ( | const char * | fn | ) |
| static

Definition at line 2759 of file rpmmtree.c.

References _, __progname, EXIT_FAILURE, Fclose(), fdGetFILE, Ferror(), Fopen(), Fstrerror(), exclude::glob, exclude::pathname, RPM_LIST_INSERT_HEAD, xmalloc(), and xstrdup().

Referenced by mtreeArgCallback().

NODE * mtreeSpec | ( | rpmfts | fts,
|  | FILE * | fp
| ) |  |
| static

< directory

< directory

Definition at line 1590 of file rpmmtree.c.

References _, __progname, _node::child, F_DIR, _node::flags, KF_ISSET, rpmfts_s::lineno, MAGIC, mtree_error(), MTREE_KEYS_DONE, MTREE_KEYS_MAGIC, _node::name, _node::next, _node::parent, _node::prev, strunvis(), _node::type, unset(), and xcalloc().

Referenced by main(), and mtreeVSpec().

static int mtreeSWalk | ( | NODE * | t1,
|  | NODE * | t2,
|  | const char * | path
| ) |  |
| static

< directory

< directory

< directory

< directory

< directory

< directory

< directory

< directory

Definition at line 1950 of file rpmmtree.c.

References _node::child, compare_nodes(), F_DIR, _node::name, _node::next, and _node::type.

Referenced by mtreeVSpec().

static int mtreeVisitD | ( | rpmfts | fts | ) |
| static

Definition at line 2365 of file rpmmtree.c.

References _, __progname, _free(), _FTSCALLOC, errno, Fts_children(), _ftsent::fts_link, _ftsent::fts_path, _ftsent::fts_statp, rpmfts_s::g, gidToGname(), rpmfts_s::keys, KF_ISSET, rpmfts_s::m, rpmfts_s::maxg, rpmfts_s::maxm, rpmfts_s::maxu, MBITS, MF_ISSET, mtree_error(), rpmfts_s::p, rpmfts_s::sb, rpmfts_s::sb_is_valid, SKIPDOTSLASH, rpmfts_s::t, rpmfts_s::u, and uidToUname().

Referenced by mtreeCWalk().

static void mtreeVisitF | ( | rpmfts | fts | ) |
| static

Definition at line 2524 of file rpmmtree.c.

References _, __progname, _free(), algo2tagname(), rpmfts_s::algos, crc(), CWALKINDENTNAMELEN, Fclose(), fdFiniDigest(), fdInitDigest(), FDSTAT_DIGEST, fdstat_op(), FDSTAT_READ, Ferror(), Fopen(), Fread(), Fstrerror(), _ftsent::fts_accpath, _ftsent::fts_info, _ftsent::fts_level, _ftsent::fts_name, _ftsent::fts_namelen, FTS_SL, FTS_SLNONE, _ftsent::fts_statp, gidToGname(), indent, inotype(), rpmfts_s::keys, KF_ISSET, L, MAXLINELEN, MBITS, MF_ISSET, mtree_error(), ARGI_s::nvals, output(), rpmfts_s::p, rlink(), rpmswAdd(), S_ISLNK, rpmfts_s::sb, strvis(), uidToUname(), ARGI_s::vals, VIS_OCTAL, VIS_WHITE, and xmalloc().

Referenced by mtreeCWalk().

int mtreeVSpec | ( | rpmfts | fts | ) |
| static

Definition at line 2019 of file rpmmtree.c.

References compare_nodes(), MISMATCHEXIT, mtreeSpec(), mtreeSWalk(), rpmfts_s::spec1, and rpmfts_s::spec2.

Referenced by main().

int mtreeVWalk | ( | rpmfts | fts | ) |
| static

< directory

Definition at line 3355 of file rpmmtree.c.

References _, __progname, _node::child, chkSuffix(), compare(), errno, F_DIR, _node::flags, FNM_PATHNAME, fnmatch(), _ftsent::fts_accpath, Fts_close(), FTS_COMFOLLOW, FTS_D, FTS_DNR, FTS_DP, FTS_ERR, _ftsent::fts_errno, _ftsent::fts_info, _ftsent::fts_level, _ftsent::fts_name, _ftsent::fts_namelen, FTS_NOCHDIR, FTS_NS, Fts_open(), _ftsent::fts_path, Fts_read(), Fts_set(), FTS_SKIP, FTS_SL, _ftsent::fts_statp, rpmfts_s::ftsoptions, rpmfts_s::keys, KF_ISSET, MAGIC, MF_ISSET, MISMATCHEXIT, mtree_error(), MTREE_KEYS_SLINK, MTREE_KEYS_VISIT, mtreeCheckExcludes(), _node::name, _node::next, rpmfts_s::p, _node::parent, rpmfts_s::paths, _node::prev, Rmdir(), rpmfts_s::root, SKIPDOTSLASH, rpmfts_s::t, _node::type, and Unlink().

Referenced by main().

static void output | ( | int | indent,
|  | int * | offset,
|  | const char * | fmt,
|  |  | ...
| ) |  |
| static

Definition at line 2505 of file rpmmtree.c.

References CWALKINDENTNAMELEN, indent, MAXLINELEN, and vsnprintf().

Referenced by mtreeVisitF().

static unsigned parsekey | ( | char * | name,
|  | uint32_t * | needvaluep
| ) |  |
| static

Definition at line 399 of file rpmmtree.c.

References keycompare(), keylist, mtree_error(), name, and key_s::name.

Referenced by mtreeArgCallback(), set(), and unset().

static const char* rlink | ( | const char * | name | ) |
| static

Definition at line 2034 of file rpmmtree.c.

References errno, MAXPATHLEN, mtree_error(), and Readlink().

Referenced by compare(), and mtreeVisitF().

static void set | ( | char * | t,
|  | NODE * | ip
| ) |  |
| static

< block special

< char special

< directory

< regular file

< fifo

< symbolic link

< socket

Definition at line 1425 of file rpmmtree.c.

References _, __progname, argiAdd(), argvAdd(), errno, F_BLOCK, F_CHAR, F_DIR, F_FIFO, F_FILE, F_LINK, F_SOCK, gnameToGid(), mtree_error(), MTREE_KEYS_CKSUM, MTREE_KEYS_DIGEST, MTREE_KEYS_DONE, MTREE_KEYS_FLAGS, MTREE_KEYS_GID, MTREE_KEYS_GNAME, MTREE_KEYS_IGN, MTREE_KEYS_MAGIC, MTREE_KEYS_MODE, MTREE_KEYS_NLINK, MTREE_KEYS_NOCHANGE, MTREE_KEYS_NONE, MTREE_KEYS_OPT, MTREE_KEYS_SIZE, MTREE_KEYS_SLINK, MTREE_KEYS_TIME, MTREE_KEYS_TYPE, MTREE_KEYS_UID, MTREE_KEYS_UNAME, MTREE_KEYS_VISIT, parsekey(), strunvis(), unameToUid(), and xmalloc().

Referenced by dbiAppendSet(), dbiFreeIndexSet(), dbiPruneSet(), dbt2set(), rpmdbGrowIterator(), rpmdbRemove(), rpmmiInit(), and set2dbt().

static void shownode | ( | NODE * | n,
|  | enum mtreeKeys_e | keys,
|  | const char * | path
| ) |  |
| static

Definition at line 1787 of file rpmmtree.c.

References algo2tagname(), _node::algos, _node::cksum, _node::digests, ftype(), gidToGname(), KF_ISSET, _node::name, ARGI_s::nvals, _node::sb, _node::type, uidToUname(), and ARGI_s::vals.

Referenced by mismatch().

int strunvis | ( | char * | dst,
|  | const char * | src
| ) |  |
| static

Definition at line 973 of file rpmmtree.c.

References unvis(), UNVIS_END, UNVIS_NOCHAR, UNVIS_VALID, and UNVIS_VALIDPUSH.

Referenced by mtreeSpec(), and set().

int strvis | ( | char * | dst,
|  | const char * | src,
|  | int | flag
| ) |  |
| static

Definition at line 732 of file rpmmtree.c.

References vis().

Referenced by mtreeVisitF().

static void unset | ( | char * | t,
|  | NODE * | ip
| ) |  |
| static

Definition at line 1576 of file rpmmtree.c.

References _node::flags, and parsekey().

Referenced by mtreeSpec().

int unvis | ( | char * | cp,
|  | char | c,
|  | int * | astate,
|  | int | flag
| ) |  |
| static

Definition at line 820 of file rpmmtree.c.

References isoctal, S_CTRL, S_GROUND, S_META, S_META1, S_OCTAL2, S_OCTAL3, S_START, UNVIS_END, UNVIS_NOCHAR, UNVIS_SYNBAD, UNVIS_VALID, and UNVIS_VALIDPUSH.

Referenced by strunvis().

char * vis | ( | char * | dst,
|  | int | c,
|  | int | flag,
|  | int | nextc
| ) |  |
| static

Definition at line 635 of file rpmmtree.c.

References isoctal, isvisible, VIS_CSTYLE, VIS_NOSLASH, and VIS_OCTAL.

Referenced by strvis().

## Variable Documentation

struct rpmfts_s __rpmfts
| static

Definition at line 288 of file rpmmtree.c.

rpmfts _rpmfts = &__rpmfts
| static

Definition at line 290 of file rpmmtree.c.

Referenced by main().

const char copyright[]
| static

Initial value:
=
"@(#) Copyright (c) 1989, 1990, 1993\n\
The Regents of the University of California. All rights reserved.\n"

Definition at line 35 of file rpmmtree.c.

const uint32_t crctab[]
| static

Definition at line 470 of file rpmmtree.c.

struct rpmop_s dc_digestops
| static

Definition at line 312 of file rpmmtree.c.

struct rpmop_s dc_readops
| static

Definition at line 309 of file rpmmtree.c.

struct rpmop_s dc_totalops
| static

Definition at line 306 of file rpmmtree.c.

struct { ... } excludes

KEY keylist[]
| static

Definition at line 353 of file rpmmtree.c.

Referenced by parsekey().

struct exclude* lh_first

Definition at line 303 of file rpmmtree.c.

enum mtreeFlags_e mtreeFlags = MTREE_FLAGS_NONE
| static

Definition at line 293 of file rpmmtree.c.

Referenced by main().

struct poptOption optionsTable[]
| static

Definition at line 3550 of file rpmmtree.c.

Referenced by main().