rpm: rpmfiles.h Source File

rpm 4.13.0

rpmfiles.h
Go to the documentation of this file.
1 #ifndef _RPMFILES_H
2 #define _RPMFILES_H
3
8 #include <sys/types.h>
9 #include <sys/stat.h>
10 #include <unistd.h>
11
12 #include <rpm/rpmtypes.h>
13 #include <rpm/rpmvf.h>
14 #include <rpm/rpmpgp.h>
15
23 typedef enum rpmFileTypes_e {
24 PIPE = 1,
25 CDEV = 2,
26 XDIR = 4,
27 BDEV = 6,
28 REG = 8,
29 LINK = 10,
30 SOCK = 12
31 } rpmFileTypes;
32
36 typedef enum rpmfileState_e {
37 RPMFILE_STATE_MISSING = -1, /* used for unavailable data */
38 RPMFILE_STATE_NORMAL = 0,
39 RPMFILE_STATE_REPLACED = 1,
40 RPMFILE_STATE_NOTINSTALLED = 2,
41 RPMFILE_STATE_NETSHARED = 3,
42 RPMFILE_STATE_WRONGCOLOR = 4
43 } rpmfileState;
44
45 #define RPMFILE_IS_INSTALLED(_x) ((_x) == RPMFILE_STATE_NORMAL || (_x) == RPMFILE_STATE_NETSHARED)
46
50 enum rpmfileAttrs_e {
51 RPMFILE_NONE = 0,
52 RPMFILE_CONFIG = (1 << 0),
53 RPMFILE_DOC = (1 << 1),
54 RPMFILE_ICON = (1 << 2),
55 RPMFILE_MISSINGOK = (1 << 3),
56 RPMFILE_NOREPLACE = (1 << 4),
57 RPMFILE_SPECFILE = (1 << 5),
58 RPMFILE_GHOST = (1 << 6),
59 RPMFILE_LICENSE = (1 << 7),
60 RPMFILE_README = (1 << 8),
61 /* bits 9-10 unused */
62 RPMFILE_PUBKEY = (1 << 11),
63 };
64
65 typedef rpmFlags rpmfileAttrs;
66
67 #define RPMFILE_ALL ~(RPMFILE_NONE)
68
72 typedef enum rpmFileAction_e {
73 FA_UNKNOWN = 0,
74 FA_CREATE = 1,
75 FA_COPYIN = 2,
76 FA_COPYOUT = 3,
77 FA_BACKUP = 4,
78 FA_SAVE = 5,
79 FA_SKIP = 6,
80 FA_ALTNAME = 7,
81 FA_ERASE = 8,
82 FA_SKIPNSTATE = 9,
83 FA_SKIPNETSHARED = 10,
84 FA_SKIPCOLOR = 11,
85 /* bits 16-31 reserved */
86 } rpmFileAction;
87
88 #define XFA_SKIPPING(_a) \
89 ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPCOLOR)
90
94 struct rpmRelocation_s {
95 char * oldPath;
96 char * newPath;
97 };
98
99 enum rpmfiFlags_e {
100 RPMFI_NOHEADER = 0,
101 RPMFI_KEEPHEADER = (1 << 0),
102 RPMFI_NOFILECLASS = (1 << 1),
103 RPMFI_NOFILEDEPS = (1 << 2),
104 RPMFI_NOFILELANGS = (1 << 3),
105 RPMFI_NOFILEUSER = (1 << 4),
106 RPMFI_NOFILEGROUP = (1 << 5),
107 RPMFI_NOFILEMODES = (1 << 6),
108 RPMFI_NOFILESIZES = (1 << 7),
109 RPMFI_NOFILECAPS = (1 << 8),
110 RPMFI_NOFILELINKTOS = (1 << 9),
111 RPMFI_NOFILEDIGESTS = (1 << 10),
112 RPMFI_NOFILEMTIMES = (1 << 11),
113 RPMFI_NOFILERDEVS = (1 << 12),
114 RPMFI_NOFILEINODES = (1 << 13),
115 RPMFI_NOFILESTATES = (1 << 14),
116 RPMFI_NOFILECOLORS = (1 << 15),
117 RPMFI_NOFILEVERIFYFLAGS = (1 << 16),
118 RPMFI_NOFILEFLAGS = (1 << 17),
119 RPMFI_NOFILESIGNATURES = (1 << 18),
120 };
121
122 typedef rpmFlags rpmfiFlags;
123
124 #define RPMFI_FLAGS_ERASE \
125 (RPMFI_NOFILECLASS | RPMFI_NOFILELANGS | \
126 RPMFI_NOFILEMTIMES | RPMFI_NOFILERDEVS | RPMFI_NOFILEINODES | \
127 RPMFI_NOFILEVERIFYFLAGS)
128
129 #define RPMFI_FLAGS_INSTALL \
130 (RPMFI_NOFILECLASS | RPMFI_NOFILEVERIFYFLAGS)
131
132 #define RPMFI_FLAGS_VERIFY \
133 (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
134 RPMFI_NOFILECOLORS)
135
136 #define RPMFI_FLAGS_QUERY \
137 (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
138 RPMFI_NOFILECOLORS | RPMFI_NOFILEVERIFYFLAGS)
139
140 #define RPMFI_FLAGS_ONLY_FILENAMES \
141 (RPMFI_NOFILECLASS | RPMFI_NOFILEDEPS | RPMFI_NOFILELANGS | \
142 RPMFI_NOFILEUSER | RPMFI_NOFILEGROUP | RPMFI_NOFILEMODES | \
143 RPMFI_NOFILESIZES | RPMFI_NOFILECAPS | RPMFI_NOFILELINKTOS | \
144 RPMFI_NOFILEDIGESTS | RPMFI_NOFILEMTIMES | RPMFI_NOFILERDEVS | \
145 RPMFI_NOFILEINODES | RPMFI_NOFILESTATES | RPMFI_NOFILECOLORS | \
146 RPMFI_NOFILEVERIFYFLAGS | RPMFI_NOFILEFLAGS)
147
148 typedef enum rpmFileIter_e {
149 RPMFI_ITER_FWD = 0,
150 RPMFI_ITER_BACK = 1,
151 RPMFI_ITER_WRITE_ARCHIVE = 2,
152 RPMFI_ITER_READ_ARCHIVE = 3,
153 RPMFI_ITER_READ_ARCHIVE_CONTENT_FIRST = 4,
154 RPMFI_ITER_READ_ARCHIVE_OMIT_HARDLINKS = 5,
155 RPMFI_ITER_INTERVAL = 6,
156 } rpmFileIter;
157
158 #define RPMFILEITERMAX 6
159
160 #ifdef __cplusplus
161 extern "C" {
162 #endif
163
172 rpmfiles rpmfilesNew(rpmstrPool pool, Header h, rpmTagVal tagN, rpmfiFlags flags);
173
179 rpmfiles rpmfilesLink(rpmfiles fi);
180
186 rpmfiles rpmfilesFree(rpmfiles fi);
187
193 rpm_count_t rpmfilesFC(rpmfiles fi);
194
200 rpm_count_t rpmfilesDC(rpmfiles fi);
201
210 int rpmfilesFindFN(rpmfiles files, const char * fn);
211
220 int rpmfilesFindOFN(rpmfiles files, const char * fn);
221
222 rpmfi rpmfilesIter(rpmfiles files, int itype);
223
229 int rpmfilesDigestAlgo(rpmfiles fi);
230
236 rpm_color_t rpmfilesColor(rpmfiles files);
237
246 int rpmfilesCompare(rpmfiles afi, int aix, rpmfiles bfi, int bix);
247
254 const char * rpmfilesBN(rpmfiles fi, int ix);
255
267 const char * rpmfilesDN(rpmfiles fi, int jx);
268
275 int rpmfilesDI(rpmfiles fi, int ix);
276
283 char * rpmfilesFN(rpmfiles fi, int ix);
284
291 int rpmfilesODI(rpmfiles fi, int ix);
292
299 const char * rpmfilesOBN(rpmfiles fi, int ix);
300
312 const char * rpmfilesODN(rpmfiles fi, int jx);
313
320 char * rpmfilesOFN(rpmfiles fi, int ix);
321
328 rpmVerifyAttrs rpmfilesVFlags(rpmfiles fi, int ix);
329
336 rpmfileState rpmfilesFState(rpmfiles fi, int ix);
337
344 const char * rpmfilesFLink(rpmfiles fi, int ix);
345
352 rpm_loff_t rpmfilesFSize(rpmfiles fi, int ix);
353
360 rpm_color_t rpmfilesFColor(rpmfiles fi, int ix);
361
368 const char * rpmfilesFClass(rpmfiles fi, int ix);
369
377 uint32_t rpmfilesFDepends(rpmfiles fi, int ix, const uint32_t ** fddictp);
378
385 uint32_t rpmfilesFNlink(rpmfiles fi, int ix);
386
395 uint32_t rpmfilesFLinks(rpmfiles fi, int ix, const int ** files);
396
403 const char * rpmfilesFLangs(rpmfiles fi, int ix);
404
411 rpmfileAttrs rpmfilesFFlags(rpmfiles fi, int ix);
412
419 rpm_mode_t rpmfilesFMode(rpmfiles fi, int ix);
420
429 const unsigned char * rpmfilesFDigest(rpmfiles fi, int ix, int *algo, size_t *len);
430
438 const unsigned char * rpmfilesFSignature(rpmfiles fi, int ix, size_t *len);
439
446 rpm_rdev_t rpmfilesFRdev(rpmfiles fi, int ix);
447
454 rpm_ino_t rpmfilesFInode(rpmfiles fi, int ix);
455
462 rpm_time_t rpmfilesFMtime(rpmfiles fi, int ix);
463
470 const char * rpmfilesFUser(rpmfiles fi, int ix);
471
478 const char * rpmfilesFGroup(rpmfiles fi, int ix);
479
488 const char * rpmfilesFCaps(rpmfiles fi, int ix);
489
498 int rpmfilesStat(rpmfiles fi, int ix, int flags, struct stat *sb);
499 #ifdef __cplusplus
500 }
501 #endif
502
503 #endif /* _RPMFILES_H */
PIPE
Definition: rpmfiles.h:24
RPMFI_NOFILERDEVS
Definition: rpmfiles.h:113
rpmfilesFColor
rpm_color_t rpmfilesFColor(rpmfiles fi, int ix)
Return file color bits from file info set.
rpmfilesFGroup
const char * rpmfilesFGroup(rpmfiles fi, int ix)
Return file group from file info set.
RPMFILE_CONFIG
Definition: rpmfiles.h:52
rpmVerifyAttrs
rpmFlags rpmVerifyAttrs
Definition: rpmvf.h:39
rpmfilesDC
rpm_count_t rpmfilesDC(rpmfiles fi)
Return directory count from file info set.
RPMFI_ITER_READ_ARCHIVE_OMIT_HARDLINKS
Definition: rpmfiles.h:154
RPMFILE_STATE_REPLACED
Definition: rpmfiles.h:39
rpmfilesODN
const char * rpmfilesODN(rpmfiles fi, int jx)
Return original directory name from file info set.
RPMFI_ITER_BACK
Definition: rpmfiles.h:150
RPMFI_NOFILECLASS
Definition: rpmfiles.h:102
rpmRelocation_s::oldPath
char * oldPath
Definition: rpmfiles.h:95
rpmfilesFMtime
rpm_time_t rpmfilesFMtime(rpmfiles fi, int ix)
Return file modify time from file info set.
rpm_rdev_t
uint16_t rpm_rdev_t
Definition: rpmtypes.h:54
rpmfilesFInode
rpm_ino_t rpmfilesFInode(rpmfiles fi, int ix)
Return file inode from file info set.
BDEV
Definition: rpmfiles.h:27
rpm_time_t
uint32_t rpm_time_t
Definition: rpmtypes.h:52
RPMFI_ITER_FWD
Definition: rpmfiles.h:149
RPMFI_NOFILEDIGESTS
Definition: rpmfiles.h:111
rpmfilesFCaps
const char * rpmfilesFCaps(rpmfiles fi, int ix)
Return textual representation of file capabilities from file info set.
rpmfilesFRdev
rpm_rdev_t rpmfilesFRdev(rpmfiles fi, int ix)
Return file rdev from file info set.
rpmfilesIter
rpmfi rpmfilesIter(rpmfiles files, int itype)
rpmFileAction
enum rpmFileAction_e rpmFileAction
File disposition(s) during package install/erase transaction.
rpmRelocation_s::newPath
char * newPath
Definition: rpmfiles.h:96
XDIR
Definition: rpmfiles.h:26
REG
Definition: rpmfiles.h:28
rpmFileTypes
enum rpmFileTypes_e rpmFileTypes
File types.
RPMFI_KEEPHEADER
Definition: rpmfiles.h:101
RPMFI_NOFILECOLORS
Definition: rpmfiles.h:116
rpmFileIter
enum rpmFileIter_e rpmFileIter
FA_SKIPNSTATE
Definition: rpmfiles.h:82
RPMFILE_NONE
Definition: rpmfiles.h:51
RPMFI_NOFILEDEPS
Definition: rpmfiles.h:103
rpmFileTypes_e
rpmFileTypes_e
File types.
Definition: rpmfiles.h:23
SOCK
Definition: rpmfiles.h:30
rpmfilesFLink
const char * rpmfilesFLink(rpmfiles fi, int ix)
Return file linkto (i.e.
RPMFILE_SPECFILE
Definition: rpmfiles.h:57
rpmRelocation_s
We pass these around as an array with a sentinel.
Definition: rpmfiles.h:94
RPMFI_NOFILECAPS
Definition: rpmfiles.h:109
RPMFILE_STATE_WRONGCOLOR
Definition: rpmfiles.h:42
LINK
Definition: rpmfiles.h:29
rpmfilesFState
rpmfileState rpmfilesFState(rpmfiles fi, int ix)
Return file state from file info set.
FA_SKIP
Definition: rpmfiles.h:79
rpmfilesODI
int rpmfilesODI(rpmfiles fi, int ix)
Return original directory index from file info set.
rpmfilesDI
int rpmfilesDI(rpmfiles fi, int ix)
Return directory index from file info set.
rpmfi
struct rpmfi_s * rpmfi
Definition: rpmtypes.h:66
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
RPMFILE_STATE_NOTINSTALLED
Definition: rpmfiles.h:40
rpmstrPool
struct rpmstrPool_s * rpmstrPool
Definition: rpmtypes.h:83
RPMFILE_STATE_NETSHARED
Definition: rpmfiles.h:41
RPMFI_NOFILESTATES
Definition: rpmfiles.h:115
rpmfilesFMode
rpm_mode_t rpmfilesFMode(rpmfiles fi, int ix)
Return file mode from file info set.
RPMFI_NOFILEVERIFYFLAGS
Definition: rpmfiles.h:117
FA_SAVE
Definition: rpmfiles.h:78
rpm_color_t
uint32_t rpm_color_t
Definition: rpmtypes.h:38
rpmfilesFLinks
uint32_t rpmfilesFLinks(rpmfiles fi, int ix, const int **files)
Return (calculated) file nlink count from file info set.
rpmfilesStat
int rpmfilesStat(rpmfiles fi, int ix, int flags, struct stat *sb)
Map file stat(2) info.
rpmfiFlags
rpmFlags rpmfiFlags
Definition: rpmfiles.h:122
FA_CREATE
Definition: rpmfiles.h:74
Header
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
rpmfileState
enum rpmfileState_e rpmfileState
File States (when installed).
rpmfilesDigestAlgo
int rpmfilesDigestAlgo(rpmfiles fi)
Return digest algorithm of a file info set.
RPMFI_NOHEADER
Definition: rpmfiles.h:100
RPMFILE_STATE_NORMAL
Definition: rpmfiles.h:38
RPMFILE_README
Definition: rpmfiles.h:60
RPMFI_NOFILELINKTOS
Definition: rpmfiles.h:110
rpmfileAttrs_e
rpmfileAttrs_e
Exported File Attributes (ie RPMTAG_FILEFLAGS)
Definition: rpmfiles.h:50
FA_SKIPCOLOR
Definition: rpmfiles.h:84
rpm_count_t
uint32_t rpm_count_t
Definition: rpmtypes.h:29
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.
RPMFILE_GHOST
Definition: rpmfiles.h:58
RPMFILE_NOREPLACE
Definition: rpmfiles.h:56
FA_ALTNAME
Definition: rpmfiles.h:80
rpmTagVal
rpm_tag_t rpmTagVal
Definition: rpmtypes.h:30
RPMFILE_ICON
Definition: rpmfiles.h:54
RPMFI_NOFILESIZES
Definition: rpmfiles.h:108
rpmfilesDN
const char * rpmfilesDN(rpmfiles fi, int jx)
Return directory name from file info set.
rpmfilesFSignature
const unsigned char * rpmfilesFSignature(rpmfiles fi, int ix, size_t *len)
Return file (binary) digest of file info set.
rpmfilesFree
rpmfiles rpmfilesFree(rpmfiles fi)
Destroy a file info set.
rpmfilesFUser
const char * rpmfilesFUser(rpmfiles fi, int ix)
Return file owner from file info set.
FA_SKIPNETSHARED
Definition: rpmfiles.h:83
rpmfilesFN
char * rpmfilesFN(rpmfiles fi, int ix)
Return file name from file info set.
rpmfilesBN
const char * rpmfilesBN(rpmfiles fi, int ix)
Return base name from file info set.
rpmFileAction_e
rpmFileAction_e
File disposition(s) during package install/erase transaction.
Definition: rpmfiles.h:72
FA_ERASE
Definition: rpmfiles.h:81
rpmfileState_e
rpmfileState_e
File States (when installed).
Definition: rpmfiles.h:36
FA_COPYOUT
Definition: rpmfiles.h:76
rpmfilesFLangs
const char * rpmfilesFLangs(rpmfiles fi, int ix)
Return file language(s) from file info set.
rpmfilesFFlags
rpmfileAttrs rpmfilesFFlags(rpmfiles fi, int ix)
Return file flags from file info set.
rpmfilesVFlags
rpmVerifyAttrs rpmfilesVFlags(rpmfiles fi, int ix)
Return file verify flags from file info set.
rpmfilesFNlink
uint32_t rpmfilesFNlink(rpmfiles fi, int ix)
Return (calculated) file nlink count from file info set.
rpmfilesOBN
const char * rpmfilesOBN(rpmfiles fi, int ix)
Return original base name from file info set.
FA_BACKUP
Definition: rpmfiles.h:77
RPMFI_NOFILEGROUP
Definition: rpmfiles.h:106
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.
RPMFI_NOFILEMODES
Definition: rpmfiles.h:107
rpmfilesNew
rpmfiles rpmfilesNew(rpmstrPool pool, Header h, rpmTagVal tagN, rpmfiFlags flags)
Create and load a file info set.
RPMFI_NOFILEUSER
Definition: rpmfiles.h:105
RPMFI_NOFILELANGS
Definition: rpmfiles.h:104
RPMFI_NOFILESIGNATURES
Definition: rpmfiles.h:119
RPMFI_ITER_INTERVAL
Definition: rpmfiles.h:155
RPMFILE_STATE_MISSING
Definition: rpmfiles.h:37
RPMFILE_LICENSE
Definition: rpmfiles.h:59
CDEV
Definition: rpmfiles.h:25
rpmFileIter_e
rpmFileIter_e
Definition: rpmfiles.h:148
rpmfilesColor
rpm_color_t rpmfilesColor(rpmfiles files)
Return union of all file color bits from file info set.
rpmfileAttrs
rpmFlags rpmfileAttrs
Definition: rpmfiles.h:65
rpm_mode_t
uint16_t rpm_mode_t
Definition: rpmtypes.h:53
RPMFI_ITER_WRITE_ARCHIVE
Definition: rpmfiles.h:151
rpm_ino_t
uint32_t rpm_ino_t
Definition: rpmtypes.h:56
rpmfilesFC
rpm_count_t rpmfilesFC(rpmfiles fi)
Return file count from file info set.
rpmfiFlags_e
rpmfiFlags_e
Definition: rpmfiles.h:99
RPMFI_ITER_READ_ARCHIVE
Definition: rpmfiles.h:152
RPMFILE_DOC
Definition: rpmfiles.h:53
FA_COPYIN
Definition: rpmfiles.h:75
rpmfilesFDepends
uint32_t rpmfilesFDepends(rpmfiles fi, int ix, const uint32_t **fddictp)
Return file depends dictionary from file info set.
rpmfilesOFN
char * rpmfilesOFN(rpmfiles fi, int ix)
Return original file name from file info set.
RPMFI_NOFILEINODES
Definition: rpmfiles.h:114
RPMFI_NOFILEMTIMES
Definition: rpmfiles.h:112
rpmfilesFDigest
const unsigned char * rpmfilesFDigest(rpmfiles fi, int ix, int *algo, size_t *len)
Return file (binary) digest of file info set.
rpmfiles
struct rpmfiles_s * rpmfiles
Definition: rpmtypes.h:67
rpmfilesFSize
rpm_loff_t rpmfilesFSize(rpmfiles fi, int ix)
Return file size from file info set.
rpm_loff_t
uint64_t rpm_loff_t
Definition: rpmtypes.h:51
rpmfilesLink
rpmfiles rpmfilesLink(rpmfiles fi)
Reference a file info set instance.
rpmfilesCompare
int rpmfilesCompare(rpmfiles afi, int aix, rpmfiles bfi, int bix)
Return file info comparison.
FA_UNKNOWN
Definition: rpmfiles.h:73
RPMFI_NOFILEFLAGS
Definition: rpmfiles.h:118
RPMFILE_MISSINGOK
Definition: rpmfiles.h:55
RPMFILE_PUBKEY
Definition: rpmfiles.h:62
rpmfilesFClass
const char * rpmfilesFClass(rpmfiles fi, int ix)
Return file class from file info set.
RPMFI_ITER_READ_ARCHIVE_CONTENT_FIRST
Definition: rpmfiles.h:153